Repository: pypa/pip Branch: main Commit: f82e37d6352e Files: 950 Total size: 6.6 MB Directory structure: gitextract_looz9g1z/ ├── .devcontainer/ │ ├── devcontainer.json │ └── postCreate.sh ├── .git-blame-ignore-revs ├── .gitattributes ├── .github/ │ ├── CONTRIBUTING.md │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE/ │ │ ├── bug-report.yml │ │ ├── config.yml │ │ └── feature-request.yml │ ├── PULL_REQUEST_TEMPLATE.md │ ├── chronographer.yml │ ├── dependabot.yml │ └── workflows/ │ ├── ci.yml │ ├── lock-threads.yml │ ├── release.yml │ └── update-rtd-redirects.yml ├── .gitignore ├── .mailmap ├── .pre-commit-config.yaml ├── .readthedocs-custom-redirects.yml ├── .readthedocs.yml ├── AI_POLICY.md ├── AUTHORS.txt ├── LICENSE.txt ├── NEWS.rst ├── README.rst ├── SECURITY.md ├── build-project/ │ ├── .python-version │ ├── build-project.py │ ├── build-requirements.in │ └── build-requirements.txt ├── docs/ │ ├── html/ │ │ ├── cli/ │ │ │ ├── index.md │ │ │ ├── pip.rst │ │ │ ├── pip_cache.rst │ │ │ ├── pip_check.rst │ │ │ ├── pip_config.rst │ │ │ ├── pip_debug.rst │ │ │ ├── pip_download.rst │ │ │ ├── pip_freeze.rst │ │ │ ├── pip_hash.rst │ │ │ ├── pip_index.rst │ │ │ ├── pip_inspect.rst │ │ │ ├── pip_install.rst │ │ │ ├── pip_list.rst │ │ │ ├── pip_lock.rst │ │ │ ├── pip_search.rst │ │ │ ├── pip_show.rst │ │ │ ├── pip_uninstall.rst │ │ │ └── pip_wheel.rst │ │ ├── conf.py │ │ ├── copyright.rst │ │ ├── development/ │ │ │ ├── architecture/ │ │ │ │ ├── anatomy.rst │ │ │ │ ├── command-line-interface.rst │ │ │ │ ├── configuration-files.rst │ │ │ │ ├── index.rst │ │ │ │ ├── overview.rst │ │ │ │ ├── package-finding.rst │ │ │ │ └── upgrade-options.rst │ │ │ ├── ci.rst │ │ │ ├── contributing.rst │ │ │ ├── conventions.rst │ │ │ ├── getting-started.rst │ │ │ ├── index.rst │ │ │ ├── issue-triage.md │ │ │ ├── release-process.rst │ │ │ └── vendoring-policy.rst │ │ ├── getting-started.md │ │ ├── index.md │ │ ├── installation.md │ │ ├── installing.rst │ │ ├── news.rst │ │ ├── quickstart.rst │ │ ├── reference/ │ │ │ ├── build-system.md │ │ │ ├── index.md │ │ │ ├── inspect-report.md │ │ │ ├── installation-report.md │ │ │ ├── pip.rst │ │ │ ├── pip_cache.rst │ │ │ ├── pip_check.rst │ │ │ ├── pip_config.rst │ │ │ ├── pip_debug.rst │ │ │ ├── pip_download.rst │ │ │ ├── pip_freeze.rst │ │ │ ├── pip_hash.rst │ │ │ ├── pip_index.rst │ │ │ ├── pip_install.rst │ │ │ ├── pip_list.rst │ │ │ ├── pip_search.rst │ │ │ ├── pip_show.rst │ │ │ ├── pip_uninstall.rst │ │ │ ├── pip_wheel.rst │ │ │ ├── requirement-specifiers.md │ │ │ └── requirements-file-format.md │ │ ├── topics/ │ │ │ ├── authentication.md │ │ │ ├── caching.md │ │ │ ├── configuration.md │ │ │ ├── dependency-resolution.md │ │ │ ├── deps.dot │ │ │ ├── https-certificates.md │ │ │ ├── index.md │ │ │ ├── local-project-installs.md │ │ │ ├── more-dependency-resolution.md │ │ │ ├── python-option.md │ │ │ ├── repeatable-installs.md │ │ │ ├── secure-installs.md │ │ │ ├── vcs-support.md │ │ │ └── workflow.md │ │ ├── user_guide.rst │ │ └── ux-research-design/ │ │ ├── contribute.md │ │ ├── guidance.md │ │ ├── index.md │ │ ├── research-results/ │ │ │ ├── about-our-users.md │ │ │ ├── ci-cd.md │ │ │ ├── improving-pips-documentation.md │ │ │ ├── index.md │ │ │ ├── mental-models.md │ │ │ ├── override-conflicting-dependencies.md │ │ │ ├── personas.md │ │ │ ├── pip-force-reinstall.md │ │ │ ├── pip-search.md │ │ │ ├── pip-upgrade-conflict.md │ │ │ ├── prioritizing-features.md │ │ │ └── users-and-security.md │ │ └── resolution-impossible-example.md │ ├── man/ │ │ ├── commands/ │ │ │ ├── cache.rst │ │ │ ├── check.rst │ │ │ ├── config.rst │ │ │ ├── debug.rst │ │ │ ├── download.rst │ │ │ ├── freeze.rst │ │ │ ├── hash.rst │ │ │ ├── help.rst │ │ │ ├── index.rst │ │ │ ├── install.rst │ │ │ ├── list.rst │ │ │ ├── lock.rst │ │ │ ├── search.rst │ │ │ ├── show.rst │ │ │ ├── uninstall.rst │ │ │ └── wheel.rst │ │ └── index.rst │ └── pip_sphinxext.py ├── news/ │ ├── .gitignore │ ├── 13226.bugfix.rst │ ├── 13826.process.rst │ └── 13845.trivial.rst ├── noxfile.py ├── pyproject.toml ├── src/ │ └── pip/ │ ├── __init__.py │ ├── __main__.py │ ├── __pip-runner__.py │ ├── _internal/ │ │ ├── __init__.py │ │ ├── build_env.py │ │ ├── cache.py │ │ ├── cli/ │ │ │ ├── __init__.py │ │ │ ├── autocompletion.py │ │ │ ├── base_command.py │ │ │ ├── cmdoptions.py │ │ │ ├── command_context.py │ │ │ ├── index_command.py │ │ │ ├── main.py │ │ │ ├── main_parser.py │ │ │ ├── parser.py │ │ │ ├── progress_bars.py │ │ │ ├── req_command.py │ │ │ ├── spinners.py │ │ │ └── status_codes.py │ │ ├── commands/ │ │ │ ├── __init__.py │ │ │ ├── cache.py │ │ │ ├── check.py │ │ │ ├── completion.py │ │ │ ├── configuration.py │ │ │ ├── debug.py │ │ │ ├── download.py │ │ │ ├── freeze.py │ │ │ ├── hash.py │ │ │ ├── help.py │ │ │ ├── index.py │ │ │ ├── inspect.py │ │ │ ├── install.py │ │ │ ├── list.py │ │ │ ├── lock.py │ │ │ ├── search.py │ │ │ ├── show.py │ │ │ ├── uninstall.py │ │ │ └── wheel.py │ │ ├── configuration.py │ │ ├── distributions/ │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ ├── installed.py │ │ │ ├── sdist.py │ │ │ └── wheel.py │ │ ├── exceptions.py │ │ ├── index/ │ │ │ ├── __init__.py │ │ │ ├── collector.py │ │ │ ├── package_finder.py │ │ │ └── sources.py │ │ ├── locations/ │ │ │ ├── __init__.py │ │ │ ├── _distutils.py │ │ │ ├── _sysconfig.py │ │ │ └── base.py │ │ ├── main.py │ │ ├── metadata/ │ │ │ ├── __init__.py │ │ │ ├── _json.py │ │ │ ├── base.py │ │ │ ├── importlib/ │ │ │ │ ├── __init__.py │ │ │ │ ├── _compat.py │ │ │ │ ├── _dists.py │ │ │ │ └── _envs.py │ │ │ └── pkg_resources.py │ │ ├── models/ │ │ │ ├── __init__.py │ │ │ ├── candidate.py │ │ │ ├── direct_url.py │ │ │ ├── format_control.py │ │ │ ├── index.py │ │ │ ├── installation_report.py │ │ │ ├── link.py │ │ │ ├── release_control.py │ │ │ ├── scheme.py │ │ │ ├── search_scope.py │ │ │ ├── selection_prefs.py │ │ │ ├── target_python.py │ │ │ └── wheel.py │ │ ├── network/ │ │ │ ├── __init__.py │ │ │ ├── auth.py │ │ │ ├── cache.py │ │ │ ├── download.py │ │ │ ├── lazy_wheel.py │ │ │ ├── session.py │ │ │ ├── utils.py │ │ │ └── xmlrpc.py │ │ ├── operations/ │ │ │ ├── __init__.py │ │ │ ├── build/ │ │ │ │ ├── __init__.py │ │ │ │ ├── build_tracker.py │ │ │ │ ├── metadata.py │ │ │ │ ├── metadata_editable.py │ │ │ │ ├── wheel.py │ │ │ │ └── wheel_editable.py │ │ │ ├── check.py │ │ │ ├── freeze.py │ │ │ ├── install/ │ │ │ │ ├── __init__.py │ │ │ │ └── wheel.py │ │ │ └── prepare.py │ │ ├── pyproject.py │ │ ├── req/ │ │ │ ├── __init__.py │ │ │ ├── constructors.py │ │ │ ├── pep723.py │ │ │ ├── req_dependency_group.py │ │ │ ├── req_file.py │ │ │ ├── req_install.py │ │ │ ├── req_set.py │ │ │ └── req_uninstall.py │ │ ├── resolution/ │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ ├── legacy/ │ │ │ │ ├── __init__.py │ │ │ │ └── resolver.py │ │ │ └── resolvelib/ │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ ├── candidates.py │ │ │ ├── factory.py │ │ │ ├── found_candidates.py │ │ │ ├── provider.py │ │ │ ├── reporter.py │ │ │ ├── requirements.py │ │ │ └── resolver.py │ │ ├── self_outdated_check.py │ │ ├── utils/ │ │ │ ├── __init__.py │ │ │ ├── _jaraco_text.py │ │ │ ├── _log.py │ │ │ ├── appdirs.py │ │ │ ├── compat.py │ │ │ ├── compatibility_tags.py │ │ │ ├── datetime.py │ │ │ ├── deprecation.py │ │ │ ├── direct_url_helpers.py │ │ │ ├── egg_link.py │ │ │ ├── entrypoints.py │ │ │ ├── filesystem.py │ │ │ ├── filetypes.py │ │ │ ├── glibc.py │ │ │ ├── hashes.py │ │ │ ├── logging.py │ │ │ ├── misc.py │ │ │ ├── packaging.py │ │ │ ├── pylock.py │ │ │ ├── retry.py │ │ │ ├── subprocess.py │ │ │ ├── temp_dir.py │ │ │ ├── unpacking.py │ │ │ ├── urls.py │ │ │ ├── virtualenv.py │ │ │ └── wheel.py │ │ ├── vcs/ │ │ │ ├── __init__.py │ │ │ ├── bazaar.py │ │ │ ├── git.py │ │ │ ├── mercurial.py │ │ │ ├── subversion.py │ │ │ └── versioncontrol.py │ │ └── wheel_builder.py │ ├── _vendor/ │ │ ├── README.rst │ │ ├── __init__.py │ │ ├── cachecontrol/ │ │ │ ├── LICENSE.txt │ │ │ ├── __init__.py │ │ │ ├── _cmd.py │ │ │ ├── adapter.py │ │ │ ├── cache.py │ │ │ ├── caches/ │ │ │ │ ├── __init__.py │ │ │ │ ├── file_cache.py │ │ │ │ └── redis_cache.py │ │ │ ├── controller.py │ │ │ ├── filewrapper.py │ │ │ ├── heuristics.py │ │ │ ├── py.typed │ │ │ ├── serialize.py │ │ │ └── wrapper.py │ │ ├── certifi/ │ │ │ ├── LICENSE │ │ │ ├── __init__.py │ │ │ ├── __main__.py │ │ │ ├── cacert.pem │ │ │ ├── core.py │ │ │ └── py.typed │ │ ├── dependency_groups/ │ │ │ ├── LICENSE.txt │ │ │ ├── __init__.py │ │ │ ├── __main__.py │ │ │ ├── _implementation.py │ │ │ ├── _lint_dependency_groups.py │ │ │ ├── _pip_wrapper.py │ │ │ ├── _toml_compat.py │ │ │ └── py.typed │ │ ├── distlib/ │ │ │ ├── LICENSE.txt │ │ │ ├── __init__.py │ │ │ ├── compat.py │ │ │ ├── resources.py │ │ │ ├── scripts.py │ │ │ └── util.py │ │ ├── distlib.pyi │ │ ├── distro/ │ │ │ ├── LICENSE │ │ │ ├── __init__.py │ │ │ ├── __main__.py │ │ │ ├── distro.py │ │ │ └── py.typed │ │ ├── idna/ │ │ │ ├── LICENSE.md │ │ │ ├── __init__.py │ │ │ ├── codec.py │ │ │ ├── compat.py │ │ │ ├── core.py │ │ │ ├── idnadata.py │ │ │ ├── intranges.py │ │ │ ├── package_data.py │ │ │ ├── py.typed │ │ │ └── uts46data.py │ │ ├── msgpack/ │ │ │ ├── COPYING │ │ │ ├── __init__.py │ │ │ ├── exceptions.py │ │ │ ├── ext.py │ │ │ └── fallback.py │ │ ├── msgpack.pyi │ │ ├── packaging/ │ │ │ ├── LICENSE │ │ │ ├── LICENSE.APACHE │ │ │ ├── LICENSE.BSD │ │ │ ├── __init__.py │ │ │ ├── _elffile.py │ │ │ ├── _manylinux.py │ │ │ ├── _musllinux.py │ │ │ ├── _parser.py │ │ │ ├── _structures.py │ │ │ ├── _tokenizer.py │ │ │ ├── licenses/ │ │ │ │ ├── __init__.py │ │ │ │ └── _spdx.py │ │ │ ├── markers.py │ │ │ ├── metadata.py │ │ │ ├── py.typed │ │ │ ├── pylock.py │ │ │ ├── requirements.py │ │ │ ├── specifiers.py │ │ │ ├── tags.py │ │ │ ├── utils.py │ │ │ └── version.py │ │ ├── pkg_resources/ │ │ │ ├── LICENSE │ │ │ └── __init__.py │ │ ├── pkg_resources.pyi │ │ ├── platformdirs/ │ │ │ ├── LICENSE │ │ │ ├── __init__.py │ │ │ ├── __main__.py │ │ │ ├── android.py │ │ │ ├── api.py │ │ │ ├── macos.py │ │ │ ├── py.typed │ │ │ ├── unix.py │ │ │ ├── version.py │ │ │ └── windows.py │ │ ├── pygments/ │ │ │ ├── LICENSE │ │ │ ├── __init__.py │ │ │ ├── __main__.py │ │ │ ├── console.py │ │ │ ├── filter.py │ │ │ ├── filters/ │ │ │ │ └── __init__.py │ │ │ ├── formatter.py │ │ │ ├── formatters/ │ │ │ │ ├── __init__.py │ │ │ │ └── _mapping.py │ │ │ ├── lexer.py │ │ │ ├── lexers/ │ │ │ │ ├── __init__.py │ │ │ │ ├── _mapping.py │ │ │ │ └── python.py │ │ │ ├── modeline.py │ │ │ ├── plugin.py │ │ │ ├── regexopt.py │ │ │ ├── scanner.py │ │ │ ├── sphinxext.py │ │ │ ├── style.py │ │ │ ├── styles/ │ │ │ │ ├── __init__.py │ │ │ │ └── _mapping.py │ │ │ ├── token.py │ │ │ ├── unistring.py │ │ │ └── util.py │ │ ├── pygments.pyi │ │ ├── pyproject_hooks/ │ │ │ ├── LICENSE │ │ │ ├── __init__.py │ │ │ ├── _impl.py │ │ │ ├── _in_process/ │ │ │ │ ├── __init__.py │ │ │ │ └── _in_process.py │ │ │ └── py.typed │ │ ├── requests/ │ │ │ ├── LICENSE │ │ │ ├── __init__.py │ │ │ ├── __version__.py │ │ │ ├── _internal_utils.py │ │ │ ├── adapters.py │ │ │ ├── api.py │ │ │ ├── auth.py │ │ │ ├── certs.py │ │ │ ├── compat.py │ │ │ ├── cookies.py │ │ │ ├── exceptions.py │ │ │ ├── help.py │ │ │ ├── hooks.py │ │ │ ├── models.py │ │ │ ├── packages.py │ │ │ ├── sessions.py │ │ │ ├── status_codes.py │ │ │ ├── structures.py │ │ │ └── utils.py │ │ ├── requests.pyi │ │ ├── resolvelib/ │ │ │ ├── LICENSE │ │ │ ├── __init__.py │ │ │ ├── providers.py │ │ │ ├── py.typed │ │ │ ├── reporters.py │ │ │ ├── resolvers/ │ │ │ │ ├── __init__.py │ │ │ │ ├── abstract.py │ │ │ │ ├── criterion.py │ │ │ │ ├── exceptions.py │ │ │ │ └── resolution.py │ │ │ └── structs.py │ │ ├── rich/ │ │ │ ├── LICENSE │ │ │ ├── __init__.py │ │ │ ├── __main__.py │ │ │ ├── _cell_widths.py │ │ │ ├── _emoji_codes.py │ │ │ ├── _emoji_replace.py │ │ │ ├── _export_format.py │ │ │ ├── _extension.py │ │ │ ├── _fileno.py │ │ │ ├── _inspect.py │ │ │ ├── _log_render.py │ │ │ ├── _loop.py │ │ │ ├── _null_file.py │ │ │ ├── _palettes.py │ │ │ ├── _pick.py │ │ │ ├── _ratio.py │ │ │ ├── _spinners.py │ │ │ ├── _stack.py │ │ │ ├── _timer.py │ │ │ ├── _win32_console.py │ │ │ ├── _windows.py │ │ │ ├── _windows_renderer.py │ │ │ ├── _wrap.py │ │ │ ├── abc.py │ │ │ ├── align.py │ │ │ ├── ansi.py │ │ │ ├── bar.py │ │ │ ├── box.py │ │ │ ├── cells.py │ │ │ ├── color.py │ │ │ ├── color_triplet.py │ │ │ ├── columns.py │ │ │ ├── console.py │ │ │ ├── constrain.py │ │ │ ├── containers.py │ │ │ ├── control.py │ │ │ ├── default_styles.py │ │ │ ├── diagnose.py │ │ │ ├── emoji.py │ │ │ ├── errors.py │ │ │ ├── file_proxy.py │ │ │ ├── filesize.py │ │ │ ├── highlighter.py │ │ │ ├── json.py │ │ │ ├── jupyter.py │ │ │ ├── layout.py │ │ │ ├── live.py │ │ │ ├── live_render.py │ │ │ ├── logging.py │ │ │ ├── markup.py │ │ │ ├── measure.py │ │ │ ├── padding.py │ │ │ ├── pager.py │ │ │ ├── palette.py │ │ │ ├── panel.py │ │ │ ├── pretty.py │ │ │ ├── progress.py │ │ │ ├── progress_bar.py │ │ │ ├── prompt.py │ │ │ ├── protocol.py │ │ │ ├── py.typed │ │ │ ├── region.py │ │ │ ├── repr.py │ │ │ ├── rule.py │ │ │ ├── scope.py │ │ │ ├── screen.py │ │ │ ├── segment.py │ │ │ ├── spinner.py │ │ │ ├── status.py │ │ │ ├── style.py │ │ │ ├── styled.py │ │ │ ├── syntax.py │ │ │ ├── table.py │ │ │ ├── terminal_theme.py │ │ │ ├── text.py │ │ │ ├── theme.py │ │ │ ├── themes.py │ │ │ ├── traceback.py │ │ │ └── tree.py │ │ ├── tomli/ │ │ │ ├── LICENSE │ │ │ ├── __init__.py │ │ │ ├── _parser.py │ │ │ ├── _re.py │ │ │ ├── _types.py │ │ │ └── py.typed │ │ ├── tomli_w/ │ │ │ ├── LICENSE │ │ │ ├── __init__.py │ │ │ ├── _writer.py │ │ │ └── py.typed │ │ ├── truststore/ │ │ │ ├── LICENSE │ │ │ ├── __init__.py │ │ │ ├── _api.py │ │ │ ├── _macos.py │ │ │ ├── _openssl.py │ │ │ ├── _ssl_constants.py │ │ │ ├── _windows.py │ │ │ └── py.typed │ │ ├── urllib3/ │ │ │ ├── LICENSE.txt │ │ │ ├── __init__.py │ │ │ ├── _collections.py │ │ │ ├── _version.py │ │ │ ├── connection.py │ │ │ ├── connectionpool.py │ │ │ ├── contrib/ │ │ │ │ ├── __init__.py │ │ │ │ ├── _appengine_environ.py │ │ │ │ ├── _securetransport/ │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── bindings.py │ │ │ │ │ └── low_level.py │ │ │ │ ├── appengine.py │ │ │ │ ├── ntlmpool.py │ │ │ │ ├── pyopenssl.py │ │ │ │ ├── securetransport.py │ │ │ │ └── socks.py │ │ │ ├── exceptions.py │ │ │ ├── fields.py │ │ │ ├── filepost.py │ │ │ ├── packages/ │ │ │ │ ├── __init__.py │ │ │ │ ├── backports/ │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── makefile.py │ │ │ │ │ └── weakref_finalize.py │ │ │ │ └── six.py │ │ │ ├── poolmanager.py │ │ │ ├── request.py │ │ │ ├── response.py │ │ │ └── util/ │ │ │ ├── __init__.py │ │ │ ├── connection.py │ │ │ ├── proxy.py │ │ │ ├── queue.py │ │ │ ├── request.py │ │ │ ├── response.py │ │ │ ├── retry.py │ │ │ ├── ssl_.py │ │ │ ├── ssl_match_hostname.py │ │ │ ├── ssltransport.py │ │ │ ├── timeout.py │ │ │ ├── url.py │ │ │ └── wait.py │ │ ├── urllib3.pyi │ │ └── vendor.txt │ └── py.typed ├── tests/ │ ├── __init__.py │ ├── conftest.py │ ├── data/ │ │ ├── backends/ │ │ │ ├── dummy_backend-0.1-py2.py3-none-any.whl │ │ │ └── test_backend-0.1-py2.py3-none-any.whl │ │ ├── completion_paths/ │ │ │ ├── README.txt │ │ │ ├── REPLAY/ │ │ │ │ └── video.mpeg │ │ │ └── requirements.txt │ │ ├── indexes/ │ │ │ ├── README.txt │ │ │ ├── datarequire/ │ │ │ │ └── fakepackage/ │ │ │ │ └── index.html │ │ │ ├── dev/ │ │ │ │ └── bar/ │ │ │ │ └── index.html │ │ │ ├── empty_with_pkg/ │ │ │ │ └── index.html │ │ │ ├── in dex/ │ │ │ │ ├── README.txt │ │ │ │ └── simple/ │ │ │ │ └── index.html │ │ │ ├── invalid-version/ │ │ │ │ └── invalid-version/ │ │ │ │ └── index.html │ │ │ ├── pre/ │ │ │ │ └── bar/ │ │ │ │ └── index.html │ │ │ ├── require-invalid-version/ │ │ │ │ ├── invalid-version/ │ │ │ │ │ └── index.html │ │ │ │ └── require-invalid-version/ │ │ │ │ └── index.html │ │ │ ├── simple/ │ │ │ │ └── simple/ │ │ │ │ └── index.html │ │ │ ├── yanked/ │ │ │ │ └── simple/ │ │ │ │ └── index.html │ │ │ └── yanked_all/ │ │ │ └── simple/ │ │ │ └── index.html │ │ ├── packages/ │ │ │ ├── BrokenEmitsUTF8/ │ │ │ │ ├── broken.py │ │ │ │ └── setup.py │ │ │ ├── FSPkg/ │ │ │ │ ├── fspkg/ │ │ │ │ │ └── __init__.py │ │ │ │ └── setup.py │ │ │ ├── HackedEggInfo/ │ │ │ │ └── setup.py │ │ │ ├── LineEndings/ │ │ │ │ └── setup.py │ │ │ ├── LocalEnvironMarker/ │ │ │ │ ├── .gitignore │ │ │ │ ├── localenvironmarker/ │ │ │ │ │ └── __init__.py │ │ │ │ └── setup.py │ │ │ ├── LocalExtras/ │ │ │ │ ├── .gitignore │ │ │ │ ├── localextras/ │ │ │ │ │ └── __init__.py │ │ │ │ └── setup.py │ │ │ ├── LocalExtras-0.0.2/ │ │ │ │ ├── .gitignore │ │ │ │ ├── localextras/ │ │ │ │ │ └── __init__.py │ │ │ │ └── setup.py │ │ │ ├── README.txt │ │ │ ├── SetupPyLatin1/ │ │ │ │ └── setup.py │ │ │ ├── SetupPyUTF8/ │ │ │ │ └── setup.py │ │ │ ├── brokenwheel-1.0-py2.py3-none-any.whl │ │ │ ├── colander-0.9.9-py2.py3-none-any.whl │ │ │ ├── compilewheel-1.0-py2.py3-none-any.whl │ │ │ ├── complex_dist-0.1-py2.py3-none-any.whl │ │ │ ├── console_scripts_uppercase-1.0-py2.py3-none-any.whl │ │ │ ├── corruptwheel-1.0-py2.py3-none-any.whl │ │ │ ├── has.script-1.0-py2.py3-none-any.whl │ │ │ ├── invalid.whl │ │ │ ├── invalid_version-1.0-py3-none-any.whl │ │ │ ├── invalid_version-2010i-py3-none-any.whl │ │ │ ├── license.dist-0.1-py2.py3-none-any.whl │ │ │ ├── license.dist-0.2-py2.py3-none-any.whl │ │ │ ├── meta-1.0-py2.py3-none-any.whl │ │ │ ├── mypy-0.782-py3-none-any.whl │ │ │ ├── pep517_setup_and_pyproject/ │ │ │ │ ├── pyproject.toml │ │ │ │ ├── setup.cfg │ │ │ │ └── setup.py │ │ │ ├── pep517_wrapper_buildsys/ │ │ │ │ ├── mybuildsys.py │ │ │ │ ├── pyproject.toml │ │ │ │ ├── setup.cfg │ │ │ │ └── setup.py │ │ │ ├── priority-1.0-py2.py3-none-any.whl │ │ │ ├── prjwithdatafile-1.0-py2.py3-none-any.whl │ │ │ ├── require_invalid_version-0.1-py3-none-any.whl │ │ │ ├── require_invalid_version-1.0-py3-none-any.whl │ │ │ ├── requiresPaste/ │ │ │ │ ├── pyproject.toml │ │ │ │ └── requiresPaste.py │ │ │ ├── requires_simple_extra-0.1-py2.py3-none-any.whl │ │ │ ├── requires_source-1.0-py2.py3-none-any.whl │ │ │ ├── requires_wheelbroken_upper/ │ │ │ │ ├── requires_wheelbroken_upper/ │ │ │ │ │ └── __init__.py │ │ │ │ └── setup.py │ │ │ ├── script.wheel1-0.1-py2.py3-none-any.whl │ │ │ ├── script.wheel1a-0.1-py2.py3-none-any.whl │ │ │ ├── script.wheel2-0.1-py2.py3-none-any.whl │ │ │ ├── script.wheel2a-0.1-py2.py3-none-any.whl │ │ │ ├── script.wheel3-0.1-py2.py3-none-any.whl │ │ │ ├── setuptools-0.9.8-py2.py3-none-any.whl │ │ │ ├── simple.dist-0.1-py1-none-invalid.whl │ │ │ ├── simple.dist-0.1-py2.py3-none-any.whl │ │ │ ├── simple_namespace-1.0-py2.py3-none-any.whl │ │ │ ├── simplewheel-1.0-py2.py3-none-any.whl │ │ │ ├── simplewheel-2.0-1-py2.py3-none-any.whl │ │ │ ├── simplewheel-2.0-py2.py3-none-any.whl │ │ │ ├── simplewheel-2.0-py3-fakeabi-fakeplat.whl │ │ │ ├── singlemodule-0.0.1.tar.lzma │ │ │ ├── singlemodule-0.0.1.tar.xz │ │ │ ├── symlinks/ │ │ │ │ ├── doc/ │ │ │ │ │ └── intro │ │ │ │ ├── docs │ │ │ │ ├── setup.cfg │ │ │ │ ├── setup.py │ │ │ │ └── symlinks/ │ │ │ │ └── __init__.py │ │ │ └── test_tar.tgz │ │ ├── packages3/ │ │ │ ├── dinner/ │ │ │ │ └── index.html │ │ │ ├── index.html │ │ │ └── requiredinner/ │ │ │ └── index.html │ │ ├── pypi_packages/ │ │ │ ├── django_devserver-0.8.0-py3-none-any.whl │ │ │ └── six-1.17.0-py2.py3-none-any.whl │ │ ├── reqfiles/ │ │ │ ├── README.txt │ │ │ └── supported_options2.txt │ │ └── src/ │ │ ├── TopoRequires/ │ │ │ ├── setup.py │ │ │ └── toporequires/ │ │ │ └── __init__.py │ │ ├── TopoRequires2/ │ │ │ ├── setup.cfg.pending │ │ │ ├── setup.py │ │ │ └── toporequires2/ │ │ │ └── __init__.py │ │ ├── TopoRequires3/ │ │ │ ├── setup.cfg.pending │ │ │ ├── setup.py │ │ │ └── toporequires3/ │ │ │ └── __init__.py │ │ ├── TopoRequires4/ │ │ │ ├── setup.cfg.pending │ │ │ ├── setup.py │ │ │ └── toporequires4/ │ │ │ └── __init__.py │ │ ├── chattymodule/ │ │ │ ├── backend.py │ │ │ ├── chattymodule.py │ │ │ └── pyproject.toml │ │ ├── compilewheel/ │ │ │ ├── setup.cfg │ │ │ ├── setup.py │ │ │ └── simple/ │ │ │ └── __init__.py │ │ ├── extension/ │ │ │ ├── extension.c │ │ │ └── setup.py │ │ ├── pep517_pyproject_only/ │ │ │ └── pyproject.toml │ │ ├── pep517_setup_and_pyproject/ │ │ │ ├── pyproject.toml │ │ │ └── setup.py │ │ ├── pep517_setup_cfg_only/ │ │ │ └── setup.cfg │ │ ├── pep517_setup_only/ │ │ │ └── setup.py │ │ ├── pep518-3.0/ │ │ │ ├── MANIFEST.in │ │ │ ├── pep518.py │ │ │ ├── pyproject.toml │ │ │ ├── setup.cfg │ │ │ └── setup.py │ │ ├── pep518_conflicting_requires/ │ │ │ ├── MANIFEST.in │ │ │ ├── pep518.py │ │ │ ├── pyproject.toml │ │ │ └── setup.py │ │ ├── pep518_forkbomb-235/ │ │ │ ├── MANIFEST.in │ │ │ ├── pep518_forkbomb.py │ │ │ ├── pyproject.toml │ │ │ ├── setup.cfg │ │ │ └── setup.py │ │ ├── pep518_invalid_build_system/ │ │ │ ├── MANIFEST.in │ │ │ ├── pep518.py │ │ │ ├── pyproject.toml │ │ │ └── setup.py │ │ ├── pep518_invalid_requires/ │ │ │ ├── MANIFEST.in │ │ │ ├── pep518.py │ │ │ ├── pyproject.toml │ │ │ └── setup.py │ │ ├── pep518_missing_requires/ │ │ │ ├── MANIFEST.in │ │ │ ├── pep518.py │ │ │ ├── pyproject.toml │ │ │ └── setup.py │ │ ├── pep518_twin_forkbombs_first-234/ │ │ │ ├── MANIFEST.in │ │ │ ├── pep518_twin_forkbombs_first.py │ │ │ ├── pyproject.toml │ │ │ ├── setup.cfg │ │ │ └── setup.py │ │ ├── pep518_twin_forkbombs_second-238/ │ │ │ ├── MANIFEST.in │ │ │ ├── pep518_twin_forkbombs_second.py │ │ │ ├── pyproject.toml │ │ │ ├── setup.cfg │ │ │ └── setup.py │ │ ├── pep518_with_extra_and_markers-1.0/ │ │ │ ├── MANIFEST.in │ │ │ ├── pep518_with_extra_and_markers.py │ │ │ ├── pyproject.toml │ │ │ ├── setup.cfg │ │ │ └── setup.py │ │ ├── pep518_with_namespace_package-1.0/ │ │ │ ├── pep518_with_namespace_package.py │ │ │ ├── pyproject.toml │ │ │ ├── setup.cfg │ │ │ └── setup.py │ │ ├── prjwithdatafile/ │ │ │ ├── prjwithdatafile/ │ │ │ │ ├── README.txt │ │ │ │ └── somemodule.py │ │ │ └── setup.py │ │ ├── requires_capitalized/ │ │ │ └── setup.py │ │ ├── requires_requires_capitalized/ │ │ │ └── setup.py │ │ ├── requires_simple/ │ │ │ ├── requires_simple/ │ │ │ │ └── __init__.py │ │ │ └── setup.py │ │ ├── requires_simple_extra/ │ │ │ ├── requires_simple_extra.py │ │ │ ├── setup.cfg │ │ │ └── setup.py │ │ ├── setup_error/ │ │ │ └── setup.py │ │ ├── simple_namespace/ │ │ │ ├── setup.cfg │ │ │ ├── setup.py │ │ │ └── simple_namespace/ │ │ │ ├── __init__.py │ │ │ └── module/ │ │ │ └── __init__.py │ │ ├── simplewheel-1.0/ │ │ │ ├── setup.cfg │ │ │ ├── setup.py │ │ │ └── simplewheel/ │ │ │ └── __init__.py │ │ ├── simplewheel-2.0/ │ │ │ ├── setup.cfg │ │ │ ├── setup.py │ │ │ └── simplewheel/ │ │ │ └── __init__.py │ │ ├── singlemodule/ │ │ │ ├── setup.cfg │ │ │ ├── setup.py │ │ │ └── singlemodule.py │ │ └── withpyproject/ │ │ ├── pyproject.toml │ │ └── setup.py │ ├── functional/ │ │ ├── __init__.py │ │ ├── test_bad_url.py │ │ ├── test_broken_stdout.py │ │ ├── test_build_constraints.py │ │ ├── test_build_env.py │ │ ├── test_cache.py │ │ ├── test_check.py │ │ ├── test_cli.py │ │ ├── test_completion.py │ │ ├── test_config_settings.py │ │ ├── test_configuration.py │ │ ├── test_debug.py │ │ ├── test_download.py │ │ ├── test_fast_deps.py │ │ ├── test_freeze.py │ │ ├── test_hash.py │ │ ├── test_help.py │ │ ├── test_index.py │ │ ├── test_index_invalid_wheels.py │ │ ├── test_inspect.py │ │ ├── test_install.py │ │ ├── test_install_check.py │ │ ├── test_install_cleanup.py │ │ ├── test_install_compat.py │ │ ├── test_install_config.py │ │ ├── test_install_direct_url.py │ │ ├── test_install_extras.py │ │ ├── test_install_force_reinstall.py │ │ ├── test_install_format_control.py │ │ ├── test_install_index.py │ │ ├── test_install_release_control.py │ │ ├── test_install_report.py │ │ ├── test_install_reqs.py │ │ ├── test_install_requested.py │ │ ├── test_install_script.py │ │ ├── test_install_upgrade.py │ │ ├── test_install_user.py │ │ ├── test_install_vcs_git.py │ │ ├── test_install_wheel.py │ │ ├── test_invalid_versions_and_specifiers.py │ │ ├── test_list.py │ │ ├── test_lock.py │ │ ├── test_new_resolver.py │ │ ├── test_new_resolver_errors.py │ │ ├── test_new_resolver_hashes.py │ │ ├── test_new_resolver_target.py │ │ ├── test_new_resolver_user.py │ │ ├── test_no_color.py │ │ ├── test_pep517.py │ │ ├── test_pep660.py │ │ ├── test_pep668.py │ │ ├── test_pip_runner_script.py │ │ ├── test_proxy.py │ │ ├── test_python_option.py │ │ ├── test_search.py │ │ ├── test_self_update.py │ │ ├── test_show.py │ │ ├── test_truststore.py │ │ ├── test_uninstall.py │ │ ├── test_uninstall_user.py │ │ ├── test_uploaded_prior_to.py │ │ ├── test_vcs_bazaar.py │ │ ├── test_vcs_git.py │ │ ├── test_vcs_mercurial.py │ │ ├── test_vcs_subversion.py │ │ ├── test_warning.py │ │ └── test_wheel.py │ ├── lib/ │ │ ├── __init__.py │ │ ├── certs.py │ │ ├── compat.py │ │ ├── configuration_helpers.py │ │ ├── filesystem.py │ │ ├── git_submodule_helpers.py │ │ ├── index.py │ │ ├── local_repos.py │ │ ├── options_helpers.py │ │ ├── requests_mocks.py │ │ ├── server.py │ │ ├── test_lib.py │ │ ├── test_wheel.py │ │ ├── venv.py │ │ └── wheel.py │ ├── ruff.toml │ └── unit/ │ ├── __init__.py │ ├── metadata/ │ │ ├── test_metadata.py │ │ └── test_metadata_pkg_resources.py │ ├── resolution_resolvelib/ │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── test_provider.py │ │ ├── test_requirement.py │ │ └── test_resolver.py │ ├── test_appdirs.py │ ├── test_base_command.py │ ├── test_build_constraints.py │ ├── test_cache.py │ ├── test_cli_colors.py │ ├── test_cli_spinners.py │ ├── test_cmdoptions.py │ ├── test_collector.py │ ├── test_command_install.py │ ├── test_commands.py │ ├── test_compat.py │ ├── test_configuration.py │ ├── test_direct_url.py │ ├── test_direct_url_helpers.py │ ├── test_exceptions.py │ ├── test_finder.py │ ├── test_format_control.py │ ├── test_index.py │ ├── test_link.py │ ├── test_locations.py │ ├── test_logging.py │ ├── test_models.py │ ├── test_models_wheel.py │ ├── test_network_auth.py │ ├── test_network_cache.py │ ├── test_network_download.py │ ├── test_network_lazy_wheel.py │ ├── test_network_session.py │ ├── test_network_utils.py │ ├── test_operations_prepare.py │ ├── test_options.py │ ├── test_packaging.py │ ├── test_pep517.py │ ├── test_pyproject_config.py │ ├── test_release_control.py │ ├── test_req.py │ ├── test_req_dependency_group.py │ ├── test_req_file.py │ ├── test_req_install.py │ ├── test_req_uninstall.py │ ├── test_resolution_legacy_resolver.py │ ├── test_search_scope.py │ ├── test_self_check_outdated.py │ ├── test_target_python.py │ ├── test_urls.py │ ├── test_utils.py │ ├── test_utils_compatibility_tags.py │ ├── test_utils_datetime.py │ ├── test_utils_filesystem.py │ ├── test_utils_retry.py │ ├── test_utils_subprocess.py │ ├── test_utils_temp_dir.py │ ├── test_utils_unpacking.py │ ├── test_utils_virtualenv.py │ ├── test_utils_wheel.py │ ├── test_vcs.py │ ├── test_vcs_mercurial.py │ ├── test_wheel.py │ └── test_wheel_builder.py └── tools/ ├── __init__.py ├── codespell-ignore.txt ├── news/ │ └── template.rst ├── protected_pip.py ├── release/ │ ├── __init__.py │ └── check_version.py ├── update-rtd-redirects.py └── vendoring/ └── patches/ ├── cachecontrol.patch ├── certifi.patch ├── pkg_resources.patch ├── pygments.patch ├── requests.patch ├── truststore.patch ├── urllib3-disable-brotli.patch └── urllib3.patch ================================================ FILE CONTENTS ================================================ ================================================ FILE: .devcontainer/devcontainer.json ================================================ { "name": "pip", "image": "mcr.microsoft.com/devcontainers/python:3", "remoteUser": "vscode", "remoteEnv": { "PATH": "/home/vscode/.local/bin:${containerEnv:PATH}" }, "features": { "ghcr.io/rocker-org/devcontainer-features/apt-packages:1": { "packages": "mercurial,subversion,bzr,python3-venv" } }, "postCreateCommand": "bash ${containerWorkspaceFolder}/.devcontainer/postCreate.sh", "customizations": { "vscode": { "extensions": [ "ms-python.python", "ms-python.black-formatter", "charliermarsh.ruff" ], "settings": { "python.testing.pytestEnabled": true, "python.testing.pytestArgs": [ "-n", "auto" ] } } } } ================================================ FILE: .devcontainer/postCreate.sh ================================================ #!/bin/bash set -Eeuo pipefail # Get the workspace directory WORKSPACE_DIR="${WORKSPACE_DIR:-/workspaces/pip}" cd "$WORKSPACE_DIR" # Upgrade pip and install development dependencies python -m pip install --upgrade pip python -m pip install nox --group test python -m nox -s common-wheels python -m pip install -e . ================================================ FILE: .git-blame-ignore-revs ================================================ 917b41d6d73535c090fc312668dff353cdaef906 # Blacken docs/html/conf.py ed383dd8afa8fe0250dcf9b8962927ada0e21c89 # Blacken docs/pip_sphinxext.py 228405e62451abe8a66233573035007df4be575f # Blacken noxfile.py f477a9f490e978177b71c9dbaa5465c51ea21129 # Blacken setup.py e59ba23468390217479465019f8d78e724a23550 # Blacken src/pip/__main__.py d7013db084e9a52242354ee5754dc5d19ccf062e # Blacken src/pip/_internal/build_env.py 30e9ffacae75378fc3e3df48f754dabad037edb9 # Blacken src/pip/_internal/cache.py 8341d56b46776a805286218ac5fb0e7850fd9341 # Blacken src/pip/_internal/cli/autocompletion.py 3d3461ed65208656358b3595e25d8c31c5c89470 # Blacken src/pip/_internal/cli/base_command.py d489b0f1b104bc936b0fb17e6c33633664ebdc0e # Blacken src/pip/_internal/cli/cmdoptions.py 591fe4841aefe9befa0530f2a54f820c4ecbb392 # Blacken src/pip/_internal/cli/command_context.py 9265b28ef7248ae1847a80384dbeeb8119c3e2f5 # Blacken src/pip/_internal/cli/main.py 847a369364878c38d210c90beed2737bb6fb3a85 # Blacken src/pip/_internal/cli/main_parser.py ec97119067041ae58b963935ff5f0e5d9fead80c # Blacken src/pip/_internal/cli/parser.py 6e3b8de22fa39fa3073599ecf9db61367f4b3b32 # Blacken src/pip/_internal/cli/progress_bars.py 55405227de983c5bd5bf0858ea12dbe537d3e490 # Blacken src/pip/_internal/cli/req_command.py d5ca5c850cae9a0c64882a8f49d3a318699a7e2e # Blacken src/pip/_internal/cli/spinners.py 9747cb48f8430a7a91b36fe697dd18dbddb319f0 # Blacken src/pip/_internal/commands/__init__.py 1c09fd6f124df08ca36bed68085ad68e89bb1957 # Blacken src/pip/_internal/commands/cache.py 315e93d7eb87cd476afcc4eaf0f01a7b56a5037f # Blacken src/pip/_internal/commands/check.py 8ae3b96ed7d24fd24024ccce4840da0dcf635f26 # Blacken src/pip/_internal/commands/completion.py 42ca4792202f26a293ee48380718743a80bbee37 # Blacken src/pip/_internal/commands/configuration.py 790ad78fcd43d41a5bef9dca34a3c128d05eb02c # Blacken src/pip/_internal/commands/debug.py a6fcc8f045afe257ce321f4012fc8fcb4be01eb3 # Blacken src/pip/_internal/commands/download.py 920e735dfc60109351fbe2f4c483c2f6ede9e52d # Blacken src/pip/_internal/commands/freeze.py 053004e0fcf0851238b1064fbce13aea87b24e9c # Blacken src/pip/_internal/commands/hash.py a6b6ae487e52c2242045b64cb8962e0a992cfd76 # Blacken src/pip/_internal/commands/help.py 2495cf95a6c7eb61ccf1f9f0e8b8d736af914e53 # Blacken __main__.py c7ee560e00b85f7486b452c14ff49e4737996eda # Blacken tools/ 8e2e1964a4f0a060f7299a96a911c9e116b2283d # Blacken src/pip/_internal/commands/ 1bc0eef05679e87f45540ab0a294667cb3c6a88e # Blacken src/pip/_internal/network/ 069b01932a7d64a81c708c6254cc93e1f89e6783 # Blacken src/pip/_internal/req 1897784d59e0d5fcda2dd75fea54ddd8be3d502a # Blacken src/pip/_internal/index 94999255d5ede440c37137d210666fdf64302e75 # Reformat the codebase, with black 585037a80a1177f1fa92e159a7079855782e543e # Cleanup implicit string concatenation 8a6f6ac19b80a6dc35900a47016c851d9fcd2ee2 # Blacken src/pip/_internal/resolution directory acfcae8941bb12ecfc372a05c875a7b414992604 # Reformat with Black's 2025 code style ================================================ FILE: .gitattributes ================================================ # Patches must have Unix-style line endings, even on Windows tools/vendoring/patches/* eol=lf # The CA Bundle should always use Unix-style line endings, even on Windows src/pip/_vendor/certifi/*.pem eol=lf ================================================ FILE: .github/CONTRIBUTING.md ================================================ # Contributing to pip Thank you for your interest in contributing to pip! There are many ways to contribute, and we appreciate all of them. As a reminder, all contributors are expected to follow our [Code of Conduct][coc]. Contributors wishing to use LLM tools should be aware of, and follow, our [AI Policy][ai]. [coc]: https://www.pypa.io/en/latest/code-of-conduct/ [ai]: https://github.com/pypa/pip/blob/main/AI_POLICY.md ## Development Documentation Our [development documentation](https://pip.pypa.io/en/latest/development/) contains details on how to get started with contributing to pip, and details of our development processes. ================================================ FILE: .github/FUNDING.yml ================================================ github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] patreon: # Replace with a single Patreon username open_collective: # Replace with a single Open Collective username ko_fi: # Replace with a single Ko-fi username tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username custom: "https://pypi.org/sponsor/" # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] ================================================ FILE: .github/ISSUE_TEMPLATE/bug-report.yml ================================================ name: Bug report description: Something is not working correctly. labels: "S: needs triage, type: bug" body: - type: markdown attributes: value: >- Hi there! We'd appreciate it if you could search on pip's existing issues prior to filing a bug report. We get a lot of duplicate tickets and have limited maintainer capacity to triage them. Thanks! - type: textarea attributes: label: Description description: >- A clear and concise description of what the bug is. validations: required: true - type: textarea attributes: label: Expected behavior description: >- A clear and concise description of what you expected to happen. - type: input attributes: label: pip version validations: required: true - type: input attributes: label: Python version validations: required: true - type: input attributes: label: OS validations: required: true - type: textarea attributes: label: How to Reproduce description: Please provide steps to reproduce this bug. placeholder: | 1. Get package from '...' 2. Then run '...' 3. An error occurs. validations: required: true - type: textarea attributes: label: Output description: >- Provide the output of the steps above, including the commands themselves and pip's output/traceback etc. If you want to present output from multiple commands, please prefix the line containing the command with `$ `. Please also ensure that the "How to reproduce" section contains matching instructions for reproducing this. - type: checkboxes attributes: label: Code of Conduct options: - label: >- I agree to follow the [PSF Code of Conduct](https://www.python.org/psf/conduct/). required: true ================================================ FILE: .github/ISSUE_TEMPLATE/config.yml ================================================ # Documentation for this file can be found at: # https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository blank_issues_enabled: true # contact_links: # - name: "(maintainers only) Blank issue" # url: https://github.com/pypa/pip/issues/new # about: For maintainers only. ================================================ FILE: .github/ISSUE_TEMPLATE/feature-request.yml ================================================ name: Feature request description: Suggest an idea for this project labels: "S: needs triage, type: feature request" body: - type: markdown attributes: value: >- Hi there! We'd appreciate it if you could search on pip's existing issues prior to filing a feature request. We get a lot of duplicate tickets and have limited maintainer capacity to triage them. Thanks! - type: textarea attributes: label: What's the problem this feature will solve? description: >- What are you trying to do, that you are unable to achieve with pip as it currently stands? validations: required: true - type: textarea attributes: label: Describe the solution you'd like description: >- Clear and concise description of what you want to happen. Please use examples of real world use cases that this would help with, and how it solves the problem described above. validations: required: true - type: textarea attributes: label: Alternative Solutions description: >- Have you tried to workaround the problem using pip or other tools? Or a different approach to solving this issue? Please elaborate here. validations: required: true - type: textarea attributes: label: Additional context description: >- Add any other context, links, etc. relevant to the feature request. validations: required: true - type: checkboxes attributes: label: Code of Conduct options: - label: >- I agree to follow the [PSF Code of Conduct](https://www.python.org/psf/conduct/). required: true ================================================ FILE: .github/PULL_REQUEST_TEMPLATE.md ================================================ ================================================ FILE: .github/chronographer.yml ================================================ branch-protection-check-name: Changelog entry action-hints: check-title-prefix: "Chronographer: " external-docs-url: https://pip.pypa.io/dev/news-entry-failure inline-markdown: > See https://pip.pypa.io/dev/news-entry-failure for details. enforce-name: suffix: .rst labels: skip-changelog: skip news ================================================ FILE: .github/dependabot.yml ================================================ version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" groups: github-actions: patterns: - "*" - package-ecosystem: "pip" directory: "/build-project" schedule: interval: "weekly" ================================================ FILE: .github/workflows/ci.yml ================================================ name: CI on: push: branches: [main] tags: # Tags for all potential release numbers till 2030. - "2[0-9].[0-3]" # 20.0 -> 29.3 - "2[0-9].[0-3].[0-9]+" # 20.0.0 -> 29.3.[0-9]+ pull_request: schedule: - cron: 0 0 * * MON # Run every Monday at 00:00 UTC workflow_dispatch: # allow manual runs on branches without a PR env: # The "FORCE_COLOR" variable, when set to 1, # tells Nox to colorize itself. FORCE_COLOR: "1" concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true jobs: docs: name: docs runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v6.0.2 - uses: actions/setup-python@v6 with: python-version: "3.x" - run: pip install nox - run: nox -s docs determine-changes: runs-on: ubuntu-22.04 outputs: tests: ${{ steps.filter.outputs.tests }} vendoring: ${{ steps.filter.outputs.vendoring }} steps: # For pull requests it's not necessary to checkout the code - uses: dorny/paths-filter@v3 id: filter with: filters: | vendoring: # Anything that's touching "vendored code" - "src/pip/_vendor/**" - "pyproject.toml" - "noxfile.py" tests: # Anything that's touching code-related stuff - ".github/workflows/ci.yml" - "src/**" - "tests/**" - "noxfile.py" # The test suite should also run when cutting a release # (which is the only time this file is modified). - "NEWS.rst" if: github.event_name == 'pull_request' packaging: name: packaging / ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-22.04, windows-latest] steps: - uses: actions/checkout@v6.0.2 - uses: actions/setup-python@v6 with: python-version: "3.x" - name: Set up git credentials run: | git config --global user.email "pypa-dev@googlegroups.com" git config --global user.name "pip" - run: pip install nox - run: nox -s prepare-release -- 99.9 - run: nox -s build-release -- 99.9 - run: pipx run check-sdist vendoring: name: vendoring runs-on: ubuntu-22.04 needs: [determine-changes] if: >- needs.determine-changes.outputs.vendoring == 'true' || github.event_name != 'pull_request' steps: - uses: actions/checkout@v6.0.2 - uses: actions/setup-python@v6 with: python-version: "3.x" - run: pip install nox - run: nox -s vendoring - run: git diff --exit-code tests-unix: name: tests / ${{ matrix.python.key || matrix.python }} / ${{ matrix.os }} runs-on: ${{ matrix.os }} needs: [determine-changes] if: >- needs.determine-changes.outputs.tests == 'true' || github.event_name != 'pull_request' strategy: fail-fast: true matrix: os: [ubuntu-22.04, macos-latest] python: - "3.9" - "3.10" - "3.11" - "3.12" - "3.13" - "3.14" - "3.15" steps: - uses: actions/checkout@v6.0.2 - uses: actions/setup-python@v6 with: python-version: ${{ matrix.python }} allow-prereleases: true - name: Install Ubuntu dependencies if: matrix.os == 'ubuntu-22.04' run: | sudo apt-get update sudo apt-get install bzr - name: Install MacOS dependencies if: runner.os == 'macOS' run: | DEPS=breezy if ! which svn; then DEPS="${DEPS} subversion" fi brew install ${DEPS} - run: pip install nox # Main check - name: Run unit tests run: >- nox -s test-${{ matrix.python.key || matrix.python }} -- tests/unit --verbose --numprocesses auto --showlocals - name: Run integration tests run: >- nox -s test-${{ matrix.python.key || matrix.python }} --no-install -- tests/functional --verbose --numprocesses auto --showlocals --durations=15 tests-windows: name: tests / ${{ matrix.python }} / ${{ matrix.os }} / ${{ matrix.group.number }} runs-on: ${{ matrix.os }}-latest needs: [determine-changes] if: >- needs.determine-changes.outputs.tests == 'true' || github.event_name != 'pull_request' strategy: fail-fast: true matrix: os: [Windows] python: - "3.9" # Commented out, since Windows tests are expensively slow, # only test the oldest and newest Python supported by pip # - "3.10" # - "3.11" # - "3.12" # - "3.13" - "3.14" - "3.15" group: - { number: 1, pytest-filter: "not test_install" } - { number: 2, pytest-filter: "test_install" } steps: # The D: drive is significantly faster than the system C: drive. # https://github.com/actions/runner-images/issues/8755 - name: Set TEMP to D:/Temp run: | mkdir "D:\\Temp" echo "TEMP=D:\\Temp" >> $env:GITHUB_ENV - uses: actions/checkout@v6.0.2 - uses: actions/setup-python@v6 with: python-version: ${{ matrix.python }} allow-prereleases: true - name: Install Subversion shell: pwsh run: | winget install --accept-source-agreements --accept-package-agreements -e --id Slik.Subversion echo "C:\Program Files\SlikSvn\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - run: pip install nox # Main check - name: Run unit tests (group 1) if: matrix.group.number == 1 run: >- nox -s test-${{ matrix.python }} -- tests/unit --verbose --numprocesses auto --showlocals - name: Run integration tests (group ${{ matrix.group.number }}) run: >- nox -s test-${{ matrix.python }} --no-install -- tests/functional -k "${{ matrix.group.pytest-filter }}" --verbose --numprocesses auto --showlocals --durations=15 tests-zipapp: name: tests / zipapp # The macos-latest (M1) runners are the fastest available on GHA, even # beating out the ubuntu-latest runners. The zipapp tests are slow by # nature, and we don't care where they run, so we pick the fastest one. runs-on: macos-latest needs: [packaging, determine-changes] if: >- needs.determine-changes.outputs.tests == 'true' || github.event_name != 'pull_request' steps: - uses: actions/checkout@v6.0.2 - uses: actions/setup-python@v6 with: python-version: "3.10" - name: Install MacOS dependencies run: brew install breezy subversion - run: pip install nox # Main check - name: Run integration tests run: >- nox -s test-3.10 -- tests/functional --verbose --numprocesses auto --showlocals --durations=15 --use-zipapp check: # This job does nothing and is only used for the branch protection if: always() needs: - determine-changes - docs - packaging - tests-unix - tests-windows - tests-zipapp - vendoring runs-on: ubuntu-22.04 steps: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1 with: allowed-skips: >- ${{ ( needs.determine-changes.outputs.vendoring != 'true' && github.event_name == 'pull_request' ) && 'vendoring' || '' }} , ${{ ( needs.determine-changes.outputs.tests != 'true' && github.event_name == 'pull_request' ) && ' tests-unix, tests-windows, tests-zipapp, tests-importlib-metadata, ' || '' }} jobs: ${{ toJSON(needs) }} ================================================ FILE: .github/workflows/lock-threads.yml ================================================ name: 'Lock Closed Threads' on: schedule: - cron: '0 7 * * *' # 7am UTC, daily workflow_dispatch: permissions: issues: write pull-requests: write concurrency: group: lock jobs: action: if: github.repository_owner == 'pypa' runs-on: ubuntu-latest steps: - uses: dessant/lock-threads@v6 with: issue-inactive-days: '30' pr-inactive-days: '15' ================================================ FILE: .github/workflows/release.yml ================================================ name: Publish Python 🐍 distribution 📦 to PyPI on: push: tags: - "*" jobs: build: name: Build distribution 📦 runs-on: ubuntu-latest steps: - uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v6.0.2 with: persist-credentials: false - name: Build a binary wheel and a source tarball run: ./build-project/build-project.py - name: Store the distribution packages uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 with: name: python-package-distributions path: dist/ publish-to-pypi: name: >- Publish Python 🐍 distribution 📦 to PyPI needs: - build runs-on: ubuntu-latest environment: name: pypi url: https://pypi.org/project/pip/${{ github.ref_name }} permissions: id-token: write # IMPORTANT: mandatory for trusted publishing steps: - name: Download all the dists uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 with: name: python-package-distributions path: dist/ - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 ================================================ FILE: .github/workflows/update-rtd-redirects.yml ================================================ name: Update documentation redirects on: push: branches: [main] paths: - ".readthedocs-custom-redirects.yml" - ".readthedocs.yml" schedule: - cron: 0 0 * * MON # Run every Monday at 00:00 UTC env: FORCE_COLOR: "1" concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true jobs: update-rtd-redirects: runs-on: ubuntu-latest environment: RTD Deploys steps: - uses: actions/checkout@v6.0.2 - uses: actions/setup-python@v6 with: python-version: "3.11" - run: pipx run tools/update-rtd-redirects.py env: RTD_API_TOKEN: ${{ secrets.RTD_API_TOKEN }} ================================================ FILE: .gitignore ================================================ # Byte-compiled files __pycache__/ *$py.class # Distribution / packaging /build/ /dist/ *.egg *.eggs *.egg-info/ MANIFEST # Documentation docs/build/ # mypy .mypy_cache/ # Unit test / coverage reports .[nt]ox/ htmlcov/ .coverage .coverage.* .*cache nosetests.xml coverage.xml *.cover tests/data/common_wheels/ # Misc *~ .*.sw? .env/ .venv/ # For IntelliJ IDEs (basically PyCharm) .idea/ # For Visual Studio Code .vscode/ # For Sublime Text *.sublime-workspace *.sublime-project # Scratch Pad for experiments .scratch/ # Mac .DS_Store # Profiling related artifacts *.prof ================================================ FILE: .mailmap ================================================ Adam Wentz Alethea Flowers Alethea Flowers Thea Flowers Alex Grönholm Alex Grönholm Anatoly Techtonik Andrey Bulgakov Andrei Geacar unknown Anish Tambe Bartek Ogryczak Ben Rosser Daniel Holth David Black Dongweiming Dustin Ingram Endoh Takanao Erik M. Bray Ee Durbin Gabriel de Perthuis Hsiaoming Yang Hugo van Kemenade Hugo Hugo van Kemenade hugovk Igor Kuzmitshov Ilya Baryshev Jakub Stasiak Jean Abou Samra John-Scott Atlakson Jorge Niedbalski Ludovic Gasc Markus Hametner Masklinn Matthew Iversen Ofek Lev Pi Delport Pradyun Gedam Pradyun Gedam Preston Holmes Przemek Wrzos Romuald Brunet Thomas Johansson prencher Thomas Kluyver Stephan Erb Victor Stinner Yoval P Zhiping Deng dkjsone <221672629+dkjsone@users.noreply.github.com> user Meet Vasita meet-vasita Meet Vasita Meet_Vasita <84974738+meet-vasita@users.noreply.github.com> ================================================ FILE: .pre-commit-config.yaml ================================================ exclude: 'src/pip/_vendor/' repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: check-builtin-literals - id: check-added-large-files - id: check-case-conflict - id: check-toml - id: check-yaml - id: debug-statements - id: end-of-file-fixer exclude: WHEEL - id: forbid-new-submodules - id: trailing-whitespace exclude: .patch - repo: https://github.com/psf/black-pre-commit-mirror rev: 25.12.0 hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.14.10 hooks: - id: ruff-check args: [--fix] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.19.1 hooks: - id: mypy exclude: tests/data args: - "--pretty" - "--show-error-codes" # Since this is only a partial mypy run, we can get false-positives # for unused ignores. - "--no-warn-unused-ignores" additional_dependencies: [ 'keyring==24.2.0', 'nox==2024.03.02', 'pytest', 'types-docutils==0.20.0.3', 'types-setuptools==68.2.0.0', 'types-freezegun==1.1.10', 'types-pyyaml==6.0.12.12', 'typing-extensions', ] - repo: https://github.com/pre-commit/pygrep-hooks rev: v1.10.0 hooks: - id: python-no-log-warn - id: python-no-eval - id: rst-backticks files: .*\.rst$ types: [file] exclude: NEWS.rst # The errors flagged in NEWS.rst are old. - repo: https://github.com/codespell-project/codespell rev: v2.4.1 hooks: - id: codespell exclude: AUTHORS.txt|tests/data args: ["--ignore-words", tools/codespell-ignore.txt] - repo: local hooks: - id: news-fragment-filenames name: NEWS fragment language: fail entry: NEWS fragment files must be named *.(process|removal|feature|bugfix|vendor|doc|trivial).rst exclude: ^news/(.gitignore|.*\.(process|removal|feature|bugfix|vendor|doc|trivial).rst) files: ^news/ ci: autofix_prs: false autoupdate_commit_msg: 'pre-commit autoupdate' autoupdate_schedule: monthly ================================================ FILE: .readthedocs-custom-redirects.yml ================================================ # This file is read by tools/update-rtd-redirects.py. # It is related to Read the Docs, but is not a file processed by the platform. /dev/news-entry-failure: >- https://pip.pypa.io/en/latest/development/contributing/#news-entries /errors/resolution-impossible: >- https://pip.pypa.io/en/stable/topics/dependency-resolution/#dealing-with-dependency-conflicts /surveys/backtracking: >- https://forms.gle/LkZP95S4CfqBAU1N6 /warnings/backtracking: >- https://pip.pypa.io/en/stable/topics/dependency-resolution/#possible-ways-to-reduce-backtracking /warnings/enable-long-paths: >- https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later /warnings/venv: >- https://docs.python.org/3/tutorial/venv.html /reference/build-system/pyproject-toml: >- https://pip.pypa.io/en/stable/reference/build-system/ /reference/build-system/setup-py: >- https://pip.pypa.io/en/stable/reference/build-system/ ================================================ FILE: .readthedocs.yml ================================================ version: 2 build: os: ubuntu-22.04 tools: python: "3.11" jobs: install: - pip install . - pip install --group docs sphinx: builder: dirhtml configuration: docs/html/conf.py ================================================ FILE: AI_POLICY.md ================================================ # Generative AI / LLM Policy We appreciate that we can't realistically police how you author your pull requests, which includes whether you employ large-language model (LLM)-based development tools. So, we don't. However, due to both legal and human reasons, we have to establish boundaries. ## Overview - We take the responsibility for this project very seriously and we expect you to take your responsibility for your contributions seriously, too. This used to be a given, but it changed now that a pull request is just one prompt away. - Every contribution has to be backed by a human who unequivocally owns the copyright for all changes. No LLM bots in `Co-authored-by:`s. - Repeated slop contributions are unacceptable, and will be closed without review. We reserve the right to exclude contributors who continue to submit such material. - Absolutely no unsupervised agentic tools like OpenClaw. --- By submitting a pull request, you certify that: - You are the author of the contribution or have the legal right to submit it. - You either hold the copyright to the changes or have explicit legal authorization to contribute them under this project's license. - You understand the code. - You accept full responsibility for it. ## Legal There is ongoing legal uncertainty regarding the copyright status of LLM-generated works and their provenance. Because of this, allowing contributions by LLMs has unpredictable consequences for the copyright status of this project – even when leaving aside possible copyright violations due to plagiarism. ## Human As the makers of software that is used by millions of people worldwide and with a reputation for high-quality maintenance, we take our responsibility to our users very seriously. No matter what LLM vendors or boosters on LinkedIn tell you, we have to manually review every change before merging, because it's our responsibility to keep the project stable. Please understand that by opening low-quality pull requests you're not helping anyone. Worse, you're [poisoning the open source ecosystem](https://lwn.net/Articles/1058266/) that was precarious even before the arrival of LLM tools. Having to wade through plausible-looking-but-low-quality pull requests and trying to determine which ones are legit is extremely demoralizing and has already burned out many good maintainers. In particular, note that [code reviews are a social process](https://blog.glyph.im/2026/03/what-is-code-review-for.html) and are *not* intended to catch bugs in PRs created by an LLM. If you submit a pull request, we expect you to engage with reviewers and learn from the review, not simply update the prompt that generated the PR and regenerate the code. Put bluntly, we have no time or interest to become part of your vibe coding loop where you drop LLM slop at our door, we spend time and energy to review it, and you just feed it back into the LLM for another iteration. This dynamic is especially pernicious because it poisons the well for mentoring new contributors which we are committed to. ## Summary In practice, this means: - Pull requests that have an LLM product listed as co-author can't be merged and will be closed without further discussion. We cannot risk the copyright status of this project. If you used LLM tools during development, you may still submit – but you must remove any LLM co-author tags and take full ownership of every line. - By submitting a pull request, you take full technical and legal responsibility for the contents of the pull request and promise that you hold the copyright for the changes submitted. "An LLM wrote it" is *not* an acceptable response to questions or critique. If you cannot explain and defend the changes you submit, do not submit them and open a high-quality bug report or feature request instead. - Accounts that exercise bot-like behavior – like automated mass pull requests – will be permanently banned, whether they belong to a human or not. - LLM-generated comments must be concise and accurate, and you must be prepared to stand by them. Do not post summaries unless you are certain that they add value to the discussion. Remember that all LLM output *looks* plausible. When using these tools, it's your responsibility to ensure that the output is correct, and useful. - Remember that LLM generated content is generally easier for you to produce, but *harder* for others to read, review or interpret. Prioritising your time over that of others is contrary to the project's code of conduct. Verbose, repetitive, or off topic comments may be marked as spam. ## Thanks This policy was based on the policy of the `attrs` project. Many thanks to them for developing it. ================================================ FILE: AUTHORS.txt ================================================ @Switch01 A_Rog Aakanksha Agrawal Aarni Koskela Abhinav Sagar ABHYUDAY PRATAP SINGH abs51295 AceGentile Adam Chainz Adam Tse Adam Turner Adam Wentz admin Adolfo Ochagavía Adrien Morison Agus ahayrapetyan Ahilya AinsworthK Akash Srivastava Alan Yee Albert Tugushev Albert-Guan albertg Alberto Sottile Aleks Bunin Ales Erjavec Alessandro Molina Alethea Flowers Alex Gaynor Alex Grönholm Alex Hedges Alex Loosley Alex Morega Alex Stachowiak Alexander Regueiro Alexander Shtyrov Alexandre Conrad Alexey Popravka Aleš Erjavec Alli Aman Ami Fischman Ananya Maiti Anatoly Techtonik Anders Kaseorg Andre Aguiar Andreas Lutro Andrei Geacar Andrew Gaul Andrew Shymanel Andrey Bienkowski Andrey Bulgakov Andrés Delfino Andy Freeland Andy Kluger Ani Hayrapetyan Aniruddha Basak Anish Tambe Anrs Hu Anthony Sottile Antoine Lambert Antoine Musso Anton Ovchinnikov Anton Patrushev Anton Zelenov Antonio Alvarado Hernandez Antony Lee Antti Kaihola Anubhav Patel Anudit Nagar Anuj Godase AQNOUCH Mohammed AraHaan arena arenasys Arindam Choudhury Armin Ronacher Arnon Yaari Artem Arun Babu Neelicattu Ashley Manton Ashwin Ramaswami atse Atsushi Odagiri Avinash Karhana Avner Cohen Awit (Ah-Wit) Ghirmai Baptiste Mispelon Barney Gale barneygale Bartek Ogryczak Bastian Venthur Ben Bodenmiller Ben Darnell Ben Hoyt Ben Mares Ben Rosser Bence Nagy Benjamin Peterson Benjamin VanEvery Benoit Pierre Berker Peksag Bernard Bernard Tyers Bernardo B. Marques Bernhard M. Wiedemann Bertil Hatt Bhavam Vidyarthi Blazej Michalik Bogdan Opanchuk BorisZZZ Brad Erickson Bradley Ayers Bradley Reynolds Branch Vincent Brandon L. Reiss Brandt Bucher Brannon Dorsey Brett Randall Brett Rosen Brian Cristante Brian Rosner briantracy BrownTruck Bruno Oliveira Bruno Renié Bruno S Bstrdsmkr Buck Golemon burrows Bussonnier Matthias bwoodsend c22 Caleb Brown Caleb Martinez Calvin Smith Carl Meyer Carlos Liam Carol Willing Carter Thayer Cass Chandrasekhar Atina Charlie Marsh charwick Chih-Hsuan Yen Chris Brinker Chris Hunt Chris Jerdonek Chris Kuehl Chris Markiewicz Chris McDonough Chris Pawley Chris Pryer Chris Wolfe Christian Clauss Christian Heimes Christian Oudard Christoph Reiter Christopher Hunt Christopher Snyder chrysle cjc7373 Clark Boylan Claudio Jolowicz Clay McClure Cody Cody Soyland Colin Watson Collin Anderson Connor Osborn Cooper Lees Cooper Ry Lees Cory Benfield Cory Wright Craig Kerstiens Cristian Sorinel Cristina Cristina Muñoz ctg123 Curtis Doty cytolentino Daan De Meyer Dale Damian Damian Quiroga Damian Shaw Dan Black Dan Savilonis Dan Sully Dane Hillard daniel Daniel Collins Daniel Hahler Daniel Hollas Daniel Holth Daniel Jost Daniel Katz Daniel Shaulov Daniele Esposti Daniele Nicolodi Daniele Procida Daniil Konovalenko Danny Hermes Danny McClanahan Darren Kavanagh Dav Clark Dave Abrahams Dave Jones David Aguilar David Black David Bordeynik David Caro David D Lowe David Evans David Hewitt David Linke David Poggi David Poznik David Pursehouse David Runge David Tucker David Wales Davidovich ddelange Deepak Sharma Deepyaman Datta Denis Roussel (ACSONE) Denise Yu dependabot[bot] derwolfe Desetude developer Devesh Kumar Devesh Kumar Singh devsagul Diego Caraballo Diego Ramirez DiegoCaraballo Dimitri Merejkowsky Dimitri Papadopoulos Dimitri Papadopoulos Orfanos Dirk Stolle dkjsone Dmitry Gladkov Dmitry Volodin Domen Kožar Dominic Davis-Foster Donald Stufft Dongweiming doron zarhi Dos Moonen Douglas Thor DrFeathers Dustin Ingram Dustin Rodrigues Dwayne Bailey Ed Morley Edgar Ramírez Edgar Ramírez Mondragón Ee Durbin Efflam Lemaillet efflamlemaillet Eitan Adler ekristina elainechan Eli Schwartz Elisha Hollander Ellen Marie Dash Emil Burzo Emil Styrke Emmanuel Arias Endoh Takanao enoch Erdinc Mutlu Eric Cousineau Eric Gillingham Eric Hanchrow Eric Hopper Erik M. Bray Erik Rose Erwin Janssen Eugene Vereshchagin everdimension Federico Felipe Peter Felix Yan fiber-space Filip Kokosiński Filipe Laíns Finn Womack finnagin Flavio Amurrio Florian Briand Florian Rathgeber Francesco Francesco Montesano Fredrik Orderud Fredrik Roubert Frost Ming Gabriel Curio Gabriel de Perthuis Garry Polley gavin gdanielson Gene Wood Geoffrey Sneddon George Margaritis George Song Georgi Valkov Georgy Pchelkin ghost Giftlin Rajaiah gizmoguy1 gkdoc Godefroid Chapelle Gopinath M GOTO Hayato gousaiyang gpiks Greg Roodt Greg Ward Guido Diepen Guilherme Espada Guillaume Seguin gutsytechster Guy Rozendorn Guy Tuval gzpan123 Hanjun Kim Hari Charan Harsh Vardhan Harsha Sai harupy Harutaka Kawamura Hasan-8326 hauntsaninja Henrich Hartzer Henry Schreiner Herbert Pfennig Holly Stotelmyer Honnix Hsiaoming Yang Hugo Lopes Tavares Hugo van Kemenade Hugues Bruant Hynek Schlawack iamsrp-deshaw Ian Bicking Ian Cordasco Ian Lee Ian Stapleton Cordasco Ian Wienand Igor Kuzmitshov Igor Sobreira Ikko Ashimine Ilan Schnell Illia Volochii Ilya Abdolmanafi Ilya Baryshev Inada Naoki Ionel Cristian Mărieș Ionel Maries Cristian Itamar Turner-Trauring iTrooz Ivan Pozdeev J. Nick Koston Jacob Kim Jacob Walls Jaime Sanz Jake Lishman jakirkham Jakub Kuczys Jakub Stasiak Jakub Vysoky Jakub Wilk James James Cleveland James Curtin James Firth James Gerity James Polley Jan Pokorný Jannis Leidel Jarek Potiuk jarondl Jason Curtis Jason R. Coombs JasonMo JasonMo1 Jay Graves Jean Abou Samra Jean-Christophe Fillion-Robin Jeff Barber Jeff Dairiki Jeff Widman Jelmer Vernooij jenix21 Jeremy Fleischman Jeremy Stanley Jeremy Zafran Jesse Rittner Jiashuo Li Jim Fisher Jim Garrison Jinzhe Zeng Jiun Bae Jivan Amara Joa Joe Bylund Joe Michelini Johannes Altmanninger John Paton John Sirois John T. Wodder II John-Scott Atlakson johnthagen Jon Banafato Jon Dufresne Jon Parise Jonas Nockert Jonathan Herbert Joonatan Partanen Joost Molenaar Jorge Niedbalski Joseph Bylund Joseph Long Josh Bronson Josh Cannon Josh Hansen Josh Schneier Joshua JoshuaPerdue Jost Migenda Juan Luis Cano Rodríguez Juanjo Bazán Judah Rand Julian Berman Julian Gethmann Julien Demoor Julien Stephan July Tikhonov Jussi Kukkonen Justin van Heek jwg4 Jyrki Pulliainen Kai Chen Kai Mueller Kamal Bin Mustafa Karolina Surma kasium kaustav haldar Kaz Nishimura keanemind Keith Maxwell Kelsey Hightower Kenneth Belitzky Kenneth Reitz Kevin Burke Kevin Carter Kevin Frommelt Kevin R Patterson Kexuan Sun Kit Randel Klaas van Schelven KOLANICH konstin kpinc Krishan Bhasin Krishna Oza Kumar McMillan Kuntal Majumder Kurt McKee Kyle Persohn lakshmanaram Laszlo Kiss-Kollar Laurent Bristiel Laurent LAPORTE Laurie O Laurie Opperman layday Leon Sasson Lev Givon Lincoln de Sousa Lipis lorddavidiii Loren Carvalho Lucas Cimon Ludovic Gasc Luis Medel Lukas Geiger Lukas Juhrich Luke Macken Luo Jiebin luojiebin luz.paz László Kiss Kollár M00nL1ght MajorTanya Malcolm Smith Marc Abramowitz Marc Tamlyn Marcus Smith Mariatta Mark Kohler Mark McLoughlin Mark Williams Markus Hametner Martey Dodoo Martin Fischer Martin Häcker Martin Pavlasek Masaki Masklinn Matej Stuchlik Mateusz Sokół Mathew Jennings Mathieu Bridon Mathieu Kniewallner Matt Bacchi Matt Good Matt Maker Matt Robenolt Matt Wozniski matthew Matthew Einhorn Matthew Feickert Matthew Gilliard Matthew Hughes Matthew Iversen Matthew Treinish Matthew Trumbell Matthew Willson Matthias Bussonnier mattip Maurits van Rees Max W Chase Maxim Kurnikov Maxime Rouyrre mayeut mbaluna Md Sujauddin Sekh mdebi Meet Vasita memoselyk meowmeowcat Michael Michael Aquilina Michael E. Karpeles Michael Klich Michael Mintz Michael Williamson michaelpacer Michał Górny Mickaël Schoentgen Miguel Araujo Perez Mihir Singh Mike Mike Hendricks Min RK MinRK Miro Hrončok Monica Baluna montefra Monty Taylor morotti mrKazzila Muha Ajjan MUTHUSRIHEMADHARSHINI S A Nadav Wexler Nahuel Ambrosini Nate Coraor Nate Prewitt Nathan Houghton Nathaniel J. Smith Nehal J Wani Neil Botelho Nguyễn Gia Phong Nicholas Serra Nick Coghlan Nick Stenning Nick Timkovich Nicolas Bock Nicole Harris Nikhil Benesch Nikhil Ladha Nikita Chepanov Nikolay Korolev Nipunn Koorapati Nitesh Sharma Niyas Sait Noah Noah Gorny Nothing-991 Nowell Strite NtaleGrey nucccc nvdv OBITORASU Ofek Lev ofrinevo Oleg Burnaev Oliver Freund Oliver Jeeves Oliver Mannion Oliver Tonnhofer Olivier Girardot Olivier Grisel Ollie Rutherfurd OMOTO Kenji Omry Yadan onlinejudge95 Oren Held Oscar Benjamin oxygen dioxide Oz N Tiram Pachwenko Paresh Joshi Patrick Dubroy Patrick Jenkins Patrick Lawson patricktokeeffe Patrik Kopkan Paul Ganssle Paul Kehrer Paul Moore Paul Nasrat Paul Oswald Paul van der Linden Paulus Schoutsen Pavel Safronov Pavithra Eswaramoorthy Pawel Jasinski Paweł Szramowski Pekka Klärck Peter Gessler Peter Lisák Peter Shen Peter Waller Petr Viktorin petr-tik Phaneendra Chiruvella Phil Elson Phil Freo Phil Pennock Phil Whelan Philip Jägenstedt Philip Molloy Philippe Ombredanne Pi Delport Pierre-Yves Rofes Pieter Degroote pip Prabakaran Kumaresshan Prabhjyotsing Surjit Singh Sodhi Prabhu Marappan Pradyun Gedam Prashant Sharma Pratik Mallya pre-commit-ci[bot] Preet Thakkar Preston Holmes Przemek Wrzos Pulkit Goyal q0w Qiangning Hong Qiming Xu qraqras Quentin Lee Quentin Pradet R. David Murray Rafael Caricio Ralf Schmitt Ran Benita Randy Döring Razzi Abuissa rdb Reece Dunham Remi Rampin Rene Dudfield Riccardo Magliocchetti Riccardo Schirone Richard Jones Richard Si Ricky Ng-Adam Rishi rmorotti RobberPhex Robert Collins Robert McGibbon Robert Pollak Robert T. McGibbon robin elisha robinson Rodney, Tiara Roey Berman Rohan Jain Roman Bogorodskiy Roman Donchenko Romuald Brunet ronaudinho Ronny Pfannschmidt Rory McCann Ross Brattain Roy Wellington Ⅳ Ruairidh MacLeod Russell Keith-Magee Ryan Shepherd Ryan Wooden ryneeverett Ryuma Asai S. Guliaev Sachi King Salvatore Rinchiera sandeepkiran-js Sander Van Balen Savio Jomton schlamar Scott Kitterman Sean seanj Sebastian Jordan Sebastian Schaetz Segev Finer SeongSoo Cho Sepehr Rasouli sepehrrasooli Sergey Vasilyev Seth Michael Larson Seth Woodworth Shahar Epstein Shantanu shenxianpeng shireenrao Shivansh-007 Shixian Sheng Shlomi Fish Shovan Maity Shubham Nagure Simeon Visser Simon Cross Simon Pichugin sinoroc sinscary snook92 socketubs Sorin Sbarnea Srinivas Nyayapati Srishti Hegde Stavros Korokithakis Stefan Scherfke Stefano Rivera Stephan Erb Stephane Chazelas Stephen Payne Stephen Rosen stepshal Steve (Gadget) Barnes Steve Barnes Steve Dower Steve Kowalik Steven Myint Steven Silvester stonebig studioj Stéphane Bidoul Stéphane Bidoul (ACSONE) Stéphane Klein Sumana Harihareswara Surbhi Sharma Sviatoslav Sydorenko Sviatoslav Sydorenko (Святослав Сидоренко) Swat009 Sylvain Takayuki SHIMIZUKAWA Taneli Hukkinen tbeswick Terrance Thiago Thijs Triemstra Thomas Fenzl Thomas Grainger Thomas Guettler Thomas Johansson Thomas Kluyver Thomas Smith Thomas VINCENT Tim D. Smith Tim Gates Tim Harder Tim Heap tim smith tinruufu Tobias Hermann Tom Forbes Tom Freudenheim Tom V Tomas Hrnciar Tomas Orsava Tomer Chachamu Tommi Enenkel | AnB Tomáš Hrnčiar Tony Beswick Tony Narlock Tony Zhaocheng Tan TonyBeswick toonarmycaptain Toshio Kuratomi toxinu Travis Swicegood Tushar Sadhwani Tzu-ping Chung Valentin Haenel Victor Stinner victorvpaulo Vikram - Google Viktor Szépe Ville Skyttä Vinay Sajip Vincent Philippon Vinicyus Macedo Vipul Kumar Vitaly Babiy Vladimir Fokow Vladimir Rutsky W. Trevor King Weida Hong Wil Tan Wilfred Hughes William Edwards William ML Leslie William T Olson William Woodruff Wilson Mo wim glenn Winson Luk Wolfgang Maier Wu Zhenyu XAMES3 Xavier Fernandez Xianpeng Shen xoviat xtreak YAMAMOTO Takashi Yash Yashraj Yen Chi Hsuan Yeray Diaz Diaz Yoval P Yu Jian Yuan Jing Vincent Yan Yuki Kobayashi Yusuke Hayashi zackzack38 Zearin Zhiping Deng ziebam Zvezdan Petkovic Łukasz Langa Роман Донченко Семён Марьясин ================================================ FILE: LICENSE.txt ================================================ Copyright (c) 2008-present The pip developers (see AUTHORS.txt file) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: NEWS.rst ================================================ .. note You should *NOT* be adding new change log entries to this file, this file is managed by towncrier. You *may* edit previous change logs to fix problems like typo corrections or such. To add a new change log entry, please see https://pip.pypa.io/en/latest/development/contributing/#news-entries .. towncrier release notes start 26.0.1 (2026-02-04) =================== Bug Fixes --------- - Fix ``--pre`` not being respected from the command line when a requirement file includes an option e.g. ``-extra-index-url``. (`#13788 `_) 26.0 (2026-01-30) ================= Deprecations and Removals ------------------------- - Remove support for non-bare project names in egg fragments. Affected users should use the `Direct URL requirement syntax `_. (`#13157 `_) Features -------- - Display pip's command-line help in colour, if possible. (`#12134 `_) - Support installing dependencies declared with inline script metadata (:pep:`723`) with ``--requirements-from-script``. (`#12891 `_) - Add ``--all-releases`` and ``--only-final`` options to control pre-release and final release selection during package installation. (`#13221 `_) - Add ``--uploaded-prior-to`` option to only consider packages uploaded prior to a given datetime when the ``upload-time`` field is available from a remote index. (`#13625 `_) - Add ``--use-feature inprocess-build-deps`` to request that build dependencies are installed within the same pip install process. This new mechanism is faster, supports ``--no-clean`` and ``--no-cache-dir`` reliably, and supports prompting for authentication. Enabling this feature will also enable ``--use-feature build-constraints``. This feature will become the default in a future pip version. (`#9081 `_) - ``pip cache purge`` and ``pip cache remove`` now clean up empty directories and legacy files left by older pip versions. (`#9058 `_) Bug Fixes --------- - Fix selecting pre-release versions when only pre-releases match. For example, ``package>1.0`` with versions ``1.0, 2.0rc1`` now installs ``2.0rc1`` instead of failing. (`#13746 `_) - Revisions in version control URLs now must be percent-encoded. For example, use ``git+https://example.com/repo.git@issue%231`` to specify the branch ``issue#1``. If you previously used a branch name containing a ``%`` character in a version control URL, you now need to replace it with ``%25`` to ensure correct percent-encoding. (`#13407 `_) - Preserve original casing when a path is displayed. (`#6823 `_) - Fix bash completion when the ``$IFS`` variable has been modified from its default. (`#13555 `_) - Precompute Python requirements on each candidate, reducing time of long resolutions. (`#13656 `_) - Skip redundant work converting version objects to strings when using the ``importlib.metadata`` backend. (`#13660 `_) - Fix ``pip index versions`` to honor only-binary/no-binary options. (`#13682 `_) - Fix fallthrough logic for options, allowing overriding global options with defaults from user config. (`#13703 `_) - Use a path-segment prefix comparison, not char-by-char. (`#13777 `_) Vendored Libraries ------------------ - Upgrade CacheControl to 0.14.4 - Upgrade certifi to 2026.1.4 - Upgrade idna to 3.11 - Upgrade packaging to 26.0 - Upgrade platformdirs to 4.5.1 25.3 (2025-10-24) ================= Deprecations and Removals ------------------------- - Remove support for the legacy ``setup.py develop`` editable method in setuptools editable installs; setuptools >= 64 is now required. (`#11457 `_) - Remove the deprecated ``--global-option`` and ``--build-option``. ``--config-setting`` is now the only way to pass options to the build backend. (`#11859 `_) - Deprecate the ``PIP_CONSTRAINT`` environment variable for specifying build constraints. Use the ``--build-constraint`` option or the ``PIP_BUILD_CONSTRAINT`` environment variable instead. When build constraints are used, ``PIP_CONSTRAINT`` no longer affects isolated build environments. To enable this behavior without specifying any build constraints, use ``--use-feature=build-constraint``. (`#13534 `_) - Remove support for non-standard legacy wheel filenames. (`#13581 `_) - Remove support for the deprecated ``setup.py bdist_wheel`` mechanism. Consequently, ``--use-pep517`` is now always on, and ``--no-use-pep517`` has been removed. (`#6334 `_) Features -------- - When :pep:`658` metadata is available, full distribution files are no longer downloaded when using ``pip lock`` or ``pip install --dry-run``. (`#12603 `_) - Add support for installing an editable requirement written as a Direct URL (``PackageName @ URL``). (`#13495 `_) - Add support for build constraints via the ``--build-constraint`` option. This allows constraining the versions of packages used during the build process (e.g., setuptools) without affecting the final installation. (`#13534 `_) - On ``ResolutionImpossible`` errors, include a note about causes with no candidates. (`#13588 `_) - Building pip itself from source now uses flit-core instead of setuptools. This does not affect how pip installs or builds packages you use. (`#13473 `_) Bug Fixes --------- - Handle malformed ``Version`` metadata entries and show a sensible error message instead of crashing. (`#13443 `_) - Permit spaces between a filepath and extras in an install requirement. (`#13523 `_) - Ensure the self-check files in the cache have the same permissions as the rest of the cache. (`#13528 `_) - Avoid concurrency issues and improve performance when caching locally built wheels, especially when the temporary build directory is on a different filesystem than the cache. The wheel directory passed to the build backend is now a temporary subdirectory inside the cache directory. (`#13540 `_) - Include relevant user-supplied constraints in logs when reporting dependency conflicts. (`#13545 `_) - Fix a regression in configuration parsing that was turning a single value into a list and thus leading to a validation error. (`#13548 `_) - For Python versions that do not support :pep:`706`, pip will now raise an installation error for a source distribution when it includes a symlink that points outside the source distribution archive. (`#13550 `_) - Prevent ``--user`` installs if ``site.ENABLE_USER_SITE`` is set to ``False``. (`#8794 `_) Vendored Libraries ------------------ - Upgrade certifi to 2025.10.5 - Upgrade msgpack to 1.1.2 - Upgrade platformdirs to 4.5.0 - Upgrade requests to 2.32.5 - Upgrade resolvelib to 1.2.1 - Upgrade rich to 14.2.0 - Upgrade tomli to 2.3.0 - Upgrade truststore to 0.10.4 25.2 (2025-07-30) ================= Features -------- - Declare support for Python 3.14 (`#13506 `_) - Automatic download resumption and retrying is enabled by default. (`#13464 `_) - Requires-Python error message displays version clauses in numerical order. (`#13367 `_) - Minor performance improvement getting the order to install a very large number of interdependent packages. (`#13424 `_) - Show time taken instead of ``eta 0:00:00`` at download completion. (`#13483 `_) - Speed up small CLI tools by removing ``import re`` from the console script executable template. (`#13165 `_) - Remove warning when cloning from a Git reference that does not look like a commit hash. (`#12283 `_) Bug Fixes --------- - ``pip config debug`` now correctly separates options as set by the different files at the same level. (`#12099 `_) - Ensure truststore feature remains active even when a proxy is also in use. (`#13343 `_) - Include sub-commands in tab completion. (`#13140 `_) - ``pip list`` with the ``json`` or ``freeze`` format enabled will no longer crash when encountering a package with an invalid version. (`#13345 `_) - Provide a hint if a system error is raised involving long filenames or path segments on Windows. (`#13346 `_) - Resumed downloads are saved to the HTTP cache like any other normal download. (`#13441 `_) - Configured verbosity is consistently forwarded while calling Git during VCS operations. (`#13329 `_) - Suppress the progress bar, when running with ``--log`` and ``--quiet``. Consequently, a new ``auto`` mode for ``--progress-bar`` has been added. ``auto`` will enable progress bars unless suppressed by ``--quiet``, while ``on`` will always enable progress bars. (`#10915 `_) - Fix normalization of local URLs with non-``file`` schemes. (`#13509 `_) - Fix normalization of local file URLs on Windows in newer Python versions. (`#13510 `_) - Fix remaining test failures in Python 3.14 by adjusting ``path_to_url`` and similar functions. (`#13423 `_) - Fix missing ``network`` test markings, making the suite pass in offline environments again. (`#13378 `_) Vendored Libraries ------------------ - Upgrade CacheControl to 0.14.3 - Upgrade certifi to 2025.7.14 - Upgrade distlib to 0.4.0 - Upgrade msgpack to 1.1.1 - Upgrade platformdirs to 4.3.8 - Upgrade pygments to 2.19.2 - Upgrade requests to 2.32.4 - Upgrade resolvelib to 1.2.0 - Upgrade rich to 14.1.0 - Remove vendored typing-extensions. Process ------- - pip's own licensing metadata now follows :pep:`639`. In addition, the licenses of pip's vendored dependencies are now included in the ``License-File`` metadata field and in the wheel. 25.1.1 (2025-05-02) =================== Bug Fixes --------- - Fix ``req.source_dir`` AssertionError when using the legacy resolver. (`#13353 `_) - Fix crash on Python 3.9.6 and lower when pip failed to compile a Python module during installation. (`#13364 `_) - Names in dependency group includes are now normalized before lookup, which fixes incorrect ``Dependency group '...' not found`` errors. (`#13372 `_) Vendored Libraries ------------------ - Fix issues with using tomllib from the stdlib if available, rather than tomli - Upgrade dependency-groups to 1.3.1 25.1 (2025-04-26) ================= Deprecations and Removals ------------------------- - Drop support for Python 3.8. (`#12989 `_) - On python 3.14+, the ``pkg_resources`` metadata backend cannot be used anymore. (`#13010 `_) - Hide ``--no-python-version-warning`` from CLI help and documentation as it's useless since Python 2 support was removed. Despite being formerly slated for removal, the flag will remain as a no-op to avoid breakage. (`#13303 `_) - A warning is emitted when the deprecated ``pkg_resources`` library is used to inspect and discover installed packages. This warning should only be visible to users who set an undocumented environment variable to disable the default ``importlib.metadata`` backend. (`#13318 `_) - Deprecate the legacy ``setup.py bdist_wheel`` mechanism. To silence the warning, and future-proof their setup, users should enable ``--use-pep517`` or add a ``pyproject.toml`` file to the projects they control. (`#13319 `_) Features -------- - Suggest checking "pip config debug" in case of an InvalidProxyURL error. (`#12649 `_) - Using ``--debug`` also enables verbose logging. (`#12710 `_) - Display a transient progress bar during package installation. (`#12712 `_) - Minor performance improvement when installing packages with a large number of dependencies by increasing the requirement string cache size. (`#12873 `_) - Add a ``--group`` option which allows installation from :pep:`735` Dependency Groups. ``--group`` accepts arguments of the form ``group`` or ``path:group``, where the default path is ``pyproject.toml``, and installs the named Dependency Group from the provided ``pyproject.toml`` file. (`#12963 `_) - Add support to enable resuming incomplete downloads. Control the number of retry attempts using the ``--resume-retries`` flag. (`#12991 `_) - Use :pep:`753` "Well-known Project URLs in Metadata" normalization rules when identifying an equivalent project URL to replace a missing ``Home-Page`` field in ``pip show``. (`#13135 `_) - Remove ``experimental`` warning from ``pip index versions`` command. (`#13188 `_) - Add a structured ``--json`` output to ``pip index versions`` (`#13194 `_) - Add a new, *experimental*, ``pip lock`` command, implementing :pep:`751`. (`#13213 `_) - Speed up resolution by first only considering the preference of candidates that must be required to complete the resolution. (`#13253 `_) - Improved heuristics for determining the order of dependency resolution. (`#13273 `_) - Provide hint, documentation, and link to the documentation when resolution too deep error occurs. (`#13282 `_) - Include traceback on failure to import ``setuptools`` when ``setup.py`` is being invoked directly. (`#13290 `_) - Support for :pep:`738` Android wheels. (`#13299 `_) - Display wheel build tag in ``pip list`` columns output if set. (`#5210 `_) - Build environment dependencies are no longer compiled to bytecode during installation for a minor performance improvement. (`#7294 `_) Bug Fixes --------- - When using the ``importlib.metadata`` backend (the default on Python 3.11+), ``pip list`` does not show installed egg distributions more than once anymore. Additionally, egg distributions whose parent directory was in ``sys.path`` but the egg themselves were not in ``sys.path`` are not detected anymore. (`#12308 `_) - Disable Git and SSH prompts when ``--no-input`` is passed. (`#12718 `_) - Gracefully handle Windows registry access errors while guessing the MIME type of a file. (`#12769 `_) - Support multiple global configuration paths returned by ``platformdirs`` on MacOS. (`#12903 `_) - Resolvelib 1.1.0 fixes a known issue where pip would report a ResolutionImpossible error even though there is a valid solution. However, some very complex dependency resolutions that previously resolved may resolve slower or fail with an ResolutionTooDeep error. (`#13001 `_) - Show the correct path to the interpreter also when it's a symlink in a venv in the pip upgrade prompt. (`#13156 `_) - Parse wheel filenames according to `binary distribution format specification `_. When a filename doesn't match the spec a deprecation warning is emitted and the filename is parsed using the old method. (`#13229 `_) - While resolving dependencies prefer if any of the known requirements are "direct", e.g. points to an explicit URL. (`#13244 `_) - When choosing a preferred requirement for resolving dependencies do not consider a specifier with a * in it, e.g. "==1.*", to be a pinned specifier. (`#13252 `_) - Fix a regression that causes dependencies to be checked *before* ``Requires-Python`` project metadata is checked, leading to wasted cycles when the Python version is unsupported. (`#13270 `_) - Don't require the ``wheel`` library to be installed to use ``--no-use-pep517``, any more. (`#13330 `_) - Fix regression that suppressed errors indicating which packages were ignored due to incompatible ``requires-python`` metadata. (`#13333 `_) - Fix fish shell completion when commandline contains multiple commands. (`#9727 `_) Vendored Libraries ------------------ - Upgrade CacheControl to 0.14.2 - Upgrade certifi to 2025.1.31 - Upgrade packaging to 25.0 - Upgrade platformdirs to 4.3.7 - Upgrade pygments to 2.19.1 - Upgrade resolvelib to 1.1.0. - Upgrade rich to 14.0.0 - Vendor tomli-w 1.2.0 - Upgrade truststore to 0.10.1 - Upgrade typing_extensions to 4.13.2 Improved Documentation ---------------------- - Added support for building only the man pages with minimal dependencies using the sphinx-build ``--tag man`` option. This enables distributors to generate man pages without requiring HTML documentation dependencies. (`#13168 `_) 25.0.1 (2025-02-09) =================== Bug Fixes --------- - Fix an unsupported type annotation on Python 3.10 and earlier. (`#13181 `_) - Fix a regression where truststore would never be used while installing build dependencies. (`#13186 `_) 25.0 (2025-01-26) ================= Deprecations and Removals ------------------------- - Deprecate the ``no-python-version-warning`` flag as it has long done nothing since Python 2 support was removed in pip 21.0. (`#13154 `_) Features -------- - Prefer to display :pep:`639` ``License-Expression`` in ``pip show`` if metadata version is at least 2.4. (`#13112 `_) - Support :pep:`639` ``License-Expression`` and ``License-File`` metadata fields in JSON output. ``pip inspect`` and ``pip install --report`` now emit ``license_expression`` and ``license_file`` fields in the ``metadata`` object, if the corresponding fields are present in the installed ``METADATA`` file. (`#13134 `_) - Files in the network cache will inherit the read/write permissions of pip's cache directory (in addition to the current user retaining read/write access). This enables a single cache to be shared among multiple users. (`#11012 `_) - Return the size, along with the number, of files cleared on ``pip cache purge`` and ``pip cache remove`` (`#12176 `_) - Cache ``python-requires`` checks while filtering potential installation candidates. (`#13128 `_) - Optimize package collection by avoiding unnecessary URL parsing and other processing. (`#13132 `_) Bug Fixes --------- - Reorder the encoding detection when decoding a requirements file, relying on UTF-8 over the locale encoding by default, matching the documented behaviour. (`#12771 `_) - The pip version self check is disabled on ``EXTERNALLY-MANAGED`` environments. (`#11820 `_) - Fix a security bug allowing a specially crafted wheel to execute code during installation. (`#13079 `_) - The inclusion of ``packaging`` 24.2 changes how pre-release specifiers with ``<`` and ``>`` behave. Including a pre-release version with these specifiers now implies accepting pre-releases (e.g., ``<2.0dev`` can include ``1.0rc1``). To avoid implying pre-releases, avoid specifying them (e.g., use ``<2.0``). The exception is ``!=``, which never implies pre-releases. (`#13163 `_) - The ``--cert`` and ``--client-cert`` command-line options are now respected while installing build dependencies. Consequently, the private ``_PIP_STANDALONE_CERT`` environment variable is no longer used. (`#5502 `_) - The ``--proxy`` command-line option is now respected while installing build dependencies. (`#6018 `_) Vendored Libraries ------------------ - Upgrade CacheControl to 0.14.1 - Upgrade idna to 3.10 - Upgrade msgpack to 1.1.0 - Upgrade packaging to 24.2 - Upgrade platformdirs to 4.3.6 - Upgrade pyproject-hooks to 1.2.0 - Upgrade rich to 13.9.4 - Upgrade tomli to 2.2.1 Improved Documentation ---------------------- - Removed section about non-existing ``--force-keyring`` flag. (`#12455 `_) Process ------- - Started releasing to PyPI from a GitHub Actions CI/CD workflow that implements trusted publishing and bundles :pep:`740` digital attestations. 24.3.1 (2024-10-27) =================== Bug Fixes --------- - Allow multiple nested inclusions of the same requirements file again. (`#13046 `_) 24.3 (2024-10-27) ================= Deprecations and Removals ------------------------- - Deprecate wheel filenames that are not compliant with :pep:`440`. (`#12918 `_) Features -------- - Detect recursively referencing requirements files and help users identify the source. (`#12653 `_) - Support for :pep:`730` iOS wheels. (`#12961 `_) Bug Fixes --------- - Display a better error message when an already installed package has an invalid requirement. (`#12953 `_) - Ignore ``PIP_TARGET`` and ``pip.conf`` ``global.target`` when preparing a build environment. (`#8438 `_) - Restore support for macOS 10.12 and older (via truststore). (`#12901 `_) - Allow installing pip in editable mode in a virtual environment on Windows. (`#12666 `_) Vendored Libraries ------------------ - Upgrade certifi to 2024.8.30 - Upgrade distlib to 0.3.9 - Upgrade truststore to 0.10.0 - Upgrade urllib3 to 1.26.20 24.2 (2024-07-28) ================= Deprecations and Removals ------------------------- - Deprecate ``pip install --editable`` falling back to ``setup.py develop`` when using a setuptools version that does not support :pep:`660` (setuptools v63 and older). (`#11457 `_) Features -------- - Check unsupported packages for the current platform. (`#11054 `_) - Use system certificates *and* certifi certificates to verify HTTPS connections on Python 3.10+. Python 3.9 and earlier only use certifi. To revert to previous behaviour, pass the flag ``--use-deprecated=legacy-certs``. (`#11647 `_) - Improve discovery performance of installed packages when the ``importlib.metadata`` backend is used to load distribution metadata (used by default under Python 3.11+). (`#12656 `_) - Improve performance when the same requirement string appears many times during resolution, by consistently caching the parsed requirement string. (`#12663 `_) - Minor performance improvement of finding applicable package candidates by not repeatedly calculating their versions (`#12664 `_) - Disable pip's self version check when invoking a pip subprocess to install PEP 517 build requirements. (`#12683 `_) - Improve dependency resolution performance by caching platform compatibility tags during wheel cache lookup. (`#12712 `_) - ``wheel`` is no longer explicitly listed as a build dependency of ``pip``. ``setuptools`` injects this dependency in the ``get_requires_for_build_wheel()`` hook and no longer needs it on newer versions. (`#12728 `_) - Ignore ``--require-virtualenv`` for ``pip check`` and ``pip freeze`` (`#12842 `_) - Improve package download and install performance. Increase chunk sizes when downloading (256 kB, up from 10 kB) and reading files (1 MB, up from 8 kB). This reduces the frequency of updates to pip's progress bar. (`#12810 `_) - Improve pip install performance. Files are now extracted in 1MB blocks, or in one block matching the file size for smaller files. A decompressor is no longer instantiated when extracting 0 bytes files, it is not necessary because there is no data to decompress. (`#12803 `_) Bug Fixes --------- - Set ``no_color`` to global ``rich.Console`` instance. (`#11045 `_) - Fix resolution to respect ``--python-version`` when checking ``Requires-Python``. (`#12216 `_) - Perform hash comparisons in a case-insensitive manner. (`#12680 `_) - Avoid ``dlopen`` failure for glibc detection in musl builds (`#12716 `_) - Avoid keyring logging crashes when pip is run in verbose mode. (`#12751 `_) - Fix finding hardlink targets in tar files with an ignored top-level directory. (`#12781 `_) - Improve pip install performance by only creating required parent directories once, instead of before extracting every file in the wheel. (`#12782 `_) - Improve pip install performance by calculating installed packages printout in linear time instead of quadratic time. (`#12791 `_) Vendored Libraries ------------------ - Remove vendored tenacity. - Update the preload list for the ``DEBUNDLED`` case, to replace ``pep517`` that has been renamed to ``pyproject_hooks``. - Use tomllib from the stdlib if available, rather than tomli - Upgrade certifi to 2024.7.4 - Upgrade platformdirs to 4.2.2 - Upgrade pygments to 2.18.0 - Upgrade setuptools to 70.3.0 - Upgrade typing_extensions to 4.12.2 Improved Documentation ---------------------- - Correct ``—-ignore-conflicts`` (including an em dash) to ``--ignore-conflicts``. (`#12851 `_) 24.1.2 (2024-07-07) =================== Bug Fixes --------- - Fix finding hardlink targets in tar files with an ignored top-level directory. (`#12781 `_) 24.1.1 (2024-06-26) =================== Bug Fixes --------- - Actually use system trust stores when the truststore feature is enabled. Vendored Libraries ------------------ - Upgrade requests to 2.32.3 24.1 (2024-06-20) ================= Vendored Libraries ------------------ - Upgrade truststore to 0.9.1. 24.1b2 (2024-06-12) =================== Features -------- - Report informative messages about invalid requirements. (`#12713 `_) Bug Fixes --------- - Eagerly import the self version check logic to avoid crashes while upgrading or downgrading pip at the same time. (`#12675 `_) - Accommodate for mismatches between different sources of truth for extra names, for packages generated by ``setuptools``. (`#12688 `_) - Accommodate for development versions of CPython ending in ``+`` in the version string. (`#12691 `_) Vendored Libraries ------------------ - Upgrade packaging to 24.1 - Upgrade requests to 2.32.0 - Remove vendored colorama - Remove vendored six - Remove vendored webencodings - Remove vendored charset_normalizer ``requests`` provides optional character detection support on some APIs when processing ambiguous bytes. This isn't relevant for pip to function and we're able to remove it due to recent upstream changes. 24.1b1 (2024-05-06) =================== Deprecations and Removals ------------------------- - Drop support for EOL Python 3.7. (`#11934 `_) - Remove support for legacy versions and dependency specifiers. Packages with non standard-compliant versions or dependency specifiers are now ignored by the resolver. Already installed packages with non standard-compliant versions or dependency specifiers must be uninstalled before upgrading them. (`#12063 `_) Features -------- - Improve performance of resolution of large dependency trees, with more caching. (`#12453 `_) - Further improve resolution performance of large dependency trees, by caching hash calculations. (`#12657 `_) - Reduce startup time of commands (e.g. show, freeze) that do not access the network by 15-30%. (`#4768 `_) - Reword and improve presentation of uninstallation errors. (`#10421 `_) - Add a 'raw' progress_bar type for simple and parsable download progress reports (`#11508 `_) - ``pip list`` no longer performs the pip version check unless ``--outdated`` or ``--uptodate`` is given. (`#11677 `_) - Use the ``data_filter`` when extracting tarballs, if it's available. (`#12111 `_) - Display the Project-URL value under key "Home-page" in ``pip show`` when the Home-Page metadata field is not set. The Project-URL key detection is case-insensitive, and ignores any dashes and underscores. (`#11221 `_) Bug Fixes --------- - Ensure ``-vv`` gets passed to any ``pip install`` build environment subprocesses. (`#12577 `_) - Deduplicate entries in the ``Requires`` field of ``pip show``. (`#12165 `_) - Fix error on checkout for subversion and bazaar with verbose mode on. (`#11050 `_) - Fix exception with completions when COMP_CWORD is not set (`#12401 `_) - Fix intermittent "cannot locate t64.exe" errors when upgrading pip. (`#12666 `_) - Remove duplication in invalid wheel error message (`#12579 `_) - Remove the incorrect pip3.x console entrypoint from the pip wheel. This console script continues to be generated by pip when it installs itself. (`#12536 `_) - Gracefully skip VCS detection in pip freeze when PATH points to a non-directory path. (`#12567 `_) - Make the ``--proxy`` parameter take precedence over environment variables. (`#10685 `_) Vendored Libraries ------------------ - Add charset-normalizer 3.3.2 - Remove chardet - Remove pyparsing - Upgrade CacheControl to 0.14.0 - Upgrade certifi to 2024.2.2 - Upgrade distro to 1.9.0 - Upgrade idna to 3.7 - Upgrade msgpack to 1.0.8 - Upgrade packaging to 24.0 - Upgrade platformdirs to 4.2.1 - Upgrade pygments to 2.17.2 - Upgrade rich to 13.7.1 - Upgrade setuptools to 69.5.1 - Upgrade tenacity to 8.2.3 - Upgrade typing_extensions to 4.11.0 - Upgrade urllib3 to 1.26.18 Improved Documentation ---------------------- - Document UX research done on pip. (`#10745 `_) - Fix the direct usage of zipapp showing up as ``python -m pip.pyz`` rather than ``./pip.pyz`` / ``.\pip.pyz`` (`#12043 `_) - Add a warning explaining that the snippet in "Fallback behavior" is not a valid ``pyproject.toml`` snippet for projects, and link to setuptools documentation instead. (`#12122 `_) - The Python Support Policy has been updated. (`#12529 `_) - Document the environment variables that correspond with CLI options. (`#12576 `_) - Update architecture documentation for command line interface. (`#6831 `_) Process ------- - Remove ``setup.py`` since all the pip project metadata is now declared in ``pyproject.toml``. - Move remaining pip development tools configurations to ``pyproject.toml``. 24.0 (2024-02-03) ================= Features -------- - Retry on HTTP status code 502 (`#11843 `_) - Automatically use the setuptools PEP 517 build backend when ``--config-settings`` is used for projects without ``pyproject.toml``. (`#11915 `_) - Make pip freeze and pip uninstall of legacy editable installs of packages whose name contains ``_`` compatible with ``setuptools>=69.0.3``. (`#12477 `_) - Support per requirement ``--config-settings`` for editable installs. (`#12480 `_) Bug Fixes --------- - Optimized usage of ``--find-links=``, by only scanning the relevant directory once, only considering file names that are valid wheel or sdist names, and only considering files in the directory that are related to the install. (`#12327 `_) - Removed ``wheel`` from the ``[build-system].requires`` list fallback that is used when ``pyproject.toml`` is absent. (`#12449 `_) Vendored Libraries ------------------ - Upgrade distlib to 0.3.8 Improved Documentation ---------------------- - Fix explanation of how PIP_CONFIG_FILE works (`#11815 `_) - Fix outdated pip install argument description in documentation. (`#12417 `_) - Replace some links to PEPs with links to the canonical specifications on the :doc:`pypug:index` (`#12434 `_) - Updated the ``pyproject.toml`` document to stop suggesting to depend on ``wheel`` as a build dependency directly. (`#12449 `_) - Update supported interpreters in development docs (`#12475 `_) Process ------- - Most project metadata is now defined statically via pip's ``pyproject.toml`` file. 23.3.2 (2023-12-17) =================== Bug Fixes --------- - Fix a bug in extras handling for link requirements (`#12372 `_) - Fix mercurial revision "parse error": use ``--rev={ref}`` instead of ``-r={ref}`` (`#12373 `_) 23.3.1 (2023-10-21) =================== Bug Fixes --------- - Handle a timezone indicator of Z when parsing dates in the self check. (`#12338 `_) - Fix bug where installing the same package at the same time with multiple pip processes could fail. (`#12361 `_) 23.3 (2023-10-15) ================= Process ------- - Added reference to `vulnerability reporting guidelines `_ to pip's security policy. Deprecations and Removals ------------------------- - Drop a fallback to using SecureTransport on macOS. It was useful when pip detected OpenSSL older than 1.0.1, but the current pip does not support any Python version supporting such old OpenSSL versions. (`#12175 `_) Features -------- - Improve extras resolution for multiple constraints on same base package. (`#11924 `_) - Improve use of datastructures to make candidate selection 1.6x faster. (`#12204 `_) - Allow ``pip install --dry-run`` to use platform and ABI overriding options. (`#12215 `_) - Add ``is_yanked`` boolean entry to the installation report (``--report``) to indicate whether the requirement was yanked from the index, but was still selected by pip conform to :pep:`592`. (`#12224 `_) Bug Fixes --------- - Ignore errors in temporary directory cleanup (show a warning instead). (`#11394 `_) - Normalize extras according to :pep:`685` from package metadata in the resolver for comparison. This ensures extras are correctly compared and merged as long as the package providing the extra(s) is built with values normalized according to the standard. Note, however, that this *does not* solve cases where the package itself contains unnormalized extra values in the metadata. (`#11649 `_) - Prevent downloading sdists twice when :pep:`658` metadata is present. (`#11847 `_) - Include all requested extras in the install report (``--report``). (`#11924 `_) - Removed uses of ``datetime.datetime.utcnow`` from non-vendored code. (`#12005 `_) - Consistently report whether a dependency comes from an extra. (`#12095 `_) - Fix completion script for zsh (`#12166 `_) - Fix improper handling of the new onexc argument of ``shutil.rmtree()`` in Python 3.12. (`#12187 `_) - Filter out yanked links from the available versions error message: "(from versions: 1.0, 2.0, 3.0)" will not contain yanked versions conform PEP 592. The yanked versions (if any) will be mentioned in a separate error message. (`#12225 `_) - Fix crash when the git version number contains something else than digits and dots. (`#12280 `_) - Use ``-r=...`` instead of ``-r ...`` to specify references with Mercurial. (`#12306 `_) - Redact password from URLs in some additional places. (`#12350 `_) - pip uses less memory when caching large packages. As a result, there is a new on-disk cache format stored in a new directory ($PIP_CACHE_DIR/http-v2). (`#2984 `_) Vendored Libraries ------------------ - Upgrade certifi to 2023.7.22 - Add truststore 0.8.0 - Upgrade urllib3 to 1.26.17 Improved Documentation ---------------------- - Document that ``pip search`` support has been removed from PyPI (`#12059 `_) - Clarify --prefer-binary in CLI and docs (`#12122 `_) - Document that using OS-provided Python can cause pip's test suite to report false failures. (`#12334 `_) 23.2.1 (2023-07-22) =================== Bug Fixes --------- - Disable :pep:`658` metadata fetching with the legacy resolver. (`#12156 `_) 23.2 (2023-07-15) ================= Process ------- - Deprecate support for eggs for Python 3.11 or later, when the new ``importlib.metadata`` backend is used to load distribution metadata. This only affects the egg *distribution format* (with the ``.egg`` extension); distributions using the ``.egg-info`` *metadata format* (but are not actually eggs) are not affected. For more information about eggs, see `relevant section in the setuptools documentation `__. Deprecations and Removals ------------------------- - Deprecate legacy version and version specifiers that don't conform to the :ref:`specification `. (`#12063 `_) - ``freeze`` no longer excludes the ``setuptools``, ``distribute``, and ``wheel`` from the output when running on Python 3.12 or later, where they are not included in a virtual environment by default. Use ``--exclude`` if you wish to exclude any of these packages. (`#4256 `_) Features -------- - make rejection messages slightly different between 1 and 8, so the user can make the difference. (`#12040 `_) Bug Fixes --------- - Fix ``pip completion --zsh``. (`#11417 `_) - Prevent downloading files twice when :pep:`658` metadata is present (`#11847 `_) - Add permission check before configuration (`#11920 `_) - Fix deprecation warnings in Python 3.12 for usage of shutil.rmtree (`#11957 `_) - Ignore invalid or unreadable ``origin.json`` files in the cache of locally built wheels. (`#11985 `_) - Fix installation of packages with :pep:`658` metadata using non-canonicalized names (`#12038 `_) - Correctly parse ``dist-info-metadata`` values from JSON-format index data. (`#12042 `_) - Fail with an error if the ``--python`` option is specified after the subcommand name. (`#12067 `_) - Fix slowness when using ``importlib.metadata`` (the default way for pip to read metadata in Python 3.11+) and there is a large overlap between already installed and to-be-installed packages. (`#12079 `_) - Pass the ``-r`` flag to mercurial to be explicit that a revision is passed and protect against ``hg`` options injection as part of VCS URLs. Users that do not have control on VCS URLs passed to pip are advised to upgrade. (`#12119 `_) Vendored Libraries ------------------ - Upgrade certifi to 2023.5.7 - Upgrade platformdirs to 3.8.1 - Upgrade pygments to 2.15.1 - Upgrade pyparsing to 3.1.0 - Upgrade Requests to 2.31.0 - Upgrade rich to 13.4.2 - Upgrade setuptools to 68.0.0 - Updated typing_extensions to 4.6.0 - Upgrade typing_extensions to 4.7.1 - Upgrade urllib3 to 1.26.16 23.1.2 (2023-04-26) =================== Vendored Libraries ------------------ - Upgrade setuptools to 67.7.2 23.1.1 (2023-04-22) =================== Bug Fixes --------- - Revert `#11487 `_, as it causes issues with virtualenvs created by the Windows Store distribution of Python. (`#11987 `_) Vendored Libraries ------------------ - Revert pkg_resources (via setuptools) back to 65.6.3 Improved Documentation ---------------------- - Update documentation to reflect the new behavior of using the cache of locally built wheels in hash-checking mode. (`#11967 `_) 23.1 (2023-04-15) ================= Deprecations and Removals ------------------------- - Remove support for the deprecated ``--install-options``. (`#11358 `_) - ``--no-binary`` does not imply ``setup.py install`` anymore. Instead a wheel will be built locally and installed. (`#11451 `_) - ``--no-binary`` does not disable the cache of locally built wheels anymore. It only means "don't download wheels". (`#11453 `_) - Deprecate ``--build-option`` and ``--global-option``. Users are invited to switch to ``--config-settings``. (`#11859 `_) - Using ``--config-settings`` with projects that don't have a ``pyproject.toml`` now prints a deprecation warning. In the future the presence of config settings will automatically enable the default build backend for legacy projects and pass the settings to it. (`#11915 `_) - Remove ``setup.py install`` fallback when building a wheel failed for projects without ``pyproject.toml``. (`#8368 `_) - When the ``wheel`` package is not installed, pip now uses the default build backend instead of ``setup.py install`` and ``setup.py develop`` for project without ``pyproject.toml``. (`#8559 `_) Features -------- - Specify egg-link location in assertion message when it does not match installed location to provide better error message for debugging. (`#10476 `_) - Present conflict information during installation after each choice that is rejected (pass ``-vv`` to ``pip install`` to show it) (`#10937 `_) - Display dependency chain on each Collecting/Processing log line. (`#11169 `_) - Support a per-requirement ``--config-settings`` option in requirements files. (`#11325 `_) - The ``--config-settings``/``-C`` option now supports using the same key multiple times. When the same key is specified multiple times, all values are passed to the build backend as a list, as opposed to the previous behavior, where pip would only pass the last value if the same key was used multiple times. (`#11681 `_) - Add ``-C`` as a short version of the ``--config-settings`` option. (`#11786 `_) - Reduce the number of resolver rounds, since backjumping makes the resolver more efficient in finding solutions. This also makes pathological cases fail quicker. (`#11908 `_) - Warn if ``--hash`` is used on a line without requirement in a requirements file. (`#11935 `_) - Stop propagating CLI ``--config-settings`` to the build dependencies. They already did not propagate to requirements provided in requirement files. To pass the same config settings to several requirements, users should provide the requirements as CLI arguments. (`#11941 `_) - Support wheel cache when using ``--require-hashes``. (`#5037 `_) - Add ``--keyring-provider`` flag. See the Authentication page in the documentation for more info. (`#8719 `_) - In the case of virtual environments, configuration files are now also included from the base installation. (`#9752 `_) Bug Fixes --------- - Fix grammar by changing "A new release of pip available:" to "A new release of pip is available:" in the notice used for indicating that. (`#11529 `_) - Normalize paths before checking if installed scripts are on PATH. (`#11719 `_) - Correct the way to decide if keyring is available. (`#11774 `_) - More consistent resolution backtracking by removing legacy hack related to setuptools resolution (`#11837 `_) - Include ``AUTHORS.txt`` in pip's wheels. (`#11882 `_) - The ``uninstall`` and ``install --force-reinstall`` commands no longer call ``normalize_path()`` repeatedly on the same paths. Instead, these results are cached for the duration of an uninstall operation, resulting in improved performance, particularly on Windows. (`#11889 `_) - Fix and improve the parsing of hashes embedded in URL fragments. (`#11936 `_) - When package A depends on package B provided as a direct URL dependency including a hash embedded in the link, the ``--require-hashes`` option did not warn when user supplied hashes were missing for package B. (`#11938 `_) - Correctly report ``requested_extras`` in the installation report when extras are specified for a local directory installation. (`#11946 `_) - When installing an archive from a direct URL or local file, populate ``download_info.info.hashes`` in the installation report, in addition to the legacy ``download_info.info.hash`` key. (`#11948 `_) Vendored Libraries ------------------ - Upgrade msgpack to 1.0.5 - Patch pkg_resources to remove dependency on ``jaraco.text``. - Upgrade platformdirs to 3.2.0 - Upgrade pygments to 2.14.0 - Upgrade resolvelib to 1.0.1 - Upgrade rich to 13.3.3 - Upgrade setuptools to 67.6.1 - Upgrade tenacity to 8.2.2 - Upgrade typing_extensions to 4.5.0 - Upgrade urllib3 to 1.26.15 Improved Documentation ---------------------- - Cross-reference the ``--python`` flag from the ``--prefix`` flag, and mention limitations of ``--prefix`` regarding script installation. (`#11775 `_) - Add SECURITY.md to make the policy official. (`#11809 `_) - Add username to Git over SSH example. (`#11838 `_) - Quote extras in the pip install docs to guard shells with default glob qualifiers, like zsh. (`#11842 `_) - Make it clear that requirements/constraints file can be a URL (`#11954 `_) 23.0.1 (2023-02-17) =================== Features -------- - Ignore PIP_REQUIRE_VIRTUALENV for ``pip index`` (`#11671 `_) - Implement ``--break-system-packages`` to permit installing packages into ``EXTERNALLY-MANAGED`` Python installations. (`#11780 `_) Bug Fixes --------- - Improve handling of isolated build environments on platforms that customize the Python's installation schemes, such as Debian and Homebrew. (`#11740 `_) - Do not crash in presence of misformatted hash field in ``direct_url.json``. (`#11773 `_) 23.0 (2023-01-30) ================= Features -------- - Change the hashes in the installation report to be a mapping. Emit the ``archive_info.hashes`` dictionary in ``direct_url.json``. (`#11312 `_) - Implement logic to read the ``EXTERNALLY-MANAGED`` file as specified in :pep:`668`. This allows a downstream Python distributor to prevent users from using pip to modify the externally managed environment. (`#11381 `_) - Enable the use of ``keyring`` found on ``PATH``. This allows ``keyring`` installed using ``pipx`` to be used by ``pip``. (`#11589 `_) - The inspect and installation report formats are now declared stable, and their version has been bumped from ``0`` to ``1``. (`#11757 `_) Bug Fixes --------- - Wheel cache behavior is restored to match previous versions, allowing the cache to find existing entries. (`#11527 `_) - Use the "venv" scheme if available to obtain prefixed lib paths. (`#11598 `_) - Deprecated a historical ambiguity in how ``egg`` fragments in URL-style requirements are formatted and handled. ``egg`` fragments that do not look like :pep:`508` names now produce a deprecation warning. (`#11617 `_) - Fix scripts path in isolated build environment on Debian. (`#11623 `_) - Make ``pip show`` show the editable location if package is editable (`#11638 `_) - Stop checking that ``wheel`` is present when ``build-system.requires`` is provided without ``build-system.build-backend`` as ``setuptools`` (which we still check for) will inject it anyway. (`#11673 `_) - Fix an issue when an already existing in-memory distribution would cause exceptions in ``pip install`` (`#11704 `_) Vendored Libraries ------------------ - Upgrade certifi to 2022.12.7 - Upgrade chardet to 5.1.0 - Upgrade colorama to 0.4.6 - Upgrade distro to 1.8.0 - Remove pep517 from vendored packages - Upgrade platformdirs to 2.6.2 - Add pyproject-hooks 1.0.0 - Upgrade requests to 2.28.2 - Upgrade rich to 12.6.0 - Upgrade urllib3 to 1.26.14 Improved Documentation ---------------------- - Fixed the description of the option "--install-options" in the documentation (`#10265 `_) - Remove mention that editable installs are necessary for pip freeze to report the VCS URL. (`#11675 `_) - Clarify that the egg URL fragment is only necessary for editable VCS installs, and otherwise not necessary anymore. (`#11676 `_) 22.3.1 (2022-11-05) =================== Bug Fixes --------- - Fix entry point generation of ``pip.X``, ``pipX.Y``, and ``easy_install-X.Y`` to correctly account for multi-digit Python version segments (e.g. the "11" part of 3.11). (`#11547 `_) 22.3 (2022-10-15) ================= Deprecations and Removals ------------------------- - Deprecate ``--install-options`` which forces pip to use the deprecated ``install`` command of ``setuptools``. (`#11358 `_) - Deprecate installation with 'setup.py install' when no-binary is enabled for source distributions without 'pyproject.toml'. (`#11452 `_) - Deprecate ```--no-binary`` disabling the wheel cache. (`#11454 `_) - Remove ``--use-feature=2020-resolver`` opt-in flag. This was supposed to be removed in 21.0, but missed during that release cycle. (`#11493 `_) - Deprecate installation with 'setup.py install' when the 'wheel' package is absent for source distributions without 'pyproject.toml'. (`#8559 `_) - Remove the ability to use ``pip list --outdated`` in combination with ``--format=freeze``. (`#9789 `_) Features -------- - Use ``shell=True`` for opening the editor with ``pip config edit``. (`#10716 `_) - Use the ``data-dist-info-metadata`` attribute from :pep:`658` to resolve distribution metadata without downloading the dist yet. (`#11111 `_) - Add an option to run the test suite with pip built as a zipapp. (`#11250 `_) - Add a ``--python`` option to allow pip to manage Python environments other than the one pip is installed in. (`#11320 `_) - Document the new (experimental) zipapp distribution of pip. (`#11459 `_) - Use the much faster 'bzr co --lightweight' to obtain a copy of a Bazaar tree. (`#5444 `_) Bug Fixes --------- - Fix ``--no-index`` when ``--index-url`` or ``--extra-index-url`` is specified inside a requirements file. (`#11276 `_) - Ensure that the candidate ``pip`` executable exists, when checking for a new version of pip. (`#11309 `_) - Ignore distributions with invalid ``Name`` in metadata instead of crashing, when using the ``importlib.metadata`` backend. (`#11352 `_) - Raise RequirementsFileParseError when parsing malformed requirements options that can't be successfully parsed by shlex. (`#11491 `_) - Fix build environment isolation on some system Pythons. (`#6264 `_) Vendored Libraries ------------------ - Upgrade certifi to 2022.9.24 - Upgrade distlib to 0.3.6 - Upgrade idna to 3.4 - Upgrade pep517 to 0.13.0 - Upgrade pygments to 2.13.0 - Upgrade tenacity to 8.1.0 - Upgrade typing_extensions to 4.4.0 - Upgrade urllib3 to 1.26.12 Improved Documentation ---------------------- - Mention that --quiet must be used when writing the installation report to stdout. (`#11357 `_) 22.2.2 (2022-08-03) =================== Bug Fixes --------- - Avoid ``AttributeError`` when removing the setuptools-provided ``_distutils_hack`` and it is missing its implementation. (`#11314 `_) - Fix import error when reinstalling pip in user site. (`#11319 `_) - Show pip deprecation warnings by default. (`#11330 `_) 22.2.1 (2022-07-27) =================== Bug Fixes --------- - Send the pip upgrade prompt to stderr. (`#11282 `_) - Ensure that things work correctly in environments where setuptools-injected ``distutils`` is available by default. This is done by cooperating with setuptools' injection logic to ensure that pip uses the ``distutils`` from the Python standard library instead. (`#11298 `_) - Clarify that ``pip cache``'s wheels-related output is about locally built wheels only. (`#11300 `_) 22.2 (2022-07-21) ================= Deprecations and Removals ------------------------- - Remove the ``html5lib`` deprecated feature flag. (`#10825 `_) - Remove ``--use-deprecated=backtrack-on-build-failures``. (`#11241 `_) Features -------- - Add support to use `truststore `_ as an alternative SSL certificate verification backend. The backend can be enabled on Python 3.10 and later by installing ``truststore`` into the environment, and adding the ``--use-feature=truststore`` flag to various pip commands. ``truststore`` differs from the current default verification backend (provided by ``certifi``) in it uses the operating system’s trust store, which can be better controlled and augmented to better support non-standard certificates. Depending on feedback, pip may switch to this as the default certificate verification backend in the future. (`#11082 `_) - Add ``--dry-run`` option to ``pip install``, to let it print what it would install but not actually change anything in the target environment. (`#11096 `_) - Record in wheel cache entries the URL of the original artifact that was downloaded to build the cached wheels. The record is named ``origin.json`` and uses the PEP 610 Direct URL format. (`#11137 `_) - Support `PEP 691 `_. (`#11158 `_) - pip's deprecation warnings now subclass the built-in ``DeprecationWarning``, and can be suppressed by running the Python interpreter with ``-W ignore::DeprecationWarning``. (`#11225 `_) - Add ``pip inspect`` command to obtain the list of installed distributions and other information about the Python environment, in JSON format. (`#11245 `_) - Significantly speed up isolated environment creation, by using the same sources for pip instead of creating a standalone installation for each environment. (`#11257 `_) - Add an experimental ``--report`` option to the install command to generate a JSON report of what was installed. In combination with ``--dry-run`` and ``--ignore-installed`` it can be used to resolve the requirements. (`#53 `_) Bug Fixes --------- - Fix ``pip install --pre`` for packages with pre-release build dependencies defined both in ``pyproject.toml``'s ``build-system.requires`` and ``setup.py``'s ``setup_requires``. (`#10222 `_) - When pip rewrites the shebang line in a script during wheel installation, update the hash and size in the corresponding ``RECORD`` file entry. (`#10744 `_) - Do not consider a ``.dist-info`` directory found inside a wheel-like zip file as metadata for an installed distribution. A package in a wheel is (by definition) not installed, and is not guaranteed to work due to how a wheel is structured. (`#11217 `_) - Use ``importlib.resources`` to read the ``vendor.txt`` file in ``pip debug``. This makes the command safe for use from a zipapp. (`#11248 `_) - Make the ``--use-pep517`` option of the ``download`` command apply not just to the requirements specified on the command line, but to their dependencies, as well. (`#9523 `_) Process ------- - Remove reliance on the stdlib cgi module, which is deprecated in Python 3.11. Vendored Libraries ------------------ - Remove html5lib. - Upgrade certifi to 2022.6.15 - Upgrade chardet to 5.0.0 - Upgrade colorama to 0.4.5 - Upgrade distlib to 0.3.5 - Upgrade msgpack to 1.0.4 - Upgrade pygments to 2.12.0 - Upgrade pyparsing to 3.0.9 - Upgrade requests to 2.28.1 - Upgrade rich to 12.5.1 - Upgrade typing_extensions to 4.3.0 - Upgrade urllib3 to 1.26.10 22.1.2 (2022-05-31) =================== Bug Fixes --------- - Revert `#10979 `_ since it introduced a regression in certain edge cases. (`#10979 `_) - Fix an incorrect assertion in the logging logic, that prevented the upgrade prompt from being presented. (`#11136 `_) 22.1.1 (2022-05-20) =================== Bug Fixes --------- - Properly filter out optional dependencies (i.e. extras) when checking build environment distributions. (`#11112 `_) - Change the build environment dependency checking to be opt-in. (`#11116 `_) - Allow using a pre-release version to satisfy a build requirement. This helps manually populated build environments to more accurately detect build-time requirement conflicts. (`#11123 `_) 22.1 (2022-05-11) ================= Process ------- - Enable the ``importlib.metadata`` metadata implementation by default on Python 3.11 (or later). The environment variable ``_PIP_USE_IMPORTLIB_METADATA`` can still be used to enable the implementation on 3.10 and earlier, or disable it on 3.11 (by setting it to ``0`` or ``false``). Bug Fixes --------- - Revert `#9243 `_ since it introduced a regression in certain edge cases. (`#10962 `_) - Fix missing ``REQUESTED`` metadata when using URL constraints. (`#11079 `_) - ``pip config`` now normalizes names by converting underscores into dashes. (`#9330 `_) 22.1b1 (2022-04-30) =================== Process ------- - Start migration of distribution metadata implementation from ``pkg_resources`` to ``importlib.metadata``. The new implementation is currently not exposed in any user-facing way, but included in the code base for easier development. Deprecations and Removals ------------------------- - Drop ``--use-deprecated=out-of-tree-build``, according to deprecation message. (`#11001 `_) Features -------- - Add option to install and uninstall commands to opt-out from running-as-root warning. (`#10556 `_) - Include Project-URLs in ``pip show`` output. (`#10799 `_) - Improve error message when ``pip config edit`` is provided an editor that doesn't exist. (`#10812 `_) - Add a user interface for supplying config settings to build backends. (`#11059 `_) - Add support for Powershell autocompletion. (`#9024 `_) - Explains why specified version cannot be retrieved when *Requires-Python* is not satisfied. (`#9615 `_) - Validate build dependencies when using ``--no-build-isolation``. (`#9794 `_) Bug Fixes --------- - Fix conditional checks to prevent ``pip.exe`` from trying to modify itself, on Windows. (`#10560 `_) - Fix uninstall editable from Windows junction link. (`#10696 `_) - Fallback to pyproject.toml-based builds if ``setup.py`` is present in a project, but ``setuptools`` cannot be imported. (`#10717 `_) - When checking for conflicts in the build environment, correctly skip requirements containing markers that do not match the current environment. (`#10883 `_) - Disable brotli import in vendored urllib3 so brotli could be uninstalled/upgraded by pip. (`#10950 `_) - Prioritize URL credentials over netrc. (`#10979 `_) - Filter available distributions using hash declarations from constraints files. (`#9243 `_) - Fix an error when trying to uninstall packages installed as editable from a network drive. (`#9452 `_) - Fix pip install issues using a proxy due to an inconsistency in how Requests is currently handling variable precedence in session. (`#9691 `_) Vendored Libraries ------------------ - Upgrade CacheControl to 0.12.11 - Upgrade distro to 1.7.0 - Upgrade platformdirs to 2.5.2 - Remove ``progress`` from vendored dependencies. - Upgrade ``pyparsing`` to 3.0.8 for startup performance improvements. - Upgrade rich to 12.2.0 - Upgrade tomli to 2.0.1 - Upgrade typing_extensions to 4.2.0 Improved Documentation ---------------------- - Add more dedicated topic and reference pages to the documentation. (`#10899 `_) - Capitalise Y as the default for "Proceed (y/n)?" when uninstalling. (`#10936 `_) - Add ``scheme://`` requirement to ``--proxy`` option's description (`#10951 `_) - The wheel command now references the build interface section instead of stating the legacy setuptools behavior as the default. (`#10972 `_) - Improved usefulness of ``pip config --help`` output. (`#11074 `_) 22.0.4 (2022-03-06) =================== Deprecations and Removals ------------------------- - Drop the doctype check, that presented a warning for index pages that use non-compliant HTML 5. (`#10903 `_) Vendored Libraries ------------------ - Downgrade distlib to 0.3.3. 22.0.3 (2022-02-03) =================== Features -------- - Print the exception via ``rich.traceback``, when running with ``--debug``. (`#10791 `_) Bug Fixes --------- - Only calculate topological installation order, for packages that are going to be installed/upgraded. This fixes an `AssertionError` that occurred when determining installation order, for a very specific combination of upgrading-already-installed-package + change of dependencies + fetching some packages from a package index. This combination was especially common in Read the Docs' builds. (`#10851 `_) - Use ``html.parser`` by default, instead of falling back to ``html5lib`` when ``--use-deprecated=html5lib`` is not passed. (`#10869 `_) Improved Documentation ---------------------- - Clarify that using per-requirement overrides disables the usage of wheels. (`#9674 `_) 22.0.2 (2022-01-30) =================== Deprecations and Removals ------------------------- - Instead of failing on index pages that use non-compliant HTML 5, print a deprecation warning and fall back to ``html5lib``-based parsing for now. This simplifies the migration for non-compliant index pages, by letting such indexes function with a warning. (`#10847 `_) 22.0.1 (2022-01-30) =================== Bug Fixes --------- - Accept lowercase ```` on index pages. (`#10844 `_) - Properly handle links parsed by html5lib, when using ``--use-deprecated=html5lib``. (`#10846 `_) 22.0 (2022-01-29) ================= Process ------- - Completely replace :pypi:`tox` in our development workflow, with :pypi:`nox`. Deprecations and Removals ------------------------- - Deprecate alternative progress bar styles, leaving only ``on`` and ``off`` as available choices. (`#10462 `_) - Drop support for Python 3.6. (`#10641 `_) - Disable location mismatch warnings on Python versions prior to 3.10. These warnings were helping identify potential issues as part of the sysconfig -> distutils transition, and we no longer need to rely on reports from older Python versions for information on the transition. (`#10840 `_) Features -------- - Changed ``PackageFinder`` to parse HTML documents using the stdlib :class:`html.parser.HTMLParser` class instead of the ``html5lib`` package. For now, the deprecated ``html5lib`` code remains and can be used with the ``--use-deprecated=html5lib`` command line option. However, it will be removed in a future pip release. (`#10291 `_) - Utilise ``rich`` for presenting pip's default download progress bar. (`#10462 `_) - Present a better error message when an invalid wheel file is encountered, providing more context where the invalid wheel file is. (`#10535 `_) - Documents the ``--require-virtualenv`` flag for ``pip install``. (`#10588 `_) - ``pip install `` autocompletes paths. (`#10646 `_) - Allow Python distributors to opt-out from or opt-in to the ``sysconfig`` installation scheme backend by setting ``sysconfig._PIP_USE_SYSCONFIG`` to ``True`` or ``False``. (`#10647 `_) - Make it possible to deselect tests requiring cryptography package on systems where it cannot be installed. (`#10686 `_) - Start using Rich for presenting error messages in a consistent format. (`#10703 `_) - Improve presentation of errors from subprocesses. (`#10705 `_) - Forward pip's verbosity configuration to VCS tools to control their output accordingly. (`#8819 `_) Bug Fixes --------- - Optimize installation order calculation to improve performance when installing requirements that form a complex dependency graph with a large amount of edges. (`#10557 `_) - When a package is requested by the user for upgrade, correctly identify that the extra-ed variant of that same package depended by another user-requested package is requesting the same package, and upgrade it accordingly. (`#10613 `_) - Prevent pip from installing yanked releases unless explicitly pinned via the ``==`` or ``===`` operators. (`#10617 `_) - Stop backtracking on build failures, by instead surfacing them to the user and aborting immediately. This behaviour provides more immediate feedback when a package cannot be built due to missing build dependencies or platform incompatibility. (`#10655 `_) - Silence ``Value for does not match`` warning caused by an erroneous patch in Slackware-distributed Python 3.9. (`#10668 `_) - Fix an issue where pip did not consider dependencies with and without extras to be equal (`#9644 `_) Vendored Libraries ------------------ - Upgrade CacheControl to 0.12.10 - Upgrade certifi to 2021.10.8 - Upgrade distlib to 0.3.4 - Upgrade idna to 3.3 - Upgrade msgpack to 1.0.3 - Upgrade packaging to 21.3 - Upgrade platformdirs to 2.4.1 - Add pygments 2.11.2 as a vendored dependency. - Tree-trim unused portions of vendored pygments, to reduce the distribution size. - Upgrade pyparsing to 3.0.7 - Upgrade Requests to 2.27.1 - Upgrade resolvelib to 0.8.1 - Add rich 11.0.0 as a vendored dependency. - Tree-trim unused portions of vendored rich, to reduce the distribution size. - Add typing_extensions 4.0.1 as a vendored dependency. - Upgrade urllib3 to 1.26.8 21.3.1 (2021-10-22) =================== Bug Fixes --------- - Always refuse installing or building projects that have no ``pyproject.toml`` nor ``setup.py``. (`#10531 `_) - Tweak running-as-root detection, to check ``os.getuid`` if it exists, on Unix-y and non-Linux/non-MacOS machines. (`#10565 `_) - When installing projects with a ``pyproject.toml`` in editable mode, and the build backend does not support :pep:`660`, prepare metadata using ``prepare_metadata_for_build_wheel`` instead of ``setup.py egg_info``. Also, refuse installing projects that only have a ``setup.cfg`` and no ``setup.py`` nor ``pyproject.toml``. These restore the pre-21.3 behaviour. (`#10573 `_) - Restore compatibility of where configuration files are loaded from on MacOS (back to ``Library/Application Support/pip``, instead of ``Preferences/pip``). (`#10585 `_) Vendored Libraries ------------------ - Upgrade pep517 to 0.12.0 21.3 (2021-10-11) ================= Deprecations and Removals ------------------------- - Improve deprecation warning regarding the copying of source trees when installing from a local directory. (`#10128 `_) - Suppress location mismatch warnings when pip is invoked from a Python source tree, so ``ensurepip`` does not emit warnings on CPython ``make install``. (`#10270 `_) - On Python 3.10 or later, the installation scheme backend has been changed to use ``sysconfig``. This is to anticipate the deprecation of ``distutils`` in Python 3.10, and its scheduled removal in 3.12. For compatibility considerations, pip installations running on Python 3.9 or lower will continue to use ``distutils``. (`#10358 `_) - Remove the ``--build-dir`` option and aliases, one last time. (`#10485 `_) - In-tree builds are now the default. ``--use-feature=in-tree-build`` is now ignored. ``--use-deprecated=out-of-tree-build`` may be used temporarily to ease the transition. (`#10495 `_) - Un-deprecate source distribution re-installation behaviour. (`#8711 `_) Features -------- - Replace vendored appdirs with platformdirs. (`#10202 `_) - Support `PEP 610 `_ to detect editable installs in ``pip freeze`` and ``pip list``. The ``pip list`` column output has a new ``Editable project location`` column, and the JSON output has a new ``editable_project_location`` field. (`#10249 `_) - ``pip freeze`` will now always fallback to reporting the editable project location when it encounters a VCS error while analyzing an editable requirement. Before, it sometimes reported the requirement as non-editable. (`#10410 `_) - ``pip show`` now sorts ``Requires`` and ``Required-By`` alphabetically. (`#10422 `_) - Do not raise error when there are no files to remove with ``pip cache purge/remove``. Instead log a warning and continue (to log that we removed 0 files). (`#10459 `_) - When backtracking during dependency resolution, prefer the dependencies which are involved in the most recent conflict. This can significantly reduce the amount of backtracking required. (`#10479 `_) - Cache requirement objects, to improve performance reducing reparses of requirement strings. (`#10550 `_) - Support editable installs for projects that have a ``pyproject.toml`` and use a build backend that supports :pep:`660`. (`#8212 `_) - When a revision is specified in a Git URL, use git's partial clone feature to speed up source retrieval. (`#9086 `_) - Add a ``--debug`` flag, to enable a mode that doesn't log errors and propagates them to the top level instead. This is primarily to aid with debugging pip's crashes. (`#9349 `_) - If a host is explicitly specified as trusted by the user (via the --trusted-host option), cache HTTP responses from it in addition to HTTPS ones. (`#9498 `_) Bug Fixes --------- - Present a better error message, when a ``file:`` URL is not found. (`#10263 `_) - Fix the auth credential cache to allow for the case in which the index url contains the username, but the password comes from an external source, such as keyring. (`#10269 `_) - Fix double unescape of HTML ``data-requires-python`` and ``data-yanked`` attributes. (`#10378 `_) - New resolver: Fixes depth ordering of packages during resolution, e.g. a dependency 2 levels deep will be ordered before a dependency 3 levels deep. (`#10482 `_) - Correctly indent metadata preparation messages in pip output. (`#10524 `_) Vendored Libraries ------------------ - Remove appdirs as a vendored dependency. - Upgrade distlib to 0.3.3 - Upgrade distro to 1.6.0 - Patch pkg_resources to use platformdirs rather than appdirs. - Add platformdirs as a vendored dependency. - Upgrade progress to 1.6 - Upgrade resolvelib to 0.8.0 - Upgrade urllib3 to 1.26.7 Improved Documentation ---------------------- - Update links of setuptools as setuptools moved these documents. The Simple Repository link now points to PyPUG as that is the canonical place of packaging specification, and setuptools's ``easy_install`` is deprecated. (`#10430 `_) - Create a "Build System Interface" reference section, for documenting how pip interacts with build systems. (`#10497 `_) 21.2.4 (2021-08-12) =================== Bug Fixes --------- - Fix 3.6.0 compatibility in link comparison logic. (`#10280 `_) 21.2.3 (2021-08-06) =================== Bug Fixes --------- - Modify the ``sysconfig.get_preferred_scheme`` function check to be compatible with CPython 3.10’s alphareleases. (`#10252 `_) 21.2.2 (2021-07-31) =================== Bug Fixes --------- - New resolver: When a package is specified with extras in constraints, and with extras in non-constraint requirements, the resolver now correctly identifies the constraint's existence and avoids backtracking. (`#10233 `_) 21.2.1 (2021-07-25) =================== Process ------- - The source distribution re-installation feature removal has been delayed to 21.3. 21.2 (2021-07-24) ================= Process ------- - ``pip freeze``, ``pip list``, and ``pip show`` no longer normalize underscore (``_``) in distribution names to dash (``-``). This is a side effect of the migration to ``importlib.metadata``, since the underscore-dash normalization behavior is non-standard and specific to setuptools. This should not affect other parts of pip (for example, when feeding the ``pip freeze`` result back into ``pip install``) since pip internally performs standard PEP 503 normalization independently to setuptools. Deprecations and Removals ------------------------- - Git version parsing is now done with regular expression to prepare for the pending upstream removal of non-PEP-440 version parsing logic. (`#10117 `_) - Re-enable the "Value for ... does not match" location warnings to field a new round of feedback for the ``distutils``-``sysconfig`` transition. (`#10151 `_) - Remove deprecated ``--find-links`` option in ``pip freeze`` (`#9069 `_) Features -------- - New resolver: Loosen URL comparison logic when checking for direct URL reference equivalency. The logic includes the following notable characteristics: * The authentication part of the URL is explicitly ignored. * Most of the fragment part, including ``egg=``, is explicitly ignored. Only ``subdirectory=`` and hash values (e.g. ``sha256=``) are kept. * The query part of the URL is parsed to allow ordering differences. (`#10002 `_) - Support TOML v1.0.0 syntax in ``pyproject.toml``. (`#10034 `_) - Added a warning message for errors caused due to Long Paths being disabled on Windows. (`#10045 `_) - Change the encoding of log file from default text encoding to UTF-8. (`#10071 `_) - Log the resolved commit SHA when installing a package from a Git repository. (`#10149 `_) - Add a warning when passing an invalid requirement to ``pip uninstall``. (`#4958 `_) - Add new subcommand ``pip index`` used to interact with indexes, and implement ``pip index version`` to list available versions of a package. (`#7975 `_) - When pip is asked to uninstall a project without the dist-info/RECORD file it will no longer traceback with FileNotFoundError, but it will provide a better error message instead, such as:: ERROR: Cannot uninstall foobar 0.1, RECORD file not found. You might be able to recover from this via: 'pip install --force-reinstall --no-deps foobar==0.1'. When dist-info/INSTALLER is present and contains some useful information, the info is included in the error message instead:: ERROR: Cannot uninstall foobar 0.1, RECORD file not found. Hint: The package was installed by rpm. (`#8954 `_) - Add an additional level of verbosity. ``--verbose`` (and the shorthand ``-v``) now contains significantly less output, and users that need complete full debug-level output should pass it twice (``--verbose --verbose`` or ``-vv``). (`#9450 `_) - New resolver: The order of dependencies resolution has been tweaked to traverse the dependency graph in a more breadth-first approach. (`#9455 `_) - Make "yes" the default choice in ``pip uninstall``'s prompt. (`#9686 `_) - Add a special error message when users forget the ``-r`` flag when installing. (`#9915 `_) - New resolver: A distribution's ``Requires-Python`` metadata is now checked before its Python dependencies. This makes the resolver fail quicker when there's an interpreter version conflict. (`#9925 `_) - Suppress "not on PATH" warning when ``--prefix`` is given. (`#9931 `_) - Include ``rustc`` version in pip's ``User-Agent``, when the system has ``rustc``. (`#9987 `_) Bug Fixes --------- - Update vendored six to 1.16.0 and urllib3 to 1.26.5 (`#10043 `_) - Correctly allow PEP 517 projects to be detected without warnings in ``pip freeze``. (`#10080 `_) - Strip leading slash from a ``file://`` URL built from an path with the Windows drive notation. This fixes bugs where the ``file://`` URL cannot be correctly used as requirement, constraint, or index URLs on Windows. (`#10115 `_) - New resolver: URL comparison logic now treats ``file://localhost/`` and ``file:///`` as equivalent to conform to RFC 8089. (`#10162 `_) - Prefer credentials from the URL over the previously-obtained credentials from URLs of the same domain, so it is possible to use different credentials on the same index server for different ``--extra-index-url`` options. (`#3931 `_) - Fix extraction of files with utf-8 encoded paths from tars. (`#7667 `_) - Skip distutils configuration parsing on encoding errors. (`#8931 `_) - New resolver: Detect an unnamed requirement is user-specified (by building its metadata for the project name) so it can be correctly ordered in the resolver. (`#9204 `_) - Fix :ref:`pip freeze` to output packages :ref:`installed from git ` in the correct ``git+protocol://git.example.com/MyProject#egg=MyProject`` format rather than the old and no longer supported ``git+git@`` format. (`#9822 `_) - Fix warnings about install scheme selection for Python framework builds distributed by Apple's Command Line Tools. (`#9844 `_) - Relax interpreter detection to quelch a location mismatch warning where PyPy is deliberately breaking backwards compatibility. (`#9845 `_) Vendored Libraries ------------------ - Upgrade certifi to 2021.05.30. - Upgrade idna to 3.2. - Upgrade packaging to 21.0 - Upgrade requests to 2.26.0. - Upgrade resolvelib to 0.7.1. - Upgrade urllib3 to 1.26.6. 21.1.3 (2021-06-26) =================== Bug Fixes --------- - Remove unused optional ``tornado`` import in vendored ``tenacity`` to prevent old versions of Tornado from breaking pip. (`#10020 `_) - Require ``setup.cfg``-only projects to be built via PEP 517, by requiring an explicit dependency on setuptools declared in pyproject.toml. (`#10031 `_) 21.1.2 (2021-05-23) =================== Bug Fixes --------- - New resolver: Correctly exclude an already installed package if its version is known to be incompatible to stop the dependency resolution process with a clear error message. (`#9841 `_) - Allow ZIP to archive files with timestamps earlier than 1980. (`#9910 `_) - Emit clearer error message when a project root does not contain either ``pyproject.toml``, ``setup.py`` or ``setup.cfg``. (`#9944 `_) - Fix detection of existing standalone pip instance for PEP 517 builds. (`#9953 `_) 21.1.1 (2021-04-30) =================== Deprecations and Removals ------------------------- - Temporarily set the new "Value for ... does not match" location warnings level to *DEBUG*, to hide them from casual users. This prepares pip 21.1 for CPython inclusion, while pip maintainers digest the first intake of location mismatch issues for the ``distutils``-``sysconfig`` transition. (`#9912 `_) Bug Fixes --------- - This change fixes a bug on Python <=3.6.1 with a Typing feature added in 3.6.2 (`#9831 `_) - Fix compatibility between distutils and sysconfig when the project name is unknown outside of a virtual environment. (`#9838 `_) - Fix Python 3.6 compatibility when a PEP 517 build requirement itself needs to be built in an isolated environment. (`#9878 `_) 21.1 (2021-04-24) ================= Process ------- - Start installation scheme migration from ``distutils`` to ``sysconfig``. A warning is implemented to detect differences between the two implementations to encourage user reports, so we can avoid breakages before they happen. Features -------- - Add the ability for the new resolver to process URL constraints. (`#8253 `_) - Add a feature ``--use-feature=in-tree-build`` to build local projects in-place when installing. This is expected to become the default behavior in pip 21.3; see `Installing from local packages `_ for more information. (`#9091 `_) - Bring back the "(from versions: ...)" message, that was shown on resolution failures. (`#9139 `_) - Add support for editable installs for project with only setup.cfg files. (`#9547 `_) - Improve performance when picking the best file from indexes during ``pip install``. (`#9748 `_) - Warn instead of erroring out when doing a PEP 517 build in presence of ``--build-option``. Warn when doing a PEP 517 build in presence of ``--global-option``. (`#9774 `_) Bug Fixes --------- - Fixed ``--target`` to work with ``--editable`` installs. (`#4390 `_) - Add a warning, discouraging the usage of pip as root, outside a virtual environment. (`#6409 `_) - Ignore ``.dist-info`` directories if the stem is not a valid Python distribution name, so they don't show up in e.g. ``pip freeze``. (`#7269 `_) - Only query the keyring for URLs that actually trigger error 401. This prevents an unnecessary keyring unlock prompt on every pip install invocation (even with default index URL which is not password protected). (`#8090 `_) - Prevent packages already-installed alongside with pip to be injected into an isolated build environment during build-time dependency population. (`#8214 `_) - Fix ``pip freeze`` permission denied error in order to display an understandable error message and offer solutions. (`#8418 `_) - Correctly uninstall script files (from setuptools' ``scripts`` argument), when installed with ``--user``. (`#8733 `_) - New resolver: When a requirement is requested both via a direct URL (``req @ URL``) and via version specifier with extras (``req[extra]``), the resolver will now be able to use the URL to correctly resolve the requirement with extras. (`#8785 `_) - New resolver: Show relevant entries from user-supplied constraint files in the error message to improve debuggability. (`#9300 `_) - Avoid parsing version to make the version check more robust against lousily debundled downstream distributions. (`#9348 `_) - ``--user`` is no longer suggested incorrectly when pip fails with a permission error in a virtual environment. (`#9409 `_) - Fix incorrect reporting on ``Requires-Python`` conflicts. (`#9541 `_) - Make wheel compatibility tag preferences more important than the build tag (`#9565 `_) - Fix pip to work with warnings converted to errors. (`#9779 `_) - **SECURITY**: Stop splitting on unicode separators in git references, which could be maliciously used to install a different revision on the repository. (`#9827 `_) Vendored Libraries ------------------ - Update urllib3 to 1.26.4 to fix CVE-2021-28363 - Remove contextlib2. - Upgrade idna to 3.1 - Upgrade pep517 to 0.10.0 - Upgrade vendored resolvelib to 0.7.0. - Upgrade tenacity to 7.0.0 Improved Documentation ---------------------- - Update "setuptools extras" link to match upstream. (`#4822829F-6A45-4202-87BA-A80482DF6D4E `_) - Improve SSL Certificate Verification docs and ``--cert`` help text. (`#6720 `_) - Add a section in the documentation to suggest solutions to the ``pip freeze`` permission denied issue. (`#8418 `_) - Add warning about ``--extra-index-url`` and dependency confusion (`#9647 `_) - Describe ``--upgrade-strategy`` and direct requirements explicitly; add a brief example. (`#9692 `_) 21.0.1 (2021-01-30) =================== Bug Fixes --------- - commands: debug: Use packaging.version.parse to compare between versions. (`#9461 `_) - New resolver: Download and prepare a distribution only at the last possible moment to avoid unnecessary network access when the same version is already installed locally. (`#9516 `_) Vendored Libraries ------------------ - Upgrade packaging to 20.9 21.0 (2021-01-23) ================= Deprecations and Removals ------------------------- - Drop support for Python 2. (`#6148 `_) - Remove support for legacy wheel cache entries that were created with pip versions older than 20.0. (`#7502 `_) - Remove support for VCS pseudo URLs editable requirements. It was emitting deprecation warning since version 20.0. (`#7554 `_) - Modernise the codebase after Python 2. (`#8802 `_) - Drop support for Python 3.5. (`#9189 `_) - Remove the VCS export feature that was used only with editable VCS requirements and had correctness issues. (`#9338 `_) Features -------- - Add ``--ignore-requires-python`` support to pip download. (`#1884 `_) - New resolver: Error message shown when a wheel contains inconsistent metadata is made more helpful by including both values from the file name and internal metadata. (`#9186 `_) Bug Fixes --------- - Fix a regression that made ``pip wheel`` do a VCS export instead of a VCS clone for editable requirements. This broke VCS requirements that need the VCS information to build correctly. (`#9273 `_) - Fix ``pip download`` of editable VCS requirements that need VCS information to build correctly. (`#9337 `_) Vendored Libraries ------------------ - Upgrade msgpack to 1.0.2. - Upgrade requests to 2.25.1. Improved Documentation ---------------------- - Render the unreleased pip version change notes on the news page in docs. (`#9172 `_) - Fix broken email link in docs feedback banners. (`#9343 `_) 20.3.4 (2021-01-23) =================== Features -------- - ``pip wheel`` now verifies the built wheel contains valid metadata, and can be installed by a subsequent ``pip install``. This can be disabled with ``--no-verify``. (`#9206 `_) - Improve presentation of XMLRPC errors in pip search. (`#9315 `_) Bug Fixes --------- - Fixed hanging VCS subprocess calls when the VCS outputs a large amount of data on stderr. Restored logging of VCS errors that was inadvertently removed in pip 20.2. (`#8876 `_) - Fix error when an existing incompatibility is unable to be applied to a backtracked state. (`#9180 `_) - New resolver: Discard a faulty distribution, instead of quitting outright. This implementation is taken from 20.2.2, with a fix that always makes the resolver iterate through candidates from indexes lazily, to avoid downloading candidates we do not need. (`#9203 `_) - New resolver: Discard a source distribution if it fails to generate metadata, instead of quitting outright. This implementation is taken from 20.2.2, with a fix that always makes the resolver iterate through candidates from indexes lazily, to avoid downloading candidates we do not need. (`#9246 `_) Vendored Libraries ------------------ - Upgrade resolvelib to 0.5.4. 20.3.3 (2020-12-15) =================== Bug Fixes --------- - Revert "Skip candidate not providing valid metadata", as that caused pip to be overeager about downloading from the package index. (`#9264 `_) 20.3.2 (2020-12-15) =================== Features -------- - New resolver: Resolve direct and pinned (``==`` or ``===``) requirements first to improve resolver performance. (`#9185 `_) - Add a mechanism to delay resolving certain packages, and use it for setuptools. (`#9249 `_) Bug Fixes --------- - New resolver: The "Requirement already satisfied" log is not printed only once for each package during resolution. (`#9117 `_) - Fix crash when logic for redacting authentication information from URLs in ``--help`` is given a list of strings, instead of a single string. (`#9191 `_) - New resolver: Correctly implement PEP 592. Do not return yanked versions from an index, unless the version range can only be satisfied by yanked candidates. (`#9203 `_) - New resolver: Make constraints also apply to package variants with extras, so the resolver correctly avoids backtracking on them. (`#9232 `_) - New resolver: Discard a candidate if it fails to provide metadata from source, or if the provided metadata is inconsistent, instead of quitting outright. (`#9246 `_) Vendored Libraries ------------------ - Update vendoring to 20.8 Improved Documentation ---------------------- - Update documentation to reflect that pip still uses legacy resolver by default in Python 2 environments. (`#9269 `_) 20.3.1 (2020-12-03) =================== Deprecations and Removals ------------------------- - The --build-dir option has been restored as a no-op, to soften the transition for tools that still used it. (`#9193 `_) 20.3 (2020-11-30) ================= Deprecations and Removals ------------------------- - Remove --unstable-feature flag as it has been deprecated. (`#9133 `_) Features -------- - Add support for :pep:`600`: Future 'manylinux' Platform Tags for Portable Linux Built Distributions. (`#9077 `_) - The new resolver now resolves packages in a deterministic order. (`#9100 `_) - Add support for MacOS Big Sur compatibility tags. (`#9138 `_) Bug Fixes --------- - New Resolver: Rework backtracking and state management, to avoid getting stuck in an infinite loop. (`#9011 `_) - New resolver: Check version equality with ``packaging.version`` to avoid edge cases if a wheel used different version normalization logic in its filename and metadata. (`#9083 `_) - New resolver: Show each requirement in the conflict error message only once to reduce cluttering. (`#9101 `_) - Fix a regression that made ``pip wheel`` generate zip files of editable requirements in the wheel directory. (`#9122 `_) - Fix ResourceWarning in VCS subprocesses (`#9156 `_) - Redact auth from URL in help message. (`#9160 `_) - New Resolver: editable installations are done, regardless of whether the already-installed distribution is editable. (`#9169 `_) Vendored Libraries ------------------ - Upgrade certifi to 2020.11.8 - Upgrade colorama to 0.4.4 - Upgrade packaging to 20.7 - Upgrade pep517 to 0.9.1 - Upgrade requests to 2.25.0 - Upgrade resolvelib to 0.5.3 - Upgrade toml to 0.10.2 - Upgrade urllib3 to 1.26.2 Improved Documentation ---------------------- - Add a section to the User Guide to cover backtracking during dependency resolution. (`#9039 `_) - Reorder and revise installation instructions to make them easier to follow. (`#9131 `_) 20.3b1 (2020-10-31) =================== Deprecations and Removals ------------------------- - ``pip freeze`` will stop filtering the ``pip``, ``setuptools``, ``distribute`` and ``wheel`` packages from ``pip freeze`` output in a future version. To keep the previous behavior, users should use the new ``--exclude`` option. (`#4256 `_) - Deprecate support for Python 3.5 (`#8181 `_) - Document that certain removals can be fast tracked. (`#8417 `_) - Document that Python versions are generally supported until PyPI usage falls below 5%. (`#8927 `_) - Deprecate ``--find-links`` option in ``pip freeze`` (`#9069 `_) Features -------- - Add ``--exclude`` option to ``pip freeze`` and ``pip list`` commands to explicitly exclude packages from the output. (`#4256 `_) - Allow multiple values for --abi and --platform. (`#6121 `_) - Add option ``--format`` to subcommand ``list`` of ``pip cache``, with ``abspath`` choice to output the full path of a wheel file. (`#8355 `_) - Improve error message friendliness when an environment has packages with corrupted metadata. (`#8676 `_) - Make the ``setup.py install`` deprecation warning less noisy. We warn only when ``setup.py install`` succeeded and ``setup.py bdist_wheel`` failed, as situations where both fails are most probably irrelevant to this deprecation. (`#8752 `_) - Check the download directory for existing wheels to possibly avoid fetching metadata when the ``fast-deps`` feature is used with ``pip wheel`` and ``pip download``. (`#8804 `_) - When installing a git URL that refers to a commit that is not available locally after git clone, attempt to fetch it from the remote. (`#8815 `_) - Include http subdirectory in ``pip cache info`` and ``pip cache purge`` commands. (`#8892 `_) - Cache package listings on index packages so they are guaranteed to stay stable during a pip command session. This also improves performance when a index page is accessed multiple times during the command session. (`#8905 `_) - New resolver: Tweak resolution logic to improve user experience when user-supplied requirements conflict. (`#8924 `_) - Support Python 3.9. (`#8971 `_) - Log an informational message when backtracking takes multiple rounds on a specific package. (`#8975 `_) - Switch to the new dependency resolver by default. (`#9019 `_) - Remove the ``--build-dir`` option, as per the deprecation. (`#9049 `_) Bug Fixes --------- - Propagate ``--extra-index-url`` from requirements file properly to session auth, so that keyring auth will work as expected. (`#8103 `_) - Allow specifying verbosity and quiet level via configuration files and environment variables. Previously these options were treated as boolean values when read from there while through CLI the level can be specified. (`#8578 `_) - Only converts Windows path to unicode on Python 2 to avoid regressions when a POSIX environment does not configure the file system encoding correctly. (`#8658 `_) - List downloaded distributions before exiting ``pip download`` when using the new resolver to make the behavior the same as that on the legacy resolver. (`#8696 `_) - New resolver: Pick up hash declarations in constraints files and use them to filter available distributions. (`#8792 `_) - Avoid polluting the destination directory by resolution artifacts when the new resolver is used for ``pip download`` or ``pip wheel``. (`#8827 `_) - New resolver: If a package appears multiple times in user specification with different ``--hash`` options, only hashes that present in all specifications should be allowed. (`#8839 `_) - Tweak the output during dependency resolution in the new resolver. (`#8861 `_) - Correctly search for installed distributions in new resolver logic in order to not miss packages (virtualenv packages from system-wide-packages for example) (`#8963 `_) - Do not fail in pip freeze when encountering a ``direct_url.json`` metadata file with editable=True. Render it as a non-editable ``file://`` URL until modern editable installs are standardized and supported. (`#8996 `_) Vendored Libraries ------------------ - Fix devendoring instructions to explicitly state that ``vendor.txt`` should not be removed. It is mandatory for ``pip debug`` command. Improved Documentation ---------------------- - Add documentation for '.netrc' support. (`#7231 `_) - Add OS tabs for OS-specific commands. (`#7311 `_) - Add note and example on keyring support for index basic-auth (`#8636 `_) - Added initial UX feedback widgets to docs. (`#8783 `_, `#8848 `_) - Add ux documentation (`#8807 `_) - Update user docs to reflect new resolver as default in 20.3. (`#9044 `_) - Improve migration guide to reflect changes in new resolver behavior. (`#9056 `_) 20.2.4 (2020-10-16) =================== Deprecations and Removals ------------------------- - Document that certain removals can be fast tracked. (`#8417 `_) - Document that Python versions are generally supported until PyPI usage falls below 5%. (`#8927 `_) Features -------- - New resolver: Avoid accessing indexes when the installed candidate is preferred and considered good enough. (`#8023 `_) - Improve error message friendliness when an environment has packages with corrupted metadata. (`#8676 `_) - Cache package listings on index packages so they are guaranteed to stay stable during a pip command session. This also improves performance when a index page is accessed multiple times during the command session. (`#8905 `_) - New resolver: Tweak resolution logic to improve user experience when user-supplied requirements conflict. (`#8924 `_) Bug Fixes --------- - New resolver: Correctly respect ``Requires-Python`` metadata to reject incompatible packages in ``--no-deps`` mode. (`#8758 `_) - New resolver: Pick up hash declarations in constraints files and use them to filter available distributions. (`#8792 `_) - New resolver: If a package appears multiple times in user specification with different ``--hash`` options, only hashes that present in all specifications should be allowed. (`#8839 `_) Improved Documentation ---------------------- - Add ux documentation (`#8807 `_) 20.2.3 (2020-09-08) =================== Deprecations and Removals ------------------------- - Deprecate support for Python 3.5 (`#8181 `_) Features -------- - Make the ``setup.py install`` deprecation warning less noisy. We warn only when ``setup.py install`` succeeded and ``setup.py bdist_wheel`` failed, as situations where both fails are most probably irrelevant to this deprecation. (`#8752 `_) 20.2.2 (2020-08-11) =================== Bug Fixes --------- - Only attempt to use the keyring once and if it fails, don't try again. This prevents spamming users with several keyring unlock prompts when they cannot unlock or don't want to do so. (`#8090 `_) - Fix regression that distributions in system site-packages are not correctly found when a virtual environment is configured with ``system-site-packages`` on. (`#8695 `_) - Disable caching for range requests, which causes corrupted wheels when pip tries to obtain metadata using the feature ``fast-deps``. (`#8701 `_, `#8716 `_) - Always use UTF-8 to read ``pyvenv.cfg`` to match the built-in ``venv``. (`#8717 `_) - 2020 Resolver: Correctly handle marker evaluation in constraints and exclude them if their markers do not match the current environment. (`#8724 `_) 20.2.1 (2020-08-04) =================== Features -------- - Ignore require-virtualenv in ``pip list`` (`#8603 `_) Bug Fixes --------- - Correctly find already-installed distributions with dot (``.``) in the name and uninstall them when needed. (`#8645 `_) - Trace a better error message on installation failure due to invalid ``.data`` files in wheels. (`#8654 `_) - Fix SVN version detection for alternative SVN distributions. (`#8665 `_) - New resolver: Correctly include the base package when specified with extras in ``--no-deps`` mode. (`#8677 `_) - Use UTF-8 to handle ZIP archive entries on Python 2 according to PEP 427, so non-ASCII paths can be resolved as expected. (`#8684 `_) Improved Documentation ---------------------- - Add details on old resolver deprecation and removal to migration documentation. (`#8371 `_) - Fix feature flag name in docs. (`#8660 `_) 20.2 (2020-07-29) ================= Deprecations and Removals ------------------------- - Deprecate setup.py-based builds that do not generate an ``.egg-info`` directory. (`#6998 `_, `#8617 `_) - Disallow passing install-location-related arguments in ``--install-options``. (`#7309 `_) - Add deprecation warning for invalid requirements format "base>=1.0[extra]" (`#8288 `_) - Deprecate legacy setup.py install when building a wheel failed for source distributions without pyproject.toml (`#8368 `_) - Deprecate -b/--build/--build-dir/--build-directory. Its current behaviour is confusing and breaks in case different versions of the same distribution need to be built during the resolution process. Using the TMPDIR/TEMP/TMP environment variable, possibly combined with --no-clean covers known use cases. (`#8372 `_) - Remove undocumented and deprecated option ``--always-unzip`` (`#8408 `_) Features -------- - Log debugging information about pip, in ``pip install --verbose``. (`#3166 `_) - Refine error messages to avoid showing Python tracebacks when an HTTP error occurs. (`#5380 `_) - Install wheel files directly instead of extracting them to a temp directory. (`#6030 `_) - Add a beta version of pip's next-generation dependency resolver. Move pip's new resolver into beta, remove the ``--unstable-feature=resolver`` flag, and enable the ``--use-feature=2020-resolver`` flag. The new resolver is significantly stricter and more consistent when it receives incompatible instructions, and reduces support for certain kinds of :ref:`Constraints Files`, so some workarounds and workflows may break. More details about how to test and migrate, and how to report issues, at :ref:`Resolver changes 2020` . Maintainers are preparing to release pip 20.3, with the new resolver on by default, in October. (`#6536 `_) - Introduce a new ResolutionImpossible error, raised when pip encounters un-satisfiable dependency conflicts (`#8546 `_, `#8377 `_) - Add a subcommand ``debug`` to ``pip config`` to list available configuration sources and the key-value pairs defined in them. (`#6741 `_) - Warn if index pages have unexpected content-type (`#6754 `_) - Allow specifying ``--prefer-binary`` option in a requirements file (`#7693 `_) - Generate PEP 376 REQUESTED metadata for user supplied requirements installed by pip. (`#7811 `_) - Warn if package url is a vcs or an archive url with invalid scheme (`#8128 `_) - Parallelize network operations in ``pip list``. (`#8504 `_) - Allow the new resolver to obtain dependency information through wheels lazily downloaded using HTTP range requests. To enable this feature, invoke ``pip`` with ``--use-feature=fast-deps``. (`#8588 `_) - Support ``--use-feature`` in requirements files (`#8601 `_) Bug Fixes --------- - Use canonical package names while looking up already installed packages. (`#5021 `_) - Fix normalizing path on Windows when installing package on another logical disk. (`#7625 `_) - The VCS commands run by pip as subprocesses don't merge stdout and stderr anymore, improving the output parsing by subsequent commands. (`#7968 `_) - Correctly treat non-ASCII entry point declarations in wheels so they can be installed on Windows. (`#8342 `_) - Update author email in config and tests to reflect decommissioning of pypa-dev list. (`#8454 `_) - Headers provided by wheels in .data directories are now correctly installed into the user-provided locations, such as ``--prefix``, instead of the virtual environment pip is running in. (`#8521 `_) Vendored Libraries ------------------ - Vendored htmlib5 no longer imports deprecated xml.etree.cElementTree on Python 3. - Upgrade appdirs to 1.4.4 - Upgrade certifi to 2020.6.20 - Upgrade distlib to 0.3.1 - Upgrade html5lib to 1.1 - Upgrade idna to 2.10 - Upgrade packaging to 20.4 - Upgrade requests to 2.24.0 - Upgrade six to 1.15.0 - Upgrade toml to 0.10.1 - Upgrade urllib3 to 1.25.9 Improved Documentation ---------------------- - Add ``--no-input`` option to pip docs (`#7688 `_) - List of options supported in requirements file are extracted from source of truth, instead of being maintained manually. (`#7908 `_) - Fix pip config docstring so that the subcommands render correctly in the docs (`#8072 `_) - replace links to the old pypa-dev mailing list with https://mail.python.org/mailman3/lists/distutils-sig.python.org/ (`#8353 `_) - Fix example for defining multiple values for options which support them (`#8373 `_) - Add documentation for the ResolutionImpossible error that helps the user fix dependency conflicts (`#8459 `_) - Add feature flags to docs (`#8512 `_) - Document how to install package extras from git branch and source distributions. (`#8576 `_) 20.2b1 (2020-05-21) =================== Bug Fixes --------- - Correctly treat wheels containing non-ASCII file contents so they can be installed on Windows. (`#5712 `_) - Prompt the user for password if the keyring backend doesn't return one (`#7998 `_) Improved Documentation ---------------------- - Add GitHub issue template for reporting when the dependency resolver fails (`#8207 `_) 20.1.1 (2020-05-19) =================== Deprecations and Removals ------------------------- - Revert building of local directories in place, restoring the pre-20.1 behaviour of copying to a temporary directory. (`#7555 `_) - Drop parallelization from ``pip list --outdated``. (`#8167 `_) Bug Fixes --------- - Fix metadata permission issues when umask has the executable bit set. (`#8164 `_) - Avoid unnecessary message about the wheel package not being installed when a wheel would not have been built. Additionally, clarify the message. (`#8178 `_) 20.1 (2020-04-28) ================= Process ------- - Document that pip 21.0 will drop support for Python 2.7. Features -------- - Add ``pip cache dir`` to show the cache directory. (`#7350 `_) Bug Fixes --------- - Abort pip cache commands early when cache is disabled. (`#8124 `_) - Correctly set permissions on metadata files during wheel installation, to permit non-privileged users to read from system site-packages. (`#8139 `_) 20.1b1 (2020-04-21) =================== Deprecations and Removals ------------------------- - Remove emails from AUTHORS.txt to prevent usage for spamming, and only populate names in AUTHORS.txt at time of release (`#5979 `_) - Remove deprecated ``--skip-requirements-regex`` option. (`#7297 `_) - Building of local directories is now done in place, instead of a temporary location containing a copy of the directory tree. (`#7555 `_) - Remove unused ``tests/scripts/test_all_pip.py`` test script and the ``tests/scripts`` folder. (`#7680 `_) Features -------- - pip now implements PEP 610, so ``pip freeze`` has better fidelity in presence of distributions installed from Direct URL requirements. (`#609 `_) - Add ``pip cache`` command for inspecting/managing pip's wheel cache. (`#6391 `_) - Raise error if ``--user`` and ``--target`` are used together in ``pip install`` (`#7249 `_) - Significantly improve performance when ``--find-links`` points to a very large HTML page. (`#7729 `_) - Indicate when wheel building is skipped, due to lack of the ``wheel`` package. (`#7768 `_) - Change default behaviour to always cache responses from trusted-host source. (`#7847 `_) - An alpha version of a new resolver is available via ``--unstable-feature=resolver``. (`#988 `_) Bug Fixes --------- - Correctly freeze a VCS editable package when it is nested inside another VCS repository. (`#3988 `_) - Correctly handle ``%2F`` in URL parameters to avoid accidentally unescape them into ``/``. (`#6446 `_) - Reject VCS URLs with an empty revision. (`#7402 `_) - Warn when an invalid URL is passed with ``--index-url`` (`#7430 `_) - Use better mechanism for handling temporary files, when recording metadata about installed files (RECORD) and the installer (INSTALLER). (`#7699 `_) - Correctly detect global site-packages availability of virtual environments created by PyPA’s virtualenv>=20.0. (`#7718 `_) - Remove current directory from ``sys.path`` when invoked as ``python -m pip `` (`#7731 `_) - Stop failing uninstallation, when trying to remove non-existent files. (`#7856 `_) - Prevent an infinite recursion with ``pip wheel`` when ``$TMPDIR`` is within the source directory. (`#7872 `_) - Significantly speedup ``pip list --outdated`` by parallelizing index interaction. (`#7962 `_) - Improve Windows compatibility when detecting writability in folder. (`#8013 `_) Vendored Libraries ------------------ - Update semi-supported debundling script to reflect that appdirs is vendored. - Add ResolveLib as a vendored dependency. - Upgrade certifi to 2020.04.05.1 - Upgrade contextlib2 to 0.6.0.post1 - Upgrade distro to 1.5.0. - Upgrade idna to 2.9. - Upgrade msgpack to 1.0.0. - Upgrade packaging to 20.3. - Upgrade pep517 to 0.8.2. - Upgrade pyparsing to 2.4.7. - Remove pytoml as a vendored dependency. - Upgrade requests to 2.23.0. - Add toml as a vendored dependency. - Upgrade urllib3 to 1.25.8. Improved Documentation ---------------------- - Emphasize that VCS URLs using git, git+git and git+http are insecure due to lack of authentication and encryption (`#1983 `_) - Clarify the usage of --no-binary command. (`#3191 `_) - Clarify the usage of freeze command in the example of Using pip in your program (`#7008 `_) - Add a "Copyright" page. (`#7767 `_) - Added example of defining multiple values for options which support them (`#7803 `_) 20.0.2 (2020-01-24) =================== Bug Fixes --------- - Fix a regression in generation of compatibility tags. (`#7626 `_) Vendored Libraries ------------------ - Upgrade packaging to 20.1 20.0.1 (2020-01-21) =================== Bug Fixes --------- - Rename an internal module, to avoid ImportErrors due to improper uninstallation. (`#7621 `_) 20.0 (2020-01-21) ================= Process ------- - Switch to a dedicated CLI tool for vendoring dependencies. Deprecations and Removals ------------------------- - Remove wheel tag calculation from pip and use ``packaging.tags``. This should provide more tags ordered better than in prior releases. (`#6908 `_) - Deprecate setup.py-based builds that do not generate an ``.egg-info`` directory. (`#6998 `_) - The pip>=20 wheel cache is not retro-compatible with previous versions. Until pip 21.0, pip will continue to take advantage of existing legacy cache entries. (`#7296 `_) - Deprecate undocumented ``--skip-requirements-regex`` option. (`#7297 `_) - Deprecate passing install-location-related options via ``--install-option``. (`#7309 `_) - Use literal "abi3" for wheel tag on CPython 3.x, to align with PEP 384 which only defines it for this platform. (`#7327 `_) - Remove interpreter-specific major version tag e.g. ``cp3-none-any`` from consideration. This behavior was not documented strictly, and this tag in particular is `not useful `_. Anyone with a use case can create an issue with pypa/packaging. (`#7355 `_) - Wheel processing no longer permits wheels containing more than one top-level .dist-info directory. (`#7487 `_) - Support for the ``git+git@`` form of VCS requirement is being deprecated and will be removed in pip 21.0. Switch to ``git+https://`` or ``git+ssh://``. ``git+git://`` also works but its use is discouraged as it is insecure. (`#7543 `_) Features -------- - Default to doing a user install (as if ``--user`` was passed) when the main site-packages directory is not writeable and user site-packages are enabled. (`#1668 `_) - Warn if a path in PATH starts with tilde during ``pip install``. (`#6414 `_) - Cache wheels built from Git requirements that are considered immutable, because they point to a commit hash. (`#6640 `_) - Add option ``--no-python-version-warning`` to silence warnings related to deprecation of Python versions. (`#6673 `_) - Cache wheels that ``pip wheel`` built locally, matching what ``pip install`` does. This particularly helps performance in workflows where ``pip wheel`` is used for `building before installing `_. Users desiring the original behavior can use ``pip wheel --no-cache-dir``. (`#6852 `_) - Display CA information in ``pip debug``. (`#7146 `_) - Show only the filename (instead of full URL), when downloading from PyPI. (`#7225 `_) - Suggest a more robust command to upgrade pip itself to avoid confusion when the current pip command is not available as ``pip``. (`#7376 `_) - Define all old pip console script entrypoints to prevent import issues in stale wrapper scripts. (`#7498 `_) - The build step of ``pip wheel`` now builds all wheels to a cache first, then copies them to the wheel directory all at once. Before, it built them to a temporary directory and moved them to the wheel directory one by one. (`#7517 `_) - Expand ``~`` prefix to user directory in path options, configs, and environment variables. Values that may be either URL or path are not currently supported, to avoid ambiguity: * ``--find-links`` * ``--constraint``, ``-c`` * ``--requirement``, ``-r`` * ``--editable``, ``-e`` (`#980 `_) Bug Fixes --------- - Correctly handle system site-packages, in virtual environments created with venv (PEP 405). (`#5702 `_, `#7155 `_) - Fix case sensitive comparison of pip freeze when used with -r option. (`#5716 `_) - Enforce PEP 508 requirement format in ``pyproject.toml`` ``build-system.requires``. (`#6410 `_) - Make ``ensure_dir()`` also ignore ``ENOTEMPTY`` as seen on Windows. (`#6426 `_) - Fix building packages which specify ``backend-path`` in pyproject.toml. (`#6599 `_) - Do not attempt to run ``setup.py clean`` after a ``pep517`` build error, since a ``setup.py`` may not exist in that case. (`#6642 `_) - Fix passwords being visible in the index-url in "Downloading " message. (`#6783 `_) - Change method from shutil.remove to shutil.rmtree in noxfile.py. (`#7191 `_) - Skip running tests which require subversion, when svn isn't installed (`#7193 `_) - Fix not sending client certificates when using ``--trusted-host``. (`#7207 `_) - Make sure ``pip wheel`` never outputs pure python wheels with a python implementation tag. Better fix/workaround for `#3025 `_ by using a per-implementation wheel cache instead of caching pure python wheels with an implementation tag in their name. (`#7296 `_) - Include ``subdirectory`` URL fragments in cache keys. (`#7333 `_) - Fix typo in warning message when any of ``--build-option``, ``--global-option`` and ``--install-option`` is used in requirements.txt (`#7340 `_) - Fix the logging of cached HTTP response shown as downloading. (`#7393 `_) - Effectively disable the wheel cache when it is not writable, as is the case with the http cache. (`#7488 `_) - Correctly handle relative cache directory provided via --cache-dir. (`#7541 `_) Vendored Libraries ------------------ - Upgrade CacheControl to 0.12.5 - Upgrade certifi to 2019.9.11 - Upgrade colorama to 0.4.1 - Upgrade distlib to 0.2.9.post0 - Upgrade ipaddress to 1.0.22 - Update packaging to 20.0. - Upgrade pkg_resources (via setuptools) to 44.0.0 - Upgrade pyparsing to 2.4.2 - Upgrade six to 1.12.0 - Upgrade urllib3 to 1.25.6 Improved Documentation ---------------------- - Document that "coding: utf-8" is supported in requirements.txt (`#7182 `_) - Explain how to get pip's source code in `Getting Started `_ (`#7197 `_) - Describe how basic authentication credentials in URLs work. (`#7201 `_) - Add more clear installation instructions (`#7222 `_) - Fix documentation links for index options (`#7347 `_) - Better document the requirements file format (`#7385 `_) 19.3.1 (2019-10-17) =================== Features -------- - Document Python 3.8 support. (`#7219 `_) Bug Fixes --------- - Fix bug that prevented installation of PEP 517 packages without ``setup.py``. (`#6606 `_) 19.3 (2019-10-14) ================= Deprecations and Removals ------------------------- - Remove undocumented support for un-prefixed URL requirements pointing to SVN repositories. Users relying on this can get the original behavior by prefixing their URL with ``svn+`` (which is backwards-compatible). (`#7037 `_) - Remove the deprecated ``--venv`` option from ``pip config``. (`#7163 `_) Features -------- - Print a better error message when ``--no-binary`` or ``--only-binary`` is given an argument starting with ``-``. (`#3191 `_) - Make ``pip show`` warn about packages not found. (`#6858 `_) - Support including a port number in ``--trusted-host`` for both HTTP and HTTPS. (`#6886 `_) - Redact single-part login credentials from URLs in log messages. (`#6891 `_) - Implement manylinux2014 platform tag support. manylinux2014 is the successor to manylinux2010. It allows carefully compiled binary wheels to be installed on compatible Linux platforms. The manylinux2014 platform tag definition can be found in `PEP599 `_. (`#7102 `_) Bug Fixes --------- - Abort installation if any archive contains a file which would be placed outside the extraction location. (`#3907 `_) - pip's CLI completion code no longer prints a Traceback if it is interrupted. (`#3942 `_) - Correct inconsistency related to the ``hg+file`` scheme. (`#4358 `_) - Fix ``rmtree_errorhandler`` to skip non-existing directories. (`#4910 `_) - Ignore errors copying socket files for local source installs (in Python 3). (`#5306 `_) - Fix requirement line parser to correctly handle PEP 440 requirements with a URL pointing to an archive file. (`#6202 `_) - The ``pip-wheel-metadata`` directory does not need to persist between invocations of pip, use a temporary directory instead of the current ``setup.py`` directory. (`#6213 `_) - Fix ``--trusted-host`` processing under HTTPS to trust any port number used with the host. (`#6705 `_) - Switch to new ``distlib`` wheel script template. This should be functionally equivalent for end users. (`#6763 `_) - Skip copying .tox and .nox directories to temporary build directories (`#6770 `_) - Fix handling of tokens (single part credentials) in URLs. (`#6795 `_) - Fix a regression that caused ``~`` expansion not to occur in ``--find-links`` paths. (`#6804 `_) - Fix bypassed pip upgrade warning on Windows. (`#6841 `_) - Fix 'm' flag erroneously being appended to ABI tag in Python 3.8 on platforms that do not provide SOABI (`#6885 `_) - Hide security-sensitive strings like passwords in log messages related to version control system (aka VCS) command invocations. (`#6890 `_) - Correctly uninstall symlinks that were installed in a virtualenv, by tools such as ``flit install --symlink``. (`#6892 `_) - Don't fail installation using pip.exe on Windows when pip wouldn't be upgraded. (`#6924 `_) - Use canonical distribution names when computing ``Required-By`` in ``pip show``. (`#6947 `_) - Don't use hardlinks for locking selfcheck state file. (`#6954 `_) - Ignore "require_virtualenv" in ``pip config`` (`#6991 `_) - Fix ``pip freeze`` not showing correct entry for mercurial packages that use subdirectories. (`#7071 `_) - Fix a crash when ``sys.stdin`` is set to ``None``, such as on AWS Lambda. (`#7118 `_, `#7119 `_) Vendored Libraries ------------------ - Upgrade certifi to 2019.9.11 - Add contextlib2 0.6.0 as a vendored dependency. - Remove Lockfile as a vendored dependency. - Upgrade msgpack to 0.6.2 - Upgrade packaging to 19.2 - Upgrade pep517 to 0.7.0 - Upgrade pyparsing to 2.4.2 - Upgrade pytoml to 0.1.21 - Upgrade setuptools to 41.4.0 - Upgrade urllib3 to 1.25.6 Improved Documentation ---------------------- - Document caveats for UNC paths in uninstall and add .pth unit tests. (`#6516 `_) - Add architectural overview documentation. (`#6637 `_) - Document that ``--ignore-installed`` is dangerous. (`#6794 `_) 19.2.3 (2019-08-25) =================== Bug Fixes --------- - Fix 'm' flag erroneously being appended to ABI tag in Python 3.8 on platforms that do not provide SOABI (`#6885 `_) 19.2.2 (2019-08-11) =================== Bug Fixes --------- - Fix handling of tokens (single part credentials) in URLs. (`#6795 `_) - Fix a regression that caused ``~`` expansion not to occur in ``--find-links`` paths. (`#6804 `_) 19.2.1 (2019-07-23) =================== Bug Fixes --------- - Fix a ``NoneType`` ``AttributeError`` when evaluating hashes and no hashes are provided. (`#6772 `_) 19.2 (2019-07-22) ================= Deprecations and Removals ------------------------- - Drop support for EOL Python 3.4. (`#6685 `_) - Improve deprecation messages to include the version in which the functionality will be removed. (`#6549 `_) Features -------- - Credentials will now be loaded using `keyring` when installed. (`#5948 `_) - Fully support using ``--trusted-host`` inside requirements files. (`#3799 `_) - Update timestamps in pip's ``--log`` file to include milliseconds. (`#6587 `_) - Respect whether a file has been marked as "yanked" from a simple repository (see `PEP 592 `__ for details). (`#6633 `_) - When choosing candidates to install, prefer candidates with a hash matching one of the user-provided hashes. (`#5874 `_) - Improve the error message when ``METADATA`` or ``PKG-INFO`` is None when accessing metadata. (`#5082 `_) - Add a new command ``pip debug`` that can display e.g. the list of compatible tags for the current Python. (`#6638 `_) - Display hint on installing with --pre when search results include pre-release versions. (`#5169 `_) - Report to Warehouse that pip is running under CI if the ``PIP_IS_CI`` environment variable is set. (`#5499 `_) - Allow ``--python-version`` to be passed as a dotted version string (e.g. ``3.7`` or ``3.7.3``). (`#6585 `_) - Log the final filename and SHA256 of a ``.whl`` file when done building a wheel. (`#5908 `_) - Include the wheel's tags in the log message explanation when a candidate wheel link is found incompatible. (`#6121 `_) - Add a ``--path`` argument to ``pip freeze`` to support ``--target`` installations. (`#6404 `_) - Add a ``--path`` argument to ``pip list`` to support ``--target`` installations. (`#6551 `_) Bug Fixes --------- - Set ``sys.argv[0]`` to the underlying ``setup.py`` when invoking ``setup.py`` via the setuptools shim so setuptools doesn't think the path is ``-c``. (`#1890 `_) - Update ``pip download`` to respect the given ``--python-version`` when checking ``"Requires-Python"``. (`#5369 `_) - Respect ``--global-option`` and ``--install-option`` when installing from a version control url (e.g. ``git``). (`#5518 `_) - Make the "ascii" progress bar really be "ascii" and not Unicode. (`#5671 `_) - Fail elegantly when trying to set an incorrectly formatted key in config. (`#5963 `_) - Prevent DistutilsOptionError when prefix is indicated in the global environment and `--target` is used. (`#6008 `_) - Fix ``pip install`` to respect ``--ignore-requires-python`` when evaluating links. (`#6371 `_) - Fix a debug log message when freezing an editable, non-version controlled requirement. (`#6383 `_) - Extend to Subversion 1.8+ the behavior of calling Subversion in interactive mode when pip is run interactively. (`#6386 `_) - Prevent ``pip install `` from permitting directory traversal if e.g. a malicious server sends a ``Content-Disposition`` header with a filename containing ``../`` or ``..\\``. (`#6413 `_) - Hide passwords in output when using ``--find-links``. (`#6489 `_) - Include more details in the log message if ``pip freeze`` can't generate a requirement string for a particular distribution. (`#6513 `_) - Add the line number and file location to the error message when reading an invalid requirements file in certain situations. (`#6527 `_) - Prefer ``os.confstr`` to ``ctypes`` when extracting glibc version info. (`#6543 `_, `#6675 `_) - Improve error message printed when an invalid editable requirement is provided. (`#6648 `_) - Improve error message formatting when a command errors out in a subprocess. (`#6651 `_) Vendored Libraries ------------------ - Upgrade certifi to 2019.6.16 - Upgrade distlib to 0.2.9.post0 - Upgrade msgpack to 0.6.1 - Upgrade requests to 2.22.0 - Upgrade urllib3 to 1.25.3 - Patch vendored html5lib, to prefer using `collections.abc` where possible. Improved Documentation ---------------------- - Document how Python 2.7 support will be maintained. (`#6726 `_) - Upgrade Sphinx version used to build documentation. (`#6471 `_) - Fix generation of subcommand manpages. (`#6724 `_) - Mention that pip can install from git refs. (`#6512 `_) - Replace a failing example of pip installs with extras with a working one. (`#4733 `_) 19.1.1 (2019-05-06) =================== Features -------- - Restore ``pyproject.toml`` handling to how it was with pip 19.0.3 to prevent the need to add ``--no-use-pep517`` when installing in editable mode. (`#6434 `_) Bug Fixes --------- - Fix a regression that caused `@` to be quoted in pypiserver links. This interfered with parsing the revision string from VCS urls. (`#6440 `_) 19.1 (2019-04-23) ================= Features -------- - Configuration files may now also be stored under ``sys.prefix`` (`#5060 `_) - Avoid creating an unnecessary local clone of a Bazaar branch when exporting. (`#5443 `_) - Include in pip's User-Agent string whether it looks like pip is running under CI. (`#5499 `_) - A custom (JSON-encoded) string can now be added to pip's User-Agent using the ``PIP_USER_AGENT_USER_DATA`` environment variable. (`#5549 `_) - For consistency, passing ``--no-cache-dir`` no longer affects whether wheels will be built. In this case, a temporary directory is used. (`#5749 `_) - Command arguments in ``subprocess`` log messages are now quoted using ``shlex.quote()``. (`#6290 `_) - Prefix warning and error messages in log output with `WARNING` and `ERROR`. (`#6298 `_) - Using ``--build-options`` in a PEP 517 build now fails with an error, rather than silently ignoring the option. (`#6305 `_) - Error out with an informative message if one tries to install a ``pyproject.toml``-style (PEP 517) source tree using ``--editable`` mode. (`#6314 `_) - When downloading a package, the ETA and average speed now only update once per second for better legibility. (`#6319 `_) Bug Fixes --------- - The stdout and stderr from VCS commands run by pip as subprocesses (e.g. ``git``, ``hg``, etc.) no longer pollute pip's stdout. (`#1219 `_) - Fix handling of requests exceptions when dependencies are debundled. (`#4195 `_) - Make pip's self version check avoid recommending upgrades to prereleases if the currently-installed version is stable. (`#5175 `_) - Fixed crash when installing a requirement from a URL that comes from a dependency without a URL. (`#5889 `_) - Improve handling of file URIs: correctly handle `file://localhost/...` and don't try to use UNC paths on Unix. (`#5892 `_) - Fix ``utils.encoding.auto_decode()`` ``LookupError`` with invalid encodings. ``utils.encoding.auto_decode()`` was broken when decoding Big Endian BOM byte-strings on Little Endian or vice versa. (`#6054 `_) - Fix incorrect URL quoting of IPv6 addresses. (`#6285 `_) - Redact the password from the extra index URL when using ``pip -v``. (`#6295 `_) - The spinner no longer displays a completion message after subprocess calls not needing a spinner. It also no longer incorrectly reports an error after certain subprocess calls to Git that succeeded. (`#6312 `_) - Fix the handling of editable mode during installs when ``pyproject.toml`` is present but PEP 517 doesn't require the source tree to be treated as ``pyproject.toml``-style. (`#6370 `_) - Fix ``NameError`` when handling an invalid requirement. (`#6419 `_) Vendored Libraries ------------------ - Updated certifi to 2019.3.9 - Updated distro to 1.4.0 - Update progress to 1.5 - Updated pyparsing to 2.4.0 - Updated pkg_resources to 41.0.1 (via setuptools) Improved Documentation ---------------------- - Make dashes render correctly when displaying long options like ``--find-links`` in the text. (`#6422 `_) 19.0.3 (2019-02-20) =================== Bug Fixes --------- - Fix an ``IndexError`` crash when a legacy build of a wheel fails. (`#6252 `_) - Fix a regression introduced in 19.0.2 where the filename in a RECORD file of an installed file would not be updated when installing a wheel. (`#6266 `_) 19.0.2 (2019-02-09) =================== Bug Fixes --------- - Fix a crash where PEP 517-based builds using ``--no-cache-dir`` would fail in some circumstances with an ``AssertionError`` due to not finalizing a build directory internally. (`#6197 `_) - Provide a better error message if attempting an editable install of a directory with a ``pyproject.toml`` but no ``setup.py``. (`#6170 `_) - The implicit default backend used for projects that provide a ``pyproject.toml`` file without explicitly specifying ``build-backend`` now behaves more like direct execution of ``setup.py``, and hence should restore compatibility with projects that were unable to be installed with ``pip`` 19.0. This raised the minimum required version of ``setuptools`` for such builds to 40.8.0. (`#6163 `_) - Allow ``RECORD`` lines with more than three elements, and display a warning. (`#6165 `_) - ``AdjacentTempDirectory`` fails on unwritable directory instead of locking up the uninstall command. (`#6169 `_) - Make failed uninstalls roll back more reliably and better at avoiding naming conflicts. (`#6194 `_) - Ensure the correct wheel file is copied when building PEP 517 distribution is built. (`#6196 `_) - The Python 2 end of life warning now only shows on CPython, which is the implementation that has announced end of life plans. (`#6207 `_) Improved Documentation ---------------------- - Re-write README and documentation index (`#5815 `_) 19.0.1 (2019-01-23) =================== Bug Fixes --------- - Fix a crash when using --no-cache-dir with PEP 517 distributions (`#6158 `_, `#6171 `_) 19.0 (2019-01-22) ================= Deprecations and Removals ------------------------- - Deprecate support for Python 3.4 (`#6106 `_) - Start printing a warning for Python 2.7 to warn of impending Python 2.7 End-of-life and prompt users to start migrating to Python 3. (`#6148 `_) - Remove the deprecated ``--process-dependency-links`` option. (`#6060 `_) - Remove the deprecated SVN editable detection based on dependency links during freeze. (`#5866 `_) Features -------- - Implement PEP 517 (allow projects to specify a build backend via pyproject.toml). (`#5743 `_) - Implement manylinux2010 platform tag support. manylinux2010 is the successor to manylinux1. It allows carefully compiled binary wheels to be installed on compatible Linux platforms. (`#5008 `_) - Improve build isolation: handle ``.pth`` files, so namespace packages are correctly supported under Python 3.2 and earlier. (`#5656 `_) - Include the package name in a freeze warning if the package is not installed. (`#5943 `_) - Warn when dropping an ``--[extra-]index-url`` value that points to an existing local directory. (`#5827 `_) - Prefix pip's ``--log`` file lines with their timestamp. (`#6141 `_) Bug Fixes --------- - Avoid creating excessively long temporary paths when uninstalling packages. (`#3055 `_) - Redact the password from the URL in various log messages. (`#4746 `_, `#6124 `_) - Avoid creating excessively long temporary paths when uninstalling packages. (`#3055 `_) - Avoid printing a stack trace when given an invalid requirement. (`#5147 `_) - Present 401 warning if username/password do not work for URL (`#4833 `_) - Handle ``requests.exceptions.RetryError`` raised in ``PackageFinder`` that was causing pip to fail silently when some indexes were unreachable. (`#5270 `_, `#5483 `_) - Handle a broken stdout pipe more gracefully (e.g. when running ``pip list | head``). (`#4170 `_) - Fix crash from setting ``PIP_NO_CACHE_DIR=yes``. (`#5385 `_) - Fix crash from unparsable requirements when checking installed packages. (`#5839 `_) - Fix content type detection if a directory named like an archive is used as a package source. (`#5838 `_) - Fix listing of outdated packages that are not dependencies of installed packages in ``pip list --outdated --not-required`` (`#5737 `_) - Fix sorting ``TypeError`` in ``move_wheel_files()`` when installing some packages. (`#5868 `_) - Fix support for invoking pip using ``python src/pip ...``. (`#5841 `_) - Greatly reduce memory usage when installing wheels containing large files. (`#5848 `_) - Editable non-VCS installs now freeze as editable. (`#5031 `_) - Editable Git installs without a remote now freeze as editable. (`#4759 `_) - Canonicalize sdist file names so they can be matched to a canonicalized package name passed to ``pip install``. (`#5870 `_) - Properly decode special characters in SVN URL credentials. (`#5968 `_) - Make ``PIP_NO_CACHE_DIR`` disable the cache also for truthy values like ``"true"``, ``"yes"``, ``"1"``, etc. (`#5735 `_) Vendored Libraries ------------------ - Include license text of vendored 3rd party libraries. (`#5213 `_) - Update certifi to 2018.11.29 - Update colorama to 0.4.1 - Update distlib to 0.2.8 - Update idna to 2.8 - Update packaging to 19.0 - Update pep517 to 0.5.0 - Update pkg_resources to 40.6.3 (via setuptools) - Update pyparsing to 2.3.1 - Update pytoml to 0.1.20 - Update requests to 2.21.0 - Update six to 1.12.0 - Update urllib3 to 1.24.1 Improved Documentation ---------------------- - Include the Vendoring Policy in the documentation. (`#5958 `_) - Add instructions for running pip from source to Development documentation. (`#5949 `_) - Remove references to removed ``#egg=-`` functionality (`#5888 `_) - Fix omission of command name in HTML usage documentation (`#5984 `_) 18.1 (2018-10-05) ================= Features -------- - Allow PEP 508 URL requirements to be used as dependencies. As a security measure, pip will raise an exception when installing packages from PyPI if those packages depend on packages not also hosted on PyPI. In the future, PyPI will block uploading packages with such external URL dependencies directly. (`#4187 `_) - Allows dist options (--abi, --python-version, --platform, --implementation) when installing with --target (`#5355 `_) - Support passing ``svn+ssh`` URLs with a username to ``pip install -e``. (`#5375 `_) - pip now ensures that the RECORD file is sorted when installing from a wheel file. (`#5525 `_) - Add support for Python 3.7. (`#5561 `_) - Malformed configuration files now show helpful error messages, instead of tracebacks. (`#5798 `_) Bug Fixes --------- - Checkout the correct branch when doing an editable Git install. (`#2037 `_) - Run self-version-check only on commands that may access the index, instead of trying on every run and failing to do so due to missing options. (`#5433 `_) - Allow a Git ref to be installed over an existing installation. (`#5624 `_) - Show a better error message when a configuration option has an invalid value. (`#5644 `_) - Always revalidate cached simple API pages instead of blindly caching them for up to 10 minutes. (`#5670 `_) - Avoid caching self-version-check information when cache is disabled. (`#5679 `_) - Avoid traceback printing on autocomplete after flags in the CLI. (`#5751 `_) - Fix incorrect parsing of egg names if pip needs to guess the package name. (`#5819 `_) Vendored Libraries ------------------ - Upgrade certifi to 2018.8.24 - Upgrade packaging to 18.0 - Upgrade pyparsing to 2.2.1 - Add pep517 version 0.2 - Upgrade pytoml to 0.1.19 - Upgrade pkg_resources to 40.4.3 (via setuptools) Improved Documentation ---------------------- - Fix "Requirements Files" reference in User Guide (`#user_guide_fix_requirements_file_ref `_) 18.0 (2018-07-22) ================= Process ------- - Switch to a Calendar based versioning scheme. - Formally document our deprecation process as a minimum of 6 months of deprecation warnings. - Adopt and document NEWS fragment writing style. - Switch to releasing a new, non-bug fix version of pip every 3 months. Deprecations and Removals ------------------------- - Remove the legacy format from pip list. (#3651, #3654) - Dropped support for Python 3.3. (#3796) - Remove support for cleaning up #egg fragment postfixes. (#4174) - Remove the shim for the old get-pip.py location. (#5520) For the past 2 years, it's only been redirecting users to use the newer https://bootstrap.pypa.io/get-pip.py location. Features -------- - Introduce a new --prefer-binary flag, to prefer older wheels over newer source packages. (#3785) - Improve autocompletion function on file name completion after options which have ````, ```` or ```` as metavar. (#4842, #5125) - Add support for installing PEP 518 build dependencies from source. (#5229) - Improve status message when upgrade is skipped due to only-if-needed strategy. (#5319) Bug Fixes --------- - Update pip's self-check logic to not use a virtualenv specific file and honor cache-dir. (#3905) - Remove compiled pyo files for wheel packages. (#4471) - Speed up printing of newly installed package versions. (#5127) - Restrict install time dependency warnings to directly-dependant packages. (#5196, #5457) Warning about the entire package set has resulted in users getting confused as to why pip is printing these warnings. - Improve handling of PEP 518 build requirements: support environment markers and extras. (#5230, #5265) - Remove username/password from log message when using index with basic auth. (#5249) - Remove trailing os.sep from PATH directories to avoid false negatives. (#5293) - Fix "pip wheel pip" being blocked by the "don't use pip to modify itself" check. (#5311, #5312) - Disable pip's version check (and upgrade message) when installed by a different package manager. (#5346) This works better with Linux distributions where pip's upgrade message may result in users running pip in a manner that modifies files that should be managed by the OS's package manager. - Check for file existence and unlink first when clobbering existing files during a wheel install. (#5366) - Improve error message to be more specific when no files are found as listed in as listed in PKG-INFO. (#5381) - Always read ``pyproject.toml`` as UTF-8. This fixes Unicode handling on Windows and Python 2. (#5482) - Fix a crash that occurs when PATH not set, while generating script location warning. (#5558) - Disallow packages with ``pyproject.toml`` files that have an empty build-system table. (#5627) Vendored Libraries ------------------ - Update CacheControl to 0.12.5. - Update certifi to 2018.4.16. - Update distro to 1.3.0. - Update idna to 2.7. - Update ipaddress to 1.0.22. - Update pkg_resources to 39.2.0 (via setuptools). - Update progress to 1.4. - Update pytoml to 0.1.16. - Update requests to 2.19.1. - Update urllib3 to 1.23. Improved Documentation ---------------------- - Document how to use pip with a proxy server. (#512, #5574) - Document that the output of pip show is in RFC-compliant mail header format. (#5261) 10.0.1 (2018-04-19) =================== Features -------- - Switch the default repository to the new "PyPI 2.0" running at https://pypi.org/. (#5214) Bug Fixes --------- - Fix a bug that made get-pip.py unusable on Windows without renaming. (#5219) - Fix a TypeError when loading the cache on older versions of Python 2.7. (#5231) - Fix and improve error message when EnvironmentError occurs during installation. (#5237) - A crash when reinstalling from VCS requirements has been fixed. (#5251) - Fix PEP 518 support when pip is installed in the user site. (#5524) Vendored Libraries ------------------ - Upgrade distlib to 0.2.7 10.0.0 (2018-04-14) =================== Bug Fixes --------- - Prevent false-positive installation warnings due to incomplete name normalization. (#5134) - Fix issue where installing from Git with a short SHA would fail. (#5140) - Accept pre-release versions when checking for conflicts with pip check or pip install. (#5141) - ``ioctl(fd, termios.TIOCGWINSZ, ...)`` needs 8 bytes of data (#5150) - Do not warn about script location when installing to the directory containing sys.executable. This is the case when 'pip install'ing without activating a virtualenv. (#5157) - Fix PEP 518 support. (#5188) - Don't warn about script locations if ``--target`` is specified. (#5203) 10.0.0b2 (2018-04-02) ===================== Bug Fixes --------- - Fixed line endings in CA Bundle - 10.0.0b1 was inadvertently released with Windows line endings. (#5131) 10.0.0b1 (2018-03-31) ===================== Deprecations and Removals ------------------------- - Removed the deprecated ``--egg`` parameter to ``pip install``. (#1749) - Removed support for uninstalling projects which have been installed using distutils. distutils installed projects do not include metadata indicating what files belong to that install and thus it is impossible to *actually* uninstall them rather than just remove the metadata saying they've been installed while leaving all of the actual files behind. (#2386) - Removed the deprecated ``--download`` option to ``pip install``. (#2643) - Removed the deprecated --(no-)use-wheel flags to ``pip install`` and ``pip wheel``. (#2699) - Removed the deprecated ``--allow-external``, ``--allow-all-external``, and ``--allow-unverified`` options. (#3070) - Switch the default for ``pip list`` to the columns format, and deprecate the legacy format. (#3654, #3686) - Deprecate support for Python 3.3. (#3796) - Removed the deprecated ``--default-vcs`` option. (#4052) - Removed the ``setup.py test`` support from our sdist as it wasn't being maintained as a supported means to run our tests. (#4203) - Dropped support for Python 2.6. (#4343) - Removed the --editable flag from pip download, as it did not make sense (#4362) - Deprecate SVN detection based on dependency links in ``pip freeze``. (#4449) - Move all of pip's APIs into the pip._internal package, properly reflecting the fact that pip does not currently have any public APIs. (#4696, #4700) Features -------- - Add `--progress-bar ` to ``pip download``, ``pip install`` and ``pip wheel`` commands, to allow selecting a specific progress indicator or, to completely suppress, (for example in a CI environment) use ``--progress-bar off```. (#2369, #2756) - Add `--no-color` to `pip`. All colored output is disabled if this flag is detected. (#2449) - pip uninstall now ignores the absence of a requirement and prints a warning. (#3016, #4642) - Improved the memory and disk efficiency of the HTTP cache. (#3515) - Support for packages specifying build dependencies in pyproject.toml (see `PEP 518 `__). Packages which specify one or more build dependencies this way will be built into wheels in an isolated environment with those dependencies installed. (#3691) - pip now supports environment variable expansion in requirement files using only ``${VARIABLE}`` syntax on all platforms. (#3728) - Allowed combinations of -q and -v to act sanely. Then we don't need warnings mentioned in the issue. (#4008) - Add `--exclude-editable` to ``pip freeze`` and ``pip list`` to exclude editable packages from installed package list. (#4015, #4016) - Improve the error message for the common ``pip install ./requirements.txt`` case. (#4127) - Add support for the new ``@ url`` syntax from PEP 508. (#4175) - Add setuptools version to the statistics sent to BigQuery. (#4209) - Report the line which caused the hash error when using requirement files. (#4227) - Add a pip config command for managing configuration files. (#4240) - Allow ``pip download`` to be used with a specific platform when ``--no-deps`` is set. (#4289) - Support build-numbers in wheel versions and support sorting with build-numbers. (#4299) - Change pip outdated to use PackageFinder in order to do the version lookup so that local mirrors in Environments that do not have Internet connections can be used as the Source of Truth for latest version. (#4336) - pip now retries on more HTTP status codes, for intermittent failures. Previously, it only retried on the standard 503. Now, it also retries on 500 (transient failures on AWS S3), 520 and 527 (transient failures on Cloudflare). (#4473) - pip now displays where it is looking for packages, if non-default locations are used. (#4483) - Display a message to run the right command for modifying pip on Windows (#4490) - Add Man Pages for pip (#4491) - Make uninstall command less verbose by default (#4493) - Switch the default upgrade strategy to be 'only-if-needed' (#4500) - Installing from a local directory or a VCS URL now builds a wheel to install, rather than running ``setup.py install``. Wheels from these sources are not cached. (#4501) - Don't log a warning when installing a dependency from Git if the name looks like a commit hash. (#4507) - pip now displays a warning when it installs scripts from a wheel outside the PATH. These warnings can be suppressed using a new --no-warn-script-location option. (#4553) - Local Packages can now be referenced using forward slashes on Windows. (#4563) - pip show learnt a new Required-by field that lists currently installed packages that depend on the shown package (#4564) - The command-line autocompletion engine ``pip show`` now autocompletes installed distribution names. (#4749) - Change documentation theme to be in line with Python Documentation (#4758) - Add auto completion of short options. (#4954) - Run 'setup.py develop' inside pep518 build environment. (#4999) - pip install now prints an error message when it installs an incompatible version of a dependency. (#5000) - Added a way to distinguish between pip installed packages and those from the system package manager in 'pip list'. Specifically, 'pip list -v' also shows the installer of package if it has that meta data. (#949) - Show install locations when list command ran with "-v" option. (#979) Bug Fixes --------- - Allow pip to work if the ``GIT_DIR`` and ``GIT_WORK_TREE`` environment variables are set. (#1130) - Make ``pip install --force-reinstall`` not require passing ``--upgrade``. (#1139) - Return a failing exit status when `pip install`, `pip download`, or `pip wheel` is called with no requirements. (#2720) - Interactive setup.py files will no longer hang indefinitely. (#2732, #4982) - Correctly reset the terminal if an exception occurs while a progress bar is being shown. (#3015) - "Support URL-encoded characters in URL credentials." (#3236) - Don't assume sys.__stderr__.encoding exists (#3356) - Fix ``pip uninstall`` when ``easy-install.pth`` lacks a trailing newline. (#3741) - Keep install options in requirements.txt from leaking. (#3763) - pip no longer passes global options from one package to later packages in the same requirement file. (#3830) - Support installing from Git refs (#3876) - Use pkg_resources to parse the entry points file to allow names with colons. (#3901) - ``-q`` specified once correctly sets logging level to WARNING, instead of CRITICAL. Use `-qqq` to have the previous behavior back. (#3994) - Shell completion scripts now use correct executable names (e.g., ``pip3`` instead of ``pip``) (#3997) - Changed vendored encodings from ``utf8`` to ``utf-8``. (#4076) - Fixes destination directory of data_files when ``pip install --target`` is used. (#4092) - Limit the disabling of requests' pyopenssl to Windows only. Fixes "SNIMissingWarning / InsecurePlatformWarning not fixable with pip 9.0 / 9.0.1" (for non-Windows) (#4098) - Support the installation of wheels with non-PEP 440 version in their filenames. (#4169) - Fall back to sys.getdefaultencoding() if locale.getpreferredencoding() returns None in `pip.utils.encoding.auto_decode`. (#4184) - Fix a bug where `SETUPTOOLS_SHIM` got called incorrectly for relative path requirements by converting relative paths to absolute paths prior to calling the shim. (#4208) - Return the latest version number in search results. (#4219) - Improve error message on permission errors (#4233) - Fail gracefully when ``/etc/image_version`` (or another distro version file) appears to exists but is not readable. (#4249) - Avoid importing setuptools in the parent pip process, to avoid a race condition when upgrading one of setuptools dependencies. (#4264) - Fix for an incorrect ``freeze`` warning message due to a package being included in multiple requirements files that were passed to ``freeze``. Instead of warning incorrectly that the package is not installed, pip now warns that the package was declared multiple times and lists the name of each requirements file that contains the package in question. (#4293) - Generalize help text for ``compile``/``no-compile`` flags. (#4316) - Handle the case when ``/etc`` is not readable by the current user by using a hardcoded list of possible names of release files. (#4320) - Fixed a ``NameError`` when attempting to catch ``FileNotFoundError`` on Python 2.7. (#4322) - Ensure USER_SITE is correctly initialised. (#4437) - Reinstalling an editable package from Git no longer assumes that the ``master`` branch exists. (#4448) - This fixes an issue where when someone who tries to use git with pip but pip can't because git is not in the path environment variable. This clarifies the error given to suggest to the user what might be wrong. (#4461) - Improve handling of text output from build tools (avoid Unicode errors) (#4486) - Fix a "No such file or directory" error when using --prefix. (#4495) - Allow commands to opt out of --require-venv. This allows pip help to work even when the environment variable PIP_REQUIRE_VIRTUALENV is set. (#4496) - Fix warning message on mismatched versions during installation. (#4655) - pip now records installed files in a deterministic manner improving reproducibility. (#4667) - Fix an issue where ``pip install -e`` on a Git url would fail to update if a branch or tag name is specified that happens to match the prefix of the current ``HEAD`` commit hash. (#4675) - Fix an issue where a variable assigned in a try clause was accessed in the except clause, resulting in an undefined variable error in the except clause. (#4811) - Use log level `info` instead of `warning` when ignoring packages due to environment markers. (#4876) - Replaced typo mistake in subversion support. (#4908) - Terminal size is now correctly inferred when using Python 3 on Windows. (#4966) - Abort if reading configuration causes encoding errors. (#4976) - Add a ``--no-user`` option and use it when installing build dependencies. (#5085) Vendored Libraries ------------------ - Upgraded appdirs to 1.4.3. - Upgraded CacheControl to 0.12.3. - Vendored certifi at 2017.7.27.1. - Vendored chardet at 3.0.4. - Upgraded colorama to 0.3.9. - Upgraded distlib to 0.2.6. - Upgraded distro to 1.2.0. - Vendored idna at idna==2.6. - Upgraded ipaddress to 1.0.18. - Vendored msgpack-python at 0.4.8. - Removed the vendored ordereddict. - Upgraded progress to 1.3. - Upgraded pyparsing to 2.2.0. - Upgraded pytoml to 0.1.14. - Upgraded requests to 2.18.4. - Upgraded pkg_resources (via setuptools) to 36.6.0. - Upgraded six to 1.11.0. - Vendored urllib3 at 1.22. - Upgraded webencodings to 0.5.1. Improved Documentation ---------------------- - Added documentation on usage of --build command line option (#4262) - (#4358) - Document how to call pip from your code, including the fact that we do not provide a Python API. (#4743) 9.0.3 (2018-03-21) ================== - Fix an error where the vendored requests was not correctly containing itself to only the internal vendored prefix. - Restore compatibility with 2.6. 9.0.2 (2018-03-16) ================== - Fallback to using SecureTransport on macOS when the linked OpenSSL is too old to support TLSv1.2. 9.0.1 (2016-11-06) ================== - Correct the deprecation message when not specifying a --format so that it uses the correct setting name (``format``) rather than the incorrect one (``list_format``). (#4058) - Fix ``pip check`` to check all available distributions and not just the local ones. (#4083) - Fix a crash on non ASCII characters from `lsb_release`. (#4062) - Fix an SyntaxError in an unused module of a vendored dependency. (#4059) - Fix UNC paths on Windows. (#4064) 9.0.0 (2016-11-02) ================== - **BACKWARD INCOMPATIBLE** Remove the attempted autodetection of requirement names from URLs, URLs must include a name via ``#egg=``. - **DEPRECATION** ``pip install --egg`` have been deprecated and will be removed in the future. This "feature" has a long list of drawbacks which break nearly all of pip's other features in subtle and hard-to-diagnose ways. - **DEPRECATION** ``--default-vcs`` option. (#4052) - **WARNING** pip 9 cache can break forward compatibility with previous pip versions if your package repository allows chunked responses. (#4078) - Add an ``--upgrade-strategy`` option to ``pip install``, to control how dependency upgrades are managed. (#3972) - Add a ``pip check`` command to check installed packages dependencies. (#3750) - Add option allowing user to abort pip operation if file/directory exists - Add Appveyor CI - Uninstall existing packages when performing an editable installation of the same packages. (#1548) - ``pip show`` is less verbose by default. ``--verbose`` prints multiline fields. (#3858) - Add optional column formatting to ``pip list``. (#3651) - Add ``--not-required`` option to ``pip list``, which lists packages that are not dependencies of other packages. - Fix builds on systems with symlinked ``/tmp`` directory for custom builds such as numpy. (#3701) - Fix regression in ``pip freeze``: when there is more than one git remote, priority is given to the remote named ``origin``. (#3708, #3616). - Fix crash when calling ``pip freeze`` with invalid requirement installed. (#3704, #3681) - Allow multiple ``--requirement`` files in ``pip freeze``. (#3703) - Implementation of pep-503 ``data-requires-python``. When this field is present for a release link, pip will ignore the download when installing to a Python version that doesn't satisfy the requirement. - ``pip wheel`` now works on editable packages too (it was only working on editable dependencies before); this allows running ``pip wheel`` on the result of ``pip freeze`` in presence of editable requirements. (#3695, #3291) - Load credentials from ``.netrc`` files. (#3715, #3569) - Add ``--platform``, ``--python-version``, ``--implementation`` and ``--abi`` parameters to ``pip download``. These allow utilities and advanced users to gather distributions for interpreters other than the one pip is being run on. (#3760) - Skip scanning virtual environments, even when venv/bin/python is a dangling symlink. - Added ``pip completion`` support for the ``fish`` shell. - Fix problems on Windows on Python 2 when username or hostname contains non-ASCII characters. (#3463, #3970, #4000) - Use ``git fetch --tags`` to fetch tags in addition to everything else that is normally fetched; this is necessary in case a git requirement url points to a tag or commit that is not on a branch. (#3791) - Normalize package names before using in ``pip show`` (#3976) - Raise when Requires-Python do not match the running version and add ``--ignore-requires-python`` option as escape hatch. (#3846) - Report the correct installed version when performing an upgrade in some corner cases. (#2382 - Add ``-i`` shorthand for ``--index`` flag in ``pip search``. - Do not optionally load C dependencies in requests. (#1840, #2930, #3024) - Strip authentication from SVN url prior to passing it to ``svn``. (#3697, #3209) - Also install in platlib with ``--target`` option. (#3694, #3682) - Restore the ability to use inline comments in requirements files passed to ``pip freeze``. (#3680) 8.1.2 (2016-05-10) ================== - Fix a regression on systems with uninitialized locale. (#3575) - Use environment markers to filter packages before determining if a required wheel is supported. (#3254) - Make glibc parsing for `manylinux1` support more robust for the variety of glibc versions found in the wild. (#3588) - Update environment marker support to fully support legacy and PEP 508 style environment markers. (#3624) - Always use debug logging to the ``--log`` file. (#3351) - Don't attempt to wrap search results for extremely narrow terminal windows. (#3655) 8.1.1 (2016-03-17) ================== - Fix regression with non-ascii requirement files on Python 2 and add support for encoding headers in requirement files. (#3548, #3547) 8.1.0 (2016-03-05) ================== - Implement PEP 513, which adds support for the manylinux1 platform tag, allowing carefully compiled binary wheels to be installed on compatible Linux platforms. - Allow wheels which are not specific to a particular Python interpreter but which are specific to a particular platform. (#3202) - Fixed an issue where ``call_subprocess`` would crash trying to print debug data on child process failure. (#3521, #3522) - Exclude the wheel package from the `pip freeze` output (like pip and setuptools). (#2989) - Allow installing modules from a subdirectory of a vcs repository in non-editable mode. (#3217, #3466) - Make pip wheel and pip download work with vcs urls with subdirectory option. (#3466) - Show classifiers in ``pip show``. - Show PEP376 Installer in ``pip show``. (#3517) - Unhide completion command. (#1810) - Show latest version number in ``pip search`` results. (#1415) - Decode requirement files according to their BOM if present. (#3485, #2865) - Fix and deprecate package name detection from url path. (#3523, #3495) - Correct the behavior where interpreter specific tags (such as cp34) were being used on later versions of the same interpreter instead of only for that specific interpreter. (#3472) - Fix an issue where pip would erroneously install a 64 bit wheel on a 32 bit Python running on a 64 bit macOS machine. - Do not assume that all git repositories have an origin remote. - Correctly display the line to add to a requirements.txt for an URL based dependency when ``--require-hashes`` is enabled. 8.0.3 (2016-02-25) ================== - Make ``install --quiet`` really quiet. (#3418) - Fix a bug when removing packages in python 3: disable INI-style parsing of the entry_point.txt file to allow entry point names with colons. (#3434) - Normalize generated script files path in RECORD files. (#3448) - Fix bug introduced in 8.0.0 where subcommand output was not shown, even when the user specified ``-v`` / ``--verbose``. (#3486) - Enable python -W with respect to PipDeprecationWarning. (#3455) - Upgrade distlib to 0.2.2. - Improved support for Jython when quoting executables in output scripts. (#3467) - Add a `--all` option to `pip freeze` to include usually skipped package (like pip, setuptools and wheel) to the freeze output. (#1610) 8.0.2 (2016-01-21) ================== - Stop attempting to trust the system CA trust store because it's extremely common for them to be broken, often in incompatible ways. (#3416) 8.0.1 (2016-01-21) ================== - Detect CAPaths in addition to CAFiles on platforms that provide them. - Installing argparse or wsgiref will no longer warn or error - pip will allow the installation even though it may be useless (since the installed thing will be shadowed by the standard library). - Upgrading a distutils installed item that is installed outside of a virtual environment, while inside of a virtual environment will no longer warn or error. - Fix a bug where pre-releases were showing up in ``pip list --outdated`` without the ``--pre`` flag. - Switch the SOABI emulation from using RuntimeWarnings to debug logging. - Rollback the removal of the ability to uninstall distutils installed items until a future date. 8.0.0 (2016-01-19) ================== - **BACKWARD INCOMPATIBLE** Drop support for Python 3.2. - **BACKWARD INCOMPATIBLE** Remove the ability to find any files other than the ones directly linked from the index or find-links pages. - **BACKWARD INCOMPATIBLE** Remove the ``--download-cache`` which had been deprecated and no-op'd in 6.0. - **BACKWARD INCOMPATIBLE** Remove the ``--log-explicit-levels`` which had been deprecated in 6.0. - **BACKWARD INCOMPATIBLE** Change pip wheel --wheel-dir default path from /wheelhouse to . - Deprecate and no-op the ``--allow-external``, ``--allow-all-external``, and ``--allow-unverified`` functionality that was added as part of PEP 438. With changes made to the repository protocol made in PEP 470, these options are no longer functional. - Allow ``--trusted-host`` within a requirements file. (#2822) - Allow ``--process-dependency-links`` within a requirements file. (#1274) - Allow ``--pre`` within a requirements file. (#1273) - Allow repository URLs with secure transports to count as trusted. (E.g., "git+ssh" is okay.) (#2811) - Implement a top-level ``pip download`` command and deprecate ``pip install --download``. - When uninstalling, look for the case of paths containing symlinked directories (#3141, #3154) - When installing, if building a wheel fails, clear up the build directory before falling back to a source install. (#3047) - Fix user directory expansion when ``HOME=/``. Workaround for Python bug https://bugs.python.org/issue14768. (#2996) - Correct reporting of requirements file line numbers. (#3009, #3125) - Fixed Exception(IOError) for ``pip freeze`` and ``pip list`` commands with subversion >= 1.7. (#1062, #3346) - Provide a spinner showing that progress is happening when installing or building a package via ``setup.py``. This will alleviate concerns that projects with unusually long build times have with pip appearing to stall. - Include the functionality of ``peep`` into pip, allowing hashes to be baked into a requirements file and ensuring that the packages being downloaded match one of those hashes. This is an additional, opt-in security measure that, when used, removes the need to trust the repository. - Fix a bug causing pip to not select a wheel compiled against an OSX SDK later than what Python itself was compiled against when running on a newer version of OSX. - Add a new ``--prefix`` option for ``pip install`` that supports wheels and sdists. (#3252) - Fixed issue regarding wheel building with setup.py using a different encoding than the system. (#2042) - Drop PasteScript specific egg_info hack. (#3270) - Allow combination of pip list options --editable with --outdated/--uptodate. (#933) - Gives VCS implementations control over saying whether a project is under their control. (#3258) - Git detection now works when ``setup.py`` is not at the Git repo root and when ``package_dir`` is used, so ``pip freeze`` works in more cases. (#3258) - Correctly freeze Git develop packages in presence of the &subdirectory option (#3258) - The detection of editable packages now relies on the presence of ``.egg-link`` instead of looking for a VCS, so ``pip list -e`` is more reliable. (#3258) - Add the ``--prefix`` flag to ``pip install`` which allows specifying a root prefix to use instead of ``sys.prefix``. (#3252) - Allow duplicate specifications in the case that only the extras differ, and union all specified extras together. (#3198) - Fix the detection of the user's current platform on OSX when determining the OSX SDK version. (#3232) - Prevent the automatically built wheels from mistakenly being used across multiple versions of Python when they may not be correctly configured for that by making the wheel specific to a specific version of Python and specific interpreter. (#3225) - Emulate the SOABI support in wheels from Python 2.x on Python 2.x as closely as we can with the information available within the interpreter. (#3075) - Don't roundtrip to the network when git is pinned to a specific commit hash and that hash already exists locally. (#3066) - Prefer wheels built against a newer SDK to wheels built against an older SDK on OSX. (#3163) - Show entry points for projects installed via wheel. (#3122) - Improve message when an unexisting path is passed to --find-links option. (#2968) - pip freeze does not add the VCS branch/tag name in the #egg=... fragment anymore. (#3312) - Warn on installation of editable if the provided #egg=name part does not match the metadata produced by `setup.py egg_info`. (#3143) - Add support for .xz files for python versions supporting them (>= 3.3). (#722) 7.1.2 (2015-08-22) ================== - Don't raise an error if pip is not installed when checking for the latest pip version. 7.1.1 (2015-08-20) ================== - Check that the wheel cache directory is writable before we attempt to write cached files to them. - Move the pip version check until *after* any installs have been performed, thus removing the extraneous warning when upgrading pip. - Added debug logging when using a cached wheel. - Respect platlib by default on platforms that have it separated from purelib. - Upgrade packaging to 15.3. - Normalize post-release spellings for rev/r prefixes. - Upgrade distlib to 0.2.1. - Updated launchers to decode shebangs using UTF-8. This allows non-ASCII pathnames to be correctly handled. - Ensured that the executable written to shebangs is normcased. - Changed ScriptMaker to work better under Jython. - Upgrade ipaddress to 1.0.13. 7.1.0 (2015-06-30) ================== - Allow constraining versions globally without having to know exactly what will be installed by the pip command. (#2731) - Accept --no-binary and --only-binary via pip.conf. (#2867) - Allow ``--allow-all-external`` within a requirements file. - Fixed an issue where ``--user`` could not be used when ``--prefix`` was used in a distutils configuration file. - Fixed an issue where the SOABI tags were not correctly being generated on Python 3.5. - Fixed an issue where we were advising windows users to upgrade by directly executing pip, when that would always fail on Windows. - Allow ``~`` to be expanded within a cache directory in all situations. 7.0.3 (2015-06-01) ================== - Fixed a regression where ``--no-cache-dir`` would raise an exception. (#2855) 7.0.2 (2015-06-01) ================== - **BACKWARD INCOMPATIBLE** Revert the change (released in v7.0.0) that required quoting in requirements files around specifiers containing environment markers. (#2841) - **BACKWARD INCOMPATIBLE** Revert the accidental introduction of support for options interleaved with requirements, version specifiers etc in ``requirements`` files. (#2841) - Expand ``~`` in the cache directory when caching wheels. (#2816) - Use ``python -m pip`` instead of ``pip`` when recommending an upgrade command to Windows users. 7.0.1 (2015-05-22) ================== - Don't build and cache wheels for non-editable installations from VCSs. - Allow ``--allow-all-external`` inside of a requirements.txt file, fixing a regression in 7.0. 7.0.0 (2015-05-21) ================== - **BACKWARD INCOMPATIBLE** Removed the deprecated ``--mirror``, ``--use-mirrors``, and ``-M`` options. - **BACKWARD INCOMPATIBLE** Removed the deprecated ``zip`` and ``unzip`` commands. - **BACKWARD INCOMPATIBLE** Removed the deprecated ``--no-install`` and ``--no-download`` options. - **BACKWARD INCOMPATIBLE** No longer implicitly support an insecure origin origin, and instead require insecure origins be explicitly trusted with the ``--trusted-host`` option. - **BACKWARD INCOMPATIBLE** Removed the deprecated link scraping that attempted to parse HTML comments for a specially formatted comment. - **BACKWARD INCOMPATIBLE** Requirements in requirements files containing markers must now be quoted due to parser changes. For example, use ``"SomeProject; python_version < '2.7'"``, not simply ``SomeProject; python_version < '2.7'`` (#2697, #2725) - `get-pip.py` now installs the "wheel" package, when it's not already installed. (#2800) - Ignores bz2 archives if Python wasn't compiled with bz2 support. (#497) - Support ``--install-option`` and ``--global-option`` per requirement in requirement files. (#2537) - Build Wheels prior to installing from sdist, caching them in the pip cache directory to speed up subsequent installs. (#2618) - Allow fine grained control over the use of wheels and source builds. (#2699) - ``--no-use-wheel`` and ``--use-wheel`` are deprecated in favour of new options ``--no-binary`` and ``--only-binary``. The equivalent of ``--no-use-wheel`` is ``--no-binary=:all:``. (#2699) - The use of ``--install-option``, ``--global-option`` or ``--build-option`` disable the use of wheels, and the autobuilding of wheels. (#2711, #2677) - Improve logging when a requirement marker doesn't match your environment. (#2735) - Removed the temporary modifications (that began in pip v1.4 when distribute and setuptools merged) that allowed distribute to be considered a conflict to setuptools. ``pip install -U setuptools`` will no longer upgrade "distribute" to "setuptools". Instead, use ``pip install -U distribute``. (#2767) - Only display a warning to upgrade pip when the newest version is a final release and it is not a post release of the version we already have installed. (#2766) - Display a warning when attempting to access a repository that uses HTTPS when we don't have Python compiled with SSL support. (#2761) - Allowing using extras when installing from a file path without requiring the use of an editable. (#2785) - Fix an infinite loop when the cache directory is stored on a file system which does not support hard links. (#2796) - Remove the implicit debug log that was written on every invocation, instead users will need to use ``--log`` if they wish to have one. (#2798) 6.1.1 (2015-04-07) ================== - No longer ignore dependencies which have been added to the standard library, instead continue to install them. 6.1.0 (2015-04-07) ================== - Fixes upgrades failing when no potential links were found for dependencies other than the current installation. (#2538, #2502) - Use a smoother progress bar when the terminal is capable of handling it, otherwise fallback to the original ASCII based progress bar. - Display much less output when `pip install` succeeds, because on success, users probably don't care about all the nitty gritty details of compiling and installing. When `pip install` fails, display the failed install output once instead of twice, because once is enough. (#2487) - Upgrade the bundled copy of requests to 2.6.0, fixing CVE-2015-2296. - Display format of latest package when using ``pip list --outdated``. (#2475) - Don't use pywin32 as ctypes should always be available on Windows, using pywin32 prevented uninstallation of pywin32 on Windows. (:pr:`2467`) - Normalize the ``--wheel-dir`` option, expanding out constructs such as ``~`` when used. (#2441) - Display a warning when an undefined extra has been requested. (#2142) - Speed up installing a directory in certain cases by creating a sdist instead of copying the entire directory. (#2535) - Don't follow symlinks when uninstalling files (#2552) - Upgrade the bundled copy of cachecontrol from 0.11.1 to 0.11.2. (#2481, #2595) - Attempt to more smartly choose the order of installation to try and install dependencies before the projects that depend on them. (#2616) - Skip trying to install libraries which are part of the standard library. (#2636, #2602) - Support arch specific wheels that are not tied to a specific Python ABI. (#2561) - Output warnings and errors to stderr instead of stdout. (#2543) - Adjust the cache dir file checks to only check ownership if the effective user is root. (#2396) - Install headers into a per project name directory instead of all of them into the root directory when inside of a virtual environment. (#2421) 6.0.8 (2015-02-04) ================== - Fix an issue where the ``--download`` flag would cause pip to no longer use randomized build directories. - Fix an issue where pip did not properly unquote quoted URLs which contain characters like PEP 440's epoch separator (``!``). - Fix an issue where distutils installed projects were not actually uninstalled and deprecate attempting to uninstall them altogether. - Retry deleting directories in case a process like an antivirus is holding the directory open temporarily. - Fix an issue where pip would hide the cursor on Windows but would not reshow it. 6.0.7 (2015-01-28) ================== - Fix a regression where Numpy requires a build path without symlinks to properly build. - Fix a broken log message when running ``pip wheel`` without a requirement. - Don't mask network errors while downloading the file as a hash failure. - Properly create the state file for the pip version check so it only happens once a week. - Fix an issue where switching between Python 3 and Python 2 would evict cached items. - Fix a regression where pip would be unable to successfully uninstall a project without a normalized version. 6.0.6 (2015-01-03) ================== - Continue the regression fix from 6.0.5 which was not a complete fix. 6.0.5 (2015-01-03) ================== - Fix a regression with 6.0.4 under Windows where most commands would raise an exception due to Windows not having the ``os.geteuid()`` function. 6.0.4 (2015-01-03) ================== - Fix an issue where ANSI escape codes would be used on Windows even though the Windows shell does not support them, causing odd characters to appear with the progress bar. - Fix an issue where using -v would cause an exception saying ``TypeError: not all arguments converted during string formatting``. - Fix an issue where using -v with dependency links would cause an exception saying ``TypeError: 'InstallationCandidate' object is not iterable``. - Fix an issue where upgrading distribute would cause an exception saying ``TypeError: expected string or buffer``. - Show a warning and disable the use of the cache directory when the cache directory is not owned by the current user, commonly caused by using ``sudo`` without the ``-H`` flag. - Update PEP 440 support to handle the latest changes to PEP 440, particularly the changes to ``>V`` and `` when the given specifier doesn't match anything. - Fix an issue where installing from a directory would not copy over certain directories which were being excluded, however some build systems rely on them. 6.0 (2014-12-22) ================ - **PROCESS** Version numbers are now simply ``X.Y`` where the leading ``1`` has been dropped. - **BACKWARD INCOMPATIBLE** Dropped support for Python 3.1. - **BACKWARD INCOMPATIBLE** Removed the bundle support which was deprecated in 1.4. (#1806) - **BACKWARD INCOMPATIBLE** File lists generated by `pip show -f` are now rooted at the location reported by show, rather than one (unstated) directory lower. (#1933) - **BACKWARD INCOMPATIBLE** The ability to install files over the FTP protocol was accidentally lost in pip 1.5 and it has now been decided to not restore that ability. - **BACKWARD INCOMPATIBLE** PEP 440 is now fully implemented, this means that in some cases versions will sort differently or version specifiers will be interpreted differently than previously. The common cases should all function similarly to before. - **DEPRECATION** ``pip install --download-cache`` and ``pip wheel --download-cache`` command line flags have been deprecated and the functionality removed. Since pip now automatically configures and uses it's internal HTTP cache which supplants the ``--download-cache`` the existing options have been made non functional but will still be accepted until their removal in pip v8.0. For more information please see https://pip.pypa.io/en/stable/reference/pip_install.html#caching - **DEPRECATION** ``pip install --build`` and ``pip install --no-clean`` are now *NOT* deprecated. This reverses the deprecation that occurred in v1.5.3. (#906) - **DEPRECATION** Implicitly accessing URLs which point to an origin which is not a secure origin, instead requiring an opt-in for each host using the new ``--trusted-host`` flag (``pip install --trusted-host example.com foo``). - Allow the new ``--trusted-host`` flag to also disable TLS verification for a particular hostname. - Added a ``--user`` flag to ``pip freeze`` and ``pip list`` to check the user site directory only. - Silence byte compile errors when installation succeed. (#1873) - Added a virtualenv-specific configuration file. (#1364) - Added site-wide configuration files. (1978) - Added an automatic check to warn if there is an updated version of pip available. (#2049) - `wsgiref` and `argparse` (for >py26) are now excluded from `pip list` and `pip freeze`. (#1606, #1369) - Add ``--client-cert`` option for SSL client certificates. (#1424) - `pip show --files` was broken for wheel installs. (#1635, #1484) - install_lib should take precedence when reading distutils config. (#1642, #1641) - Send `Accept-Encoding: identity` when downloading files in an attempt to convince some servers who double compress the downloaded file to stop doing so. (#1688) - Stop breaking when given pip commands in uppercase (#1559, #1725) - pip no longer adds duplicate logging consumers, so it won't create duplicate output when being called multiple times. (#1618, #1723) - `pip wheel` now returns an error code if any wheels fail to build. (#1769) - `pip wheel` wasn't building wheels for dependencies of editable requirements. (#1775) - Allow the use of ``--no-use-wheel`` within a requirements file. (#1859) - Attempt to locate system TLS certificates to use instead of the included CA Bundle if possible. (#1680, #1866) - Allow use of Zip64 extension in Wheels and other zip files. (#1319, #1868) - Properly handle an index or --find-links target which has a without a href attribute. (#1101, #1869) - Properly handle extras when a project is installed via Wheel. (#1885, #1896) - Added support to respect proxies in ``pip search``. (#1180, #932, #1104, #1902) - `pip install --download` works with vcs links. (#798, #1060, #1926) - Disabled warning about insecure index host when using localhost. Based off of Guy Rozendorn's work in #1718. (#1456, #1967) - Allow the use of OS standard user configuration files instead of ones simply based around ``$HOME``. (#2021) - When installing directly from wheel paths or urls, previous versions were not uninstalled. (#1825, #804, #1838) - Detect the location of the ``.egg-info`` directory by looking for any file located inside of it instead of relying on the record file listing a directory. (#2075, #2076) - Use a randomized and secure default build directory when possible. (#1964, #1935, #676, #2122, CVE-2014-8991) - Support environment markers in requirements.txt files. (#1433, #2134) - Automatically retry failed HTTP requests by default. (#1444, #2147) - Handle HTML Encoding better using a method that is more similar to how browsers handle it. (#1100, #1874) - Reduce the verbosity of the pip command by default. (#2175, #2177, #2178) - Fixed :issue:`2031` - Respect sys.executable on OSX when installing from Wheels. - Display the entire URL of the file that is being downloaded when downloading from a non PyPI repository. (#2183) - Support setuptools style environment markers in a source distribution. (#2153) 1.5.6 (2014-05-16) ================== - Upgrade requests to 2.3.0 to fix an issue with proxies on Python 3.4.1. (#1821) 1.5.5 (2014-05-03) ================== - Uninstall issues on debianized pypy, specifically issues with setuptools upgrades. (#1632, #1743) - Update documentation to point at https://bootstrap.pypa.io/get-pip.py for bootstrapping pip. - Update docs to point to https://pip.pypa.io/ - Upgrade the bundled projects (distlib==0.1.8, html5lib==1.0b3, six==1.6.1, colorama==0.3.1, setuptools==3.4.4). 1.5.4 (2014-02-21) ================== - Correct deprecation warning for ``pip install --build`` to only notify when the `--build` value is different than the default. 1.5.3 (2014-02-20) ================== - **DEPRECATION** ``pip install --build`` and ``pip install --no-clean`` are now deprecated. (#906) - Fixed being unable to download directly from wheel paths/urls, and when wheel downloads did occur using requirement specifiers, dependencies weren't downloaded. (#1112, #1527) - ``pip wheel`` was not downloading wheels that already existed. (#1320, #1524) - ``pip install --download`` was failing using local ``--find-links``. (#1111, #1524) - Workaround for Python bug https://bugs.python.org/issue20053. (#1544) - Don't pass a unicode __file__ to setup.py on Python 2.x. (#1583) - Verify that the Wheel version is compatible with this pip. (#1569) 1.5.2 (2014-01-26) ================== - Upgraded the vendored ``pkg_resources`` and ``_markerlib`` to setuptools 2.1. - Fixed an error that prevented accessing PyPI when pyopenssl, ndg-httpsclient, and pyasn1 are installed. - Fixed an issue that caused trailing comments to be incorrectly included as part of the URL in a requirements file. 1.5.1 (2014-01-20) ================== - pip now only requires setuptools (any setuptools, not a certain version) when installing distributions from src (i.e. not from wheel). (#1434) - `get-pip.py` now installs setuptools, when it's not already installed. (#1475) - Don't decode downloaded files that have a ``Content-Encoding`` header. (#1435) - Fix to correctly parse wheel filenames with single digit versions. (#1445) - If `--allow-unverified` is used assume it also means `--allow-external`. (#1457) 1.5 (2014-01-01) ================ - **BACKWARD INCOMPATIBLE** pip no longer supports the ``--use-mirrors``, ``-M``, and ``--mirrors`` flags. The mirroring support has been removed. In order to use a mirror specify it as the primary index with ``-i`` or ``--index-url``, or as an additional index with ``--extra-index-url``. (#1098, CVE-2013-5123) - **BACKWARD INCOMPATIBLE** pip no longer will scrape insecure external urls by default nor will it install externally hosted files by default. Users may opt into installing externally hosted or insecure files or urls using ``--allow-external PROJECT`` and ``--allow-unverified PROJECT``. (#1055) - **BACKWARD INCOMPATIBLE** pip no longer respects dependency links by default. Users may opt into respecting them again using ``--process-dependency-links``. - **DEPRECATION** ``pip install --no-install`` and ``pip install --no-download`` are now formally deprecated. See #906 for discussion on possible alternatives, or lack thereof, in future releases. - **DEPRECATION** ``pip zip`` and ``pip unzip`` are now formally deprecated. - pip will now install Mac OSX platform wheels from PyPI. (:pr:`1278`) - pip now generates the appropriate platform-specific console scripts when installing wheels. (#1251) - pip now confirms a wheel is supported when installing directly from a path or url. (#1315) - ``--ignore-installed`` now behaves again as designed, after it was unintentionally broke in v0.8.3 when fixing #14. (#1097, #1352) - Fixed a bug where global scripts were being removed when uninstalling --user installed packages. (#1353) - ``--user`` wasn't being respected when installing scripts from wheels. (#1163, #1176) - Assume '_' means '-' in versions from wheel filenames. (#1150, #1158) - Error when using --log with a failed install. (#219, #1205) - Fixed logging being buffered and choppy in Python 3. (#1131) - Don't ignore --timeout. (#70, #1202) - Fixed an error when setting PIP_EXISTS_ACTION. (#772, #1201) - Added colors to the logging output in order to draw attention to important warnings and errors. (#1109) - Added warnings when using an insecure index, find-link, or dependency link. (#1121) - Added support for installing packages from a subdirectory using the ``subdirectory`` editable option. (#1082) - Fixed "TypeError: bad operand type for unary" in some cases when installing wheels using --find-links. (#1192, #1218) - Archive contents are now written based on system defaults and umask (i.e. permissions are not preserved), except that regular files with any execute permissions have the equivalent of "chmod +x" applied after being written. (#1133, #317, #1146) - PreviousBuildDirError now returns a non-zero exit code and prevents the previous build dir from being cleaned in all cases. (#1162) - Renamed --allow-insecure to --allow-unverified, however the old name will continue to work for a period of time. (#1257) - Fixed an error when installing local projects with symlinks in Python 3. (#1006, #1311) - The previously hidden ``--log-file`` option, is now shown as a general option. (#1316) 1.4.1 (2013-08-07) ================== - **New Signing Key** Release 1.4.1 is using a different key than normal with fingerprint: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA - Fixed issues with installing from pybundle files. (#1116) - Fixed error when sysconfig module throws an exception. (#1095) - Don't ignore already installed pre-releases. (#1076) - Fixes related to upgrading setuptools. (#1092) - Fixes so that --download works with wheel archives. (#1113) - Fixes related to recognizing and cleaning global build dirs. (#1080) 1.4 (2013-07-23) ================ - **BACKWARD INCOMPATIBLE** pip now only installs stable versions by default, and offers a new ``--pre`` option to also find pre-release and development versions. (#834) - **BACKWARD INCOMPATIBLE** Dropped support for Python 2.5. The minimum supported Python version for pip 1.4 is Python 2.6. - Added support for installing and building wheel archives. Thanks Daniel Holth, Marcus Smith, Paul Moore, and Michele Lacchia (#845) - Applied security patch to pip's ssl support related to certificate DNS wildcard matching (https://bugs.python.org/issue17980). - To satisfy pip's setuptools requirement, pip now recommends setuptools>=0.8, not distribute. setuptools and distribute are now merged into one project called 'setuptools'. (#1003) - pip will now warn when installing a file that is either hosted externally to the index or cannot be verified with a hash. In the future pip will default to not installing them and will require the flags --allow-external NAME, and --allow-insecure NAME respectively. (#985) - If an already-downloaded or cached file has a bad hash, re-download it rather than erroring out. (#963) - ``pip bundle`` and support for installing from pybundle files is now considered deprecated and will be removed in pip v1.5. - Fix a number of issues related to cleaning up and not reusing build directories. (#413, #709, #634, #602, #939, #865, #948) - Added a User Agent so that pip is identifiable in logs. (#901) - Added ssl and --user support to get-pip.py. Thanks Gabriel de Perthuis. (#895) - Fixed the proxy support, which was broken in pip 1.3.x (#840) - Fixed pip failing when server does not send content-type header. Thanks Hugo Lopes Tavares and Kelsey Hightower. (#32, #872) - "Vendorized" distlib as pip.vendor.distlib (https://distlib.readthedocs.io/). - Fixed git VCS backend with git 1.8.3. (#967) 1.3.1 (2013-03-08) ================== - Fixed a major backward incompatible change of parsing URLs to externally hosted packages that got accidentally included in 1.3. 1.3 (2013-03-07) ================ - SSL Cert Verification; Make https the default for PyPI access. Thanks James Cleveland, Giovanni Bajo, Marcus Smith and many others. (#791, CVE-2013-1629) - Added "pip list" for listing installed packages and the latest version available. Thanks Rafael Caricio, Miguel Araujo, Dmitry Gladkov. (#752) - Fixed security issues with pip's use of temp build directories. Thanks David (d1b) and Thomas Guttler. (#780, CVE-2013-1888) - Improvements to sphinx docs and cli help. (#773) - Fixed an issue dealing with macOS temp dir handling, which was causing global NumPy installs to fail. (#707, #768) - Split help output into general vs command-specific option groups. Thanks Georgi Valkov. (#744, #721) - Fixed dependency resolution when installing from archives with uppercase project names. (#724) - Fixed problem where re-installs always occurred when using file:// find-links. (#683, #702) - "pip install -v" now shows the full download url, not just the archive name. Thanks Marc Abramowitz (#687) - Fix to prevent unnecessary PyPI redirects. Thanks Alex Gronholm (#695) - Fixed an install failure under Python 3 when the same version of a package is found under 2 different URLs. Thanks Paul Moore (#670, #671) - Fix git submodule recursive updates. Thanks Roey Berman. (#674) - Explicitly ignore rel='download' links while looking for html pages. Thanks Maxime R. (#677) - --user/--upgrade install options now work together. Thanks 'eevee' for discovering the problem. (#705) - Added check in ``install --download`` to prevent re-downloading if the target file already exists. Thanks Andrey Bulgakov. (#669) - Added support for bare paths (including relative paths) as argument to `--find-links`. Thanks Paul Moore for draft patch. - Added support for --no-index in requirements files. - Added "pip show" command to get information about an installed package. Thanks Kelsey Hightower and Rafael Caricio. (#131) - Added `--root` option for "pip install" to specify root directory. Behaves like the same option in distutils but also plays nice with pip's egg-info. Thanks Przemek Wrzos. (#253, #693) 1.2.1 (2012-09-06) ================== - Fixed a regression introduced in 1.2 about raising an exception when not finding any files to uninstall in the current environment. Thanks for the fix, Marcus Smith. 1.2 (2012-09-01) ================ - **Dropped support for Python 2.4** The minimum supported Python version is now Python 2.5. - Fixed PyPI mirror support being broken on some DNS responses. Thanks philwhin. (#605) - Fixed pip uninstall removing files it didn't install. Thanks pjdelport. (#355) - Fixed a number of issues related to improving support for the user installation scheme. Thanks Marcus Smith. (#493, #494, #440, #573) - Write failure log to temp file if default location is not writable. Thanks andreigc. - Pull in submodules for git editable checkouts. Thanks Hsiaoming Yang and Markus Hametner. (#289, #421) - Use a temporary directory as the default build location outside of a virtualenv. Thanks Ben Rosser. (#339, #381) - Added support for specifying extras with local editables. Thanks Nick Stenning. - Added ``--egg`` flag to request egg-style rather than flat installation. Thanks Kamal Bin Mustafa. (#3) - Prevent e.g. ``gmpy2-2.0.tar.gz`` from matching a request to ``pip install gmpy``; sdist filename must begin with full project name followed by a dash. Thanks casevh for the report. (#510) - Allow package URLS to have querystrings. Thanks W. Trevor King. (#504) - pip freeze now falls back to non-editable format rather than blowing up if it can't determine the origin repository of an editable. Thanks Rory McCann. (#58) - Added a `__main__.py` file to enable `python -m pip` on Python versions that support it. Thanks Alexey Luchko. - Fixed upgrading from VCS url of project that does exist on index. Thanks Andrew Knapp for the report. (#487) - Fix upgrade from VCS url of project with no distribution on index. Thanks Andrew Knapp for the report. (#486) - Add a clearer error message on a malformed VCS url. Thanks Thomas Fenzl. (#427) - Added support for using any of the built in guaranteed algorithms in ``hashlib`` as a checksum hash. - Raise an exception if current working directory can't be found or accessed. (#321) - Removed special casing of the user directory and use the Python default instead. (#82) - Only warn about version conflicts if there is actually one. This re-enables using ``==dev`` in requirements files. (#436) - Moved tests to be run on Travis CI: https://travis-ci.org/pypa/pip - Added a better help formatter. 1.1 (2012-02-16) ================ - Don't crash when a package's setup.py emits UTF-8 and then fails. Thanks Marc Abramowitz. (#326) - Added ``--target`` option for installing directly to arbitrary directory. Thanks Stavros Korokithakis. - Added support for authentication with Subversion repositories. Thanks Qiangning Hong. - ``--download`` now downloads dependencies as well. Thanks Qiangning Hong. (#315) - Errors from subprocesses will display the current working directory. Thanks Antti Kaihola. - Fixed compatibility with Subversion 1.7. Thanks Qiangning Hong. Note that setuptools remains incompatible with Subversion 1.7; to get the benefits of pip's support you must use Distribute rather than setuptools. (#369) - Ignore py2app-generated macOS mpkg zip files in finder. Thanks Rene Dudfield. (#57) - Log to ~/Library/Logs/ by default on macOS framework installs. Thanks Dan Callahan for report and patch. (#182) - Understand version tags without minor version ("py3") in sdist filenames. Thanks Stuart Andrews for report and Olivier Girardot for patch. (#310) - pip now supports optionally installing setuptools "extras" dependencies; e.g. "pip install Paste[openid]". Thanks Matt Maker and Olivier Girardot. (#7) - freeze no longer borks on requirements files with --index-url or --find-links. Thanks Herbert Pfennig. (#391) - Handle symlinks properly. Thanks lebedov for the patch. (#288) - pip install -U no longer reinstalls the same versions of packages. Thanks iguananaut for the pull request. (#49) - Removed ``-E``/``--environment`` option and ``PIP_RESPECT_VIRTUALENV``; both use a restart-in-venv mechanism that's broken, and neither one is useful since every virtualenv now has pip inside it. Replace ``pip -E path/to/venv install Foo`` with ``virtualenv path/to/venv && path/to/venv/pip install Foo``. - Fixed pip throwing an IndexError when it calls `scraped_rel_links`. (#366) - pip search should set and return a useful shell status code. (#22) - Added global ``--exists-action`` command line option to easier script file exists conflicts, e.g. from editable requirements from VCS that have a changed repo URL. (#351, #365) 1.0.2 (2011-07-16) ================== - Fixed docs issues. - Reinstall a package when using the ``install -I`` option. (#295) - Finds a Git tag pointing to same commit as origin/master. (#283) - Use absolute path for path to docs in setup.py. (#279) - Correctly handle exceptions on Python3. (#314) - Correctly parse ``--editable`` lines in requirements files. (#320) 1.0.1 (2011-04-30) ================== - Start to use git-flow. - `find_command` should not raise AttributeError. (#274) - Respect Content-Disposition header. Thanks Bradley Ayers. (#273) - pathext handling on Windows. (#233) - svn+svn protocol. (#252) - multiple CLI searches. (#44) - Current working directory when running setup.py clean. (#266) 1.0 (2011-04-04) ================ - Added Python 3 support! Huge thanks to Vinay Sajip, Vitaly Babiy, Kelsey Hightower, and Alex Gronholm, among others. - Download progress only shown on a real TTY. Thanks Alex Morega. - Fixed finding of VCS binaries to not be fooled by same-named directories. Thanks Alex Morega. - Fixed uninstall of packages from system Python for users of Debian/Ubuntu python-setuptools package (workaround until fixed in Debian and Ubuntu). - Added `get-pip.py `_ installer. Simply download and execute it, using the Python interpreter of your choice:: $ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py $ python get-pip.py This may have to be run as root. .. note:: Make sure you have `distribute `_ installed before using the installer! 0.8.3 ===== - Moved main repository to GitHub: https://github.com/pypa/pip - Transferred primary maintenance from Ian to Jannis Leidel, Carl Meyer, Brian Rosner - Fixed no uninstall-on-upgrade with URL package. Thanks Oliver Tonnhofer. (#14) - Fixed egg name not properly resolving. Thanks Igor Sobreira. (#163) - Fixed Non-alphabetical installation of requirements. Thanks Igor Sobreira. (#178) - Fixed documentation mentions --index instead of --index-url. Thanks Kelsey Hightower (#199) - rmtree undefined in mercurial.py. Thanks Kelsey Hightower. (#204) - Fixed bug in Git vcs backend that would break during reinstallation. - Fixed bug in Mercurial vcs backend related to pip freeze and branch/tag resolution. - Fixed bug in version string parsing related to the suffix "-dev". 0.8.2 ===== - Avoid redundant unpacking of bundles (from pwaller) - Fixed checking out the correct tag/branch/commit when updating an editable Git requirement. (#32, #150, #161) - Added ability to install version control requirements without making them editable, e.g.:: pip install git+https://github.com/pypa/pip/ (#49) - Correctly locate build and source directory on macOS. (#175) - Added ``git+https://`` scheme to Git VCS backend. 0.8.1 ===== - Added global --user flag as shortcut for --install-option="--user". From Ronny Pfannschmidt. - Added support for `PyPI mirrors `_ as defined in `PEP 381 `_, from Jannis Leidel. - Fixed git revisions being ignored. Thanks John-Scott Atlakson. (#138) - Fixed initial editable install of github package from a tag failing. Thanks John-Scott Atlakson. (#95) - Fixed installing if a directory in cwd has the same name as the package you're installing. (#107) - --install-option="--prefix=~/.local" ignored with -e. Thanks Ronny Pfannschmidt and Wil Tan. (#39) 0.8 === - Track which ``build/`` directories pip creates, never remove directories it doesn't create. From Hugo Lopes Tavares. - pip now accepts file:// index URLs. Thanks Dave Abrahams. - Various cleanup to make test-running more consistent and less fragile. Thanks Dave Abrahams. - Real Windows support (with passing tests). Thanks Dave Abrahams. - ``pip-2.7`` etc. scripts are created (Python-version specific scripts) - ``contrib/build-standalone`` script creates a runnable ``.zip`` form of pip, from Jannis Leidel - Editable git repos are updated when reinstalled - Fix problem with ``--editable`` when multiple ``.egg-info/`` directories are found. - A number of VCS-related fixes for ``pip freeze``, from Hugo Lopes Tavares. - Significant test framework changes, from Hugo Lopes Tavares. 0.7.2 ===== - Set zip_safe=False to avoid problems some people are encountering where pip is installed as a zip file. 0.7.1 ===== - Fixed opening of logfile with no directory name. Thanks Alexandre Conrad. - Temporary files are consistently cleaned up, especially after installing bundles, also from Alex Conrad. - Tests now require at least ScriptTest 1.0.3. 0.7 === - Fixed uninstallation on Windows - Added ``pip search`` command. - Tab-complete names of installed distributions for ``pip uninstall``. - Support tab-completion when there is a global-option before the subcommand. - Install header files in standard (scheme-default) location when installing outside a virtualenv. Install them to a slightly more consistent non-standard location inside a virtualenv (since the standard location is a non-writable symlink to the global location). - pip now logs to a central location by default (instead of creating ``pip-log.txt`` all over the place) and constantly overwrites the file in question. On Unix and macOS this is ``'$HOME/.pip/pip.log'`` and on Windows it's ``'%HOME%\\pip\\pip.log'``. You are still able to override this location with the ``$PIP_LOG_FILE`` environment variable. For a complete (appended) logfile use the separate ``'--log'`` command line option. - Fixed an issue with Git that left an editable package as a checkout of a remote branch, even if the default behaviour would have been fine, too. - Fixed installing from a Git tag with older versions of Git. - Expand "~" in logfile and download cache paths. - Speed up installing from Mercurial repositories by cloning without updating the working copy multiple times. - Fixed installing directly from directories (e.g. ``pip install path/to/dir/``). - Fixed installing editable packages with ``svn+ssh`` URLs. - Don't print unwanted debug information when running the freeze command. - Create log file directory automatically. Thanks Alexandre Conrad. - Make test suite easier to run successfully. Thanks Dave Abrahams. - Fixed "pip install ." and "pip install .."; better error for directory without setup.py. Thanks Alexandre Conrad. - Support Debian/Ubuntu "dist-packages" in zip command. Thanks duckx. - Fix relative --src folder. Thanks Simon Cross. - Handle missing VCS with an error message. Thanks Alexandre Conrad. - Added --no-download option to install; pairs with --no-install to separate download and installation into two steps. Thanks Simon Cross. - Fix uninstalling from requirements file containing -f, -i, or --extra-index-url. - Leftover build directories are now removed. Thanks Alexandre Conrad. 0.6.3 ===== - Fixed import error on Windows with regard to the backwards compatibility package 0.6.2 ===== - Fixed uninstall when /tmp is on a different filesystem. - Fixed uninstallation of distributions with namespace packages. 0.6.1 ===== - Added support for the ``https`` and ``http-static`` schemes to the Mercurial and ``ftp`` scheme to the Bazaar backend. - Fixed uninstallation of scripts installed with easy_install. - Fixed an issue in the package finder that could result in an infinite loop while looking for links. - Fixed issue with ``pip bundle`` and local files (which weren't being copied into the bundle), from Whit Morriss. 0.6 === - Add ``pip uninstall`` and uninstall-before upgrade (from Carl Meyer). - Extended configurability with config files and environment variables. - Allow packages to be upgraded, e.g., ``pip install Package==0.1`` then ``pip install Package==0.2``. - Allow installing/upgrading to Package==dev (fix "Source version does not match target version" errors). - Added command and option completion for bash and zsh. - Extended integration with virtualenv by providing an option to automatically use an active virtualenv and an option to warn if no active virtualenv is found. - Fixed a bug with pip install --download and editable packages, where directories were being set with 0000 permissions, now defaults to 755. - Fixed uninstallation of easy_installed console_scripts. - Fixed uninstallation on macOS Framework layout installs - Fixed bug preventing uninstall of editables with source outside venv. - Creates download cache directory if not existing. 0.5.1 ===== - Fixed a couple little bugs, with git and with extensions. 0.5 === - Added ability to override the default log file name (``pip-log.txt``) with the environmental variable ``$PIP_LOG_FILE``. - Made the freeze command print installed packages to stdout instead of writing them to a file. Use simple redirection (e.g. ``pip freeze > stable-req.txt``) to get a file with requirements. - Fixed problem with freezing editable packages from a Git repository. - Added support for base URLs using ```` when parsing HTML pages. - Fixed installing of non-editable packages from version control systems. - Fixed issue with Bazaar's bzr+ssh scheme. - Added --download-dir option to the install command to retrieve package archives. If given an editable package it will create an archive of it. - Added ability to pass local file and directory paths to ``--find-links``, e.g. ``--find-links=file:///path/to/my/private/archive`` - Reduced the amount of console log messages when fetching a page to find a distribution was problematic. The full messages can be found in pip-log.txt. - Added ``--no-deps`` option to install ignore package dependencies - Added ``--no-index`` option to ignore the package index (PyPI) temporarily - Fixed installing editable packages from Git branches. - Fixes freezing of editable packages from Mercurial repositories. - Fixed handling read-only attributes of build files, e.g. of Subversion and Bazaar on Windows. - When downloading a file from a redirect, use the redirected location's extension to guess the compression (happens specifically when redirecting to a bitbucket.org tip.gz file). - Editable freeze URLs now always use revision hash/id rather than tip or branch names which could move. - Fixed comparison of repo URLs so incidental differences such as presence/absence of final slashes or quoted/unquoted special characters don't trigger "ignore/switch/wipe/backup" choice. - Fixed handling of attempt to checkout editable install to a non-empty, non-repo directory. 0.4 === - Make ``-e`` work better with local hg repositories - Construct PyPI URLs the exact way easy_install constructs URLs (you might notice this if you use a custom index that is slash-sensitive). - Improvements on Windows (from `Ionel Maries Cristian `_). - Fixed problem with not being able to install private git repositories. - Make ``pip zip`` zip all its arguments, not just the first. - Fix some filename issues on Windows. - Allow the ``-i`` and ``--extra-index-url`` options in requirements files. - Fix the way bundle components are unpacked and moved around, to make bundles work. - Adds ``-s`` option to allow the access to the global site-packages if a virtualenv is to be created. - Fixed support for Subversion 1.6. 0.3.1 ===== - Improved virtualenv restart and various path/cleanup problems on win32. - Fixed a regression with installing from svn repositories (when not using ``-e``). - Fixes when installing editable packages that put their source in a subdirectory (like ``src/``). - Improve ``pip -h`` 0.3 === - Added support for editable packages created from Git, Mercurial and Bazaar repositories and ability to freeze them. Refactored support for version control systems. - Do not use ``sys.exit()`` from inside the code, instead use a return. This will make it easier to invoke programmatically. - Put the install record in ``Package.egg-info/installed-files.txt`` (previously they went in ``site-packages/install-record-Package.txt``). - Fix a problem with ``pip freeze`` not including ``-e svn+`` when an svn structure is peculiar. - Allow ``pip -E`` to work with a virtualenv that uses a different version of Python than the parent environment. - Fixed Win32 virtualenv (``-E``) option. - Search the links passed in with ``-f`` for packages. - Detect zip files, even when the file doesn't have a ``.zip`` extension and it is served with the wrong Content-Type. - Installing editable from existing source now works, like ``pip install -e some/path/`` will install the package in ``some/path/``. Most importantly, anything that package requires will also be installed by pip. - Add a ``--path`` option to ``pip un/zip``, so you can avoid zipping files that are outside of where you expect. - Add ``--simulate`` option to ``pip zip``. 0.2.1 ===== - Fixed small problem that prevented using ``pip.py`` without actually installing pip. - Fixed ``--upgrade``, which would download and appear to install upgraded packages, but actually just reinstall the existing package. - Fixed Windows problem with putting the install record in the right place, and generating the ``pip`` script with Setuptools. - Download links that include embedded spaces or other unsafe characters (those characters get %-encoded). - Fixed use of URLs in requirement files, and problems with some blank lines. - Turn some tar file errors into warnings. 0.2 === - Renamed to ``pip``, and to install you now do ``pip install PACKAGE`` - Added command ``pip zip PACKAGE`` and ``pip unzip PACKAGE``. This is particularly intended for Google App Engine to manage libraries to stay under the 1000-file limit. - Some fixes to bundles, especially editable packages and when creating a bundle using unnamed packages (like just an svn repository without ``#egg=Package``). 0.1.4 ===== - Added an option ``--install-option`` to pass options to pass arguments to ``setup.py install`` - ``.svn/`` directories are no longer included in bundles, as these directories are specific to a version of svn -- if you build a bundle on a system with svn 1.5, you can't use the checkout on a system with svn 1.4. Instead a file ``svn-checkout.txt`` is included that notes the original location and revision, and the command you can use to turn it back into an svn checkout. (Probably unpacking the bundle should, maybe optionally, recreate this information -- but that is not currently implemented, and it would require network access.) - Avoid ambiguities over project name case, where for instance MyPackage and mypackage would be considered different packages. This in particular caused problems on Macs, where ``MyPackage/`` and ``mypackage/`` are the same directory. - Added support for an environmental variable ``$PIP_DOWNLOAD_CACHE`` which will cache package downloads, so future installations won't require large downloads. Network access is still required, but just some downloads will be avoided when using this. 0.1.3 ===== - Always use ``svn checkout`` (not ``export``) so that ``tag_svn_revision`` settings give the revision of the package. - Don't update checkouts that came from ``.pybundle`` files. 0.1.2 ===== - Improve error text when there are errors fetching HTML pages when seeking packages. - Improve bundles: include empty directories, make them work with editable packages. - If you use ``-E env`` and the environment ``env/`` doesn't exist, a new virtual environment will be created. - Fix ``dependency_links`` for finding packages. 0.1.1 ===== - Fixed a NameError exception when running pip outside of a virtualenv environment. - Added HTTP proxy support (from Prabhu Ramachandran) - Fixed use of ``hashlib.md5`` on python2.5+ (also from Prabhu Ramachandran) 0.1 === - Initial release ================================================ FILE: README.rst ================================================ pip - The Python Package Installer ================================== .. |pypi-version| image:: https://img.shields.io/pypi/v/pip.svg :target: https://pypi.org/project/pip/ :alt: PyPI .. |python-versions| image:: https://img.shields.io/pypi/pyversions/pip :target: https://pypi.org/project/pip :alt: PyPI - Python Version .. |docs-badge| image:: https://readthedocs.org/projects/pip/badge/?version=latest :target: https://pip.pypa.io/en/latest :alt: Documentation |pypi-version| |python-versions| |docs-badge| pip is the `package installer`_ for Python. You can use pip to install packages from the `Python Package Index`_ and other indexes. Please take a look at our documentation for how to install and use pip: * `Installation`_ * `Usage`_ We release updates regularly, with a new version every 3 months. Find more details in our documentation: * `Release notes`_ * `Release process`_ If you find bugs, need help, or want to talk to the developers, please use our mailing lists or chat rooms: * `Issue tracking`_ * `Discourse channel`_ * `User IRC`_ If you want to get involved, head over to GitHub to get the source code, look at our development documentation and feel free to jump on the developer mailing lists and chat rooms: * `GitHub page`_ * `Development documentation`_ * `Development IRC`_ Code of Conduct --------------- Everyone interacting in the pip project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_. .. _package installer: https://packaging.python.org/guides/tool-recommendations/ .. _Python Package Index: https://pypi.org .. _Installation: https://pip.pypa.io/en/stable/installation/ .. _Usage: https://pip.pypa.io/en/stable/ .. _Release notes: https://pip.pypa.io/en/stable/news.html .. _Release process: https://pip.pypa.io/en/latest/development/release-process/ .. _GitHub page: https://github.com/pypa/pip .. _Development documentation: https://pip.pypa.io/en/latest/development .. _Issue tracking: https://github.com/pypa/pip/issues .. _Discourse channel: https://discuss.python.org/c/packaging .. _User IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa .. _Development IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev .. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md ================================================ FILE: SECURITY.md ================================================ # Security Policy ## Reporting a Vulnerability Please read the guidelines on reporting security issues [on the official website](https://www.python.org/dev/security/) for instructions on how to report a security-related problem to the Python Security Response Team responsibly. To reach the response team, email `security at python dot org`. ================================================ FILE: build-project/.python-version ================================================ 3.12 ================================================ FILE: build-project/build-project.py ================================================ #!/usr/bin/env python3 """Build pip using pinned build requirements.""" import subprocess import tempfile import venv from os import PathLike from pathlib import Path from types import SimpleNamespace from typing import Union class EnvBuilder(venv.EnvBuilder): """A subclass of venv.EnvBuilder that exposes the python executable command.""" def ensure_directories( self, env_dir: Union[str, bytes, "PathLike[str]", "PathLike[bytes]"] ) -> SimpleNamespace: context = super().ensure_directories(env_dir) self.env_exec_cmd = context.env_exec_cmd return context def get_git_head_timestamp() -> str: return subprocess.run( [ "git", "log", "-1", "--pretty=format:%ct", ], text=True, stdout=subprocess.PIPE, ).stdout.strip() def main() -> None: with tempfile.TemporaryDirectory() as build_env: env_builder = EnvBuilder(with_pip=True) # If this venv creation step fails, you may be hitting # https://github.com/astral-sh/python-build-standalone/issues/381 # Try running with a another Python distribution. env_builder.create(build_env) subprocess.run( [ env_builder.env_exec_cmd, "-Im", "pip", "install", "--no-deps", "--only-binary=:all:", "--require-hashes", "-r", Path(__file__).parent / "build-requirements.txt", ], check=True, ) subprocess.run( [ env_builder.env_exec_cmd, "-Im", "build", "--no-isolation", ], check=True, env={"SOURCE_DATE_EPOCH": get_git_head_timestamp()}, cwd=Path(__file__).parent.parent, ) if __name__ == "__main__": main() ================================================ FILE: build-project/build-requirements.in ================================================ build flit-core ================================================ FILE: build-project/build-requirements.txt ================================================ # # This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --allow-unsafe --generate-hashes build-requirements.in # build==1.4.0 \ --hash=sha256:6a07c1b8eb6f2b311b96fcbdbce5dab5fe637ffda0fd83c9cac622e927501596 \ --hash=sha256:f1b91b925aa322be454f8330c6fb48b465da993d1e7e7e6fa35027ec49f3c936 # via -r build-requirements.in flit-core==3.12.0 \ --hash=sha256:18f63100d6f94385c6ed57a72073443e1a71a4acb4339491615d0f16d6ff01b2 \ --hash=sha256:e7a0304069ea895172e3c7bb703292e992c5d1555dd1233ab7b5621b5b69e62c # via -r build-requirements.in packaging==25.0 \ --hash=sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484 \ --hash=sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f # via build pyproject-hooks==1.2.0 \ --hash=sha256:1e859bd5c40fae9448642dd871adf459e5e2084186e8d2c2a79a824c970da1f8 \ --hash=sha256:9e5c6bfa8dcc30091c74b0cf803c81fdd29d94f01992a7707bc97babb1141913 # via build ================================================ FILE: docs/html/cli/index.md ================================================ # Commands The general options that apply to all the commands listed below can be found [under the `pip` page in this section](pip). ```{toctree} :maxdepth: 1 :hidden: pip ``` ```{toctree} :maxdepth: 1 :caption: Environment Management and Introspection pip_install pip_uninstall pip_inspect pip_list pip_show pip_freeze pip_check ``` ```{toctree} :maxdepth: 1 :caption: Resolving dependencies pip_lock ``` ```{toctree} :maxdepth: 1 :caption: Handling Distribution Files pip_download pip_wheel pip_hash ``` ```{toctree} :maxdepth: 1 :caption: Package Index information pip_search pip_index ``` ```{toctree} :maxdepth: 1 :caption: Managing pip itself pip_cache pip_config pip_debug ``` ================================================ FILE: docs/html/cli/pip.rst ================================================ === pip === Usage ***** .. tab:: Unix/macOS .. code-block:: shell python -m pip [options] .. tab:: Windows .. code-block:: shell py -m pip [options] Description *********** .. _`Logging`: Logging ======= Console logging ~~~~~~~~~~~~~~~ pip offers :ref:`-v, --verbose <--verbose>` and :ref:`-q, --quiet <--quiet>` to control the console log level. By default, some messages (error and warnings) are colored in the terminal. If you want to suppress the colored output use :ref:`--no-color <--no-color>`. .. _`FileLogging`: File logging ~~~~~~~~~~~~ pip offers the :ref:`--log <--log>` option for specifying a file where a maximum verbosity log will be kept. This option is empty by default. This log appends to previous logging. Like all pip options, ``--log`` can also be set as an environment variable, or placed into the pip config file. See the :doc:`../topics/configuration` section. .. _`exists-action`: --exists-action option ====================== This option specifies default behavior when path already exists. Possible cases: downloading files or checking out repositories for installation, creating archives. If ``--exists-action`` is not defined, pip will prompt when decision is needed. *(s)witch* Only relevant to VCS checkout. Attempt to switch the checkout to the appropriate URL and/or revision. *(i)gnore* Abort current operation (e.g. don't copy file, don't create archive, don't modify a checkout). *(w)ipe* Delete the file or VCS checkout before trying to create, download, or checkout a new one. *(b)ackup* Rename the file or checkout to ``{name}{'.bak' * n}``, where n is some number of ``.bak`` extensions, such that the file didn't exist at some point. So the most recent backup will be the one with the largest number after ``.bak``. *(a)bort* Abort pip and return non-zero exit status. .. _`2-build-system-interface`: .. rubric:: Build System Interface This is now covered in :doc:`../reference/build-system`. .. _`General Options`: General Options *************** .. pip-general-options:: ================================================ FILE: docs/html/cli/pip_cache.rst ================================================ .. _`pip cache`: pip cache --------- Usage ***** .. tab:: Unix/macOS .. pip-command-usage:: cache "python -m pip" .. tab:: Windows .. pip-command-usage:: cache "py -m pip" Description *********** .. pip-command-description:: cache Options ******* .. pip-command-options:: cache ================================================ FILE: docs/html/cli/pip_check.rst ================================================ .. _`pip check`: ========= pip check ========= Usage ===== .. tab:: Unix/macOS .. pip-command-usage:: check "python -m pip" .. tab:: Windows .. pip-command-usage:: check "py -m pip" Description =========== .. pip-command-description:: check Examples ======== #. If all dependencies are compatible: .. tab:: Unix/macOS .. code-block:: console $ python -m pip check No broken requirements found. $ echo $? 0 .. tab:: Windows .. code-block:: console C:\> py -m pip check No broken requirements found. C:\> echo %errorlevel% 0 #. If a package is missing: .. tab:: Unix/macOS .. code-block:: console $ python -m pip check pyramid 1.5.2 requires WebOb, which is not installed. $ echo $? 1 .. tab:: Windows .. code-block:: console C:\> py -m pip check pyramid 1.5.2 requires WebOb, which is not installed. C:\> echo %errorlevel% 1 #. If a package has the wrong version: .. tab:: Unix/macOS .. code-block:: console $ python -m pip check pyramid 1.5.2 has requirement WebOb>=1.3.1, but you have WebOb 0.8. $ echo $? 1 .. tab:: Windows .. code-block:: console C:\> py -m pip check pyramid 1.5.2 has requirement WebOb>=1.3.1, but you have WebOb 0.8. C:\> echo %errorlevel% 1 ================================================ FILE: docs/html/cli/pip_config.rst ================================================ .. _`pip config`: ========== pip config ========== Usage ===== .. tab:: Unix/macOS .. pip-command-usage:: config "python -m pip" .. tab:: Windows .. pip-command-usage:: config "py -m pip" Description =========== .. pip-command-description:: config Options ======= .. pip-command-options:: config ================================================ FILE: docs/html/cli/pip_debug.rst ================================================ .. _`pip debug`: ========= pip debug ========= Usage ===== .. tab:: Unix/macOS .. pip-command-usage:: debug "python -m pip" .. tab:: Windows .. pip-command-usage:: debug "py -m pip" .. warning:: This command is only meant for debugging. Its options and outputs are provisional and may change without notice. Description =========== .. pip-command-description:: debug Options ======= .. pip-command-options:: debug ================================================ FILE: docs/html/cli/pip_download.rst ================================================ .. _`pip download`: ============ pip download ============ Usage ===== .. tab:: Unix/macOS .. pip-command-usage:: download "python -m pip" .. tab:: Windows .. pip-command-usage:: download "py -m pip" Description =========== .. pip-command-description:: download Overview -------- ``pip download`` does the same resolution and downloading as ``pip install``, but instead of installing the dependencies, it collects the downloaded distributions into the directory provided (defaulting to the current directory). This directory can later be passed as the value to ``pip install --find-links`` to facilitate offline or locked down package installation. ``pip download`` with the ``--platform``, ``--python-version``, ``--implementation``, and ``--abi`` options provides the ability to fetch dependencies for an interpreter and system other than the ones that pip is running on. ``--only-binary=:all:`` or ``--no-deps`` is required when using any of these options. It is important to note that these options all default to the current system/interpreter, and not to the most restrictive constraints (e.g. platform any, abi none, etc). To avoid fetching dependencies that happen to match the constraint of the current interpreter (but not your target one), it is recommended to specify all of these options if you are specifying one of them. Generic dependencies (e.g. universal wheels, or dependencies with no platform, abi, or implementation constraints) will still match an over- constrained download requirement. If some of your dependencies are not available as binaries, you can build them manually for your target platform and let pip download know where to find them using ``--find-links``. .. note:: To determine the appropriate values for ``--python-version`` and ``--platform``, you can query the target system using the following commands: - For the Python version, use :func:`sysconfig.get_python_version() `. - For the platform, use :func:`packaging.tags.platform_tags() `. Options ======= .. pip-command-options:: download .. pip-index-options:: download .. pip-package-selection-options:: download Examples ======== #. Download a package and all of its dependencies .. tab:: Unix/macOS .. code-block:: shell python -m pip download SomePackage python -m pip download -d . SomePackage # equivalent to above python -m pip download --no-index --find-links=/tmp/wheelhouse -d /tmp/otherwheelhouse SomePackage .. tab:: Windows .. code-block:: shell py -m pip download SomePackage py -m pip download -d . SomePackage # equivalent to above py -m pip download --no-index --find-links=/tmp/wheelhouse -d /tmp/otherwheelhouse SomePackage #. Download a package and all of its dependencies with OSX specific interpreter constraints. This forces OSX 10.10 or lower compatibility. Since OSX deps are forward compatible, this will also match ``macosx_10_9_x86_64``, ``macosx_10_8_x86_64``, ``macosx_10_8_intel``, etc. It will also match deps with platform ``any``. Also force the interpreter version to ``27`` (or more generic, i.e. ``2``) and implementation to ``cp`` (or more generic, i.e. ``py``). .. tab:: Unix/macOS .. code-block:: shell python -m pip download \ --only-binary=:all: \ --platform macosx_10_10_x86_64 \ --python-version 27 \ --implementation cp \ SomePackage .. tab:: Windows .. code-block:: shell py -m pip download ^ --only-binary=:all: ^ --platform macosx_10_10_x86_64 ^ --python-version 27 ^ --implementation cp ^ SomePackage #. Download a package and its dependencies with linux specific constraints. Force the interpreter to be any minor version of py3k, and only accept ``cp34m`` or ``none`` as the abi. .. tab:: Unix/macOS .. code-block:: shell python -m pip download \ --only-binary=:all: \ --platform linux_x86_64 \ --python-version 3 \ --implementation cp \ --abi cp34m \ SomePackage .. tab:: Windows .. code-block:: shell py -m pip download ^ --only-binary=:all: ^ --platform linux_x86_64 ^ --python-version 3 ^ --implementation cp ^ --abi cp34m ^ SomePackage #. Force platform, implementation, and abi agnostic deps. .. tab:: Unix/macOS .. code-block:: shell python -m pip download \ --only-binary=:all: \ --platform any \ --python-version 3 \ --implementation py \ --abi none \ SomePackage .. tab:: Windows .. code-block:: shell py -m pip download ^ --only-binary=:all: ^ --platform any ^ --python-version 3 ^ --implementation py ^ --abi none ^ SomePackage #. Even when overconstrained, this will still correctly fetch the pip universal wheel. .. tab:: Unix/macOS .. code-block:: console $ python -m pip download \ --only-binary=:all: \ --platform linux_x86_64 \ --python-version 33 \ --implementation cp \ --abi cp34m \ pip>=8 .. code-block:: console $ ls pip-8.1.1-py2.py3-none-any.whl pip-8.1.1-py2.py3-none-any.whl .. tab:: Windows .. code-block:: console C:\> py -m pip download ^ --only-binary=:all: ^ --platform linux_x86_64 ^ --python-version 33 ^ --implementation cp ^ --abi cp34m ^ pip>=8 .. code-block:: console C:\> dir pip-8.1.1-py2.py3-none-any.whl pip-8.1.1-py2.py3-none-any.whl #. Download a package supporting one of several ABIs and platforms. This is useful when fetching wheels for a well-defined interpreter, whose supported ABIs and platforms are known and fixed, different than the one pip is running under. .. tab:: Unix/macOS .. code-block:: console $ python -m pip download \ --only-binary=:all: \ --platform manylinux1_x86_64 --platform linux_x86_64 --platform any \ --python-version 36 \ --implementation cp \ --abi cp36m --abi cp36 --abi abi3 --abi none \ SomePackage .. tab:: Windows .. code-block:: console C:> py -m pip download ^ --only-binary=:all: ^ --platform manylinux1_x86_64 --platform linux_x86_64 --platform any ^ --python-version 36 ^ --implementation cp ^ --abi cp36m --abi cp36 --abi abi3 --abi none ^ SomePackage ================================================ FILE: docs/html/cli/pip_freeze.rst ================================================ .. _`pip freeze`: ========== pip freeze ========== Usage ===== .. tab:: Unix/macOS .. pip-command-usage:: freeze "python -m pip" .. tab:: Windows .. pip-command-usage:: freeze "py -m pip" Description =========== .. pip-command-description:: freeze .. note:: By default, ``pip freeze`` omits bootstrap packaging tools so the output focuses on your project’s dependencies. On Python **3.11 and earlier** this excludes ``pip``, ``setuptools``, ``wheel`` and ``distribute``; on Python **3.12 and later** only ``pip`` is excluded. Use ``--all`` to include those packages when you need a complete environment snapshot. ``pip freeze`` reports what is installed; it does **not** compute a lockfile or a solver result. Options ======= .. pip-command-options:: freeze Examples ======== #. Generate output suitable for a requirements file. .. tab:: Unix/macOS .. code-block:: console $ python -m pip freeze docutils==0.11 Jinja2==2.7.2 MarkupSafe==0.19 Pygments==1.6 Sphinx==1.2.2 .. tab:: Windows .. code-block:: console C:\> py -m pip freeze docutils==0.11 Jinja2==2.7.2 MarkupSafe==0.19 Pygments==1.6 Sphinx==1.2.2 #. Generate a requirements file and then install from it in another environment. .. tab:: Unix/macOS .. code-block:: shell env1/bin/python -m pip freeze > requirements.txt env2/bin/python -m pip install -r requirements.txt .. tab:: Windows .. code-block:: shell env1\bin\python -m pip freeze > requirements.txt env2\bin\python -m pip install -r requirements.txt Fixing "Permission denied:" errors ================================== The purpose of this section of documentation is to provide practical suggestions to users seeing a `"Permission denied" error `__ on ``pip freeze``. This error occurs, for instance, when the command is installed only for another user, and the current user doesn't have the permission to execute the other user's command. To solve that issue, you can try one of the following: - Install the command for yourself (e.g. in your home directory). - Ask the system admin to allow this command for all users. - Check and correct the PATH variable of your own environment. - Check the `ACL (Access-Control List) `_ for this command. ================================================ FILE: docs/html/cli/pip_hash.rst ================================================ .. _`pip hash`: ======== pip hash ======== Usage ===== .. tab:: Unix/macOS .. pip-command-usage:: hash "python -m pip" .. tab:: Windows .. pip-command-usage:: hash "py -m pip" Description =========== .. pip-command-description:: hash Overview -------- ``pip hash`` is a convenient way to get a hash digest for use with :ref:`hash-checking mode`, especially for packages with multiple archives. The error message from ``pip install --require-hashes ...`` will give you one hash, but, if there are multiple archives (like source and binary ones), you will need to manually download and compute a hash for the others. Otherwise, a spurious hash mismatch could occur when :ref:`pip install` is passed a different set of options, like :ref:`--no-binary `. Options ======= .. pip-command-options:: hash Example ======= Compute the hash of a downloaded archive: .. tab:: Unix/macOS .. code-block:: console $ python -m pip download SomePackage Collecting SomePackage Downloading SomePackage-2.2.tar.gz Saved ./pip_downloads/SomePackage-2.2.tar.gz Successfully downloaded SomePackage $ python -m pip hash ./pip_downloads/SomePackage-2.2.tar.gz ./pip_downloads/SomePackage-2.2.tar.gz: --hash=sha256:93e62e05c7ad3da1a233def6731e8285156701e3419a5fe279017c429ec67ce0 .. tab:: Windows .. code-block:: console C:\> py -m pip download SomePackage Collecting SomePackage Downloading SomePackage-2.2.tar.gz Saved ./pip_downloads/SomePackage-2.2.tar.gz Successfully downloaded SomePackage C:\> py -m pip hash ./pip_downloads/SomePackage-2.2.tar.gz ./pip_downloads/SomePackage-2.2.tar.gz: --hash=sha256:93e62e05c7ad3da1a233def6731e8285156701e3419a5fe279017c429ec67ce0 ================================================ FILE: docs/html/cli/pip_index.rst ================================================ .. _`pip index`: =========== pip index =========== Usage ===== .. tab:: Unix/macOS .. pip-command-usage:: index "python -m pip" .. tab:: Windows .. pip-command-usage:: index "py -m pip" Description =========== .. pip-command-description:: index Options ======= .. pip-command-options:: index .. pip-index-options:: index .. pip-package-selection-options:: index Examples ======== #. Search for "peppercorn" versions .. tab:: Unix/macOS .. code-block:: console $ python -m pip index versions peppercorn peppercorn (0.6) Available versions: 0.6, 0.5, 0.4, 0.3, 0.2, 0.1 .. tab:: Windows .. code-block:: console C:\> py -m pip index peppercorn peppercorn (0.6) Available versions: 0.6, 0.5, 0.4, 0.3, 0.2, 0.1 ================================================ FILE: docs/html/cli/pip_inspect.rst ================================================ .. _`pip inspect`: =========== pip inspect =========== .. versionadded:: 22.2 Usage ===== .. tab:: Unix/macOS .. pip-command-usage:: inspect "python -m pip" .. tab:: Windows .. pip-command-usage:: inspect "py -m pip" Description =========== .. pip-command-description:: inspect The format of the JSON output is described in :doc:`../reference/inspect-report`. Options ======= .. pip-command-options:: inspect ================================================ FILE: docs/html/cli/pip_install.rst ================================================ .. _`pip install`: =========== pip install =========== Usage ===== .. tab:: Unix/macOS .. pip-command-usage:: install 'python -m pip' .. tab:: Windows .. pip-command-usage:: install "py -m pip" Description =========== .. pip-command-description:: install Overview -------- pip install has several stages: 1. Identify the base requirements. The user supplied arguments are processed here. 2. Resolve dependencies. What will be installed is determined here. 3. Build wheels. All the dependencies that can be are built into wheels. 4. Install the packages (and uninstall anything being upgraded/replaced). Note that ``pip install`` prefers to leave the installed version as-is unless ``--upgrade`` is specified. Argument Handling ----------------- When looking at the items to be installed, pip checks what type of item each is, in the following order: 1. Project or archive URL. 2. Local directory (which must contain a ``pyproject.toml`` or ``setup.py``, otherwise pip will report an error). 3. Local file (a sdist or wheel format archive, following the naming conventions for those formats). 4. A :ref:`version specifier `. Each item identified is added to the set of requirements to be satisfied by the install. Working Out the Name and Version -------------------------------- For each candidate item, pip needs to know the project name and version. For wheels (identified by the ``.whl`` file extension) this can be obtained from the filename, as per the Wheel spec. For local directories, or explicitly specified sdist files, the ``setup.py egg_info`` command is used to determine the project metadata. For sdists located via an index, the filename is parsed for the name and project version (this is in theory slightly less reliable than using the ``egg_info`` command, but avoids downloading and processing unnecessary numbers of files). The :ref:`Direct URL requirement syntax ` can be used to explicitly state the project name (see :doc:`../topics/vcs-support`). Satisfying Requirements ----------------------- Once pip has the set of requirements to satisfy, it chooses which version of each requirement to install using the simple rule that the latest version that satisfies the given constraints will be installed (but see :ref:`here
`
for an exception regarding pre-release versions). Where more than one source of
the chosen version is available, it is assumed that any source is acceptable
(as otherwise the versions would differ).

Obtaining information about what was installed
----------------------------------------------

The install command has a ``--report`` option that will generate a JSON report of what
pip has installed. In combination with the ``--dry-run`` and ``--ignore-installed`` it
can be used to *resolve* a set of requirements without actually installing them.

The report can be written to a file, or to standard output (using ``--report -`` in
combination with ``--quiet``).

The format of the JSON report is described in :doc:`../reference/installation-report`.

Installation Order
------------------

.. note::

   This section is only about installation order of runtime dependencies, and
   does not apply to build dependencies (those are specified using the
   :ref:`[build-system] table `).

As of v6.1.0, pip installs dependencies before their dependents, i.e. in
"topological order."  This is the only commitment pip currently makes related
to order.  While it may be coincidentally true that pip will install things in
the order of the install arguments or in the order of the items in a
requirements file, this is not a promise.

In the event of a dependency cycle (aka "circular dependency"), the current
implementation (which might possibly change later) has it such that the first
encountered member of the cycle is installed last.

For instance, if quux depends on foo which depends on bar which depends on baz,
which depends on foo:

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip install quux
      ...
      Installing collected packages baz, bar, foo, quux

      $ python -m pip install bar
      ...
      Installing collected packages foo, baz, bar

.. tab:: Windows

   .. code-block:: console

      C:\> py -m pip install quux
      ...
      Installing collected packages baz, bar, foo, quux

      C:\> py -m pip install bar
      ...
      Installing collected packages foo, baz, bar


Prior to v6.1.0, pip made no commitments about install order.

The decision to install topologically is based on the principle that
installations should proceed in a way that leaves the environment usable at each
step. This has two main practical benefits:

1. Concurrent use of the environment during the install is more likely to work.
2. A failed install is less likely to leave a broken environment.  Although pip
   would like to support failure rollbacks eventually, in the mean time, this is
   an improvement.

Although the new install order is not intended to replace (and does not replace)
the use of ``setup_requires`` to declare build dependencies, it may help certain
projects install from sdist (that might previously fail) that fit the following
profile:

1. They have build dependencies that are also declared as install dependencies
   using ``install_requires``.
2. ``python setup.py egg_info`` works without their build dependencies being
   installed.
3. For whatever reason, they don't or won't declare their build dependencies using
   ``setup_requires``.

.. _`0-requirements-file-format`:
.. rubric:: Requirements File Format

This section has been moved to :doc:`../reference/requirements-file-format`.

.. _`0-requirement-specifiers`:
.. rubric:: Requirement Specifiers

This section has been moved to :doc:`../reference/requirement-specifiers`.

.. _`0-per-requirement-overrides`:
.. rubric:: Per-requirement Overrides

This is now covered in :doc:`../reference/requirements-file-format`.

.. _`Pre Release Versions`:

Pre-release Versions
--------------------

Starting with v1.4, pip will only install stable versions as specified by
`pre-releases`_ by default. If a version cannot be parsed as a
:ref:`compliant ` version then it is assumed to be
a pre-release.

If a Requirement specifier includes a pre-release or development version
(e.g. ``>=0.0.dev0``) then pip will allow pre-release and development versions
for that requirement. This does not include the != flag.

The ``pip install`` command also supports a :ref:`--pre ` flag
that enables installation of pre-releases and development releases.


.. _pre-releases: https://www.python.org/dev/peps/pep-0440/#handling-of-pre-releases

.. _`0-vcs-support`:
.. rubric:: VCS Support

This is now covered in :doc:`../topics/vcs-support`.

Finding Packages
----------------

pip searches for packages on `PyPI`_ using the
`HTTP simple interface `_,
which is documented `here `_
and `there `_.

pip offers a number of package index options for modifying how packages are
found.

pip looks for packages in a number of places: on PyPI (or the index given as
``--index-url``, if not disabled via ``--no-index``), in the local filesystem,
and in any additional repositories specified via ``--find-links`` or
``--extra-index-url``. There is no priority in the locations that are searched.
Rather they are all checked, and the "best" match for the requirements (in
terms of version number - see the
:ref:`specification ` for details) is selected.

See the :ref:`pip install Examples`.

.. _`0-ssl certificate verification`:
.. rubric:: SSL Certificate Verification

This is now covered in :doc:`../topics/https-certificates`.

.. _`0-caching`:
.. rubric:: Caching

This is now covered in :doc:`../topics/caching`.

.. _`0-wheel-cache`:
.. rubric:: Wheel Cache

This is now covered in :doc:`../topics/caching`.

.. _`0-hash-checking-mode`:
.. rubric:: Hash checking mode

This is now covered in :doc:`../topics/secure-installs`.

.. _`0-local-project-installs`:
.. rubric:: Local Project Installs

This is now covered in :doc:`../topics/local-project-installs`.

.. _`0-editable-installs`:
.. rubric:: Editable installs

This is now covered in :doc:`../topics/local-project-installs`.

.. _`0-build-system-interface`:
.. rubric:: Build System Interface

This is now covered in :doc:`../reference/build-system`.

.. _`pip install Options`:

Options
=======

.. pip-command-options:: install

.. pip-index-options:: install

.. pip-package-selection-options:: install

.. _`pip install Examples`:


Examples
========

#. Install ``SomePackage`` and its dependencies from `PyPI`_ using :ref:`Requirement Specifiers`

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip install SomePackage            # latest version
         python -m pip install 'SomePackage==1.0.4'   # specific version
         python -m pip install 'SomePackage>=1.0.4'   # minimum version

   .. tab:: Windows

      .. code-block:: shell

         py -m pip install SomePackage            # latest version
         py -m pip install "SomePackage==1.0.4"   # specific version
         py -m pip install "SomePackage>=1.0.4"   # minimum version


#. Install a list of requirements specified in a file.  See the :ref:`Requirements files `.

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip install -r requirements.txt

   .. tab:: Windows

      .. code-block:: shell

         py -m pip install -r requirements.txt


#. Upgrade an already installed ``SomePackage`` to the latest from PyPI.

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip install --upgrade SomePackage

   .. tab:: Windows

      .. code-block:: shell

         py -m pip install --upgrade SomePackage

   .. note::

      This will guarantee an update to ``SomePackage`` as it is a direct
      requirement, and possibly upgrade dependencies if their installed
      versions do not meet the minimum requirements of ``SomePackage``.
      Any non-requisite updates of its dependencies (indirect requirements)
      will be affected by the ``--upgrade-strategy`` command.

#. Install a local project in "editable" mode. See the section on :ref:`Editable Installs `.

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip install -e .                # project in current directory
         python -m pip install -e path/to/project  # project in another directory

   .. tab:: Windows

      .. code-block:: shell

         py -m pip install -e .                 # project in current directory
         py -m pip install -e path/to/project   # project in another directory


#. Install a project from VCS

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip install 'SomeProject@git+https://git.repo/some_pkg.git@1.3.1'

   .. tab:: Windows

      .. code-block:: shell

         py -m pip install "SomeProject@git+https://git.repo/some_pkg.git@1.3.1"


#. Install a project from VCS in "editable" mode. See the sections on :doc:`../topics/vcs-support` and :ref:`Editable Installs `.

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip install -e 'SomePackage @ git+https://git.repo/some_pkg.git'          # from git
         python -m pip install -e 'SomePackage @ hg+https://hg.repo/some_pkg.git'            # from mercurial
         python -m pip install -e 'SomePackage @ svn+svn://svn.repo/some_pkg/trunk/'         # from svn
         python -m pip install -e 'SomePackage @ git+https://git.repo/some_pkg.git@feature'  # from 'feature' branch
         python -m pip install -e 'SomePackage @ git+https://git.repo/some_repo.git#subdirectory=subdir_path' # install a python package from a repo subdirectory

   .. tab:: Windows

      .. code-block:: shell

         py -m pip install -e "SomePackage @ git+https://git.repo/some_pkg.git"          # from git
         py -m pip install -e "SomePackage @ hg+https://hg.repo/some_pkg.git"            # from mercurial
         py -m pip install -e "SomePackage @ svn+svn://svn.repo/some_pkg/trunk/"         # from svn
         py -m pip install -e "SomePackage @ git+https://git.repo/some_pkg.git@feature"  # from 'feature' branch
         py -m pip install -e "SomePackage @ git+https://git.repo/some_repo.git#subdirectory=subdir_path" # install a python package from a repo subdirectory

#. Install a package with extras, i.e., optional dependencies
   (:ref:`specification `).

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip install 'SomePackage[PDF]'
         python -m pip install 'SomePackage[PDF] @ git+https://git.repo/SomePackage@main#subdirectory=subdir_path'
         python -m pip install '.[PDF]'  # project in current directory
         python -m pip install 'SomePackage[PDF]==3.0'
         python -m pip install 'SomePackage[PDF,EPUB]'  # multiple extras

   .. tab:: Windows

      .. code-block:: shell

         py -m pip install "SomePackage[PDF]"
         py -m pip install "SomePackage[PDF] @ git+https://git.repo/SomePackage@main#subdirectory=subdir_path"
         py -m pip install ".[PDF]"  # project in current directory
         py -m pip install "SomePackage[PDF]==3.0"
         py -m pip install "SomePackage[PDF,EPUB]"  # multiple extras

#. Install a particular source archive file.

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip install './downloads/SomePackage-1.0.4.tar.gz'
         python -m pip install 'http://my.package.repo/SomePackage-1.0.4.zip'

   .. tab:: Windows

      .. code-block:: shell

         py -m pip install "./downloads/SomePackage-1.0.4.tar.gz"
         py -m pip install "http://my.package.repo/SomePackage-1.0.4.zip"

#. Install a particular source archive file following direct references
   (:ref:`specification `).

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip install 'SomeProject@http://my.package.repo/SomeProject-1.2.3-py33-none-any.whl'
         python -m pip install 'SomeProject @ http://my.package.repo/SomeProject-1.2.3-py33-none-any.whl'
         python -m pip install 'SomeProject@http://my.package.repo/1.2.3.tar.gz'

   .. tab:: Windows

      .. code-block:: shell

         py -m pip install "SomeProject@http://my.package.repo/SomeProject-1.2.3-py33-none-any.whl"
         py -m pip install "SomeProject @ http://my.package.repo/SomeProject-1.2.3-py33-none-any.whl"
         py -m pip install "SomeProject@http://my.package.repo/1.2.3.tar.gz"

#. Install from alternative package repositories.

   Install from a different index, and not `PyPI`_

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip install --index-url http://my.package.repo/simple/ SomePackage

   .. tab:: Windows

      .. code-block:: shell

         py -m pip install --index-url http://my.package.repo/simple/ SomePackage

   Install from a local flat directory containing archives (and don't scan indexes):

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip install --no-index --find-links=file:///local/dir/ SomePackage
         python -m pip install --no-index --find-links=/local/dir/ SomePackage
         python -m pip install --no-index --find-links=relative/dir/ SomePackage

   .. tab:: Windows

      .. code-block:: shell

         py -m pip install --no-index --find-links=file:///local/dir/ SomePackage
         py -m pip install --no-index --find-links=/local/dir/ SomePackage
         py -m pip install --no-index --find-links=relative/dir/ SomePackage

   Search an additional index during install, in addition to `PyPI`_

   .. warning::

       Using the ``--extra-index-url`` option to search for packages which are
       not in the main repository (for example, private packages) is unsafe.
       This is a class of security issue known as `dependency confusion `_: an
       attacker can publish a package with the same name to a public index,
       which may then be chosen instead of your private package.

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip install --extra-index-url http://my.package.repo/simple SomePackage

   .. tab:: Windows

      .. code-block:: shell

         py -m pip install --extra-index-url http://my.package.repo/simple SomePackage


#. Find pre-release and development versions, in addition to stable versions.  By default, pip only finds stable versions.

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip install --pre SomePackage

   .. tab:: Windows

      .. code-block:: shell

         py -m pip install --pre SomePackage


#. Install packages from source.

   Do not use any binary packages

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip install SomePackage1 SomePackage2 --no-binary :all:

   .. tab:: Windows

      .. code-block:: shell

         py -m pip install SomePackage1 SomePackage2 --no-binary :all:

   Specify ``SomePackage1`` to be installed from source:

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip install SomePackage1 SomePackage2 --no-binary SomePackage1

   .. tab:: Windows

      .. code-block:: shell

         py -m pip install SomePackage1 SomePackage2 --no-binary SomePackage1

.. _PyPI: https://pypi.org/


================================================
FILE: docs/html/cli/pip_list.rst
================================================
.. _`pip list`:

========
pip list
========



Usage
=====

.. tab:: Unix/macOS

   .. pip-command-usage:: list "python -m pip"

.. tab:: Windows

   .. pip-command-usage:: list "py -m pip"


Description
===========

.. pip-command-description:: list


Options
=======

.. pip-command-options:: list

.. pip-index-options:: list

.. pip-package-selection-options:: list


Examples
========

#. List installed packages (with the default column formatting).

   .. tab:: Unix/macOS

      .. code-block:: console

         $ python -m pip list
         Package Version
         ------- -------
         docopt  0.6.2
         idlex   1.13
         jedi    0.9.0

   .. tab:: Windows

      .. code-block:: console

         C:\> py -m pip list
         Package Version
         ------- -------
         docopt  0.6.2
         idlex   1.13
         jedi    0.9.0

#. List outdated packages with column formatting.

   .. tab:: Unix/macOS

      .. code-block:: console

         $ python -m pip list --outdated --format columns
         Package    Version Latest Type
         ---------- ------- ------ -----
         retry      0.8.1   0.9.1  wheel
         setuptools 20.6.7  21.0.0 wheel

   .. tab:: Windows

      .. code-block:: console

         C:\> py -m pip list --outdated --format columns
         Package    Version Latest Type
         ---------- ------- ------ -----
         retry      0.8.1   0.9.1  wheel
         setuptools 20.6.7  21.0.0 wheel

#. List packages that are not dependencies of other packages. Can be combined with
   other options.

   .. tab:: Unix/macOS

      .. code-block:: console

         $ python -m pip list --outdated --not-required
         Package  Version Latest Type
         -------- ------- ------ -----
         docutils 0.14    0.17.1 wheel

   .. tab:: Windows

      .. code-block:: console

         C:\> py -m pip list --outdated --not-required
         Package  Version Latest Type
         -------- ------- ------ -----
         docutils 0.14    0.17.1 wheel

#. Use json formatting

   .. tab:: Unix/macOS

      .. code-block:: console

         $ python -m pip list --format=json
         [{'name': 'colorama', 'version': '0.3.7'}, {'name': 'docopt', 'version': '0.6.2'}, ...

   .. tab:: Windows

      .. code-block:: console

         C:\> py -m pip list --format=json
         [{'name': 'colorama', 'version': '0.3.7'}, {'name': 'docopt', 'version': '0.6.2'}, ...

#. Use freeze formatting

   .. tab:: Unix/macOS

      .. code-block:: console

         $ python -m pip list --format=freeze
         colorama==0.3.7
         docopt==0.6.2
         idlex==1.13
         jedi==0.9.0

   .. tab:: Windows

      .. code-block:: console

         C:\> py -m pip list --format=freeze
         colorama==0.3.7
         docopt==0.6.2
         idlex==1.13
         jedi==0.9.0

#. List packages installed in editable mode

   When some packages are installed in editable mode, ``pip list`` outputs an
   additional column that shows the directory where the editable project is
   located (i.e. the directory that contains the ``pyproject.toml`` or
   ``setup.py`` file).

   .. tab:: Unix/macOS

      .. code-block:: console

         $ python -m pip list
         Package          Version  Editable project location
         ---------------- -------- -------------------------------------
         pip              21.2.4
         pip-test-package 0.1.1    /home/you/.venv/src/pip-test-package
         setuptools       57.4.0
         wheel            0.36.2


   .. tab:: Windows

      .. code-block:: console

         C:\> py -m pip list
         Package          Version  Editable project location
         ---------------- -------- ----------------------------------------
         pip              21.2.4
         pip-test-package 0.1.1    C:\Users\You\.venv\src\pip-test-package
         setuptools       57.4.0
         wheel            0.36.2

   The json format outputs an additional ``editable_project_location`` field.

   .. tab:: Unix/macOS

      .. code-block:: console

         $ python -m pip list --format=json | python -m json.tool
         [
           {
             "name": "pip",
             "version": "21.2.4",
           },
           {
             "name": "pip-test-package",
             "version": "0.1.1",
             "editable_project_location": "/home/you/.venv/src/pip-test-package"
           },
           {
             "name": "setuptools",
             "version": "57.4.0"
           },
           {
             "name": "wheel",
             "version": "0.36.2"
           }
         ]

   .. tab:: Windows

      .. code-block:: console

         C:\> py -m pip list --format=json | py -m json.tool
         [
           {
             "name": "pip",
             "version": "21.2.4",
           },
           {
             "name": "pip-test-package",
             "version": "0.1.1",
             "editable_project_location": "C:\Users\You\.venv\src\pip-test-package"
           },
           {
             "name": "setuptools",
             "version": "57.4.0"
           },
           {
             "name": "wheel",
             "version": "0.36.2"
           }
         ]

.. note::

   Contrary to the ``freeze``  command, ``pip list --format=freeze`` will not
   report editable install information, but the version of the package at the
   time it was installed.


================================================
FILE: docs/html/cli/pip_lock.rst
================================================

.. _`pip lock`:

========
pip lock
========



Usage
=====

.. tab:: Unix/macOS

   .. pip-command-usage:: lock "python -m pip"

.. tab:: Windows

   .. pip-command-usage:: lock "py -m pip"


Description
===========

.. pip-command-description:: lock

Options
=======

.. pip-command-options:: lock

.. pip-index-options:: lock

.. pip-package-selection-options:: lock


Examples
========

#. Emit a ``pylock.toml`` for the project in the current directory

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip lock -e .

   .. tab:: Windows

      .. code-block:: shell

         py -m pip lock -e .


================================================
FILE: docs/html/cli/pip_search.rst
================================================
.. _`pip search`:

==========
pip search
==========



Usage
=====

.. tab:: Unix/macOS

   .. pip-command-usage:: search "python -m pip"

.. tab:: Windows

   .. pip-command-usage:: search "py -m pip"


Description
===========

.. attention::
    PyPI no longer supports ``pip search`` (or XML-RPC search). Please use https://pypi.org/search (via a browser)
    instead. See https://warehouse.pypa.io/api-reference/xml-rpc.html#deprecated-methods for more information.

    However, XML-RPC search (and this command) may still be supported by indexes other than PyPI.

.. pip-command-description:: search


Options
=======

.. pip-command-options:: search


Examples
========

#. Search for "peppercorn"

   .. tab:: Unix/macOS

      .. code-block:: console

         $ python -m pip search peppercorn
         pepperedform    - Helpers for using peppercorn with formprocess.
         peppercorn      - A library for converting a token stream into [...]

   .. tab:: Windows

      .. code-block:: console

         C:\> py -m pip search peppercorn
         pepperedform    - Helpers for using peppercorn with formprocess.
         peppercorn      - A library for converting a token stream into [...]


================================================
FILE: docs/html/cli/pip_show.rst
================================================
.. _`pip show`:

========
pip show
========



Usage
=====

.. tab:: Unix/macOS

   .. pip-command-usage:: show "python -m pip"

.. tab:: Windows

   .. pip-command-usage:: show "py -m pip"


Description
===========

.. pip-command-description:: show


Options
=======

.. pip-command-options:: show


Examples
========

#. Show information about a package:

   .. tab:: Unix/macOS

      .. code-block:: console

         $ python -m pip show sphinx
         Name: Sphinx
         Version: 1.4.5
         Summary: Python documentation generator
         Home-page: http://sphinx-doc.org/
         Author: Georg Brandl
         Author-email: georg@python.org
         License: BSD
         Location: /my/env/lib/python2.7/site-packages
         Requires: docutils, snowballstemmer, alabaster, Pygments, imagesize, Jinja2, babel, six

   .. tab:: Windows

      .. code-block:: console

         C:\> py -m pip show sphinx
         Name: Sphinx
         Version: 1.4.5
         Summary: Python documentation generator
         Home-page: http://sphinx-doc.org/
         Author: Georg Brandl
         Author-email: georg@python.org
         License: BSD
         Location: /my/env/lib/python2.7/site-packages
         Requires: docutils, snowballstemmer, alabaster, Pygments, imagesize, Jinja2, babel, six

#. Show all information about a package

   .. tab:: Unix/macOS

      .. code-block:: console

         $ python -m pip show --verbose sphinx
         Name: Sphinx
         Version: 1.4.5
         Summary: Python documentation generator
         Home-page: http://sphinx-doc.org/
         Author: Georg Brandl
         Author-email: georg@python.org
         License: BSD
         Location: /my/env/lib/python2.7/site-packages
         Requires: docutils, snowballstemmer, alabaster, Pygments, imagesize, Jinja2, babel, six
         Metadata-Version: 2.0
         Installer:
         Classifiers:
            Development Status :: 5 - Production/Stable
            Environment :: Console
            Environment :: Web Environment
            Intended Audience :: Developers
            Intended Audience :: Education
            License :: OSI Approved :: BSD License
            Operating System :: OS Independent
            Programming Language :: Python
            Programming Language :: Python :: 2
            Programming Language :: Python :: 3
            Framework :: Sphinx
            Framework :: Sphinx :: Extension
            Framework :: Sphinx :: Theme
            Topic :: Documentation
            Topic :: Documentation :: Sphinx
            Topic :: Text Processing
            Topic :: Utilities
         Entry-points:
            [console_scripts]
            sphinx-apidoc = sphinx.apidoc:main
            sphinx-autogen = sphinx.ext.autosummary.generate:main
            sphinx-build = sphinx:main
            sphinx-quickstart = sphinx.quickstart:main
            [distutils.commands]
            build_sphinx = sphinx.setup_command:BuildDoc

   .. tab:: Windows

      .. code-block:: console

         C:\> py -m pip show --verbose sphinx
         Name: Sphinx
         Version: 1.4.5
         Summary: Python documentation generator
         Home-page: http://sphinx-doc.org/
         Author: Georg Brandl
         Author-email: georg@python.org
         License: BSD
         Location: /my/env/lib/python2.7/site-packages
         Requires: docutils, snowballstemmer, alabaster, Pygments, imagesize, Jinja2, babel, six
         Metadata-Version: 2.0
         Installer:
         Classifiers:
            Development Status :: 5 - Production/Stable
            Environment :: Console
            Environment :: Web Environment
            Intended Audience :: Developers
            Intended Audience :: Education
            License :: OSI Approved :: BSD License
            Operating System :: OS Independent
            Programming Language :: Python
            Programming Language :: Python :: 2
            Programming Language :: Python :: 3
            Framework :: Sphinx
            Framework :: Sphinx :: Extension
            Framework :: Sphinx :: Theme
            Topic :: Documentation
            Topic :: Documentation :: Sphinx
            Topic :: Text Processing
            Topic :: Utilities
         Entry-points:
            [console_scripts]
            sphinx-apidoc = sphinx.apidoc:main
            sphinx-autogen = sphinx.ext.autosummary.generate:main
            sphinx-build = sphinx:main
            sphinx-quickstart = sphinx.quickstart:main
            [distutils.commands]
            build_sphinx = sphinx.setup_command:BuildDoc


================================================
FILE: docs/html/cli/pip_uninstall.rst
================================================
.. _`pip uninstall`:

=============
pip uninstall
=============



Usage
=====

.. tab:: Unix/macOS

   .. pip-command-usage:: uninstall "python -m pip"

.. tab:: Windows

   .. pip-command-usage:: uninstall "py -m pip"


Description
===========

.. pip-command-description:: uninstall


Options
=======

.. pip-command-options:: uninstall


Examples
========

#. Uninstall a package.

   .. tab:: Unix/macOS

      .. code-block:: console

         $ python -m pip uninstall simplejson
         Uninstalling simplejson:
            /home/me/env/lib/python3.9/site-packages/simplejson
            /home/me/env/lib/python3.9/site-packages/simplejson-2.2.1-py3.9.egg-info
         Proceed (Y/n)? y
            Successfully uninstalled simplejson

   .. tab:: Windows

      .. code-block:: console

         C:\> py -m pip uninstall simplejson
         Uninstalling simplejson:
            /home/me/env/lib/python3.9/site-packages/simplejson
            /home/me/env/lib/python3.9/site-packages/simplejson-2.2.1-py3.9.egg-info
         Proceed (Y/n)? y
            Successfully uninstalled simplejson


================================================
FILE: docs/html/cli/pip_wheel.rst
================================================

.. _`pip wheel`:

=========
pip wheel
=========



Usage
=====

.. tab:: Unix/macOS

   .. pip-command-usage:: wheel "python -m pip"

.. tab:: Windows

   .. pip-command-usage:: wheel "py -m pip"


Description
===========

.. pip-command-description:: wheel


.. _`1-build-system-interface`:
.. rubric:: Build System Interface

This is now covered in :doc:`../reference/build-system`.

Differences to ``build``
------------------------

`build `_ is a simple tool which can among other things build
wheels for projects using the standard ``pyproject.toml``-based build interface. It
is comparable to the execution of ``pip wheel --no-deps .``.
It can also build source distributions which is not possible with ``pip``.
``pip wheel`` covers the wheel scope of ``build`` but offers many additional features.

Options
=======

.. pip-command-options:: wheel

.. pip-index-options:: wheel

.. pip-package-selection-options:: wheel


Examples
========

#. Build wheels for a requirement (and all its dependencies), and then install

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip wheel --wheel-dir=/tmp/wheelhouse SomePackage
         python -m pip install --no-index --find-links=/tmp/wheelhouse SomePackage

   .. tab:: Windows

      .. code-block:: shell

         py -m pip wheel --wheel-dir=/tmp/wheelhouse SomePackage
         py -m pip install --no-index --find-links=/tmp/wheelhouse SomePackage

#. Build a wheel for a package from source

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip wheel --no-binary SomePackage SomePackage

   .. tab:: Windows

      .. code-block:: shell

         py -m pip wheel --no-binary SomePackage SomePackage


================================================
FILE: docs/html/conf.py
================================================
"""Sphinx configuration file for pip's documentation."""

import glob
import os
import pathlib
import re
import sys

# Add the docs/ directory to sys.path, because pip_sphinxext.py is there.
docs_dir = os.path.dirname(os.path.dirname(__file__))
sys.path.insert(0, docs_dir)

# -- General configuration ------------------------------------------------------------

extensions = [
    # extensions common to all builds
    "pip_sphinxext",
]

# 'tags' is a injected by sphinx
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-tags
if "man" not in tags:  # type: ignore[name-defined] # noqa: F821
    # extensions not needed for building man pages
    extensions.extend(
        (
            # first-party extensions
            "sphinx.ext.autodoc",
            "sphinx.ext.todo",
            "sphinx.ext.intersphinx",
            # third-party extensions
            "myst_parser",
            "sphinx_copybutton",
            "sphinx_inline_tabs",
            "sphinxcontrib.towncrier",
            "sphinx_issues",
        ),
    )

# General information about the project.
project = "pip"
copyright = "The pip developers"

# Find the version and release information.
# We have a single source of truth for our version number: pip's __init__.py file.
# This next bit of code reads from it.
file_with_version = os.path.join(docs_dir, "..", "src", "pip", "__init__.py")
with open(file_with_version) as f:
    for line in f:
        m = re.match(r'__version__ = "(.*)"', line)
        if m:
            __version__ = m.group(1)
            # The short X.Y version.
            version = ".".join(__version__.split(".")[:2])
            # The full version, including alpha/beta/rc tags.
            release = __version__
            break
    else:  # AKA no-break
        version = release = "dev"

print("pip version:", version)
print("pip release:", release)

# -- Options for myst-parser ----------------------------------------------------------

myst_enable_extensions = ["deflist"]
myst_heading_anchors = 3

# -- Options for smartquotes ----------------------------------------------------------

# Disable the conversion of dashes so that long options like "--find-links" won't
# render as "-find-links" if included in the text.The default of "qDe" converts normal
# quote characters ('"' and "'"), en and em dashes ("--" and "---"), and ellipses "..."
smartquotes_action = "qe"

# -- Options for intersphinx ----------------------------------------------------------

intersphinx_mapping = {
    "python": ("https://docs.python.org/3", None),
    "pypug": ("https://packaging.python.org", None),
    "packaging": ("https://packaging.pypa.io/en/stable/", None),
}

# -- Options for towncrier_draft extension --------------------------------------------

towncrier_draft_autoversion_mode = "draft"  # or: 'sphinx-release', 'sphinx-version'
towncrier_draft_include_empty = True
towncrier_draft_working_directory = pathlib.Path(docs_dir).parent
# Not yet supported: towncrier_draft_config_path = 'pyproject.toml'  # relative to cwd

# -- Options for HTML -----------------------------------------------------------------

html_theme = "furo"
html_title = f"{project} documentation v{release}"

# Disable the generation of the various indexes
html_use_modindex = False
html_use_index = False

# -- Options for Manual Pages ---------------------------------------------------------


# List of manual pages generated
def determine_man_pages() -> list[tuple[str, str, str, str, int]]:
    """Determine which man pages need to be generated."""

    def to_document_name(path: str, base_dir: str) -> str:
        """Convert a provided path to a Sphinx "document name"."""
        relative_path = os.path.relpath(path, base_dir)
        root, _ = os.path.splitext(relative_path)
        return root.replace(os.sep, "/")

    # Crawl the entire man/commands/ directory and list every file with appropriate
    # name and details.
    man_dir = os.path.join(docs_dir, "man")
    raw_subcommands = glob.glob(os.path.join(man_dir, "commands/*.rst"))
    if not raw_subcommands:
        raise FileNotFoundError(
            "The individual subcommand manpages could not be found!"
        )

    retval = [
        ("index", "pip", "package manager for Python packages", "pip developers", 1),
    ]
    for fname in raw_subcommands:
        fname_base = to_document_name(fname, man_dir)
        outname = "pip-" + fname_base.split("/")[1]
        description = "description of {} command".format(outname.replace("-", " "))

        retval.append((fname_base, outname, description, "pip developers", 1))

    return retval


man_pages = determine_man_pages()

# -- Options for sphinx_copybutton ----------------------------------------------------

copybutton_prompt_text = r"\$ | C\:\> "
copybutton_prompt_is_regexp = True
copybutton_only_copy_prompt_lines = False

# -- Options for sphinx_issues --------------------------------------------------------

issues_default_group_project = "pypa/pip"


================================================
FILE: docs/html/copyright.rst
================================================
:orphan:

=========
Copyright
=========

pip and this documentation is:

Copyright © 2008-2020 The pip developers (see `AUTHORS.txt `_ file). All rights reserved.


================================================
FILE: docs/html/development/architecture/anatomy.rst
================================================
.. note::

    This section of the documentation is currently being written. pip
    developers welcome your help to complete this documentation. If you're
    interested in helping out, please let us know in the `tracking issue`_.

****************************************
Repository anatomy & directory structure
****************************************

``pip``’s codebase (`GitHub repository`_) is structured as a standard Python package.


Root and tools
==============

The ``README``, license, ``pyproject.toml``, and so on are in the top level.

* ``AUTHORS.txt``
* ``LICENSE.txt``
* ``NEWS.rst``
* ``pyproject.toml``
* ``README.rst``
* ``noxfile.py`` -- ``pip`` uses Nox, an automation tool, configured by this file. ``noxfile.py`` describes a few environments ``pip`` uses during development for simplifying how tests are run (complicated situation there). Example: ``nox -s lint``, ``nox -s test-3.10``. We can run tests for different versions of Python by changing “3.10” to “3.7” or similar.
* ``.gitattributes``
* ``.gitignore``
* ``.mailmap``
* ``docs/`` *[documentation, built with Sphinx]*

  * ``html/`` *[sources to HTML documentation avail. online]*
  * ``man/`` has man pages the distros can use by running ``man pip``
  * ``pip_sphinxext.py`` *[an extension -- pip-specific plugins to Sphinx that do not apply to other packages]*

* ``news/`` *[pip stores news fragments… Every time pip makes a user-facing change, a file is added to this directory (usually a short note referring to a GitHub issue) with the right extension & name so it gets included in changelog…. So every release the maintainers will be deleting old files in this directory? Yes - we use the towncrier automation to generate a NEWS file, and auto-delete old stuff. There’s more about this in the contributor documentation!]*

  * ``template.rst`` *[template for changelog -- this is a file towncrier uses…. Is this jinja? I don’t know, check towncrier docs]*

* ``src/`` *[source; see below]*
* ``tools/`` *[misc development workflow tools, like requirements files & CI files & helpers. For instance, automating the release.]*
* ``tests/`` -- contains tests you can run. There are instructions in :doc:`../getting-started`.

  * ``__init__.py``
  * ``conftest.py``
  * ``data/`` *[test data for running tests -- pseudo package index in it!  Lots of small packages that are invalid or are valid. Test fixtures.  Used by functional tests]*
  * ``functional/`` *[functional tests of pip’s CLI -- end-to-end, invoke pip in subprocess & check results of execution against desired result. This also is what makes test suite slow]*
  * ``lib/`` *[helpers for tests]*
  * ``unit/`` *[unit tests -- fast and small and nice!]*

* ``.github``


src directory
=============

In the root directory, the ``src/`` directory contains pip's core
source code. Within ``src/pip/``, ``_internal/`` has the pip code
that's written by pip maintainers, and ``_vendor/`` is pip's
dependencies (code from other packages).

Within ``src/``:

* ``pip/``

  * ``__init__.py``
  * ``__main__.py``
  * ``_internal/`` *[where all the pip code lives that’s written by pip maintainers -- underscore means private. pip is not a library -- it’s a command line tool! A very important distinction! People who want to install stuff with pip should not use the internals -- they should use the CLI. There’s a note on this in the docs.]*

    * ``__init__.py``
    * ``build_env.py``
    * ``cache.py`` *[has all the info for how to handle caching within pip -- cache-handling stuff. Uses cachecontrol from PyPI, vendored into pip]*
    * ``cli/`` *[subpackage containing helpers & additional code for managing the command line interface. Uses argparse from stdlib]*
    * ``commands/`` *[literally - each file is the name of the command on the pip CLI. Each has a class that defines what’s needed to set it up, what happens]*
    * ``configuration.py``
    * ``download.py``
    * ``exceptions.py``
    * ``index/``
    * ``locations/``
    * ``main.py`` *[legacy entry point]*
    * ``models/`` *[in-process refactoring! Goal: improve how pip internally models representations it has for data -- data representation. General overall cleanup. Data reps are spread throughout codebase….link is defined in a class in 1 file, and then another file imports Link from that file. Sometimes cyclic dependency?!?! To prevent future situations like this, etc., Pradyun started moving these into a models directory.]*
    * ``operations/`` -- a bit of a weird directory….. ``Freeze.py`` used to be in there. Freeze is an operation -- there was an operations.freeze. Then “prepare” got added (the operation of preparing a pkg). Then “check” got added for checking the state of an env.] [what’s a command vs an operation? Command is on CLI; an operation would be an internal bit of code that actually does some subset of the operation the command says. ``install`` command uses bits of ``check`` and ``prepare``, for instance. In the long run, Pradyun’s goal: ``prepare.py`` goes away (gets refactored into other files) such that ``operations`` is just ``check`` and ``freeze``..... … Pradyun plans to refactor this. [how does this compare to ``utils``?]

      * ``install/`` -- for modules related to installing projects of various kinds

        * ``wheel.py`` is a file that manages installation of a wheel file. This handles unpacking wheels -- “unpack and spread”. There is a package on PyPI called ``wheel`` that builds wheels -- do not confuse it with this.

    * ``pep425tags.py`` -- getting refactored into packaging.tags (a library on PyPI) which is external to pip (but vendored by pip). :pep:`425` tags: turns out lots of people want this! Compatibility tags for built distributions -> e.g., platform, Python version, etc.
    * ``pyproject.py`` -- ``pyproject.toml`` is a new standard (:pep:`518` and :pep:`517`). This file reads pyproject.toml and passes that info elsewhere. The rest of the processing happens in a different file. All the handling for 517 and 518 is in a different file.
    * ``req/`` *[*\ **A DIRECTORY THAT NEEDS REFACTORING. A LOT**\ *\ …… Remember Step 3? Dependency resolution etc.? This is that step! Each file represents … have the entire flow of installing & uninstalling, getting info about packages…. Some files here are more than 1,000 lines long! (used to be longer?!) Refactor will deeply improve developer experience. Also, we're `improving the pip dependency resolver`_ in 2020 so a bunch of this is changing.]*
    * ``utils/`` *[everything that is not “operationally” pip ….. Misc functions and files get dumped. There’s some organization here. There’s a models.py here which needs refactoring. Deprecation.py is useful, as are other things, but some things do not belong here. There ought to be some GitHub issues for refactoring some things here. Maybe a few issues with checkbox lists.]*
    * ``vcs/`` *[stands for Version Control System. Where pip handles all version control stuff -- one of the ``pip install`` arguments you can use is a version control link. Are any of these commands vendored? No, via subprocesses. For performance, it makes sense (we think) to do this instead of pygitlib2 or similar -- and has to be pure Python, can’t include C libraries, because you can’t include compiled C stuff, because you might not have it for the platform you are running on.]*

  * ``_vendor/`` *[code from other packages -- pip’s own dependencies…. Has them in its own source tree, because pip cannot depend on pip being installed on the machine already!]*

.. _`tracking issue`: https://github.com/pypa/pip/issues/6831
.. _GitHub repository: https://github.com/pypa/pip/
.. _improving the pip dependency resolver: https://github.com/pypa/pip/issues/988


================================================
FILE: docs/html/development/architecture/command-line-interface.rst
================================================
======================
Command Line Interface
======================

The ``pip._internal.cli`` package is responsible for processing and providing
pip's command line interface. This package handles:

* CLI option definition and parsing
* autocompletion
* dispatching to the various commands
* utilities like progress bars and spinners

.. note::

    This section of the documentation is currently being written. pip
    developers welcome your help to complete this documentation. If you're
    interested in helping out, please let us know in the
    `tracking issue `_.


.. _cli-overview:

Overview
========

A ``ConfigOptionParser`` instance is used as the "main parser",
for parsing top level args.

``Command`` then uses another ``ConfigOptionParser`` instance, to parse command-specific args.

Command structure
-----------------

This section shows the class hierarchy from which every command's class will inherit
from.

`base_command.py `_
defines the base ``Command`` class, from which every other command will inherit directly or
indirectly (see the *command tree* at the end of this section).

Using the ``ConfigOptionParser`` (see `Configuration and CLI "blend" `_),
this class adds the general options and instantiates the *cmd_opts* group, where every other specific
option will be added if needed on each command's class. For those commands that define specific
options, like ``--dry-run`` on ``pip install`` command, the options must be added to *cmd_opts*
this is the job of *add_options* method), which will be automatically called on ``Command``'s initialization.

The base ``Command`` has the following methods:

.. py:class:: Command

  .. py:method:: main()

    Main method of the class, it's always called (as can be seen in main.py's
    `main `_).
    It's in charge of calling the specific ``run`` method of the class and handling the possible errors.

  .. py:method:: run()

    Abstract method where the actual action of a command is defined.

  .. py:method:: add_options()

    Optional method to insert additional options on a class, called on ``Command`` initialization.

Some commands have more specialized behavior, (see for example ``pip index``).
These commands instead will inherit from ``IndexGroupCommand``, which inherits from ``Command``
and  ``SessionCommandMixin`` to build build the pip session for the corresponding requests.

Lastly, ``RequirementCommand``, which inherits from ``IndexGroupCommand`` is the base class
for those commands which make use of requirements in any form, like ``pip install``.

In addition to the previous classes, a last mixin class must be mentioned, from which
``Command`` as well as ``SessionCommandMixin`` inherit: ``CommandContextMixIn``, in
charge of the command's context.

In the following command tree we can see the hierarchy defined for the different pip
commands, where each command is defined under the base class it inherits from:

| ``Command``
|  ├─ ``cache``, ``check``, ``completion``, ``configuration``, ``debug``, ``freeze``, ``hash``, ``help``, ``inspect``, ``show``, ``search``, ``uninstall``
|  └─ ``IndexGroupCommand``
|      ├─ ``index``, ``list``
|      └─ ``RequirementCommand``
|           └─ ``wheel``, ``download``, ``install``


Option definition
-----------------

The set of shared options are defined in `cmdoptions.py `_
module, as well as the *general options* and *package index options* groups of options
we see when we call a command's help, or the ``pip index``'s help message respectively.
All options are defined in terms of functions that return `optparse.Option `_
instances once called, while specific groups of options, like *Config Options* for
``pip config`` are defined in each specific command file (see for example the
`configuration.py `_).

Argument parsing
----------------

The main entrypoint for the application is defined in the ``main`` function in the
`main.py `_ module.
This function is in charge of the `autocompletion `_,
calling the ``parse_command`` function and creating and running the subprograms
via ``create_command``, on which the ``main`` method is called.

The ``parse_command`` is defined in the `main_parser.py `_
module, which defines the following two functions:

.. py:function:: parse_command()

  Function in charge of the initial parse of ``pip``'s program. Creates the main parser (see
  the next function ``create_main_parser``) to extract the general options
  and the remaining arguments. For example, running ``pip --timeout=5 install --user INITools``
  will split ``['--timeout=5']`` as general option and  ``['install', '--user', 'INITools']``
  as the remainder.

  At this step the program deals with the options ``--python``, ``--version``, ``pip``
  or ``pip help``. If neither of the previous options is found, it tries to extract the command
  name and arguments.

.. py:function:: create_main_parser()

  Creates the main parser (type ``pip`` in the console to see the description of the
  program). The internal parser (`ConfigOptionParser `_),
  adds the general option group and the list of commands coming from ``cmdoptions.py``
  at this point.

After the initial parsing is done, ``create_command`` is in charge of creating the appropriate
command using the information stored in `commands_dict `_
variable, and calling its ``main`` method (see `Command structure `_).

A second argument parsing is done at each specific command (defined in the base ``Command`` class),
again using the ``ConfigOptionParser``.

Argument access
---------------

To access all the options and arguments, ``Command.run()`` takes
the options as `optparse.Values `_
and a list of strings for the arguments (parsed in ``Command.main()``). The internal methods of
the base ``Command`` class are in charge of passing these variables after ``parse_args`` is
called for a specific command.

Configuration and CLI "blend"
-----------------------------

The base ``Command`` instantiates the class `ConfigOptionParser `_
which is in charge of the parsing process (via its parent class
`optparse.OptionParser `_).
Its main addition consists of the following function:

.. py:class:: ConfigOptionParser(OptionParser)

  .. py:method:: get_default_values()

    Overrides the original method to allow updating the defaults after the instantiation of the
    option parser.

It allows overriding the default options and arguments using the ``Configuration`` class
(more information can be found on :ref:`Configuration`) to include environment variables and
settings from configuration files.

Progress bars and spinners
--------------------------

There are two more modules in the ``cli`` subpackage in charge of showing the state of the
program.

* `progress_bars.py `_

  This module contains the following function:

  .. py:function:: get_download_progress_renderer()

    It uses `rich `_
    functionalities to render the download progress.

  This function (used in `download.py `_,
  inside the ``Downloader`` class), allows watching the download process when running
  ``pip install`` on *big* packages.

* `spinner.py `_

  The main function of this module is:

  .. py:function:: open_spinner()

    It yields the appropriate type of spinner, which is used in ``call_subprocess``
    function, inside `subprocess.py `_
    module, so the user can see there is a program running.

* TODO: quirks / standard practices / broad ideas.
  (avoiding lists in option def'n, special cased option value types,
  )


Future Refactoring Ideas
========================

* Change option definition to be a more declarative, consistent, static
  data-structure, replacing the current ``partial(Option, ...)`` form
* Move progress bar and spinner to a ``cli.ui`` subpackage
* Move all ``Command`` classes into a ``cli.commands`` subpackage
  (including base classes)


================================================
FILE: docs/html/development/architecture/configuration-files.rst
================================================
===========================
Configuration File Handling
===========================

The ``pip._internal.configuration`` module is responsible for handling
(eg. loading from and saving values to) configuration files that are used by
pip. The module's functionality is largely exposed through and coordinated by
the module's ``Configuration`` class.

.. note::

    This section of the documentation is currently being written. pip
    developers welcome your help to complete this documentation. If you're
    interested in helping out, please let us know in the
    `tracking issue `_.


.. _configuration-overview:

Overview
========

pip stores configuration files in standard OS-appropriate locations, which are
determined by ``appdirs``. These files are in the INI format and are processed
with ``RawConfigParser``.

pip uses configuration files in two operations:

* During processing of command line options.

  * Reading from *all* configuration sources

* As part of ``pip config`` command.

  * Reading from *all* configuration sources
  * Manipulating a single configuration file

Both of these operations utilize functionality provided the ``Configuration``
object, which encapsulates all the logic for handling configuration files and
provides APIs for the same.

The remainder of this section documents the ``Configuration`` class, and
discusses potential future refactoring ideas.


.. _configuration-class:

``Configuration`` class
=======================

``Configuration`` loads configuration values from sources in the local
environment: a combination of configuration files and environment variables.

It can be used in two "modes", for reading all the values from the local
environment and for manipulating a single configuration file. It differentiates
between these two modes using the ``load_only`` attribute, which can be None or
represent the :ref:`kind ` of the configuration file to be
manipulated.

The ``isolated`` attribute determines which sources are used when loading the
configuration. If ``isolated`` is ``True``, user-specific configuration files
and environment variables are not used.

Reading from local environment
------------------------------

``Configuration`` can be used to read from all configuration sources in the
local environment and access the values, as per the precedence logic described
in the :ref:`Config Precedence ` section.

For this use case, the ``Configuration.load_only`` attribute would be ``None``,
and the methods used would be:

.. py:class:: Configuration

  .. py:method:: load()

    Handles all the interactions with the environment, to load all the
    configuration data into objects in memory.

  .. py:method:: items()

    Provides key-value pairs (like ``dict.items()``) from the loaded-in-memory
    information, handling all of the override ordering logic.

  .. py:method:: get_value(key)

    Provides the value of the given key from the loaded configuration.
    The loaded configuration may have ``load_only`` be None or non-None.
    This uses the same underlying mechanism as ``Configuration.items()`` and
    does follow the precedence logic described in :ref:`Config Precedence
    `.

At the time of writing, the parts of the codebase that use ``Configuration``
in this manner are: ``ConfigOptionParser``, to transparently include
configuration handling as part of the command line processing logic,
and ``pip config get``, for printing the entire configuration when no
:ref:`kind ` is specified via the CLI.

Manipulating a single configuration file
----------------------------------------

``Configuration`` can be used to manipulate a single configuration file,
such as to add, change or remove certain key-value pairs.

For this use case, the ``load_only`` attribute would be non-None, and would
represent the :ref:`kind ` of the configuration file to be
manipulated. In addition to the methods discussed in the previous section,
the methods used would be:

.. py:class:: Configuration
  :noindex:

  .. py:method:: get_file_to_edit()

    Provides the "highest priority" file, for the :ref:`kind ` of
    configuration file specified by ``load_only``. This requires ``load_only``
    to be non-None.

  .. py:method:: set_value(key, value)

    Provides a way to add/change a single key-value pair, in the file specified
    by ``Configuration.get_file_to_edit()``.

  .. py:method:: unset_value(key)

    Provides a way to remove a single key-value pair, in the file specified
    by ``Configuration.get_file_to_edit()``.

  .. py:method:: save()

    Saves the in-memory state of to the original files, saving any modifications
    made to the ``Configuration`` object back into the local environment.

.. _config-kinds:

kinds
=====

This is an enumeration that provides values to represent a "source" for
configuration. This includes environment variables and various types of
configuration files (global, site-specific, user_specific, specified via
``PIP_CONFIG_FILE``).

Future Refactoring Ideas
========================

* Break up the ``Configuration`` class into 2 smaller classes, by use case
    * ``Command`` use-case (read only) -- ``ConfigurationReader``
    * ``pip config`` use-case (read / write) -- ``ConfigurationModifier`` (inherit from ``ConfigurationReader``)
* Eagerly populate ``Configuration._dictionary`` on load.


================================================
FILE: docs/html/development/architecture/index.rst
================================================
.. _architecture-pip-internals:

===============================
Architecture of pip's internals
===============================

.. note::

    This section of the documentation is currently being written. pip
    developers welcome your help to complete this documentation. If
    you're interested in helping out, please let us know in the
    `tracking issue`_, or just go ahead and submit a pull request and
    mention it in that tracking issue.

.. note::

    Direct use of pip's internals is *not supported*, and these internals
    can change at any time. For more details, see :ref:`Using pip from
    your program`.


.. toctree::
    :maxdepth: 2

    overview
    anatomy
    configuration-files
    package-finding
    command-line-interface
    upgrade-options


.. _`tracking issue`: https://github.com/pypa/pip/issues/6831


================================================
FILE: docs/html/development/architecture/overview.rst
================================================
.. note::

    This section of the documentation is currently being written. pip
    developers welcome your help to complete this documentation. If you're
    interested in helping out, please let us know in the `tracking issue`_.


****************************
Broad functionality overview
****************************

pip is a package installer.

pip does a lot more than installation; it also has a cache, and it has
configuration, and it has a CLI, which has its own quirks. But mainly:

Things pip does:

1. | Manages the building of packages (offloads package building to a
     backend) when that’s necessary (a source distribution package --
     this is not necessary if the package is a wheel).

   1. | By default, pip delegates package-building to setuptools, for
           backwards compatibility reasons. But thing with setuptools:
           has a ``setup.py`` file that it invokes to …… get info?

2. Decides where to install stuff. Once the package is built, the resulting
   artifact is then installed to the system in its appropriate place. :pep:`517`
   defines the interface between the build backend & installer.

Broad overview of flow
======================

In sequence, what does pip do?:

1. Get user input (user-supplied string saying what package they want)
2. Figure out what that means: exactly what the user requested --
   translate to a thing pip can operate on (user input to requirements)
3. CORE OF THE WHOLE PROCESS, MAYBE? Once you have a set of reqs from
   Step 2, you have to expand those into a concrete “things to install”
   -- Figure out what other requirements it has to install based on
   user-given requirements, and where to get them from.

   a. this step is convoluted - also exploratory, involves dependency
      resolution -- we need to get to the index, see what versions
      are available

   b. Sometimes you need to build the package itself in order to get
      dependency information, which means fetching the package from
      package index, which means knowing whether it exists. For a
      single package,

4. Install the actual items to be installed.

Why? pip installs from places other than PyPI! But also, we’ve never had
guarantees of PyPI’s JSON API before now, so no one has been getting
metadata from PyPI separate from downloading the package itself.

In terms of flow of the install process:

1. For 1 package: Get abstract requirement(s) for that package, and
   try and see what that means (this abstract requirement can take
   various forms). Define abstract dependencies.

2. Once we have a set of "this package, get it from here, this is that
   version of that package",

3. Modify the environment to install those things (which means: place
   the files in the right place). For example: if you already have
   version 6.0 of a requirement and you are installing 7.2, uninstall
   6.0 and install 7.2.

Download process
----------------

What happens in an install? Well, a subset of ``install``, a process
pip usually does during a ``pip install``, is ``download`` (also
available to the user as the :ref:`pip download` command). And we
download and INSPECT packages to get manifests. For any given package
name, we need to know what files are available and what their
filenames are.

pip can download from a Python package repository, where packages are
stored in a structured format so an installer like pip can find them.

:pep:`503` defines the API we use to talk to a Python package repository.

PyPI
^^^^

What happens if we run ``pip download somepackage`` with no other
arguments?  By default we look at `PyPI`_, which is where pip knows
where to look to get more info for what the package index knows about
``somepackage``.

``pip`` then knows: what files are available, and what their filenames
are.

IN OTHER WORDS

While all dependencies have not been resolved, do the following:

1.  Following the API defined in :pep:`503`, fetch the index page from
    `https://{pypi_index}/simple/{package_name} `_
2.  Parse all of the file links from the page.
3.  Select a single file to download from the list of links.
4.  Extract the metadata from the downloaded package.
5.  Update the dependency tree based on the metadata.

The package index gives pip a list of files for that package (via the existing PyPI API). The files have the version and some other info that helps pip decide whether that's something pip ought to download.

pip chooses from the list a single file to download.

It may go back and choose another file to download.

When pip looks at the package index, the place where it looks has
basically a link. The link’s text is the name of the file.

This is the `PyPI Simple API`_ (PyPI has several APIs, some are being
deprecated). pip looks at Simple API, documented initially at :pep:`503` --
packaging.python.org has PyPA specifications with more details for
Simple Repository API.

For this package name -- this is the list of files available.

Looks there for:

* The list of filenames
* Other info

Once it has those, it selects one file and downloads it.

(Question: If I want to ``pip install flask``, I think the whole list of filenames
cannot….should not be …. ? I want only the Flask …. Why am I getting the
whole list?

Answer: It's not every file, just files of Flask. No API for getting all
files on PyPI. It’s for getting all files of Flask.)

.. _`tracking issue`: https://github.com/pypa/pip/issues/6831
.. _PyPI: https://pypi.org/
.. _PyPI Simple API: https://warehouse.readthedocs.io/api-reference/legacy/


================================================
FILE: docs/html/development/architecture/package-finding.rst
================================================
Finding and choosing files (``index`` and ``PackageFinder``)
---------------------------------------------------------------

The ``pip._internal.index`` sub-package in pip is responsible for deciding
what file to download and from where, given a requirement for a project. The
package's functionality is largely exposed through and coordinated by the
package's ``PackageFinder`` class.


.. _index-overview:

Overview
********

Here is a rough description of the process that pip uses to choose what
file to download for a package, given a requirement:

1. Collect together the various network and file system locations containing
   project package files. These locations are derived, for example, from pip's
   :ref:`--index-url ` (with default
   https://pypi.org/simple/ ) setting and any configured
   :ref:`--extra-index-url ` locations. Each of the
   project page URL's is an HTML page of anchor links, as defined in
   `PEP 503`_, the "Simple Repository API."
2. For each project page URL, fetch the HTML and parse out the anchor links,
   creating a ``Link`` object from each one. The :ref:`LinkCollector
   ` class is responsible for both the previous step
   and fetching the HTML over the network.
3. Determine which of the links are minimally relevant, using the
   :ref:`LinkEvaluator ` class.  Create an
   ``InstallationCandidate`` object (aka candidate for install) for each
   of these relevant links.
4. Further filter the collection of ``InstallationCandidate`` objects (using
   the :ref:`CandidateEvaluator ` class) to a
   collection of "applicable" candidates.
5. If there are applicable candidates, choose the best candidate by sorting
   them (again using the :ref:`CandidateEvaluator
   ` class).

The remainder of this section is organized by documenting some of the
classes inside the ``index`` package, in the following order:

* the main :ref:`PackageFinder ` class,
* the :ref:`LinkCollector ` class,
* the :ref:`LinkEvaluator ` class,
* the :ref:`CandidateEvaluator ` class,
* the :ref:`CandidatePreferences ` class, and
* the :ref:`BestCandidateResult ` class.


.. _package-finder-class:

The ``PackageFinder`` class
***************************

The ``PackageFinder`` class is the primary way through which code in pip
interacts with ``index`` package. It is an umbrella class that encapsulates and
groups together various package-finding functionality.

The ``PackageFinder`` class is responsible for searching the network and file
system for what versions of a package pip can install, and also for deciding
which version is most preferred, given the user's preferences, target Python
environment, etc.

The pip commands that use the ``PackageFinder`` class are:

* :ref:`pip download`
* :ref:`pip install`
* :ref:`pip list`
* :ref:`pip wheel`

The pip commands requiring use of the ``PackageFinder`` class generally
instantiate ``PackageFinder`` only once for the whole pip invocation. In
fact, pip creates this ``PackageFinder`` instance when command options
are first parsed.

With the exception of :ref:`pip list`, each of the above commands is
implemented as a ``Command`` class inheriting from ``RequirementCommand``
(for example :ref:`pip download` is implemented by ``DownloadCommand``), and
the ``PackageFinder`` instance is created by calling the
``RequirementCommand`` class's ``_build_package_finder()`` method. ``pip
list``, on the other hand, constructs its ``PackageFinder`` instance by
calling the ``ListCommand`` class's ``_build_package_finder()``. (This
difference may simply be historical and may not actually be necessary.)

Each of these commands also uses the ``PackageFinder`` class for pip's
"self-check," (i.e. to check whether a pip upgrade is available). In this
case, the ``PackageFinder`` instance is created by the
``self_outdated_check.py`` module's ``pip_self_version_check()`` function.

The ``PackageFinder`` class is responsible for doing all of the things listed
in the :ref:`Overview ` section like fetching and parsing
`PEP 503`_ simple repository HTML pages, evaluating which links in the simple
repository pages are relevant for each requirement, and further filtering and
sorting by preference the candidates for install coming from the relevant
links.

One of ``PackageFinder``'s main top-level methods is
``find_best_candidate()``. This method does the following two things:

1. Calls its ``find_all_candidates()`` method, which gathers all
   possible package links by reading and parsing the index URL's and
   locations provided by the user (the :ref:`LinkCollector
   ` class's ``collect_sources()`` method), constructs a
   :ref:`LinkEvaluator ` object to filter out some of
   those links, and then returns a list of ``InstallationCandidates`` (aka
   candidates for install). This corresponds to steps 1-3 of the
   :ref:`Overview ` above.
2. Constructs a ``CandidateEvaluator`` object and uses that to determine
   the best candidate. It does this by calling the ``CandidateEvaluator``
   class's ``compute_best_candidate()`` method on the return value of
   ``find_all_candidates()``. This corresponds to steps 4-5 of the Overview.

``PackageFinder`` also has a ``process_project_url()`` method (called by
``find_best_candidate()``) to process a `PEP 503`_ "simple repository"
project page. This method fetches and parses the HTML from a PEP 503 project
page URL, extracts the anchor elements and creates ``Link`` objects from
them, and then evaluates those links.


.. _link-collector-class:

The ``LinkCollector`` class
***************************

The :ref:`LinkCollector ` class is the class
responsible for collecting the raw list of "links" to package files
(represented as ``Link`` objects) from file system locations, as well as the
`PEP 503`_ project page URL's that ``PackageFinder`` should access.

The ``LinkCollector`` class takes into account the user's :ref:`--find-links
`, :ref:`--extra-index-url `,
and related options when deciding which locations to collect links from. The
class's main method is the ``collect_sources()`` method. The :ref:`PackageFinder
` class invokes this method as the first step of its
``find_all_candidates()`` method.

``LinkCollector`` also has a ``fetch_page()`` method to fetch the HTML from a
project page URL. This method is "unintelligent" in that it doesn't parse the
HTML.

The ``LinkCollector`` class is the only class in the ``index`` sub-package that
makes network requests and is the only class in the sub-package that depends
directly on ``PipSession``, which stores pip's configuration options and
state for making requests.


.. _link-evaluator-class:

The ``LinkEvaluator`` class
***************************

The ``LinkEvaluator`` class contains the business logic for determining
whether a link (e.g. in a simple repository page) satisfies minimal
conditions to be a candidate for install (resulting in an
``InstallationCandidate`` object). When making this determination, the
``LinkEvaluator`` instance uses information like the target Python
interpreter as well as user preferences like whether binary files are
allowed or preferred, etc.

Specifically, the ``LinkEvaluator`` class has an ``evaluate_link()`` method
that returns whether a link is a candidate for install.

Instances of this class are created by the ``PackageFinder`` class's
``make_link_evaluator()`` on a per-requirement basis.


.. _candidate-evaluator-class:

The ``CandidateEvaluator`` class
********************************

The ``CandidateEvaluator`` class contains the business logic for evaluating
which ``InstallationCandidate`` objects should be preferred. This can be
viewed as a determination that is finer-grained than that performed by the
``LinkEvaluator`` class.

In particular, the ``CandidateEvaluator`` class uses the whole set of
``InstallationCandidate`` objects when making its determinations, as opposed
to evaluating each candidate in isolation, as ``LinkEvaluator`` does. For
example, whether a pre-release is eligible for selection or whether a file
whose hash doesn't match is eligible depends on properties of the collection
as a whole.

The ``CandidateEvaluator`` class uses information like the list of
:ref:`platform tags `
compatible with the target Python interpreter, hashes provided by the
user, and other user preferences, etc.

Specifically, the class has a ``get_applicable_candidates()`` method.
This accepts the ``InstallationCandidate`` objects resulting from the links
accepted by the ``LinkEvaluator`` class's ``evaluate_link()`` method, filters
them to a list of "applicable" candidates and orders them by preference.

The ``CandidateEvaluator`` class also has a ``sort_best_candidate()`` method
that returns the best (i.e. most preferred) candidate.

Finally, the class has a ``compute_best_candidate()`` method that calls
``get_applicable_candidates()`` followed by ``sort_best_candidate()``, and
then returning a :ref:`BestCandidateResult `
object encapsulating both the intermediate and final results of the decision.

Instances of ``CandidateEvaluator`` are created by the ``PackageFinder``
class's ``make_candidate_evaluator()`` method on a per-requirement basis.


.. _candidate-preferences-class:

The ``CandidatePreferences`` class
**********************************

The ``CandidatePreferences`` class is a simple container class that groups
together some of the user preferences that ``PackageFinder`` uses to
construct ``CandidateEvaluator`` objects (via the ``PackageFinder`` class's
``make_candidate_evaluator()`` method).

A ``PackageFinder`` instance has a ``_candidate_prefs`` attribute whose value
is a ``CandidatePreferences`` instance. Since ``PackageFinder`` has a number
of responsibilities and options that control its behavior, grouping the
preferences specific to ``CandidateEvaluator`` helps maintainers know which
attributes are needed only for ``CandidateEvaluator``.


.. _best-candidate-result-class:

The ``BestCandidateResult`` class
*********************************

The ``BestCandidateResult`` class is a convenience "container" class that
encapsulates the result of finding the best candidate for a requirement.
(By "container" we mean an object that simply contains data and has no
business logic or state-changing methods of its own.) It stores not just the
final result but also intermediate values used to determine the result.

The class is the return type of both the ``CandidateEvaluator`` class's
``compute_best_candidate()`` method and the ``PackageFinder`` class's
``find_best_candidate()`` method.


.. _`PEP 503`: https://www.python.org/dev/peps/pep-0503/


================================================
FILE: docs/html/development/architecture/upgrade-options.rst
================================================
=============================================
Options that control the installation process
=============================================

When installing packages, pip chooses a distribution file, and
installs it in the user's environment. There are many choices (which
are `still evolving`_) involved in deciding which file to install, and
these are controlled by a variety of options.

.. note::

    This section of the documentation needs to be updated per
    :ref:`Resolver changes 2020`.

Controlling what gets installed
===============================

These options directly affect how the resolver uses the list of available
distribution files to decide which one to install. So these modify the
resolution algorithm itself, rather than the input to that algorithm.

``--upgrade``

Allow installing a newer version of an installed package. In principle, this
option actually affects "what gets considered", in the sense that it allows
the resolver to see other versions of installed packages. Without
``--upgrade``, the resolver will only see the installed version as a
candidate.

``--upgrade-strategy``

This option affects which packages are allowed to be installed. It is only
relevant if ``--upgrade`` is specified (except for the ``to-satisfy-only``
option mentioned below). The base behaviour is to allow
packages specified on pip's command line to be upgraded. This option controls
what *other* packages can be upgraded:

* ``eager`` - all packages will be upgraded to the latest possible version.
  It should be noted here that pip's current resolution algorithm isn't even
  aware of packages other than those specified on the command line, and
  those identified as dependencies. This may or may not be true of the new
  resolver.
* ``only-if-needed`` - packages are only upgraded if they are named in the
  pip command or a requirement file (i.e, they are direct requirements), or
  an upgraded parent needs a later version of the dependency than is
  currently installed.
* ``to-satisfy-only`` (**undocumented, please avoid**) - packages are not
  upgraded (not even direct requirements) unless the currently installed
  version fails to satisfy a requirement (either explicitly specified or a
  dependency).

  * This is actually the "default" upgrade strategy when ``--upgrade`` is
    *not set*, i.e. ``pip install AlreadyInstalled`` and
    ``pip install --upgrade --upgrade-strategy=to-satisfy-only AlreadyInstalled``
    yield the same behavior.

``--force-reinstall``

Doesn't affect resolution, but if the resolved result is the same as what is
currently installed, uninstall and reinstall it rather than leaving the
current version in place. This occurs even if ``--upgrade`` is not set.

``--ignore-installed``

Act as if the currently installed version isn't there - so don't care about
``--upgrade``, and don't uninstall before (re-)installing.


Controlling what gets considered
================================

These options affect the list of distribution files that the resolver will
consider as candidates for installation. As such, they affect the data that
the resolver has to work with, rather than influencing what pip does with the
resolution result.

Prereleases

``--pre``

Source vs Binary

``--no-binary``

``--only-binary``

``--prefer-binary``

Wheel tag specification

``--platform``

``--implementation``

``--abi``

Index options

``--index-url``

``--extra-index-url``

``--no-index``

``--find-links``


Controlling dependency data
===========================

These options control what dependency data the resolver sees for any given
package (or, in the case of ``--python-version``, the environment information
the resolver uses to *check* the dependency).

``--no-deps``

``--python-version``

``--ignore-requires-python``


Special cases
=============

These need further investigation. They affect the install process, but not
necessarily resolution or what gets installed.

``--require-hashes``

``--constraint``

``--editable ``


.. _still evolving: https://github.com/pypa/pip/issues/8115


================================================
FILE: docs/html/development/ci.rst
================================================
.. note::

    This section of the documentation is currently out of date.

    pip developers welcome your help to update this documentation. If
    you're interested in helping out, please let us know in the
    `tracking issue`_, or just submit a pull request and mention it in
    that tracking issue.

.. _`tracking issue`: https://github.com/pypa/pip/issues/7279

======================
Continuous Integration
======================

Supported interpreters
======================

pip support a variety of Python interpreters:

- CPython 3.9
- CPython 3.10
- CPython 3.11
- CPython 3.12
- CPython 3.13
- CPython 3.14
- Latest PyPy3

on different operating systems:

- Linux
- Windows
- macOS

and on different architectures:

- x64
- x86
- arm64 (macOS only)

so 56 hypothetical interpreters.


Checks
======

``pip`` CI runs different kind of tests:

- lint (defined in ``.pre-commit-config.yaml``)
- docs
- vendoring (is the ``src/_internal/_vendor`` directory cleanly vendored)
- unit tests (present in ``tests/unit``)
- "integration" tests (mostly present in ``tests/functional``)
- package (test the packaging steps)

Since lint, docs, vendoring and package tests only need to run on a pip
developer/contributor machine, they only need to be tested on the x64 variant
of the 3 different operating systems, and when an interpreter needs to be
specified it's ok to require the latest CPython interpreter.

So only unit tests and integration tests would need to be run with the different
interpreters.


Services
========

pip test suite and checks are distributed on `GitHub Actions`_ which provides
free executors for open source packages.

.. _`GitHub Actions`: https://github.com/features/actions


Current run tests
=================

Developer tasks
---------------

======== =============== ================ ================== =============
   OS          docs            lint           vendoring        packaging
======== =============== ================ ================== =============
Linux         GitHub           GitHub           GitHub           GitHub
Windows       GitHub           GitHub           GitHub           GitHub
macOS         GitHub           GitHub           GitHub           GitHub
======== =============== ================ ================== =============

Actual testing
--------------

+------------------------------+---------------+-----------------+
|       **interpreter**        |   **unit**    | **integration** |
+-----------+----------+-------+---------------+-----------------+
|           |   x86    | CP3.9 |               |                 |
|           |          +-------+---------------+-----------------+
|           |          | CP3.10|               |                 |
|           |          +-------+---------------+-----------------+
|           |          | CP3.11|               |                 |
|           |          +-------+---------------+-----------------+
|           |          | CP3.12|               |                 |
|           |          +-------+---------------+-----------------+
|           |          | CP3.13|               |                 |
|           |          +-------+---------------+-----------------+
|           |          | CP3.14|               |                 |
|           |          +-------+---------------+-----------------+
|           |          | PyPy3 |               |                 |
|  Windows  +----------+-------+---------------+-----------------+
|           |   x64    | CP3.9 |   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.10|               |                 |
|           |          +-------+---------------+-----------------+
|           |          | CP3.11|               |                 |
|           |          +-------+---------------+-----------------+
|           |          | CP3.12|               |                 |
|           |          +-------+---------------+-----------------+
|           |          | CP3.13|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.14|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | PyPy3 |               |                 |
+-----------+----------+-------+---------------+-----------------+
|           |   x86    | CP3.9 |               |                 |
|           |          +-------+---------------+-----------------+
|           |          | CP3.10|               |                 |
|           |          +-------+---------------+-----------------+
|           |          | CP3.11|               |                 |
|           |          +-------+---------------+-----------------+
|           |          | CP3.12|               |                 |
|           |          +-------+---------------+-----------------+
|           |          | CP3.13|               |                 |
|           |          +-------+---------------+-----------------+
|           |          | CP3.14|               |                 |
|           |          +-------+---------------+-----------------+
|           |          | PyPy3 |               |                 |
|   Linux   +----------+-------+---------------+-----------------+
|           |   x64    | CP3.9 |   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.10|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.11|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.12|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.13|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.14|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | PyPy3 |               |                 |
+-----------+----------+-------+---------------+-----------------+
|           |  arm64   | CP3.9 |   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.10|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.11|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.12|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.13|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.14|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | PyPy3 |               |                 |
|   macOS   +----------+-------+---------------+-----------------+
|           |   x64    | CP3.9 |   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.10|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.11|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.12|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.13|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | CP3.14|   GitHub      |   GitHub        |
|           |          +-------+---------------+-----------------+
|           |          | PyPy3 |               |                 |
+-----------+----------+-------+---------------+-----------------+


================================================
FILE: docs/html/development/contributing.rst
================================================
============
Contributing
============

Pip's internals
===============

We have an in-progress guide to the
:ref:`architecture-pip-internals`. It might be helpful as you dive in.

AI Policy
=========

While we do not dictate what tools contributors use to create pull requests,
LLM (Large Language Model) tools are often used to generate code that the
human contributor does not fully understand, and may not even be legally
considered the owner of. Therefore, contributors wishing to use LLM tools
should read and follow the project [AI policy](https://github.com/pypa/pip/blob/main/.github/AI_POLICY.md).

Submitting Pull Requests
========================

Submit pull requests against the ``main`` branch, providing a good
description of what you're doing and why. You must have legal permission to
distribute any code you contribute to pip and it must be available under the
MIT License.

Provide tests that cover your changes and run the tests locally first. pip
:ref:`supports ` multiple Python versions and
operating systems. Any pull request must consider and work on all these
platforms.

Pull requests should be small to facilitate easier review. Keep them
self-contained, and limited in scope. `Studies have shown`_ that review quality
falls off as patch size grows. Sometimes this will result in many small PRs to
land a single large feature. In particular, pull requests must not be treated
as "feature branches", with ongoing development work happening within the PR.
Instead, the feature should be broken up into smaller, independent parts which
can be reviewed and merged individually.

Additionally, avoid including "cosmetic" changes to code that
is unrelated to your change, as these make reviewing the PR more difficult.
Examples include re-flowing text in comments or documentation, or adding or
removing blank lines or whitespace within lines. Such changes can be made
separately, as a "formatting cleanup" PR, if needed.

.. attention::

   While contributors may use whatever tools they like when developing a pull
   request, it is the contributor's responsibility to ensure that submitted
   code meets the project requirements, and that they understand the submitted
   code well enough to respond to review comments.

Automated Testing
=================

All pull requests and merges to 'main' branch are tested using `GitHub
Actions`_ based on our `.github/workflows`_ files. More details about pip's
Continuous Integration can be found in the `CI Documentation`_


You can find the status and results to the CI runs for your PR on GitHub's web
UI for the pull request. You can also find links to the CI services' pages for
the specific builds in the form of "Details" links, in case the CI run fails
and you wish to view the output.

To trigger CI to run again for a pull request, you can close and open the pull
request or submit another change to the pull request. If needed, project
maintainers can manually trigger a restart of a job/build.

To understand the broader software architecture around dependency
resolution in pip, and how we automatically test this functionality,
see `Testing the next-gen pip dependency resolver`_.

NEWS Entries
============

The ``NEWS.rst`` file is managed using `towncrier`_ and all non trivial changes
must be accompanied by a news entry.

To add an entry to the news file, first you need to have created an issue
describing the change you want to make. A Pull Request itself *may* function as
such, but it is preferred to have a dedicated issue (for example, in case the
PR ends up rejected due to code quality reasons).

Once you have an issue or pull request, you take the number and you create a
file inside of the ``news/`` directory, named after that issue number with a
"type" of ``removal``, ``feature``, ``bugfix``, or ``doc`` associated with it.

If your issue or PR number is ``1234`` and this change is fixing a bug,
then you would create a file ``news/1234.bugfix.rst``. PRs can span multiple
categories by creating multiple files (for instance, if you added a feature and
deprecated/removed the old feature at the same time, you would create
``news/NNNN.feature.rst`` and ``news/NNNN.removal.rst``).

If a PR touches multiple issues/PRs, you may create a file for each of them
with the exact same contents and Towncrier will deduplicate them.

Contents of a NEWS entry
------------------------

The contents of this file are reStructuredText formatted text that
will be used as the content of the news file entry. You do not need to
reference the issue or PR numbers in the entry, since ``towncrier``
will automatically add a reference to all of the affected issues when
rendering the NEWS file. There must be a newline at the end of the file.

In order to maintain a consistent style in the ``NEWS.rst`` file, it is
preferred to keep the news entry to the point, in sentence case, shorter than
80 characters and in an imperative tone -- an entry should complete the sentence
"This change will ...". In rare cases, where one line is not enough, use a
summary line in an imperative tone followed by a blank line separating it
from a description of the feature/change in one or more paragraphs, each wrapped
at 80 characters. Remember that a news entry is meant for end users and should
only contain details relevant to an end user.

.. _`choosing-news-entry-type`:

Choosing the type of NEWS entry
-------------------------------

A trivial change is anything that does not warrant an entry in the news file.
Some examples are: Code refactors that don't change anything as far as the
public is concerned, typo fixes, white space modification, etc. To mark a PR
as trivial a contributor simply needs to add a randomly named, empty file to
the ``news/`` directory with the extension of ``.trivial.rst``. If you are on a
POSIX like operating system, one can be added by running
``touch news/$(uuidgen).trivial.rst``. On Windows, the same result can be
achieved in Powershell using ``New-Item "news/$([guid]::NewGuid()).trivial.rst"``.
Core committers may also add a "skip news" label to the PR which will accomplish
the same thing.

Upgrading, removing, or adding a new vendored library gets a special mention
using a ``news/.vendor.rst`` file. This is in addition to any features,
bugfixes, or other kinds of news that pulling in this library may have. This
uses the library name as the key so that updating the same library twice doesn't
produce two news file entries.

Changes to the processes, policies, or other non code related changed that are
otherwise notable can be done using a ``news/.process.rst`` file. This is
not typically used, but can be used for things like changing version schemes,
updating deprecation policy, etc.


Updating your branch
====================

As you work, you might need to update your local main branch up-to-date with
the ``main`` branch in the main pip repository, which moves forward as the
maintainers merge pull requests. Most people working on the project use the
following workflow.

This assumes that you have Git configured so that when you run the following
command:

.. code-block:: console

    git remote -v

Your output looks like this:

.. code-block:: console

    origin  https://github.com/USERNAME/pip.git (fetch)
    origin  https://github.com/USERNAME/pip.git (push)
    upstream  https://github.com/pypa/pip.git (fetch)
    upstream  https://github.com/pypa/pip.git (push)

In the example above, ``USERNAME`` is your username on GitHub.

First, fetch the latest changes from the main pip repository, ``upstream``:

.. code-block:: console

    git fetch upstream

Then, check out your local ``main`` branch, and rebase the changes on top of
it:

.. code-block:: console

    git checkout main
    git rebase upstream/main

At this point, you might have to `resolve merge conflicts`_. Once this is done,
push the updates you have just made to your local ``main`` branch to your
``origin`` repository on GitHub:

.. code-block:: console

    git checkout main
    git push origin main

Now your local ``main`` branch and the ``main`` branch in your ``origin``
repo have been updated with the most recent changes from the main pip
repository.

To keep your branches updated, the process is similar:

.. code-block:: console

    git checkout awesome-feature
    git fetch upstream
    git rebase upstream/main

Now your branch has been updated with the latest changes from the
``main`` branch on the upstream pip repository.

It's good practice to back up your branches by pushing them to your
``origin`` on GitHub as you are working on them. To push a branch,
run this command:

.. code-block:: console

    git push origin awesome-feature

In this example, ```` is the name of your branch. This
will push the branch you are working on to GitHub, but will not
create a PR.

Once you have pushed your branch to your ``origin``, if you need to
update it again, you will have to force push your changes by running the
following command:

.. code-block:: console

    git push -f origin awesome-feature

The ``-f`` (or ``--force``) flag after ``push`` forces updates from your local
branch to update your ``origin`` branch. If you have a PR open on your
branch, force pushing will update your PR. (This is a useful command
when someone requests changes on a PR.)

If you get an error message like this:

.. code-block:: console

    ! [rejected]        awesome-feature -> awesome-feature (non-fast-forward)
    error: failed to push some refs to 'https://github.com/USERNAME/pip.git'
    hint: Updates were rejected because the tip of your current branch is behind
    hint: its remote counterpart. Integrate the remote changes (e.g.
    hint: 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Try force-pushing your branch with ``push -f``.

The ``main`` branch in the main pip repository gets updated frequently, so
you might have to update your branch at least once while you are working on it.

Thank you for your contribution!


Becoming a maintainer
=====================

If you want to become an official maintainer, start by helping out.

As a first step, we welcome you to triage issues on pip's issue
tracker. pip maintainers provide triage abilities to contributors once
they have been around for some time (probably at least 2-3 months) and
contributed positively to the project. This is optional and highly
recommended for becoming a pip maintainer.

Later, when you think you're ready (probably at least 5 months after
starting to triage), get in touch with one of the maintainers and they
will initiate a vote among the existing maintainers.

.. note::

    Upon becoming a maintainer, a person should be given access to various
    pip-related tooling across multiple platforms. These are noted here for
    future reference by the maintainers:

    - GitHub Push Access
    - PyPI Publishing Access
    - CI Administration capabilities
    - ReadTheDocs Administration capabilities

.. _`Studies have shown`: https://smartbear.com/learn/code-review/best-practices-for-peer-code-review/
.. _`resolve merge conflicts`: https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line
.. _`GitHub Actions`: https://github.com/features/actions
.. _`.github/workflows`: https://github.com/pypa/pip/blob/main/.github/workflows
.. _`CI Documentation`: https://pip.pypa.io/en/latest/development/ci/
.. _`towncrier`: https://pypi.org/project/towncrier/
.. _`Testing the next-gen pip dependency resolver`: https://pradyunsg.me/blog/2020/03/27/pip-resolver-testing/


================================================
FILE: docs/html/development/conventions.rst
================================================
:orphan:

=========================
Documentation Conventions
=========================

This document describes the conventions used in pip's documentation. We
expect it to evolve over time as additional conventions are identified
and past conventions are rendered obsolete.

.. note::

   Currently, these conventions are not enforced automatically, and
   need to be verified manually during code review. We are interested
   in linters that can help us enforce these conventions automatically.


Files
=====

Naming
------

Folder names should be a single word, all lowercase.

File names must use the kebab-case style (all lowercase, hyphen for
separating words) and have the extension ``.rst``.

Encoding
--------

All files in our documentation must use UTF-8 encoding.

Line Length
-----------

Limit all lines to a maximum of 72 characters, where possible. This may
be exceeded when it does not make sense to abide by it (eg. long links,
code blocks).

Headings
========

Use the following symbols to create headings:

#. ``=`` with overline
#. ``=``
#. ``-``
#. ``^``
#. ``'``
#. ``*``

For visual separation from the rest of the content, all other headings
must have one empty line before and after. Heading 2 (``=``) should have
two empty lines before, for indicating the end of the section prior to
it.

::

   =========
   Heading 1
   =========

   Lorem ipsum dolor sit amet consectetur adipisicing elit.


   Heading 2
   =========

   Lorem ipsum dolor sit amet consectetur adipisicing elit.

   Heading 3
   ---------

   Lorem ipsum dolor sit amet consectetur adipisicing elit.

   Heading 4
   ^^^^^^^^^

   Lorem ipsum dolor sit amet consectetur adipisicing elit.

   Heading 5
   '''''''''

   Lorem ipsum dolor sit amet consectetur adipisicing elit.

   Heading 6
   *********

   Lorem ipsum dolor sit amet consectetur adipisicing elit.


Writing
=======

.. note::

   We're still discussing *how* pip should be capitalized in prose. The
   current statement here is tentative.

pip is a proper noun, and spelt all lowercase. Do not capitalize pip as
"Pip" at the start of a sentence.

Avoid using phrases such as "easy", "just", "simply" etc, which imply
that the task is trivial. If it were trivial, the user wouldn't be
reading the documentation for it.


================================================
FILE: docs/html/development/getting-started.rst
================================================
===============
Getting Started
===============

We’re pleased that you are interested in working on pip.

This document is meant to get you setup to work on pip and to act as a guide and
reference to the development setup. If you face any issues during this
process, please `open an issue`_ about it on the issue tracker.


Get the source code
===================

To work on pip, you first need to get the source code of pip. The source code is
available on `GitHub`_.

.. code-block:: console

    $ git clone https://github.com/pypa/pip
    $ cd pip


Development Environment
=======================

pip is a command line application written in Python. For developing pip,
you should `install Python`_ on your computer.

For developing pip, you need to install :pypi:`nox`. The full development setup would then be:

.. tab:: Unix/macOS

    .. code-block:: shell

        python -m venv .venv
        source .venv/bin/activate
        python -m pip install nox

.. tab:: Windows

    .. code-block:: shell

        py -m venv .venv
        .venv\Scripts\activate
        py -m pip install nox

Running pip From Source Tree
============================

To run the pip executable from your source tree during development, install pip
locally using editable installation (inside a virtualenv).
You can then invoke your local source tree pip normally (be sure virtualenv is active).

.. tab:: Unix/macOS

    .. code-block:: shell

        python -m pip install -e .
        python -m pip --version

.. tab:: Windows

    .. code-block:: shell

        py -m pip install -e .
        py -m pip --version

Running Tests
=============

pip's tests are written using the :pypi:`pytest` test framework and
:mod:`unittest.mock`. :pypi:`nox` is used to automate the setup and execution
of pip's tests.

It is preferable to run the tests in parallel for a better experience during development,
since the tests can take a long time to finish when run sequentially.

To run tests:

.. code-block:: console

    $ nox -s test-3.10 -- -n auto

To run tests without parallelization, run:

.. code-block:: console

    $ nox -s test-3.10

The example above runs tests against Python 3.10. You can also use other
versions like ``3.9`` and ``pypy3``.

``nox`` has been configured to forward any additional arguments it is given to
``pytest``. This enables the use of pytest's `rich CLI`_. As an example, you
can select tests using the various ways that pytest provides:

.. code-block:: console

    $ # Using file name
    $ nox -s test-3.10 -- tests/functional/test_install.py
    $ # Using markers
    $ nox -s test-3.10 -- -m unit
    $ # Using keywords
    $ nox -s test-3.10 -- -k "install and not wheel"

.. note::

    When running pip's tests with OS distribution Python versions, be aware that some
    functional tests may fail due to potential patches introduced by the distribution.
    For all tests to pass consider:

    - Installing Python from `python.org`_ or compile from source
    - Or, using `pyenv`_ to assist with source compilation

Running pip's entire test suite requires supported version control tools
(subversion, bazaar, git, and mercurial) to be installed. If you are missing
any of these VCS, those tests should be skipped automatically. You can also
explicitly tell pytest to skip those tests:

.. code-block:: console

    $ nox -s test-3.10 -- -k "not svn"
    $ nox -s test-3.10 -- -k "not (svn or git)"

.. _python.org: https://www.python.org/downloads/
.. _pyenv: https://github.com/pyenv/pyenv


Running Linters
===============

pip uses :pypi:`pre-commit` for managing linting of the codebase.
``pre-commit`` performs various checks on all files in pip and uses tools that
help follow a consistent code style within the codebase.

To use linters locally, run:

.. code-block:: console

    $ nox -s lint

.. note::

    Avoid using ``# noqa`` comments to suppress linter warnings - wherever
    possible, warnings should be fixed instead. ``# noqa`` comments are
    reserved for rare cases where the recommended style causes severe
    readability problems.


Running pip under a debugger
============================

In order to debug pip's behavior, you can run it under a debugger like so:

.. code-block:: console

    $ python -m pdb -m pip --debug ...


Replace the ``...`` with arguments you'd like to run pip with. Give PDB the
``c`` ("continue") command afterwards, to run the process.

The ``--debug`` flag disables pip's exception handler, which would normally
catch all unhandled exceptions. With this flag, pip will let these exceptions
propagate outside of its main subroutine, letting them get caught by the
debugger. This way you'll be able to debug an exception post-mortem via PDB.


Building Documentation
======================

pip's documentation is built using :pypi:`Sphinx`. The documentation is written
in reStructuredText.

To build it locally, run:

.. code-block:: console

    $ nox -s docs

The built documentation can be found in the ``docs/build`` folder.

For each Pull Request made the documentation is deployed following this link:

.. code-block:: none

    https://pip--.org.readthedocs.build/en/


What Next?
==========

The following pages may be helpful for new contributors on where to look next
in order to start contributing.

* Some `good first issues`_ on GitHub for new contributors
* A deep dive into `pip's architecture`_
* A guide on `triaging issues`_ for issue tracker
* Getting started with Git

  - `Hello World for Git`_
  - `Understanding the GitHub flow`_
  - `Start using Git on the command line`_


.. _`open an issue`: https://github.com/pypa/pip/issues/new?title=Trouble+with+pip+development+environment
.. _`install Python`: https://realpython.com/installing-python/
.. _`rich CLI`: https://docs.pytest.org/en/latest/how-to/usage.html#specifying-which-tests-to-run
.. _`GitHub`: https://github.com/pypa/pip
.. _`good first issues`: https://github.com/pypa/pip/labels/good%20first%20issue
.. _`pip's architecture`: https://pip.pypa.io/en/latest/development/architecture/
.. _`triaging issues`: https://pip.pypa.io/en/latest/development/issue-triage/
.. _`Hello World for Git`: https://guides.github.com/activities/hello-world/
.. _`Understanding the GitHub flow`: https://guides.github.com/introduction/flow/
.. _`Start using Git on the command line`: https://docs.gitlab.com/ee/topics/git/


================================================
FILE: docs/html/development/index.rst
================================================
===========
Development
===========

pip is a volunteer maintained open source project and we welcome contributions
of all forms. The sections below will help you get started with development,
testing, and documentation.

You can also join ``#pypa`` (general packaging discussion and user support) and
``#pypa-dev`` (discussion about development of packaging tools) `on Libera.chat`_,
or the ``#pip`` channel on the `PyPA Discord`_, to ask questions or get involved.

.. toctree::
    :maxdepth: 2

    getting-started
    contributing
    ci
    issue-triage
    architecture/index
    release-process
    vendoring-policy

.. note::

    pip's development documentation has been rearranged and some older
    references might be broken.

.. _`on Libera.chat`: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev
.. _`PyPA Discord`: https://discord.gg/pypa


================================================
FILE: docs/html/development/issue-triage.md
================================================
```{note}
This section of the documentation is currently being written. pip
developers welcome your help to complete this documentation. If
you're interested in helping out, please let us know in the
[tracking issue](https://github.com/pypa/pip/issues/6583), or
just submit a pull request and mention it in that tracking issue.
```

# Issue Triage

This serves as an introduction to issue tracking in pip as well as
how to help triage reported issues.

## Issue Tracker

The [pip issue tracker](https://github.com/pypa/pip/issues) is hosted on
GitHub alongside the project.

Currently, the issue tracker is used for bugs, feature requests, and general
user support.

In the pip issue tracker, we make use of labels and milestones to organize and
track work.

### Labels

Issue labels are used to:

1. Categorize issues
2. Provide status information for contributors and reporters
3. Help contributors find tasks to work on

The current set of labels are divided into several categories identified by
prefix:

**C - Category**
: which area of `pip` functionality a feature request or issue is related to

**K - Kind**
**O - Operating System**
: for issues that are OS-specific

**P - Project/Platform**
: related to something external to `pip`

**R - Resolution**
: no more discussion is really needed, an action has been identified and the
issue is waiting or closed

**S - State**
: for some automatic labels and other indicators that work is needed

**type**
: the role or flavor of an issue

The specific labels falling into each category have a description that can be
seen on the [Labels](https://github.com/pypa/pip/labels) page.

In addition, there are several standalone labels:

**good first issue**
: this label marks an issue as beginner-friendly and shows up in banners that
GitHub displays for first-time visitors to the repository

**triage**
: default label given to issues when they are created

**trivial**
: special label for pull requests that removes the
{ref}`news file requirement `

**needs rebase or merge**

: this is a special label used by BrownTruck to mark PRs that have merge
conflicts

### Automation

There are several helpers to manage issues and pull requests.

Issues created on the issue tracker are automatically given the
`triage` label by the
[triage-new-issues](https://github.com/apps/triage-new-issues)
bot. The label is automatically removed when another label is added.

When an issue needs feedback from the author we can label it with
`S: awaiting response`. When the author responds, the
[no-response](https://github.com/apps/no-response) bot removes the label.

After an issue has been closed for 30 days, the
[lock](https://github.com/apps/lock) bot locks the issue and adds the
`S: auto-locked` label. This allows us to avoid monitoring existing closed
issues, but unfortunately prevents and references to issues from showing up as
links on the closed issue.

## Triage Issues

Users can make issues for a number of reasons:

1. Suggestions about pip features that could be added or improved
2. Problems using pip
3. Concerns about pip usability
4. General packaging problems to be solved with pip
5. Problems installing or using Python packages
6. Problems managing virtual environments
7. Problems managing Python installations

To triage issues means to identify what kind of issue is happening and

- confirm bugs
- provide support
- discuss and design around the uses of the tool

Specifically, to address an issue:

1. Read issue title
2. Scan issue description
3. Ask questions
4. If time is available, try to reproduce
5. Search for or remember related issues and link to them
6. Identify an appropriate area of concern (if applicable)

Keep in mind that all communication is happening with other people and
should be done with respect per the
[Code of Conduct](https://www.pypa.io/en/latest/code-of-conduct/).

The lifecycle of an issue (bug or support) generally looks like:

1. waiting for triage (marked with label `triage`)

2. confirming issue - some discussion with the user, gathering
   details, trying to reproduce the issue (may be marked with a specific
   category, `S: awaiting-response`, `S: discussion-needed`, or
   `S: need-repro`)

3. confirmed - the issue is pretty consistently reproducible in a
   straightforward way, or a mechanism that could be causing the issue has been
   identified

4. awaiting fix - the fix is identified and no real discussion on the issue
   is needed, should be marked `R: awaiting PR`

5. closed - can be for several reasons

   - fixed
   - could not be reproduced, no more details could be obtained, and no
     progress can be made
   - actual issue was with another project or related to system
     configuration and pip cannot (or will not) be adapted for it

### Requesting information

Requesting more information to better understand the context and environment
that led to the issue. Examples of specific information that may be useful
depending on the situation:

- pip debug: `pip debug`
- pip version: `pip -V`
- Python version: `python -VV`
- Python path: `python -c 'import sys; print(sys.executable)'`
- `python` on `PATH`: Unix: `which python`; Windows: `where python`
- Python as resolved by the shell: `type python`
- Origin of pip (get-pip.py, OS-level package manager, ensurepip, manual
  installation)
- Using a virtual environment (with `--system-site-packages`?)
- Using a conda environment
- `PATH` environment variable
- Network situation (e.g. airgapped environment, firewalls)
- `--verbose` output of a failing command
- (Unix) `strace` output from a failing command (be careful not to output
  into the same directory as a package that's being installed, otherwise pip
  will loop forever copying the log file...)
- (Windows)
  [procmon](https://docs.microsoft.com/en-us/sysinternals/downloads/procmon)
  output during a failing command
  ([example request](https://github.com/pypa/pip/issues/6814#issuecomment-516611389))
- Listing of files relevant to the issue (e.g. `ls -l venv/lib/pythonX.Y/problem-package.dist-info/`)
- whether the unexpected behavior ever worked as expected - if so then what
  were the details of the setup (same information as above)

Generally, information is good to request if it can help confirm or rule out
possible sources of error. We shouldn't request information that does not
improve our understanding of the situation.

### Reproducing issues

Whenever an issue happens and the cause isn't obvious, it is important
that we be able to reproduce it independently. This serves several purposes:

1. If it is a pip bug, then any fix will need tests - a good reproducer
   is most of the way towards that.
2. If it is not reproducible using the provided instructions, that helps
   rule out a lot of possible causes.
3. A clear set of instructions is an easy way to get on the same page as
   someone reporting an issue.

The best way to reproduce an issue is with a script.

A script can be copied into a file and executed, whereas shell output
has to be manually copied a line at a time.

Scripts to reproduce issues should be:

- portable (few/no assumptions about the system, other that it being Unix or Windows as applicable)
- non-destructive
- convenient
- require little/no setup on the part of the runner

Examples:

- creating and installing multiple wheels with different versions
  ([link](https://github.com/pypa/pip/issues/4331#issuecomment-520156471))
- using a small web server for authentication errors
  ([link](https://github.com/pypa/pip/issues/2920#issuecomment-508953118))
- using docker to test system or global configuration-related issues
  ([link](https://github.com/pypa/pip/issues/5533#issuecomment-520159896))
- using docker to test special filesystem permission/configurations
  ([link](https://github.com/pypa/pip/issues/6364#issuecomment-507074729))
- using docker for global installation with get-pip
  ([link](https://github.com/pypa/pip/issues/6498#issuecomment-513501112))
- get-pip on system with no `/usr/lib64`
  ([link](https://github.com/pypa/pip/issues/5379#issuecomment-515270576))
- reproducing with `pip` from current development branch
  ([link](https://github.com/pypa/pip/issues/6707#issue-467770959))

### Reaching resolution

Some user support questions are more related to system configuration than pip.
It's important to treat these issues with the same care and attention as
others, specifically:

1. Unless the issue is very old and the user doesn't seem active, wait for
   confirmation before closing the issue

2. Direct the user to the most appropriate forum for their questions:

   - For Ubuntu, [askubuntu](https://askubuntu.com/)
   - For Other linuxes/unixes, [serverfault](https://serverfault.com/)
   - For network connectivity issues,
     [serverfault](https://serverfault.com/)

3. Just because a user support question is best solved using some other forum
   doesn't mean that we can't make things easier. Try to extract and
   understand from the user query how things could have been made easier for
   them or you, for example with better warning or error messages. If an issue
   does not exist covering that case then create one. If an issue does exist then
   make sure to reference that issue before closing this one.

4. A user may be having trouble installing a package, where the package
   `setup.py` or build-backend configuration is non-trivial. In these cases we
   can help to troubleshoot but the best advice is going to be to direct them
   to the support channels for the related projects.

5. Do not be hasty to assume it is one cause or another. What looks like
   someone else's problem may still be an issue in pip or at least something
   that could be improved.

6. For general discussion on Python packaging:

   - [pypa/packaging](https://github.com/pypa/packaging-problems)
   - [discuss.python.org/packaging](https://discuss.python.org/c/packaging)

### Closing issues

An issue may be considered resolved and closed when:

- for each possible improvement or problem represented in the issue
  discussion:

  - Consensus has been reached on a specific action and the actions
    appear to be external to the project, with no follow up needed
    in the project afterwards.

    - PEP updates (with a corresponding issue in
      [python/peps](https://github.com/python/peps))
    - already tracked by another issue

  - A project-specific issue has been identified and the issue no
    longer occurs as of the latest commit on the main branch.

- An enhancement or feature request no longer has a proponent and the maintainers
  don't think it's worth keeping open.

- An issue has been identified as a duplicate, and it is clearly a duplicate (i.e. the
  original report was very good and points directly to the issue)

- The issue has been fixed, and can be independently validated as no longer being an
  issue. If this is with code then the specific change/PR that led to it should be
  identified and posted for tracking.

## Common issues

1. network-related issues - any issue involving retries, address lookup, or
   anything like that are typically network issues.

2. issues related to having multiple Python versions, or an OS package
   manager-managed pip/python installation (specifically with Debian/Ubuntu).
   These typically present themselves as:

   1. Not being able to find installed packages
   2. basic libraries not able to be found, fundamental OS components missing
   3. In these situations you will want to make sure that we know how they got
      their Python and pip. Knowing the relevant package manager commands can
      help, e.g. `dpkg -S`.

## For issues caused by changes by redistributors

Certain issues are caused by patches that redistributors of Python/pip
make to Python/pip.

Certain redistributors have shared preferred wording to redirect users
to their issue trackers.

Fedora, RHEL, CentOS (and probably other derivatives – Rocky, Scientific, CloudLinux):

```
This issue looks like it's caused by changes that Fedora or Red Hat
made in their pip packaging. Please file a Fedora bug at
https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=python-pip

cc @encukou @hroncok
```

Debian:

```
This issue looks like it's caused by changes that Debian made in
their pip packaging. Please file a bug with Debian, with
`reportbug python3-pip` [Docs](https://www.debian.org/Bugs/Reporting).
You can link to this issue in your bug report.

In the meantime, you may be able to work-around your issue by upgrading
pip inside your virtualenv: `python -m pip install -U pip`
```

Ubuntu:

```
This issue looks like it's caused by changes that Ubuntu made in
their pip packaging. Please file a bug with Ubuntu, with
`ubuntu-bug python3-pip` [Docs](https://help.ubuntu.com/community/ReportingBugs).
You can link to this issue in your bug report.

In the meantime, you may be able to work-around your issue by upgrading
pip inside your virtualenv: `python -m pip install -U pip`
```


================================================
FILE: docs/html/development/release-process.rst
================================================
===============
Release process
===============

.. _`Release Cadence`:

Release Cadence
===============

The pip project has a release cadence of releasing whatever is on ``main``
every 3 months. This gives users a predictable pattern for when releases
are going to happen and prevents locking up improvements for fixes for long
periods of time, while still preventing massively fracturing the user base
with version numbers.

Our release months are January, April, July, October. The release date within
that month will be up to the release manager for that release. If there are
no changes, then that release month is skipped and the next release will be
3 months later.

The version number of pip is ``YY.N``, where ``YY`` is the year of the release
and ``N`` identifies the quarter of the year (0-3).

The release manager may, at their discretion, choose whether or not there
will be a pre-release period for a release, and if there is may extend that
period into the next month if needed.

Because releases are made direct from the ``main`` branch, it is essential
that ``main`` is always in a releasable state. It is acceptable to merge
PRs that partially implement a new feature, but only if the partially
implemented version is usable in that state (for example, with reduced
functionality or disabled by default). In the case where a merged PR is found
to need extra work before being released, the release manager always has the
option to back out the partial change prior to a release. The PR can then be
reworked and resubmitted for the next release.

Vendoring updates will be picked up from the ``main`` branch, as for any other
update. Ideally, vendoring updates should be merged between releases, just like
any other change. If there are outstanding updates to vendored packages, the
release manager *may* at their discretion choose to do a vendoring update
before the release. However this is *not* a requirement and in particular,
updates to vendored packages that fix issues in pip should be merged
proactively, to ensure that they will be present in the next release.


.. _`Deprecation Policy`:

Deprecation Policy
==================

Any change to pip that removes or significantly alters user-visible behavior
that is described in the pip documentation will be deprecated for a minimum of
6 months before the change occurs.

Certain changes may be fast tracked and have a deprecation period of 3 months.
This requires at least two members of the pip team to be in favor of doing so,
and no pip maintainers opposing.

Deprecation will take the form of a warning being issued by pip when the
feature is used. Longer deprecation periods, or deprecation warnings for
behavior changes that would not normally be covered by this policy, are also
possible depending on circumstances, but this is at the discretion of the pip
maintainers.

Note that the documentation is the sole reference for what counts as agreed
behavior. If something isn't explicitly mentioned in the documentation, it can
be changed without warning, or any deprecation period, in a pip release.
However, we are aware that the documentation isn't always complete - PRs that
document existing behavior with the intention of covering that behavior with
the above deprecation process are always acceptable, and will be considered on
their merits.

.. note::

  pip has a helper function for making deprecation easier for pip maintainers.
  The supporting documentation can be found in the source code of
  ``pip._internal.utils.deprecation.deprecated``. The function is not a part of
  pip's public API.

Supported Versions
==================

The latest version of the pip is the only supported version, previous
versions should be considered unsupported. Users are encouraged to make
regular updates to their version of pip in order to remain supported.

.. _`Python 2 Support`:

Python 2 Support
----------------

pip 20.3 was the last version of pip that supported Python 2. Bugs reported
with pip which only occur on Python 2.7 will likely be closed as "won't fix"
issues by pip's maintainers.

Python Support Policy
---------------------

pip supports `CPython versions that are not end-of-life`_. Older versions of CPython may
be supported at the discretion of pip maintainers (based on criteria such as download
statistics on PyPI, Python versions supported by the vendored dependencies and
maintenance burden).

pip maintainers accept pull requests to support other Python implementations, but the
pip CI does not test for compatibility with them.

.. _`Feature Flags`:

Feature Flags
=============

``--use-deprecated``
--------------------

Example: ``--use-deprecated=legacy-resolver``

Use for features that will be deprecated. Deprecated features should remain
available behind this flag for at least six months, as per the deprecation
policy.

Features moved behind this flag should always include a warning that indicates
when the feature is scheduled to be removed.

Once the feature is removed, users who use the flag should be shown an error.

``--use-feature``
-----------------

Example: ``--use-feature=2020-resolver``

Use for new features that users can test before they become pip's default
behaviour (e.g. alpha or beta releases).

Once the feature becomes the default behaviour, this flag can remain in place,
but should issue a warning telling the user that it is no longer necessary.

Release Process
===============

Creating a new release
----------------------

#. Ensure you have the latest ``nox`` installed.
#. Create a new ``release/YY.N`` branch off ``main`` and switch to it.
#. Prepare for release using ``nox -s prepare-release -- YY.N``.
   This will update the relevant files and tag the correct commit.
#. Submit the ``release/YY.N`` branch as a pull request and ensure CI passes.
   Merge the changes back into ``main`` and pull them back locally.
#. Push the tag created by ``prepare-release``. This will trigger the release
   workflow on GitHub.
#. Go to https://github.com/pypa/pip/actions, find the latest ``Publish Python
   🐍 distribution 📦 to PyPI`` workflow run, open it, wait for the build step
   to complete, then approve the PyPI environment to let the publishing step
   run. If you desire, you have the possibility to download and inspect the
   artifacts before approving.
#. Regenerate the ``get-pip.py`` script in the `get-pip repository`_ (as
   documented there) and commit the results.
#. Submit a Pull Request to `CPython`_ adding the new version of pip
   to ``Lib/ensurepip/_bundled``, removing the existing version, and
   adjusting the versions listed in ``Lib/ensurepip/__init__.py``.


.. note::

  If the release dropped the support of an obsolete Python version ``M.m``,
  a new ``M.m/get-pip.py`` needs to be published: update the ``all`` task from
  ``tasks/generate.py`` in `get-pip repository`_ and make a pull request to
  `psf-salt repository`_ to add the new ``get-pip.py`` (and its directory) to
  ``salt/pypa/bootstrap/init.sls``.


.. note::

  If the ``get-pip.py`` script needs to be updated due to changes in pip internals
  and if the last ``M.m/get-pip.py`` published still uses the default template, make
  sure to first duplicate ``templates/default.py`` as ``templates/pre-YY.N.py``
  before updating it and specify in ``tasks/generate.py`` that ``M.m/get-pip.py``
  now needs to use ``templates/pre-YY.N.py``.


Creating a bug-fix release
--------------------------

Sometimes we need to release a bugfix release of the form ``YY.N.Z+1``. In
order to create one of these the changes should already be merged into the
``main`` branch.

Note that this process is only needed when there are changes on the main branch
that you do *not* want to include in the bugfix release. For a bugfix release
that will include everything that is on the ``main`` branch, the above process
for creating a new release can be used, simply changing the version number.

#. Create a new ``release/YY.N.Z+1`` branch off of the ``YY.N`` tag using the
   command ``git checkout -b release/YY.N.Z+1 YY.N``.
#. Cherry pick the fixed commits off of the ``main`` branch, fixing any
   conflicts.
#. Run ``nox -s prepare-release -- YY.N.Z+1``.
#. Merge main into your release branch and drop the news files that have been
   included in your release (otherwise they would also appear in the ``YY.N+1``
   changelog)
#. Push the ``release/YY.N.Z+1`` branch to github and submit a PR for it against
   the ``main`` branch and wait for the tests to run.
#. Once tests run, merge the ``release/YY.N.Z+1`` branch into ``main``, and
   follow the above release process starting with step 5.

.. _`get-pip repository`: https://github.com/pypa/get-pip
.. _`psf-salt repository`: https://github.com/python/psf-salt
.. _`CPython`: https://github.com/python/cpython
.. _`CPython versions that are not end-of-life`: https://devguide.python.org/versions/


================================================
FILE: docs/html/development/vendoring-policy.rst
================================================
.. include:: ../../../src/pip/_vendor/README.rst


================================================
FILE: docs/html/getting-started.md
================================================
# Getting Started

To get started with using pip, you should [install Python] on your system.

[install Python]: https://realpython.com/installing-python/

## Ensure you have a working pip

As a first step, you should check that you have a working Python with pip
installed. This can be done by running the following commands and making
sure that the output looks similar.

```{pip-cli}
$ python --version
Python 3.N.N
$ pip --version
pip X.Y.Z from ... (python 3.N.N)
```

If that worked, congratulations! You have a working pip in your environment.

If you got output that does not look like the sample above, please read
the {doc}`installation` page. It provides guidance on how to install pip
within a Python environment that doesn't have it.

## Common tasks

### Install a package

```{pip-cli}
$ pip install sampleproject
[...]
Successfully installed sampleproject
```

By default, pip will fetch packages from [Python Package Index][PyPI], a
repository of software for the Python programming language where anyone can
upload packages.

[PyPI]: https://pypi.org/

### Install a package from GitHub

```{pip-cli}
$ pip install git+https://github.com/pypa/sampleproject.git@main
[...]
Successfully installed sampleproject
```

See {doc}`topics/vcs-support` for more information about this syntax.

### Install a package from a distribution file

pip can install directly from distribution files as well. They come in 2 forms:

- {term}`source distribution ` (usually shortened to "sdist")
- {term}`wheel distribution ` (usually shortened to "wheel")

```{pip-cli}
$ pip install sampleproject-1.0.tar.gz
[...]
Successfully installed sampleproject
$ pip install sampleproject-1.0-py3-none-any.whl
[...]
Successfully installed sampleproject
```

### Install multiple packages using a requirements file

Many Python projects use {file}`requirements.txt` files, to specify the
list of packages that need to be installed for the project to run. To install
the packages listed in that file, you can run:

```{pip-cli}
$ pip install -r requirements.txt
[...]
Successfully installed sampleproject
```

### Upgrade a package

```{pip-cli}
$ pip install --upgrade sampleproject
   [...]
Successfully installed sampleproject
```

### Uninstall a package

```{pip-cli}
$ pip uninstall sampleproject
Uninstalling sampleproject:
   [...]
Proceed (Y/n)? y
Successfully uninstalled sampleproject
```

## Next Steps

It is recommended to learn about what virtual environments are and how to use
them. This is covered in the {doc}`Installing Packages `
tutorial on packaging.python.org.


================================================
FILE: docs/html/index.md
================================================
---
hide-toc: true
---

# pip

pip is the [package installer for Python][recommended]. You can use it to
install packages from the [Python Package Index][pypi] and other indexes.

```{toctree}
:hidden:

getting-started
installation
user_guide
topics/index
reference/index
cli/index
```

```{toctree}
:caption: Project
:hidden:

development/index
ux-research-design/index
news
Code of Conduct 
GitHub 
```

If you want to learn about how to use pip, check out the following resources:

- [Getting Started](getting-started)
- [Python Packaging User Guide](https://packaging.python.org)

If you find bugs, need help, or want to talk to the developers, use our mailing
lists or chat rooms:

- [GitHub Issues][issue-tracker]
- [Discourse channel][packaging-discourse]
- [User IRC][irc-pypa]
- [Development IRC][irc-pypa-dev]

[recommended]: https://packaging.python.org/guides/tool-recommendations/
[pypi]: https://pypi.org/
[issue-tracker]: https://github.com/pypa/pip/issues/
[packaging-discourse]: https://discuss.python.org/c/packaging/14
[irc-pypa]: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa
[irc-pypa-dev]: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev

If you find any security issues, please report to [security@python.org](mailto:security@python.org)

## Privacy Notice

Pip does not collect any telemetry, however, it will send
non-identifying environment information (Python version, OS, etc.) to any remote indices
used, who may choose to retain such information. Please consult PyPI's privacy
policy for their data collection and retention practices.


================================================
FILE: docs/html/installation.md
================================================
# Installation

Usually, pip is automatically installed if you are:

- working in a
  {ref}`virtual environment `
- using Python downloaded from [python.org](https://www.python.org)
- using Python that has not been modified by a redistributor to remove
  {mod}`ensurepip`

## Supported Methods

If your Python environment does not have pip installed, there are 2 mechanisms
to install pip supported directly by pip's maintainers:

- [`ensurepip`](#ensurepip)
- [`get-pip.py`](#get-pippy)

### `ensurepip`

Python comes with an {mod}`ensurepip` module[^python], which can install pip in
a Python environment.

```{pip-cli}
$ python -m ensurepip --upgrade
```

More details about how {mod}`ensurepip` works and how it can be used, is
available in the standard library documentation.

### `get-pip.py`

This is a Python script that uses some bootstrapping logic to install
pip.

- Download the script, from .
- Open a terminal/command prompt, `cd` to the folder containing the
  `get-pip.py` file and run:

  ```{pip-cli}
  $ python get-pip.py
  ```

More details about this script can be found in [pypa/get-pip]'s README.

[pypa/get-pip]: https://github.com/pypa/get-pip

### Standalone zip application

```{note}
The zip application is currently experimental. We test that pip runs correctly
in this form, but it is possible that there could be issues in some situations.
We will accept bug reports in such cases, but for now the zip application should
not be used in production environments.
```

In addition to installing pip in your environment, pip is available as a
standalone [zip application](https://docs.python.org/3.11/library/zipapp.html).
This can be downloaded from . There are
also zip applications for specific pip versions, named `pip-X.Y.Z.pyz`.

The zip application can be run using any supported version of Python:

```{pip-cli}
$ python pip.pyz --help
```

If run directly:

````{tab} Linux
```console
$ chmod +x ./pip.pyz
$ ./pip.pyz
```

then the currently active Python interpreter will be used.
````

````{tab} MacOS
```console
$ chmod +x ./pip.pyz
$ ./pip.pyz
```

then the currently active Python interpreter will be used.
````

````{tab} Windows
```doscon
C:> .\pip.pyz
```

then the currently active Python interpreter will be used.

You may need to configure your system to recognise the ``.pyz`` extension
before this will work.
````

## Alternative Methods

Depending on how you installed Python, there might be other mechanisms
available to you for installing pip such as
{ref}`using Linux package managers `.

These mechanisms are provided by redistributors of pip, who may have modified
pip to change its behaviour. This has been a frequent source of user confusion,
since it causes a mismatch between documented behaviour in this documentation
and how pip works after those modifications.

If you face issues when using Python and pip installed using these mechanisms,
it is recommended to request for support from the relevant provider (eg: Linux
distro community, cloud provider support channels, etc).

## Upgrading `pip`

Upgrade your `pip` by running:

```{pip-cli}
$ pip install --upgrade pip
```

(compatibility-requirements)=

## Compatibility

The current version of pip works on:

- Windows, Linux and macOS.
- CPython 3.9, 3.10, 3.11, 3.12, 3.13, and latest PyPy3.

pip is tested to work on the latest patch version of the Python interpreter,
for each of the minor versions listed above. Previous patch versions are
supported on a best effort approach.

Other operating systems and Python versions are not supported by pip's
maintainers.

Users who are on unsupported platforms should be aware that if they hit issues, they may have to resolve them for themselves. If they received pip from a source which provides support for their platform, they should request pip support from that source.

[^python]: The `ensurepip` module was added to the Python standard library in Python 3.4.


================================================
FILE: docs/html/installing.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../installation/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`installation`


================================================
FILE: docs/html/news.rst
================================================
=========
Changelog
=========

.. attention::

    Major and minor releases of pip also include changes listed within
    prior beta releases.

.. towncrier-draft-entries:: Not yet released

.. pip-news-include:: ../../NEWS.rst


================================================
FILE: docs/html/quickstart.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../getting-started/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`getting-started`


================================================
FILE: docs/html/reference/build-system.md
================================================
(build-interface)=

# Build System Interface

When dealing with installable source distributions of a package, pip does not
directly handle the build process for the package. This responsibility is
delegated to "build backends" -- also known as "build systems". This means
that pip needs an interface, to interact with these build backends.

Modern Python packages can contain a `pyproject.toml` file, first introduced in
{pep}`518` and later expanded in {pep}`517`, {pep}`621` and {pep}`660`.
This file contains build system requirements and information, which are used by
pip to build the package.

## Build process

The overall process for building a package is:

- Create an isolated build environment.
- Populate the build environment with build dependencies.
- Generate the package's metadata, if necessary and possible.
- Generate a wheel for the package.

The wheel can then be used to perform an installation, if necessary.

### Build Isolation

For building packages using this interface, pip uses an _isolated environment_.
That is, pip will install build-time Python dependencies in a temporary
directory which will be added to `sys.path` for the build commands. This ensures
that build requirements are handled independently of the user's runtime
environment.

For example, a project that needs an older version of setuptools to build can
still be installed, even if the user has a newer version installed (and
without silently replacing that version).

### Build-time dependencies

Introduced in {pep}`518`, the `build-system.requires` key in the
`pyproject.toml` file is a list of requirement specifiers for build-time
dependencies of a package.

```toml
[build-system]
requires = ["setuptools ~= 58.0", "cython ~= 0.29.0"]
```

It is also possible for a build backend to provide dynamically calculated
build dependencies, using {pep}`517`'s `get_requires_for_build_wheel` hook. This
hook will be called by pip, and dependencies it describes will also be installed
in the build environment. For example, newer versions of setuptools expose the
contents of `setup_requires` to pip via this hook.

Build-time requirement specifiers follow {pep}`508`, so it's possible to
reference packages with URLs. For example:

```toml
[build-system]
requires = ["setuptools @ git+https://github.com/pypa/setuptools.git@main"]
```

### Metadata Generation

```{versionadded} 19.0

```

Once the build environment has been created and populated with build-time
dependencies, `pip` will usually need metadata about a package (name, version,
dependencies, and more).

If {pep}`517`'s `prepare_metadata_for_build_wheel` hook is provided by the
build backend, that will be used to generate the packages' metadata. Otherwise,
a wheel will be generated (as described below) and the metadata contained
within such a wheel will be used.

### Wheel Generation

```{versionadded} 19.0

```

For generating a wheel, pip uses the {pep}`517` `build_wheel` hook that has
to be provided by the build backend. The build backend will generate a wheel,
which may involve compiling extension code written in C/C++ (or other
languages).

Wheels generated using this mechanism can be [cached](wheel-caching) for reuse,
to speed up future installations.

### Editable Installation

```{versionadded} 21.3

```

For performing editable installs, pip will use {pep}`660`
`build_wheel_for_editable` hook that has to be provided by the build backend.
The wheels generated using this mechanism are not cached.

### Backend Configuration

Build backends have the ability to accept configuration settings, which can
change the way the build is handled. These settings take the form of a
series of `key=value` pairs. The user can supply configuration settings
using the `--config-settings` command line option (which can be supplied
multiple times, in order to specify multiple settings).

The supplied configuration settings are passed to every backend hook call.

Configuration settings provided via `--config-settings` command line options (or the
equivalent environment variables or configuration file entries) are passed to the build
of requirements explicitly provided as pip command line arguments. They are not passed
to the build of dependencies, or to the build of requirements provided in requirement
files.

## Build output

It is the responsibility of the build backend to ensure that the output is
in the correct encoding, as described in {pep}`517`.

## Fallback Behaviour

```{warning}
The following snippet merely describes the fallback behavior. For valid
examples of `pyproject.toml` to use with setuptools, please refer to
[the setuptools documentation](
https://setuptools.pypa.io/en/stable/userguide/quickstart.html#basic-use).
```

If a project does not have a `pyproject.toml` file containing a `build-system`
section, and contains a `setup.py` it will be assumed to have the following
backend settings:

```toml
[build-system]
requires = ["setuptools>=40.8.0"]
build-backend = "setuptools.build_meta:__legacy__"
```

If a project has a `build-system` section but no `build-backend`, then:

- It is expected to include `setuptools` as a build requirement. An
  error is reported if the available version of `setuptools` is not recent
  enough.

- The `setuptools.build_meta:__legacy__` build backend will be used.

## Disabling build isolation

This can be disabled using the `--no-build-isolation` flag -- users supplying
this flag are responsible for ensuring the build environment is managed
appropriately, including ensuring that all required build-time dependencies are
installed, since pip does not manage build-time dependencies when this flag is
passed.

## Historical notes

```{versionadded} 10.0

```

As this feature was incrementally rolled out, there have been various notable
changes and improvements in it.

Setuptools 40.8.0 is the first version of setuptools that offers a
{pep}`517` backend that closely mimics directly executing `setup.py`.

```{versionadded} 18.0
Prior to pip 18.0, pip only supports installing build requirements from
wheels, and does not support the use of environment markers and extras (only
version specifiers are respected).
```

```{versionadded} 18.1
Prior to pip 18.1, build dependencies using `.pth` files are not properly
supported; as a result namespace packages do not work under Python 3.2 and
earlier.
```

```{versionchanged} 23.1
The legacy interface where pip could invoke `setup.py install`
in some circumstances was removed,
in favor of the fallback behavior described above.
```

```{versionchanged} 25.3
The legacy interface where pip could invoke `setup.py build_wheel` or
`setup.py develop` in some circumstances was removed,
in favor of the fallback behavior described above.
```


================================================
FILE: docs/html/reference/index.md
================================================
# Reference

Reference provides information about various file formats, interfaces and
interoperability standards that pip utilises/implements.

```{toctree}
:titlesonly:

build-system
requirement-specifiers
requirements-file-format
installation-report
inspect-report
```


================================================
FILE: docs/html/reference/inspect-report.md
================================================
# `pip inspect` JSON output specification

```{versionadded} 22.2
```

```{versionchanged} 23.0
``version`` has been bumped to ``1`` and the format declared stable.
```

The `pip inspect` command produces a detailed JSON report of the Python
environment, including installed distributions.

## Specification

The report is a JSON object with the following properties:

- `version`: the string `1`. It will change only if
  and when backward incompatible changes are introduced, such as removing mandatory
  fields or changing the semantics or data type of existing fields. The introduction of
  backward incompatible changes will follow the usual pip processes such as the
  deprecation cycle or feature flags. Tools must check this field to ensure they support
  the corresponding version.

- `pip_version`: a string with the version of pip used to produce the report.

- `installed`: an array of [`InspectReportItem`](InspectReportItem) representing the
  distribution packages that are installed.

- `environment`: an object describing the environment where the installation report was
  generated. See the section on environment markers in the {ref}`pypug:dependency-specifiers`
  specification for more information. Values have a string type.

(InspectReportItem)=

An `InspectReportItem` is an object describing an installed distribution package with
the following properties:

- `metadata`: the metadata of the distribution, converted to a JSON object according to
  the [PEP 566
  transformation](https://www.python.org/dev/peps/pep-0566/#json-compatible-metadata).

- `metadata_location`: the location of the metadata of the installed distribution. Most
  of the time this is the `.dist-info` directory. For legacy installs it is the
  `.egg-info` directory.

  ```{warning}
  This field may not necessarily point to a directory, for instance, in the case of older
  `.egg` installs.
  ```

- `direct_url`: Information about the direct URL that was used for installation, if any,
  using the [direct URL data
  structure](https://packaging.python.org/en/latest/specifications/direct-url-data-structure/).
  In most case, this field corresponds to the
  [`direct_url.json`](https://packaging.python.org/en/latest/specifications/direct-url)
  metadata, except for legacy editable installs, where it is emulated.

- `requested`: `true` if the `REQUESTED` metadata is present, `false` otherwise. This
  field is only present for modern `.dist-info` installations.

  ```{note}
  The `REQUESTED` metadata may not be generated by all installers.
  It is generated by pip since version 20.2.
  ```

- `installer`: the content of the `INSTALLER` metadata, if present and not empty.

## Example

Running the ``pip inspect`` command, in an environment where `pip` is installed in
editable mode and `packaging` is installed as well, will produce an output similar to
this (metadata abriged for brevity):

```json
{
  "version": "1",
  "pip_version": "22.2.dev0",
  "installed": [
    {
      "metadata": {
        "metadata_version": "2.1",
        "name": "pyparsing",
        "version": "3.0.9",
        "summary": "pyparsing module - Classes and methods to define and execute parsing grammars",
        "description_content_type": "text/x-rst",
        "author_email": "Paul McGuire ",
        "classifier": [
          "Development Status :: 5 - Production/Stable",
          "Intended Audience :: Developers",
          "Intended Audience :: Information Technology",
          "License :: OSI Approved :: MIT License",
          "Operating System :: OS Independent",
          "Programming Language :: Python",
          "Programming Language :: Python :: 3",
          "Programming Language :: Python :: 3.6",
          "Programming Language :: Python :: 3.7",
          "Programming Language :: Python :: 3.8",
          "Programming Language :: Python :: 3.9",
          "Programming Language :: Python :: 3.10",
          "Programming Language :: Python :: 3 :: Only",
          "Programming Language :: Python :: Implementation :: CPython",
          "Programming Language :: Python :: Implementation :: PyPy",
          "Typing :: Typed"
        ],
        "requires_dist": [
          "railroad-diagrams ; extra == \"diagrams\"",
          "jinja2 ; extra == \"diagrams\""
        ],
        "requires_python": ">=3.6.8",
        "project_url": [
          "Homepage, https://github.com/pyparsing/pyparsing/"
        ],
        "provides_extra": [
          "diagrams"
        ],
        "description": "..."
      },
      "metadata_location": "/home/me/.virtualenvs/demoenv/lib/python3.8/site-packages/pyparsing-3.0.9.dist-info",
      "installer": "pip",
      "requested": false
    },
    {
      "metadata": {
        "metadata_version": "2.1",
        "name": "packaging",
        "version": "21.3",
        "platform": [
          "UNKNOWN"
        ],
        "summary": "Core utilities for Python packages",
        "description_content_type": "text/x-rst",
        "home_page": "https://github.com/pypa/packaging",
        "author": "Donald Stufft and individual contributors",
        "author_email": "donald@stufft.io",
        "license": "BSD-2-Clause or Apache-2.0",
        "classifier": [
          "Development Status :: 5 - Production/Stable",
          "Intended Audience :: Developers",
          "License :: OSI Approved :: Apache Software License",
          "License :: OSI Approved :: BSD License",
          "Programming Language :: Python",
          "Programming Language :: Python :: 3",
          "Programming Language :: Python :: 3 :: Only",
          "Programming Language :: Python :: 3.6",
          "Programming Language :: Python :: 3.7",
          "Programming Language :: Python :: 3.8",
          "Programming Language :: Python :: 3.9",
          "Programming Language :: Python :: 3.10",
          "Programming Language :: Python :: Implementation :: CPython",
          "Programming Language :: Python :: Implementation :: PyPy"
        ],
        "requires_dist": [
          "pyparsing (!=3.0.5,>=2.0.2)"
        ],
        "requires_python": ">=3.6",
        "description": "..."
      },
      "metadata_location": "/home/me/.virtualenvs/demoenv/lib/python3.8/site-packages/packaging-21.3.dist-info",
      "installer": "pip",
      "requested": true
    },
    {
      "metadata": {
        "metadata_version": "2.1",
        "name": "pip",
        "version": "22.2.dev0",
        "summary": "The PyPA recommended tool for installing Python packages.",
        "home_page": "https://pip.pypa.io/",
        "author": "The pip developers",
        "author_email": "distutils-sig@python.org",
        "license": "MIT",
        "classifier": [
          "Development Status :: 5 - Production/Stable",
          "Intended Audience :: Developers",
          "License :: OSI Approved :: MIT License",
          "Topic :: Software Development :: Build Tools",
          "Programming Language :: Python",
          "Programming Language :: Python :: 3",
          "Programming Language :: Python :: 3 :: Only",
          "Programming Language :: Python :: 3.7",
          "Programming Language :: Python :: 3.8",
          "Programming Language :: Python :: 3.9",
          "Programming Language :: Python :: 3.10",
          "Programming Language :: Python :: Implementation :: CPython",
          "Programming Language :: Python :: Implementation :: PyPy"
        ],
        "requires_python": ">=3.7",
        "project_url": [
          "Documentation, https://pip.pypa.io",
          "Source, https://github.com/pypa/pip",
          "Changelog, https://pip.pypa.io/en/stable/news/"
        ],
        "description": "..."
      },
      "metadata_location": "/home/me/pip/src/pip.egg-info",
      "direct_url": {
        "url": "file:///home/me/pip/src",
        "dir_info": {
          "editable": true
        }
      }
    }
  ],
  "environment": {
    "implementation_name": "cpython",
    "implementation_version": "3.8.10",
    "os_name": "posix",
    "platform_machine": "x86_64",
    "platform_release": "5.13-generic",
    "platform_system": "Linux",
    "platform_version": "...",
    "python_full_version": "3.8.10",
    "platform_python_implementation": "CPython",
    "python_version": "3.8",
    "sys_platform": "linux"
  }
}
```


================================================
FILE: docs/html/reference/installation-report.md
================================================
# Installation Report

```{versionadded} 22.2
```

```{versionchanged} 23.0
``version`` has been bumped to ``1`` and the format declared stable.
```

The `--report` option of the pip install command produces a detailed JSON report of what
it did install (or what it would have installed, if used with the `--dry-run` option).

```{note}
When considering use cases, please bear in mind that

- while the `--report` option may be used to implement requirement locking tools (among
  other use cases), this format is *not* meant to be a lock file format as such;
- there is no plan for pip to accept an installation report as input for the `install`,
  `download` or `wheel` commands;
- while the `--report` option and this format is a supported pip feature,
  it is *not* a PyPA interoperability standard and as such its evolution is governed by
  the pip processes and not the PyPA standardization processes.
```

## Specification

The report is a JSON object with the following properties:

- `version`: the string `1`. It will change only if
  and when backward incompatible changes are introduced, such as removing mandatory
  fields or changing the semantics or data type of existing fields. The introduction of
  backward incompatible changes will follow the usual pip processes such as the
  deprecation cycle or feature flags. Tools must check this field to ensure they support
  the corresponding version.

- `pip_version`: a string with the version of pip used to produce the report.

- `install`: an array of [`InstallationReportItem`](InstallationReportItem) representing
  the distribution packages (to be) installed.

- `environment`: an object describing the environment where the installation report was
  generated. See [PEP 508 environment
  markers](https://peps.python.org/pep-0508/#environment-markers) for more information.
  Values have a string type.

(InstallationReportItem)=

An `InstallationReportItem` is an object describing a (to be) installed distribution
package with the following properties:

- `metadata`: the metadata of the distribution, converted to a JSON object according to
  the [PEP 566
  transformation](https://www.python.org/dev/peps/pep-0566/#json-compatible-metadata).

- `is_direct`: `true` if the requirement was provided as, or constrained to, a direct
  URL reference. `false` if the requirements was provided as a name and version
  specifier.

- `is_yanked`: `true` if the requirement was yanked from the index, but was still
  selected by pip conform to [PEP 592](https://peps.python.org/pep-0592/#installers).

- `download_info`: Information about the artifact (to be) downloaded for installation,
  using the [direct URL data
  structure](https://packaging.python.org/en/latest/specifications/direct-url-data-structure/).
  When `is_direct` is `true`, this field is the same as the
  [`direct_url.json`](https://packaging.python.org/en/latest/specifications/direct-url)
  metadata, otherwise it represents the URL of the artifact obtained from the index or
  `--find-links`.

  ```{note}
  For source archives, `download_info.archive_info.hashes` may
  be absent when the requirement was installed from the wheel cache
  and the cache entry was populated by an older pip version that did not
  record the origin URL of the downloaded artifact.
  ```

- `requested`: `true` if the requirement was explicitly provided by the user, either
  directly via a command line argument or indirectly via a requirements file. `false`
  if the requirement was installed as a dependency of another requirement.

- `requested_extras`: extras requested by the user. This field is only present when the
  `requested` field is true.

## Example

The following command:

```console
pip install \
  --ignore-installed --dry-run --quiet \
  --report - \
  "pydantic>=1.9" git+https://github.com/pypa/packaging@main
```

will produce an output similar to this (metadata abriged for brevity):

```json
{
  "version": "1",
  "pip_version": "22.2",
  "install": [
    {
      "download_info": {
        "url": "https://files.pythonhosted.org/packages/a4/0c/fbaa7319dcb5eecd3484686eb5a5c5702a6445adb566f01aee6de3369bc4/pydantic-1.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
        "archive_info": {
          "hashes": {
            "sha256": "18f3e912f9ad1bdec27fb06b8198a2ccc32f201e24174cec1b3424dda605a310"
          }
        }
      },
      "is_direct": false,
      "is_yanked": false,
      "requested": true,
      "metadata": {
        "name": "pydantic",
        "version": "1.9.1",
        "requires_dist": [
          "typing-extensions (>=3.7.4.3)",
          "dataclasses (>=0.6) ; python_version < \"3.7\"",
          "python-dotenv (>=0.10.4) ; extra == 'dotenv'",
          "email-validator (>=1.0.3) ; extra == 'email'"
        ],
        "requires_python": ">=3.6.1",
        "provides_extra": [
          "dotenv",
          "email"
        ]
      }
    },
    {
      "download_info": {
        "url": "https://github.com/pypa/packaging",
        "vcs_info": {
          "vcs": "git",
          "requested_revision": "main",
          "commit_id": "4f42225e91a0be634625c09e84dd29ea82b85e27"
        }
      },
      "is_direct": true,
      "is_yanked": false,
      "requested": true,
      "metadata": {
        "name": "packaging",
        "version": "21.4.dev0",
        "requires_dist": [
          "pyparsing (!=3.0.5,>=2.0.2)"
        ],
        "requires_python": ">=3.7"
      }
    },
    {
      "download_info": {
        "url": "https://files.pythonhosted.org/packages/6c/10/a7d0fa5baea8fe7b50f448ab742f26f52b80bfca85ac2be9d35cdd9a3246/pyparsing-3.0.9-py3-none-any.whl",
        "archive_info": {
          "hashes": {
            "sha256": "5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"
          }
        }
      },
      "is_direct": false,
      "requested": false,
      "metadata": {
        "name": "pyparsing",
        "version": "3.0.9",
        "requires_dist": [
          "railroad-diagrams ; extra == \"diagrams\"",
          "jinja2 ; extra == \"diagrams\""
        ],
        "requires_python": ">=3.6.8"
      }
    },
    {
      "download_info": {
        "url": "https://files.pythonhosted.org/packages/75/e1/932e06004039dd670c9d5e1df0cd606bf46e29a28e65d5bb28e894ea29c9/typing_extensions-4.2.0-py3-none-any.whl",
        "archive_info": {
          "hashes": {
            "sha256": "6657594ee297170d19f67d55c05852a874e7eb634f4f753dbd667855e07c1708"
          }
        }
      },
      "is_direct": false,
      "requested": false,
      "metadata": {
        "name": "typing_extensions",
        "version": "4.2.0",
        "requires_python": ">=3.7"
      }
    }
  ],
  "environment": {
    "implementation_name": "cpython",
    "implementation_version": "3.10.5",
    "os_name": "posix",
    "platform_machine": "x86_64",
    "platform_release": "5.13-generic",
    "platform_system": "Linux",
    "platform_version": "...",
    "python_full_version": "3.10.5",
    "platform_python_implementation": "CPython",
    "python_version": "3.10",
    "sys_platform": "linux"
  }
}
```


================================================
FILE: docs/html/reference/pip.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../../cli/pip/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip`


================================================
FILE: docs/html/reference/pip_cache.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../../cli/pip_cache/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_cache`


================================================
FILE: docs/html/reference/pip_check.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../../cli/pip_check/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_check`


================================================
FILE: docs/html/reference/pip_config.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../../cli/pip_config/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_config`


================================================
FILE: docs/html/reference/pip_debug.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../../cli/pip_debug/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_debug`


================================================
FILE: docs/html/reference/pip_download.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../../cli/pip_download/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_download`


================================================
FILE: docs/html/reference/pip_freeze.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../../cli/pip_freeze/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_freeze`


================================================
FILE: docs/html/reference/pip_hash.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../../cli/pip_hash/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_hash`


================================================
FILE: docs/html/reference/pip_index.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../../cli/pip_index/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_index`


================================================
FILE: docs/html/reference/pip_install.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../../cli/pip_install/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_install`


================================================
FILE: docs/html/reference/pip_list.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../../cli/pip_list/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_list`


================================================
FILE: docs/html/reference/pip_search.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../../cli/pip_search/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_search`


================================================
FILE: docs/html/reference/pip_show.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../../cli/pip_show/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_show`


================================================
FILE: docs/html/reference/pip_uninstall.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../../cli/pip_uninstall/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_uninstall`


================================================
FILE: docs/html/reference/pip_wheel.rst
================================================
:orphan:

.. meta::

  :http-equiv=refresh: 3; url=../../cli/pip_wheel/

This page has moved
===================

You should be redirected automatically in 3 seconds. If that didn't
work, here's a link: :doc:`../cli/pip_wheel`


================================================
FILE: docs/html/reference/requirement-specifiers.md
================================================
(Requirement Specifiers)=

# Requirement Specifiers

pip supports installing from a package index using a {term}`requirement specifier `. Generally speaking, a requirement specifier is composed of a project name followed by optional {term}`version specifiers `.

{pep}`508` contains a full specification of the format of a requirement.

```{versionadded} 6.0
Support for environment markers.
```

```{versionadded} 19.1
Support for the direct URL reference form.
```

## Overview

A requirement specifier comes in two forms:

- name-based, which is composed of:

  - a package name (eg: `requests`)
  - optionally, a set of "extras" that serve to install optional dependencies (eg: `security`)
  - optionally, constraints to apply on the version of the package
  - optionally, environment markers

- URL-based, which is composed of:

  - a package name (eg: `requests`)
  - optionally, a set of "extras" that serve to install optional dependencies (eg: `security`)
  - a URL for the package
  - optionally, environment markers

## Examples

A few example name-based requirement specifiers:

```
SomeProject
SomeProject == 1.3
SomeProject >= 1.2, < 2.0
SomeProject[foo, bar]
SomeProject ~= 1.4.2
SomeProject == 5.4 ; python_version < '3.8'
SomeProject ; sys_platform == 'win32'
requests [security] >= 2.8.1, == 2.8.* ; python_version < "2.7"
```

```{note}
Use quotes around specifiers in the shell when using `>`, `<`, or when using environment markers.

Do _not_ use quotes in requirement files. There is only one exception: pip v7.0 and v7.0.1 (from May 2015) required quotes around specifiers containing environment markers in requirement files.
```

A few example URL-based requirement specifiers:

```none
pip @ https://github.com/pypa/pip/archive/22.0.2.zip
requests [security] @ https://github.com/psf/requests/archive/refs/heads/main.zip ; python_version >= "3.11"
```


================================================
FILE: docs/html/reference/requirements-file-format.md
================================================
(requirements-file-format)=

# Requirements File Format

Requirements files serve as a list of items to be installed by pip, when
using {ref}`pip install`. Files that use this format are often called
"pip requirements.txt files", since `requirements.txt` is usually what
these files are named (although, that is not a requirement).

```{note}
The requirements file format is closely tied to a number of internal details of
pip (e.g., pip's command line options). The basic format is relatively stable
and portable but the full syntax, as described here, is only intended for
consumption by pip, and other tools should take that into account before using
it for their own purposes.
```

## Example

```
# This is a comment, to show how #-prefixed lines are ignored.
# It is possible to specify requirements as plain names.
pytest
pytest-cov
beautifulsoup4

# The syntax supported here is the same as that of requirement specifiers.
docopt == 0.6.1
requests [security] >= 2.8.1, == 2.8.* ; python_version < "2.7"
urllib3 @ https://github.com/urllib3/urllib3/archive/refs/tags/1.26.8.zip

# It is possible to refer to other requirement files or constraints files.
-r other-requirements.txt
-c constraints.txt

# It is possible to refer to specific local distribution paths.
./downloads/numpy-1.9.2-cp34-none-win32.whl

# It is possible to refer to URLs.
http://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix-3.0.3.dev1820+49a8884-cp34-none-win_amd64.whl
```

## Structure

Each line of the requirements file indicates something to be installed,
or arguments to {ref}`pip install`. The following forms are supported:

- `[[--option]...]`
- ``
- ``
- `[-e] `
- `[-e] `

For details on requirement specifiers, see {ref}`Requirement Specifiers`. For
examples of all these forms, see {ref}`pip install Examples`.

### Encoding

The default encoding for requirement files is `UTF-8` unless a different
encoding is specified using a {pep}`263` style comment (e.g. `# -*- coding:
 -*-`).

### Line continuations

A line ending in an unescaped `\` is treated as a line continuation
and the newline following it is effectively ignored.

### Comments

A line that begins with `#` is treated as a comment and ignored. Whitespace
followed by a `#` causes the `#` and the remainder of the line to be
treated as a comment.

Comments are stripped _after_ line continuations are processed.

## Supported options

Requirements files only supports certain pip install options, which are listed
below.

### Global options

The following options have an effect on the _entire_ `pip install` run, and
must be specified on their individual lines.

```{eval-rst}
.. pip-requirements-file-options-ref-list::
```

````{admonition} Example
To specify {ref}`--pre `, {ref}`--no-index `
and two {ref}`--find-links ` locations:

```
--pre
--no-index
--find-links /my/local/archives
--find-links http://some.archives.com/archives
```
````

(per-requirement-options)=

### Per-requirement options

```{versionadded} 7.0

```

The options which can be applied to individual requirements are:

- {ref}`--config-settings `
- `--hash` (for {ref}`Hash-checking mode`)

## Referring to other requirements files

If you wish, you can refer to other requirements files, like this:

```
-r more_requirements.txt
```

You can also refer to {ref}`constraints files `, like this:

```
-c some_constraints.txt
```

## Using environment variables

```{versionadded} 10.0

```

pip supports the use of environment variables inside the
requirements file.

You have to use the POSIX format for variable names including brackets around
the uppercase name as shown in this example: `${API_TOKEN}`. pip will attempt
to find the corresponding environment variable defined on the host system at
runtime.

```{note}
There is no support for other variable expansion syntaxes such as `$VARIABLE`
and `%VARIABLE%`.
```

You can now store sensitive data (tokens, keys, etc.) in environment variables
and only specify the variable name for your requirements, letting pip lookup
the value at runtime. This approach aligns with the commonly used
[12-factor configuration pattern](https://12factor.net/config).


================================================
FILE: docs/html/topics/authentication.md
================================================
# Authentication

## Basic HTTP authentication

pip supports basic HTTP-based authentication credentials. This is done by
providing the username (and optionally password) in the URL:

```
https://username:password@pypi.company.com/simple
```

For indexes that only require single-part authentication tokens, provide the
token as the "username" and do not provide a password:

```
https://0123456789abcdef@pypi.company.com/simple
```

### Percent-encoding special characters

```{versionadded} 10.0
```

Certain special characters are not valid in the credential part of a URL.
If the user or password part of your login credentials contain any of these
[special characters][reserved-chars], then they must be percent-encoded. As an
example, for a user with username `user` and password `he//o` accessing a
repository at `pypi.company.com/simple`, the URL with credentials would look
like:

```
https://user:he%2F%2Fo@pypi.company.com/simple
```

[reserved-chars]: https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters

## netrc support

pip supports loading credentials from a user's `.netrc` file. If no credentials
are part of the URL, pip will attempt to get authentication credentials for the
URL's hostname from the user's `.netrc` file. This behaviour comes from the
underlying use of {pypi}`requests`, which in turn delegates it to the
[Python standard library's `netrc` module][netrc-std-lib].

```{note}
As mentioned in the [standard library documentation for netrc][netrc-std-lib],
only ASCII characters are allowed in `.netrc` files. Whitespace and
non-printable characters are not allowed in passwords.
```

Below is an example `.netrc`, for the host `example.com`, with a user named
`daniel`, using the password `qwerty`:

```
machine example.com
login daniel
password qwerty
```

More information about the `.netrc` file format can be found in the GNU [`ftp`
man pages][netrc-docs].

[netrc-docs]: https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html
[netrc-std-lib]: https://docs.python.org/3/library/netrc.html

## Keyring Support

pip supports loading credentials stored in your keyring using the
{pypi}`keyring` library, which can be enabled py passing `--keyring-provider`
with a value of `auto`, `disabled`, `import`, or `subprocess`. The default
value `auto` respects `--no-input` and does not query keyring at all if the option
is used; otherwise it tries the `import`, `subprocess`, and `disabled`
providers (in this order) and uses the first one that works.

### Configuring pip's keyring usage

Since the keyring configuration is likely system-wide, a more common way to
configure its usage would be to use a configuration instead:

```{seealso}
{doc}`./configuration` describes how pip configuration works.
```

```bash
$ pip config set --global global.keyring-provider subprocess

# A different user on the same system which has PYTHONPATH configured and and
# wanting to use keyring installed that way could then run
$ pip config set --user global.keyring-provider import

# For a specific virtual environment you might want to use disable it again
# because you will only be using PyPI and the private repo (and mirror)
# requires 2FA with a keycard and a pincode
$ pip config set --site global.index https://pypi.org/simple
$ pip config set --site global.keyring-provider disabled

# configuring it via environment variable is also possible
$ export PIP_KEYRING_PROVIDER=disabled
```

### Using keyring's Python module

Setting `keyring-provider` to `import` makes pip communicate with `keyring` via
its Python interface.

```bash
# install keyring from PyPI
$ pip install keyring --index-url https://pypi.org/simple
$ echo "your-password" | keyring set pypi.company.com your-username
$ pip install your-package --keyring-provider import --index-url https://pypi.company.com/
```

### Using keyring as a command line application

Setting `keyring-provider` to `subprocess` makes pip look for and use the
`keyring` command found on `PATH`.

For this use case, a username *must* be included in the URL, since it is
required by `keyring`'s command line interface. See the example below or the
basic HTTP authentication section at the top of this page.

```bash
# Install keyring from PyPI using pipx, which we assume is installed properly
# you can also create a venv somewhere and add it to the PATH yourself instead
$ pipx install keyring --index-url https://pypi.org/simple

# For Azure DevOps, also install its keyring backend.
$ pipx inject keyring artifacts-keyring --index-url https://pypi.org/simple

# For Google Artifact Registry, also install and initialize its keyring backend.
$ pipx inject keyring keyrings.google-artifactregistry-auth --index-url https://pypi.org/simple
$ gcloud auth login

# Note that a username is required in the index URL.
$ pip install your-package --keyring-provider subprocess --index-url https://username@pypi.example.com/
```

### Here be dragons

The `auto` provider is conservative and does not query keyring at all when
`--no-input` is used because the keyring might require user interaction such as
prompting the user on the console. Third party tools frequently call Pip for
you and do indeed pass `--no-input` as they are well-behaved and don't have
much information to work with. (Keyring does have an api to request a backend
that does not require user input.) You have more information about your system,
however!

You can force keyring usage by requesting a keyring provider other than `auto`
(or `disabled`). Leaving `import` and `subprocess`. You do this by passing
`--keyring-provider import` or one of the following methods:

```bash
# via config file, possibly with --user, --global or --site
$ pip config set global.keyring-provider subprocess
# or via environment variable
$ export PIP_KEYRING_PROVIDER=import
```

```{warning}
Be careful when doing this since it could cause tools such as pipx and Pipenv
to appear to hang. They show their own progress indicator while hiding output
from the subprocess in which they run Pip. You won't know whether the keyring
backend is waiting the user input or not in such situations.
```

Note that `keyring` (the Python package) needs to be installed separately from
pip. This can create a bootstrapping issue if you need the credentials stored in
the keyring to download and install keyring.

It is, thus, expected that users that wish to use pip's keyring support have
some mechanism for downloading and installing {pypi}`keyring`.


================================================
FILE: docs/html/topics/caching.md
================================================
# Caching

```{versionadded} 6.0

```

pip provides an on-by-default caching, designed to reduce the amount of time
spent on duplicate downloads and builds.

## What is cached

### HTTP responses

This cache functions like a web browser cache.

When making any HTTP request, pip will first check its local cache to determine
if it has a suitable response stored for that request which has not expired. If
it does then it returns that response and doesn't re-download the content.

If it has a response stored but it has expired, then it will attempt to make a
conditional request to refresh the cache which will either return an empty
response telling pip to simply use the cached item (and refresh the expiration
timer) or it will return a whole new response which pip can then store in the
cache.

While this cache attempts to minimize network activity, it does not prevent
network access altogether. If you want a local install solution that
circumvents accessing PyPI, see {ref}`Installing from local packages`.

```{versionchanged} 23.3
A new cache format is now used, stored in a directory called `http-v2` (see
below for this directory's location). Previously this cache was stored in a
directory called `http` in the main cache directory. If you have completely
switched to newer versions of `pip`, you may wish to delete the old directory.
```

(wheel-caching)=

### Locally built wheels

pip attempts to use wheels from its local wheel cache whenever possible.

This means that if there is a cached wheel for the same version of a specific
package name, pip will use that wheel instead of rebuilding the project.

When no wheels are found for a source distribution, pip will attempt to build a
wheel using the package's build system. If the build is successful, this wheel
is added to the cache and used in subsequent installs for the same package
version.

Wheels built from source distributions provided to pip as a direct path (such
as `pip install .`) are not cached across runs, though they may be reused within
the same `pip` execution.

```{versionchanged} 20.0
pip now caches wheels when building from an immutable Git reference
(i.e. a commit hash).
```

## Where is the cache stored

```{caution}
The exact filesystem structure of pip's cache's contents is considered to be
an implementation detail and may change between any two versions of pip.
```

### `pip cache dir`

```{versionadded} 20.1

```

You can use `pip cache dir` to get the cache directory that pip is currently configured to use.

### Default paths

````{tab} Linux
```
~/.cache/pip
```

pip will also respect `XDG_CACHE_HOME`.
````

````{tab} MacOS
```
~/Library/Caches/pip
```
````

````{tab} Windows
```
%LocalAppData%\pip\Cache
```
````

## Avoiding caching

pip tries to use its cache whenever possible, and it is designed do the right
thing by default.

In some cases, pip's caching behaviour can be undesirable. As an example, if you
have package with optional C extensions, that generates a pure Python wheel
when the C extension can’t be built, pip will use that cached wheel even when
you later invoke it from an environment that could have built those optional C
extensions. This is because pip is seeing a cached wheel that matches the
package being built, and pip assumes that the result of building a package from
a package index is deterministic.

The recommended approach for dealing with these situations is to directly
install from a source distribution instead of letting pip auto-discover the
package when it is trying to install. Installing directly from a source
distribution will make pip build a wheel, regardless of whether there is a
matching cached wheel. This usually means doing something like:

```{pip-cli}
$ pip download sampleproject==1.0.0 --no-binary :all:
$ pip install sampleproject-1.0.0.tar.gz
```

It is also a good idea to remove the offending cached wheel using the
{ref}`pip cache` command.

## Cache management

The {ref}`pip cache` command can be used to manage pip's cache.

### General overview

`pip cache info` provides an overview of the contents of pip's cache, such as the total size and location of various parts of it.

### Removing a single package

`pip cache remove setuptools` removes all wheel files related to setuptools from pip's cache. HTTP cache files are not removed at this time.

### Removing the cache

`pip cache purge` will clear all files from pip's wheel and HTTP caches.

### Listing cached files

`pip cache list` will list all wheel files from pip's cache.

`pip cache list setuptools` will list all setuptools-related wheel files from pip's cache.

## Disabling caching

pip's caching behaviour is disabled by passing the `--no-cache-dir` option.

It is, however, recommended to **NOT** disable pip's caching unless you have caching at a higher level (eg: layered caches in container builds). Doing so can
significantly slow down pip (due to repeated operations and package builds)
and result in significantly more network usage.


================================================
FILE: docs/html/topics/configuration.md
================================================
(configuration)=

# Configuration

pip allows a user to change its behaviour via 3 mechanisms:

- command line options
- environment variables
- configuration files

This page explains how the configuration files and environment variables work,
and how they are related to pip's various command line options.

```{seealso}
{doc}`../cli/pip_config` command, which helps manage pip's configuration.
```

(config-file)=

## Configuration Files

Configuration files can change the default values for command line options.
The files are written using standard INI format.

pip has 3 "levels" of configuration files:

- `global`: system-wide configuration file, shared across users.
- `user`: per-user configuration file.
- `site`: per-environment configuration file; i.e. per-virtualenv.

Additionally, environment variables can be specified which will override any of the above.

### Location

pip's configuration files are located in fairly standard locations. This
location is different on different operating systems, and has some additional
complexity for backwards compatibility reasons. Note that if user config files
exist in both the legacy and current locations, values in the current file
will override values in the legacy file.

```{tab} Unix

Global
: In a "pip" subdirectory of any of the paths set in the environment variable
  `XDG_CONFIG_DIRS` (if it exists), for example {file}`/etc/xdg/pip/pip.conf`.

  This will be followed by loading {file}`/etc/pip.conf`.

User
: {file}`$HOME/.config/pip/pip.conf`, which respects the `XDG_CONFIG_HOME` environment variable.

  The legacy "per-user" configuration file is also loaded, if it exists: {file}`$HOME/.pip/pip.conf`.

Site
: {file}`$VIRTUAL_ENV/pip.conf`
```

```{tab} MacOS

Global
: {file}`/Library/Application Support/pip/pip.conf`

User
: {file}`$HOME/Library/Application Support/pip/pip.conf`
  if directory `$HOME/Library/Application Support/pip` exists
  else {file}`$HOME/.config/pip/pip.conf`

  The legacy "per-user" configuration file is also loaded, if it exists: {file}`$HOME/.pip/pip.conf`.

Site
: {file}`$VIRTUAL_ENV/pip.conf`
```

```{tab} Windows

Global
: * On Windows 7 and later: {file}`C:\\ProgramData\\pip\\pip.ini`
    (hidden but writeable)
  * On Windows Vista: Global configuration is not supported.
  * On Windows XP:
    {file}`C:\\Documents and Settings\\All Users\\Application Data\\pip\\pip.ini`

User
: {file}`%APPDATA%\\pip\\pip.ini`

  The legacy "per-user" configuration file is also loaded, if it exists: {file}`%HOME%\\pip\\pip.ini`

Site
: {file}`%VIRTUAL_ENV%\\pip.ini`
```

### `PIP_CONFIG_FILE`

Additionally, the environment variable `PIP_CONFIG_FILE` can be used to specify
a configuration file that's loaded last, and whose values override the values
set in the aforementioned files. Setting this to {any}`os.devnull`
disables the loading of _all_ configuration files. Note that if a file exists
at the location that this is set to, the user config file will not be loaded.

(config-precedence)=

### Loading order

When multiple configuration files are found, pip combines them in the following
order:

- Global
- User
- Site
- `PIP_CONFIG_FILE`, if given.

Each file read overrides any values read from previous files, so if the
global timeout is specified in both the global file and the per-user file
then the latter value will be used.

### Naming

The names of the settings are derived from the long command line option.

As an example, if you want to use a different package index (`--index-url`) and
set the HTTP timeout (`--timeout`) to 60 seconds, your config file would
look like this:

```ini
[global]
timeout = 60
index-url = https://download.zope.org/ppix
```

### Per-command section

Each subcommand can be configured optionally in its own section. This overrides
the global setting with the same name.

As an example, if you want to decrease the `timeout` to `10` seconds when
running the {ref}`pip freeze`, and use `60` seconds for all other commands:

```ini
[global]
timeout = 60

[freeze]
timeout = 10
```

### Boolean options

Boolean options like `--ignore-installed` or `--no-dependencies` can be set
like this:

```ini
[install]
ignore-installed = true
no-dependencies = yes
```

To enable the boolean options `--no-compile`, `--no-warn-script-location` and
`--no-cache-dir`, falsy values have to be used:

```ini
[global]
no-cache-dir = false

[install]
no-compile = no
no-warn-script-location = false
```

### Repeatable options

For options which can be repeated like `--verbose` and `--quiet`, a
non-negative integer can be used to represent the level to be specified:

```ini
[global]
quiet = 0
verbose = 2
```

It is possible to append values to a section within a configuration file. This
is applicable to appending options like `--find-links` or `--trusted-host`,
which can be written on multiple lines:

```ini
[global]
find-links =
    http://download.example.com

[install]
find-links =
    http://mirror1.example.com
    http://mirror2.example.com

trusted-host =
    mirror1.example.com
    mirror2.example.com
```

This enables users to add additional values in the order of entry for such
command line arguments.

## Environment Variables

pip's command line options can be set with environment variables using the
format `PIP_` . Dashes (`-`) have to be replaced with
underscores (`_`).

- `PIP_TIMEOUT=60` is the same as `--timeout=60`
- ```
  PIP_FIND_LINKS="http://mirror1.example.com http://mirror2.example.com"
  ```

  is the same as

  ```
  --find-links=http://mirror1.example.com --find-links=http://mirror2.example.com
  ```

Repeatable options that do not take a value (such as `--verbose`) can be
specified using the number of repetitions:

- `PIP_VERBOSE=3` is the same as `pip install -vvv`

```{note}
Environment variables set to an empty string (like with `export X=` on Unix) will **not** be treated as false.
Use `no`, `false` or `0` instead.
```

## Precedence / Override order

Command line options override environment variables, which override the
values in a configuration file. Within the configuration file, values in
command-specific sections override values in the global section.

Examples:

- `--host=foo` overrides `PIP_HOST=foo`
- `PIP_HOST=foo` overrides a config file with `[global] host = foo`
- A command specific section in the config file `[] host = bar`
  overrides the option with same name in the `[global]` config file section.


================================================
FILE: docs/html/topics/dependency-resolution.md
================================================
# Dependency Resolution

pip is capable of determining and installing the dependencies of packages. The
process of determining which version of a dependency to install is known as
dependency resolution. This behaviour can be disabled by passing
{any}`--no-deps` to {any}`pip install`.

## How it works

When a user does a `pip install` (e.g. `pip install tea`), pip needs to work
out the package's dependencies (e.g. `spoon`, `hot-water`, `tea-leaves` etc.)
and what the versions of each of those dependencies it should install.

At the start of a `pip install` run, pip does not have all the dependency
information of the requested packages. It needs to work out the dependencies
of the requested packages, the dependencies of those dependencies, and so on.
Over the course of the dependency resolution process, pip will need to download
distribution files of the packages which are used to get the dependencies of a
package.

## Backtracking

```{versionchanged} 20.3
pip's dependency resolver is now capable of backtracking.
```

During dependency resolution, pip needs to make assumptions about the package
versions it needs to install and, later, check these assumptions were not
incorrect. When pip finds that an assumption it made earlier is incorrect, it
has to backtrack, which means also discarding some of the work that has already
been done, and going back to choose another path.

This can look like pip downloading multiple versions of the same package,
since pip explicitly presents each download to the user. The backtracking of
choices made during this step is not unexpected behaviour or a bug. It is part
of how dependency resolution for Python packages works.

````{admonition} Example
The user requests `pip install tea`. The package `tea` declares a dependency on
`hot-water`, `spoon`, `cup`, amongst others.

pip starts by picking the most recent version of `tea` and gets the list of
dependencies of that version of `tea`. It will then repeat the process for
those packages, picking the most recent version of `spoon` and then `cup`. Now,
pip notices that the version of `cup` it has chosen is not compatible with the
version of `spoon` it has chosen. Thus, pip will "go back" (backtrack) and try
to use another version of `cup`. If it is successful, it will continue onto the
next package (like `sugar`). Otherwise, it will continue to backtrack on `cup`
until it finds a version of `cup` that is compatible with all the other
packages.

This can look like:

```console
$ pip install tea
Collecting tea
  Downloading tea-1.9.8-py2.py3-none-any.whl (346 kB)
     |████████████████████████████████| 346 kB 10.4 MB/s
Collecting spoon==2.27.0
  Downloading spoon-2.27.0-py2.py3-none-any.whl (312 kB)
     |████████████████████████████████| 312 kB 19.2 MB/s
Collecting cup>=1.6.0
  Downloading cup-3.22.0-py2.py3-none-any.whl (397 kB)
     |████████████████████████████████| 397 kB 28.2 MB/s
INFO: pip is looking at multiple versions of this package to determine
which version is compatible with other requirements.
This could take a while.
  Downloading cup-3.21.0-py2.py3-none-any.whl (395 kB)
     |████████████████████████████████| 395 kB 27.0 MB/s
  Downloading cup-3.20.0-py2.py3-none-any.whl (394 kB)
     |████████████████████████████████| 394 kB 24.4 MB/s
  Downloading cup-3.19.1-py2.py3-none-any.whl (394 kB)
     |████████████████████████████████| 394 kB 21.3 MB/s
  Downloading cup-3.19.0-py2.py3-none-any.whl (394 kB)
     |████████████████████████████████| 394 kB 26.2 MB/s
  Downloading cup-3.18.0-py2.py3-none-any.whl (393 kB)
     |████████████████████████████████| 393 kB 22.1 MB/s
  Downloading cup-3.17.0-py2.py3-none-any.whl (382 kB)
     |████████████████████████████████| 382 kB 23.8 MB/s
  Downloading cup-3.16.0-py2.py3-none-any.whl (376 kB)
     |████████████████████████████████| 376 kB 27.5 MB/s
  Downloading cup-3.15.1-py2.py3-none-any.whl (385 kB)
     |████████████████████████████████| 385 kB 30.4 MB/s
INFO: pip is looking at multiple versions of this package to determine
which version is compatible with other requirements.
This could take a while.
  Downloading cup-3.15.0-py2.py3-none-any.whl (378 kB)
     |████████████████████████████████| 378 kB 21.4 MB/s
  Downloading cup-3.14.0-py2.py3-none-any.whl (372 kB)
     |████████████████████████████████| 372 kB 21.1 MB/s
```

These multiple `Downloading cup-{version}` lines show that pip is backtracking
choices it is making during dependency resolution.
````

If pip starts backtracking during dependency resolution, it does not know how
many choices it will reconsider, and how much computation would be needed.

For the user, this means it can take a long time to complete when pip starts
backtracking. In the case where a package has a lot of versions, arriving at a
good candidate can take a lot of time. The amount of time depends on the
package size, the number of versions pip must try, and various other factors.

Backtracking reduces the risk that installing a new package will accidentally
break an existing installed package, and so reduces the risk that your
environment gets messed up. To do this, pip has to do more work, to find out
which version of a package is a good candidate to install.

## Possible ways to reduce backtracking

There is no one-size-fits-all answer to situations where pip is backtracking
excessively during dependency resolution. There are ways to reduce the
degree to which pip might backtrack though. Nearly all of these approaches
require some amount of trial and error.

### Allow pip to complete its backtracking

In most cases, pip will complete the backtracking process successfully.
This could take a very long time to complete, so this may not be your
preferred option.

However, it is a possible that pip will not be able to find a set of
compatible versions. For this, pip will try every possible combination that
it needs to and determine that there is no compatible set.

If you'd prefer not to wait, you can interrupt pip (Ctrl+c) and try the
strategies listed below.

### Reduce the number of versions pip is trying to use

It is usually a good idea to add constraints the package(s) that pip is backtracking on (e.g. in the above example - `cup`).

You could try something like:

```{pip-cli}
$ pip install tea "cup >= 3.13"
```

This will reduce the number of versions of `cup` it tries, and
possibly reduce the time pip takes to install.

There is a possibility that the addition constraint is incorrect. When this
happens, the reduced search space makes it easier for pip to more quickly
determine what caused the conflict and present that to the user. It could also
result in pip backtracking on a different package due to some other conflict.

### Use constraint files or lockfiles

This option is a progression of the previous section. It requires users to know
how to inspect:

- the packages they're trying to install
- the package release frequency and compatibility policies
- their release notes and changelogs from past versions

During deployment, you can create a lockfile stating the exact package and
version number for each dependency of that package. You can create this
with [pip-tools](https://github.com/jazzband/pip-tools/).

This means the "work" is done once during development process, and thus
will avoid performing dependency resolution during deployment.

(Fixing conflicting dependencies)=

## Dealing with dependency conflicts

This section uses hypothetical packages (`package_coffee`, `package_tea`, and
`package_water`) to explain how pip resolves conflicts.

This section provides practical suggestions to pip users who encounter
a `ResolutionImpossible` error, where pip cannot install their specified
packages due to conflicting dependencies.

### Understanding your error message

When you get a `ResolutionImpossible` error, you might see something
like this:

```{pip-cli}
$ pip install package_coffee==0.44.1 package_tea==4.3.0
[regular pip output]
ERROR: Cannot install package_coffee==0.44.1 and package_tea==4.3.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    package_coffee 0.44.1 depends on package_water<3.0.0,>=2.4.2
    package_tea 4.3.0 depends on package_water==2.3.1
```

In this example, pip cannot install the packages you have requested,
because they each depend on different versions of the same package
(``package_water``):

- ``package_coffee`` version ``0.44.1`` depends on a version of
  ``package_water`` that is less than ``3.0.0`` but greater than or equal to
  ``2.4.2``
- ``package_tea`` version ``4.3.0`` depends on version ``2.3.1`` of
  ``package_water``

Note: `package_coffee`, `package_tea`, and `package_water` are hypothetical
packages used only to illustrate dependency conflicts. They are not real
projects you can install.


Sometimes these messages are straightforward to read, because they use
commonly understood comparison operators to specify the required version
(e.g. `<` or `>`).

However, Python packaging also supports some more complex ways for
specifying package versions (e.g. `~=` or `*`):

| Operator | Description                                                    | Example                                              |
| -------- | -------------------------------------------------------------- | ---------------------------------------------------- |
| `>`      | Any version greater than the specified version.                | `>3.1`: any version greater than `3.1`.              |
| `<`      | Any version less than the specified version.                   | `<3.1`: any version less than `3.1`.                 |
| `<=`     | Any version less than or equal to the specified version.       | `<=3.1`: any version less than or equal to `3.1`.    |
| `>=`     | Any version greater than or equal to the specified version.    | `>=3.1`: any version greater than or equal to `3.1`. |
| `==`     | Exactly the specified version.                                 | `==3.1`: only version `3.1`.                         |
| `!=`     | Any version not equal to the specified version.                | `!=3.1`: any version other than `3.1`.               |
| `~=`     | Any compatible{sup}`1` version.                                | `~=3.1`: any version compatible{sup}`1` with `3.1`.  |
| `*`      | Can be used at the end of a version number to represent _all_. | `==3.1.*`: any version that starts with `3.1`.       |

{sup}`1` Compatible versions are higher versions that only differ in the final segment.
`~=3.1.2` is equivalent to `>=3.1.2, ==3.1.*`. `~=3.1` is equivalent to `>=3.1, ==3.*`.

The detailed specification of supported comparison operators can be
found in {pep}`440`.

### Possible solutions

The solution to your error will depend on your individual use case. Here
are some things to try:

#### Audit your top level requirements

As a first step, it is useful to audit your project and remove any
unnecessary or out of date requirements (e.g. from your `setup.py` or
`requirements.txt` files). Removing these can significantly reduce the
complexity of your dependency tree, thereby reducing opportunities for
conflicts to occur.

#### Loosen your top level requirements

Sometimes the packages that you have asked pip to install are
incompatible because you have been too strict when you specified the
package version.

In our first example both `package_coffee` and `package_tea` have been
_pinned_ to use specific versions
(`package_coffee==0.44.1 package_tea==4.3.0`).

To find a version of both `package_coffee` and `package_tea` that depend on
the same version of `package_water`, you might consider:

- Loosening the range of packages that you are prepared to install
  (e.g. `pip install "package_coffee>0.44" "package_tea>4.0.0"`)
- Asking pip to install _any_ version of `package_coffee` and `package_tea`
  by removing the version specifiers altogether (e.g.
  `pip install package_coffee package_tea`)

In the second case, pip will automatically find a version of both
`package_coffee` and `package_tea` that depend on the same version of
`package_water`, for example:

- `package_coffee 0.44.1`, which depends on `package_water 2.6.1`
- `package_tea 4.4.3`, which also depends on `package_water 2.6.1`

If you want to prioritize one package over another, you can add version
specifiers to _only_ the more important package:

```{pip-cli}
$ pip install package_coffee==0.44.1 package_tea
```

This will result in:

- `package_coffee 0.44.1`, which depends on `package_water 2.6.1`
- `package_tea 4.4.3` which _also_ depends on `package_water 2.6.1`

Now that you have resolved the issue, you can repin the compatible
package versions as required.

#### Loosen the requirements of your dependencies

Assuming that you cannot resolve the conflict by loosening the version
of the package you require (as above), you can try to fix the issue on
your _dependency_ by:

- Requesting that the package maintainers loosen _their_ dependencies
- Forking the package and loosening the dependencies yourself

```{warning}
If you choose to fork the package yourself, you are _opting out_ of
any support provided by the package maintainers. Proceed at your own risk!
```

#### All requirements are appropriate, but a solution does not exist

Sometimes it's simply impossible to find a combination of package
versions that do not conflict. Welcome to [dependency hell].

In this situation, you could consider:

- Using an alternative package, if that is acceptable for your project.
  See [Awesome Python] for similar packages.
- Refactoring your project to reduce the number of dependencies (for
  example, by breaking up a monolithic code base into smaller pieces).

## Handling Resolution Too Deep Errors

Sometimes pip's dependency resolver may exceed its search depth and terminate
with a `ResolutionTooDeepError` exception. This typically occurs when the
dependency graph is extremely complex or when there are too many package
versions to evaluate.

To address this error, consider the following strategies:

### Specify Reasonable Lower Bounds

By setting a higher lower bound for your dependencies, you narrow the search
space. This excludes older versions that might trigger excessive backtracking.
For example:

```{pip-cli}
$ pip install "package_coffee>=0.44.0" "package_tea>=4.0.0"
```

### Use the `--upgrade` Flag

The `--upgrade` flag directs pip to ignore already installed versions and
search for the latest versions that meet your requirements. This can help
avoid unnecessary resolution paths:

```{pip-cli}
$ pip install --upgrade package_coffee package_tea
```

### Utilize Constraint Files

If you need to impose additional version restrictions on transitive
dependencies (dependencies of dependencies), consider using a constraint
file. A constraint file specifies version limits for packages that are
indirectly required. For example:

```
# constraints.txt
indirect_dependency>=2.0.0
```

Then install your packages with:

```{pip-cli}
$ pip install --constraint constraints.txt package_coffee package_tea
```

### Use Upper Bounds Sparingly

Although upper bounds are generally discouraged because they can complicate
dependency management, they may be necessary when certain versions are known
to cause conflicts. Use them cautiously—for example:

```{pip-cli}
$ pip install "package_coffee>=0.44.0,<1.0.0" "package_tea>=4.0.0"
```

### Report ResolutionTooDeep Errors

If you encounter a `ResolutionTooDeep` error consider reporting it, to help
the pip team have real world examples to test against, at the dedicated
[pip issue](https://github.com/pypa/pip/issues/13281).

## Getting help

If none of the suggestions above work for you, we recommend that you ask
for help on:

- [Python user Discourse](https://discuss.python.org/c/users/7)
- [Python user forums](https://www.python.org/community/forums/)
- [Python developers Slack channel](https://pythondev.slack.com/)
- [Python IRC](https://www.python.org/community/irc/)
- [Stack Overflow](https://stackoverflow.com/questions/tagged/python)

See ["How do I ask a good question?"] for tips on asking for help.

Unfortunately, **the pip team cannot provide support for individual
dependency conflict errors**. Please _only_ open a ticket on
[pip's issue tracker](https://github.com/pypa/pip/issues) if you believe
that your problem has exposed a bug in pip.

["how do i ask a good question?"]: https://stackoverflow.com/help/how-to-ask
[awesome python]: https://python.libhunt.com/
[dependency hell]: https://en.wikipedia.org/wiki/Dependency_hell


================================================
FILE: docs/html/topics/deps.dot
================================================
digraph G {
  graph [fontname = "Handlee"];
  node [fontname = "Handlee"];
  edge [fontname = "Handlee"];

  bgcolor=transparent;

  A [color=blue fontcolor=blue];
  A -> B [color=red];
  A -> C [color=red];
  node [color=lightgrey fontcolor=lightgrey];
  edge [color=lightgrey];
  node [color=lightgrey];
  B -> B1;
  B -> B2;
  C -> C1;
  C -> C2;

}


================================================
FILE: docs/html/topics/https-certificates.md
================================================
(SSL Certificate Verification)=

# HTTPS Certificates

```{versionadded} 1.3

```

By default, pip will perform SSL certificate verification for network
connections it makes over HTTPS. These serve to prevent man-in-the-middle
attacks against package downloads.

## Using a specific certificate store

The `--cert` option (and the corresponding `PIP_CERT` environment variable)
allow users to specify a different certificate store/bundle for pip to use. It
is also possible to use `REQUESTS_CA_BUNDLE` or `CURL_CA_BUNDLE` environment
variables.

If you need a specific certificate bundle, you can download the
[Mozilla CA bundle provided by the curl project](https://curl.se/docs/caextract.html).

## Using system certificate stores

```{versionadded} 24.2

```

```{note}
Versions of pip prior to v24.2 did not use system certificates by default.
To use system certificates with pip v22.2 or later, you must opt-in using the `--use-feature=truststore` CLI flag.
```

On Python 3.10 or later, by default
system certificates are used in addition to certifi to verify HTTPS connections.
This functionality is provided through the {pypi}`truststore` package.

If you encounter a TLS/SSL error when using the `truststore` feature you should
open an issue on the [truststore GitHub issue tracker] instead of pip's issue
tracker. The maintainers of truststore will help diagnose and fix the issue.

To opt-out of using system certificates you can pass the `--use-deprecated=legacy-certs`
flag to pip.

```{warning}
On Python 3.9 or earlier, only certifi is used to verify HTTPS connections as
`truststore` requires Python 3.10 or higher to function.

The system certificate store won't be used in this case, so some situations like proxies
with their own certificates may not work. Upgrading to at least Python 3.10 or later is
the recommended method to resolve this issue.
```

[truststore github issue tracker]:
  https://github.com/sethmlarson/truststore/issues


================================================
FILE: docs/html/topics/index.md
================================================
# Topic Guides

These pages provide detailed information on individual topics.

```{note}
This section of the documentation is currently being fleshed out. See
{issue}`9475` for more details.
```

```{toctree}
:maxdepth: 1

authentication
caching
configuration
dependency-resolution
more-dependency-resolution
https-certificates
local-project-installs
repeatable-installs
secure-installs
vcs-support
python-option
workflow
```


================================================
FILE: docs/html/topics/local-project-installs.md
================================================
# Local project installs

It is extremely common to have a project, available in a folder/directory on your computer [^1] that you wish to install.

With pip, depending on your usecase, there are two ways to do this:

- A regular install
- An editable install

## Regular installs

You can install local projects by specifying the project path to pip:

```{pip-cli}
$ pip install path/to/SomeProject
```

This will install the project into the Python that pip is associated with, in a manner similar to how it would actually be installed.

This is what should be used in CI system and for deployments, since it most closely mirrors how a package would get installed if you build a distribution and installed from it (because that's _exactly_ what it does).

(editable-installs)=

## Editable installs

You can install local projects in "editable" mode:

```{pip-cli}
$ pip install -e path/to/SomeProject
```

Editable installs allow you to install your project without copying any files. Instead, the files in the development directory are added to Python's import path. This approach is well suited for development and is also known as a "development installation".

With an editable install, you only need to perform a re-installation if you change the project metadata (eg: version, what scripts need to be generated etc). You will still need to run build commands when you need to perform a compilation for non-Python code in the project (eg: C extensions).

```{caution}
It is possible to see behaviour differences between regular installs vs editable installs. These differences depend on the build-backend, and you should check the build-backend documentation for the details. In case you distribute the project as a "distribution package", users will see the behaviour of regular installs -- thus, it is important to ensure that regular installs work correctly.
```

## Build artifacts

```{versionchanged} 21.3
The project being installed is no longer copied to a temporary directory before invoking the build system, by default. A `--use-deprecated=out-of-tree-build` option is provided as a temporary fallback to aid user migrations.
```

```{versionchanged} 22.1
The `--use-deprecated=out-of-tree-build` option has been removed.
```

When provided with a project that's in a local directory, pip will invoke the build system "in place". This behaviour has several consequences:

- Local project builds will now be significantly faster, for certain kinds of projects and on systems with slow I/O (eg: via network attached storage or overly aggressive antivirus software).
- Certain build backends (eg: `setuptools`) will litter the project directory with secondary build artifacts (eg: `.egg-info` directories).
- Certain build backends (eg: `setuptools`) may not be able to perform with parallel builds anymore, since they previously relied on the fact that pip invoked them in a separate directory for each build.

[^1]: Specifically, the current machine's filesystem.


================================================
FILE: docs/html/topics/more-dependency-resolution.md
================================================
# More on Dependency Resolution

This article goes into more detail about pip's dependency resolution algorithm.
In certain situations, pip can take a long time to determine what to install,
and this article is intended to help readers understand what is happening
"behind the scenes" during that process.

```{note}
This document is a work in progress. The details included are accurate (at the
time of writing), but there is additional information, in particular around
pip's interface with resolvelib, which has not yet been included.

Contributions to improve this document are welcome.
```

## The dependency resolution problem

The process of finding a set of packages to install, given a set of dependencies
between them, is known to be an [NP-hard](https://en.wikipedia.org/wiki/NP-hardness)
problem. What this means in practice is roughly that the process scales
*extremely* badly as the size of the problem increases. So when you have a lot
of dependencies, working out what to install will, in the worst case, take a
very long time.

The practical implication of that is that there will always be some situations
where pip cannot determine what to install in a reasonable length of time. We
make every effort to ensure that such situations happen rarely, but eliminating
them altogether isn't even theoretically possible. We'll discuss what options
you have if you hit a problem situation like this a little later.

## Python specific issues

Many algorithms for handling dependency resolution assume that you know the
full details of the problem at the start - that is, you know all of the
dependencies up front. Unfortunately, that is not the case for Python packages.
With the current package index structure, dependency metadata is only available
by downloading the package file, and extracting the data from it. And in the
case of source distributions, the situation is even worse as the project must
be built after being downloaded in order to determine the dependencies.

Work is ongoing to try to make metadata more readily available at lower cost,
but at the time of writing, this has not been completed.

As downloading projects is a costly operation, pip cannot pre-compute the full
dependency tree. This means that we are unable to use a number of techniques
for solving the dependency resolution problem. In practice, we have to use a
*backtracking algorithm*.

## Dependency metadata

It is worth discussing precisely what metadata is needed in order to drive the
package resolution process. There are essentially three key pieces of
information:

* The project name
* The release version
* The dependencies themselves

There are other pieces of data (e.g., extras, python version restrictions, wheel
compatibility tags) which are used as well, but they do not fundamentally
alter the process, so we will ignore them here.

The most important information is the project name and version. Those two pieces
of information identify an individual "candidate" for installation, and must
uniquely identify such a candidate. Name and version must be available from the
moment the candidate object is created. This is not an issue for distribution
files (sdists and wheels) as that data is available from the filename, but for
unpackaged source trees, pip needs to call the build backend to ask for that
data. This is done before resolution proper starts.

The dependency data is *not* requested in advance (as noted above, doing so
would be prohibitively costly, and for a backtracking algorithm it isn't
needed). Instead, pip requests dependency data "on demand", as the algorithm
starts to check that particular candidate.

One particular implication of the lazy fetching of dependency data is that
often, pip *does not know* things that might be obvious to a human looking at
the dependency tree as a whole. For example, if package A depends on version
1.0 of package B, it's obvious to a human that there's no point in looking at
other versions of package B. But if pip starts looking at B before it has
considered A, it doesn't have access to A's dependency data, and so has no way
of knowing that looking at other versions of B is wasted work. And worse still,
pip cannot even know that there's vital information in A's dependencies.

This latter point is a common theme with many cases where pip takes a long time
to complete a resolution - there's information pip doesn't know at the point
where it makes a "wrong" choice. Most of the heuristics added to the resolver
to guide the algorithm are designed to guess correctly in the face of that
lack of knowledge.

## The resolver and the finder

So far, we have been talking about the "resolver" as a single entity. While that
is mostly true, the process of getting package data from an index is handled
by another component of pip, the "finder". The finder is responsible for
feeding candidates to the resolver, and has a key role to play in selecting
suitable candidates.

Note that the resolver is *only* relevant for packages fetched from an index.
Candidates coming from other sources (local source directories, {ref}`direct
URL references `) do *not* go through the finder,
and are merged with the candidates provided by the finder as part of the resolver's
"provider" implementation.

As well as determining what versions exist in the index for a given project,
the finder selects the best distribution file to use for that candidate. This
may be a wheel or a source distribution, and precisely what is selected is
controlled by wheel compatibility tags, pip's options (whether to prefer binary
or source) and metadata supplied by the index. In particular, if a file is
marked as only being for specific Python versions, the file will be ignored by
the finder (and the resolver may never even see that version).

The finder also provides candidates for a project to the resolver in order of
preference - the provider implements the rule that later versions are preferred
over older versions, for example.

## The resolver algorithm

The resolver itself is based on a separate package, [resolvelib](https://pypi.org/project/resolvelib/).
This implements an abstract backtracking resolution algorithm, in a way that is
independent of the specifics of Python packages - those specifics are abstracted
away by pip before calling the resolver.

Pip's interface to resolvelib is in the form of a "provider", which is the
interface between pip's model of packages and the resolution algorithm. The
provider deals in "candidates" and "requirements" and implements the following
operations:

* `identify` - implements identity for candidates and requirements. It is this
  operation that implements the rule that candidates are identified by their
  name and version, for example.
* `get_preference` - this provides information to the resolver to help it choose
  which requirement to look at "next" when working through the resolution
  process.
* `narrow_requirement_selection` - this provides a way to limit the number of
  identifiers passed to `get_preference`.
* `find_matches` - given a set of constraints, determine what candidates exist
  that satisfy them. This is essentially where the finder interacts with the
  resolver.
* `is_satisfied_by` - checks if a candidate satisfies a requirement. This is
  basically the implementation of what a requirement means.
* `get_dependencies` - get the dependency metadata for a candidate. This is
  the implementation of the process of getting and reading package metadata.

Of these methods, the only non-trivial ones are the `get_preference` and
`narrow_requirement_selection` methods. These implement heuristics used
to guide the resolution, telling it which requirement to try to satisfy next.
It's these methods that are responsible for trying to guess which route through
the dependency tree will be most productive. As noted above, it's doing this
with limited information. See the following diagram:

![](deps.png)

When the provider is asked to choose between the red requirements (A->B and
A->C) it doesn't know anything about the dependencies of B or C (i.e., the
grey parts of the graph).

Pip's current implementation of the provider implements
`narrow_requirement_selection` as follows:

* If Requires-Python is present only consider that
* If there are causes of resolution conflict (backtrack causes) then
    only consider them until there are no longer any resolution conflicts

Pip's current implementation of the provider implements `get_preference`
for known requirements with the following preferences in the following order:

* Any requirement that is "direct", e.g., points to an explicit URL.
* Any requirement that is "pinned", i.e., contains the operator ``===``
    or ``==`` without a wildcard.
* Any requirement that imposes an upper version limit, i.e., contains the
    operator ``<``, ``<=``, ``~=``, or ``==`` with a wildcard. Because
    pip prioritizes the latest version, preferring explicit upper bounds
    can rule out infeasible candidates sooner. This does not imply that
    upper bounds are good practice; they can make dependency management
    and resolution harder.
* Order user-specified requirements as they are specified, placing
    other requirements afterward.
* Any "non-free" requirement, i.e., one that contains at least one
    operator, such as ``>=`` or ``!=``.
* Alphabetical order for consistency (aids debuggability).


================================================
FILE: docs/html/topics/python-option.md
================================================
# Managing a different Python interpreter

```{versionadded} 22.3
```

Occasionally, you may want to use pip to manage a Python installation other than
the one pip is installed into. In this case, you can use the `--python` option
to specify the interpreter you want to manage. This option can take one of two
values:

1. The path to a Python executable.
2. The path to a virtual environment.

In both cases, pip will run exactly as if it had been invoked from that Python
environment.

One example of where this might be useful is to manage a virtual environment
that does not have pip installed.

```{pip-cli}
$ python -m venv .venv --without-pip
$ pip --python .venv install SomePackage
[...]
Successfully installed SomePackage
```

You could also use `--python .venv/bin/python` (or on Windows,
`--python .venv\Scripts\python.exe`) if you wanted to be explicit, but the
virtual environment name is shorter and works exactly the same.


================================================
FILE: docs/html/topics/repeatable-installs.md
================================================
(repeatability)=
# Repeatable Installs

pip can be used to achieve various levels of repeatable environments. This page
walks through increasingly stricter definitions of what "repeatable" means.

## Pinning the package versions

Pinning package versions of your dependencies in the requirements file
protects you from bugs or incompatibilities in newly released versions:

```
SomePackage == 1.2.3
DependencyOfSomePackage == 4.5.6
```

```{note}
Pinning refers to using the `==` operator to require the package to be a
specific version.
```

A requirements file, containing pinned package versions can be generated using
{ref}`pip freeze`. This would pin not only the top-level packages, but also all of
their transitive dependencies. Performing the installation using
{ref}`--no-deps ` would provide an extra dose of insurance
against installing anything not explicitly listed.

This strategy is easy to implement and works across OSes and architectures.
However, it trusts the locations you're fetching the packages from (like PyPI)
and the certificate authority chain. It also relies on those locations not
allowing packages to change without a version increase. (PyPI does protect
against this.)

## Hash-checking

Beyond pinning version numbers, you can add hashes against which to verify
downloaded packages:

```none
FooProject == 1.2 --hash=sha256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
```

This protects against a compromise of PyPI or the HTTPS certificate chain. It
also guards against a package changing without its version number changing (on
indexes that allow this). This approach is a good fit for automated server
deployments.

Hash-checking mode is a labour-saving alternative to running a private index
server containing approved packages: it removes the need to upload packages,
maintain ACLs, and keep an audit trail (which a VCS gives you on the
requirements file for free). It can also substitute for a vendored library,
providing easier upgrades and less VCS noise. It does not, of course,
provide the availability benefits of a private index or a vendored library.

[pip-tools] is a package that builds upon pip, and provides a good workflow for
managing and generating requirements files.

[pip-tools]: https://github.com/jazzband/pip-tools#readme

## Using a wheelhouse (AKA Installation Bundles)

{ref}`pip wheel` can be used to generate and package all of a project's
dependencies, with all the compilation performed, into a single directory that
can be converted into a single archive. This archive then allows installation
when index servers are unavailable and avoids time-consuming recompilation.

````{admonition} Example
Creating the bundle, on a modern Unix system:

```
$ tempdir=$(mktemp -d /tmp/wheelhouse-XXXXX)
$ python -m pip wheel -r requirements.txt --wheel-dir=$tempdir
$ cwd=`pwd`
$ (cd "$tempdir"; tar -cjvf "$cwd/bundled.tar.bz2" *)
```

Installing from the bundle, on a modern Unix system:

```
$ tempdir=$(mktemp -d /tmp/wheelhouse-XXXXX)
$ (cd $tempdir; tar -xvf /path/to/bundled.tar.bz2)
$ python -m pip install --force-reinstall --no-index --no-deps $tempdir/*
```
````

Note that such a wheelhouse contains compiled packages, which are typically
OS and architecture-specific, so these archives are not necessarily portable
across machines.

Hash-checking mode can also be used along with this method (since this uses a
requirements file as well), to ensure that future archives are built with
identical packages.


================================================
FILE: docs/html/topics/secure-installs.md
================================================
# Secure installs

By default, pip does not perform any checks to protect against remote tampering and involves running arbitrary code from distributions. It is, however, possible to use pip in a manner that changes these behaviours, to provide a more secure installation mechanism.

This can be achieved by doing the following:

- Enable {ref}`Hash-checking mode`, by passing {any}`--require-hashes`
- Disallow source distributions, by passing {any}`--only-binary :all: <--only-binary>`

(Hash-checking mode)=

## Hash-checking Mode

```{versionadded} 8.0

```

This mode uses local hashes, embedded in a requirements.txt file, to protect against remote tampering and network issues. These hashes are specified using a `--hash` [per requirement option](per-requirement-options).

Note that hash-checking is an all-or-nothing proposition. Specifying `--hash` against _any_ requirement will activate this mode globally.

To add hashes for a package, add them to line as follows:

```
FooProject == 1.2 \
  --hash=sha256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 \
  --hash=sha256:486ea46224d1bb4fb680f34f7c9ad96a8f24ec88be73ea8e5a6c65260e9cb8a7
```

### Additional restrictions

- Hashes are required for _all_ requirements.

  This is because a partially-hashed requirements file is of little use and thus likely an error: a malicious actor could slip bad code into the installation via one of the unhashed requirements.

  Note that hashes embedded in URL-style requirements via the `#md5=...` syntax suffice to satisfy this rule (regardless of hash strength, for legacy reasons), though you should use a stronger hash like sha256 whenever possible.

- Hashes are required for _all_ dependencies.

  If there is a dependency that is not spelled out and hashed in the requirements file, it will result in an error.

- Requirements must be pinned (either to a URL, filesystem path or using `==`).

  This prevents a surprising hash mismatch upon the release of a new version that matches the requirement specifier.

### Forcing Hash-checking mode

It is possible to force the hash checking mode to be enabled, by passing `--require-hashes` command-line option.

This can be useful in deploy scripts, to ensure that the author of the requirements file provided hashes. It is also a convenient way to bootstrap your list of hashes, since it shows the hashes of the packages it fetched. It fetches only the preferred archive for each package, so you may still need to add hashes for alternatives archives using {ref}`pip hash`: for instance if there is both a binary and a source distribution.

### Hash algorithms

The recommended hash algorithm at the moment is sha256, but stronger ones are allowed, including all those supported by `hashlib`. However, weaker ones such as md5, sha1, and sha224 are excluded to avoid giving a false sense of security.

### Multiple hashes per package

It is possible to use multiple hashes for each package. This is important when a package offers binary distributions for a variety of platforms or when it is important to allow both binary and source distributions.

### Interaction with caching

```{versionchanged} 23.1
The {ref}`locally-built wheel cache ` is used in hash-checking mode too.
```

When installing from the cache of locally built wheels in hash-checking mode, pip verifies
the hashes against those of the original source distribution that was used to build the wheel.
These original hashes are obtained from a `origin.json` file stored in each cache entry.

### Using hashes from PyPI (or other index servers)

PyPI (and certain other index servers) provides a hash for the distribution, in the fragment portion of each download URL, like `#sha256=123...`, which pip checks as a protection against download corruption.

Other hash algorithms that have guaranteed support from `hashlib` are also supported here: sha1, sha224, sha384, sha256, and sha512. Since this hash originates remotely, it is not a useful guard against tampering and thus does not satisfy the `--require-hashes` demand that every package have a local hash.

## Repeatable installs

Hash-checking mode also works with {ref}`pip download` and {ref}`pip wheel`. See {doc}`../topics/repeatable-installs` for a comparison of hash-checking mode with other repeatability strategies.

## Do not use setuptools directly

Be careful not to nullify all your security work by installing your actual project by using setuptools' deprecated interfaces directly: for example, by calling `python setup.py install`, `python setup.py develop`, or `easy_install`.

These will happily go out and download, unchecked, anything you missed in your requirements file and it’s easy to miss things as your project evolves. To be safe, install your project using pip and {any}`--no-deps`.

Instead of `python setup.py install`, use:

```{pip-cli}
$ pip install --no-deps .
```

Instead of `python setup.py develop`, use:

```{pip-cli}
$ pip install --no-deps -e .
```


================================================
FILE: docs/html/topics/vcs-support.md
================================================
(vcs support)=
# VCS Support

pip supports installing from various version control systems (VCS).
This support requires a working executable to be available (for the version
control system being used). It is used through URL prefixes:

- Git -- `git+`
- Mercurial -- `hg+`
- Subversion -- `svn+`
- Bazaar -- `bzr+`

The general form of a VCS requirement is `ProjectName @ VCS_URL`, e.g.

```none
MyProject @ git+https://git.example.com/MyProject
MyProject[extra] @ git+https:/git.example.com/MyProject
```

This is the {ref}`Direct URL ` requirement syntax.
It is also permissible to remove `MyProject @` portion is removed and provide
a bare VCS URL.

```none
git+https://git.example.com/MyProject
```

This is a pip specific extension. This form can be used as long as pip does
not need to know the project name in advance. pip is generally able to infer
the project name except in the case of {ref}`editable-vcs-installs`. In
addition, extras cannot be requested using a bare VCS URL.

## Supported VCS

### Git

The supported schemes are `git+file`, `git+https`, `git+ssh`, `git+http`,
`git+git` and `git`. Here are some of the supported forms:

```none
MyProject @ git+ssh://git@git.example.com/MyProject
MyProject @ git+file:///home/user/projects/MyProject
MyProject @ git+https://git.example.com/MyProject
```

```{warning}
The use of `git`, `git+git`, and `git+http` schemes is discouraged.
The former two use [the Git Protocol], which lacks authentication, and HTTP is
insecure due to lack of TLS based encryption.
```

[the Git Protocol]: https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols

It is also possible to specify a "git ref" such as branch name, a commit hash or
a tag name:

```none
MyProject @ git+https://git.example.com/MyProject.git@master
MyProject @ git+https://git.example.com/MyProject.git@v1.0
MyProject @ git+https://git.example.com/MyProject.git@da39a3ee5e6b4b0d3255bfef95601890afd80709
MyProject @ git+https://git.example.com/MyProject.git@refs/pull/123/head
```

When passing a commit hash, specifying a full hash is preferable to a partial
hash because a full hash allows pip to operate more efficiently (e.g. by
making fewer network calls).

### Mercurial

The supported schemes are `hg+file`, `hg+http`, `hg+https`, `hg+ssh`
and `hg+static-http`. Here are some of the supported forms:

```
MyProject @ hg+http://hg.myproject.org/MyProject
MyProject @ hg+https://hg.myproject.org/MyProject
MyProject @ hg+ssh://hg.myproject.org/MyProject
MyProject @ hg+file:///home/user/projects/MyProject
```

It is also possible to specify a revision number, a revision hash, a tag name
or a local branch name:

```none
MyProject @ hg+http://hg.example.com/MyProject@da39a3ee5e6b
MyProject @ hg+http://hg.example.com/MyProject@2019
MyProject @ hg+http://hg.example.com/MyProject@v1.0
MyProject @ hg+http://hg.example.com/MyProject@special_feature
```

### Subversion

The supported schemes are `svn`, `svn+svn`, `svn+http`, `svn+https` and
`svn+ssh`. Here are some of the supported forms:

```none
MyProject @ svn+https://svn.example.com/MyProject
MyProject @ svn+ssh://svn.example.com/MyProject
MyProject @ svn+ssh://user@svn.example.com/MyProject
```

You can also give specific revisions to an SVN URL, like so:

```none
-e MyProject @ svn+http://svn.example.com/svn/MyProject/trunk@2019
-e MyProject @ svn+http://svn.example.com/svn/MyProject/trunk@{20080101}
```

Note that you need to use [Editable VCS installs](#editable-vcs-installs) for
using specific revisions from Subversion.

### Bazaar

The supported schemes are `bzr+http`, `bzr+https`, `bzr+ssh`, `bzr+sftp`,
`bzr+ftp` and `bzr+lp`. Here are the supported forms:

```none
MyProject @ bzr+http://bzr.example.com/MyProject/trunk
MyProject @ bzr+sftp://user@example.com/MyProject/trunk
MyProject @ bzr+ssh://user@example.com/MyProject/trunk
MyProject @ bzr+ftp://user@example.com/MyProject/trunk
MyProject @ bzr+lp:MyProject
```

Tags or revisions can be installed like so:

```none
MyProject @ bzr+https://bzr.example.com/MyProject/trunk@2019
MyProject @ bzr+http://bzr.example.com/MyProject/trunk@v1.0
```

(editable-vcs-installs)=

## Editable VCS installs

VCS projects can be installed in {ref}`editable mode ` (using
the {ref}`--editable ` option) or not.

In editable mode, the project name must be provided upfront using the Direct URL
(`MyProject @ URL`) form so pip can determine the VCS clone location.

- The default clone location (for editable installs) is:

  - `/src/SomeProject` in virtual environments
  - `/src/SomeProject` for global Python installs

  The {ref}`--src ` option can be used to modify this location.

- For non-editable installs, the project is built locally in a temp dir and then
  installed normally.

Note that if a satisfactory version of the package is already installed, the
VCS source will not overwrite it without an `--upgrade` flag. Further, pip
looks at the package version, at the target revision to determine what action to
take on the VCS requirement (not the commit itself).

## URL fragments

pip looks at the `subdirectory` fragments of VCS URLs for specifying the path to the
Python package, when it is not in the root of the VCS directory.

```{note}
pip also supports an `egg` fragment to specify the "project name". This is a legacy
feature and its use is discouraged in favour of the
{ref}`Direct URL ` form.

The `egg` fragment **MUST** be a bare {ref}`project name `.
Anything else is not guaranteed to work.
```

````{admonition} Example
If your repository layout is:

```
pkg_dir
├── setup.py  # setup.py for package "pkg"
└── some_module.py
other_dir
└── some_file
some_other_file
```

Then, to install from this repository, the syntax would be:

```{pip-cli}
$ pip install "pkg @ vcs+protocol://repo_url/#subdirectory=pkg_dir"
```

or:

```{pip-cli}
$ pip install -e "pkg @ vcs+protocol://repo_url/#subdirectory=pkg_dir"
```
````


================================================
FILE: docs/html/topics/workflow.md
================================================
# Pip is not a workflow management tool

The core purpose of pip is to *manage the packages installed in your
environment*. Whilst package management is an important part of most Python
development workflows, it is only one part. Tasks like creating and managing
environments, configuring and running development tasks, managing the Python
interpreter itself, and managing the overall "project", are not part of pip's
scope. Managing a development workflow as a whole is a complex task and one
where there are many views on the "correct approach".

Pip has a number of features which make it useful in development workflows - for
example, the ability to install the current project via `pip install .`,
editable installs, and requirements files. However, there is no intention that
pip will manage the workflow as a whole.

As an example, pip provides the `pip wheel` command, which can be used to build
a wheel for your project. However, there is no corresponding command to build a
source distribution. This is because building a wheel is a fundamental step in
installing a package (if that package is only available as source code), whereas
building a source distribution is never needed when installing. Users who need a
tool to build their project should use a dedicated tool like `build`, which
provides commands to build wheels and source distributions.


## The role of `ensurepip`

Pip is available in a standard Python installation, via the `ensurepip` stdlib
module. This provides users with an "out of the box" installer, which can be
used to gain access to all of the various tools and libraries available on PyPI.
In particular, this enables the installation of a number of workflow tools.

This "bootstrapping" mechanism was proposed (and accepted) in [PEP
453](https://peps.python.org/pep-0453/).


## Further information

The [Packaging User Guide](https://packaging.python.org) discusses Python
project development, and includes tool recommendations for people looking for
further information on how to manage their development workflow.


================================================
FILE: docs/html/user_guide.rst
================================================
==========
User Guide
==========

.. Hello there!

   If you're thinking of adding content to this page... please take a moment
   to consider if this content can live on its own, within a topic guide or a
   reference page.

   There is active effort being put toward *reducing* the amount of content on
   this specific page (https://github.com/pypa/pip/issues/9475) and moving it
   into more focused single-page documents that cover that specific topic.

Running pip
===========

pip is a command line program. When you install pip, a ``pip`` command is added
to your system, which can be run from the command prompt as follows:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip 

   ``python -m pip`` executes pip using the Python interpreter you
   specified as python. So ``/usr/bin/python3.7 -m pip`` means
   you are executing pip for your interpreter located at ``/usr/bin/python3.7``.

.. tab:: Windows

   .. code-block:: shell

      py -m pip 

   ``py -m pip`` executes pip using the latest Python interpreter you
   have installed. For more details, read the `Python Windows launcher`_ docs.


Installing Packages
===================

pip supports installing from `PyPI`_, version control, local projects, and
directly from distribution files.


The most common scenario is to install from `PyPI`_ using :ref:`Requirement
Specifiers`

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install SomePackage            # latest version
      python -m pip install SomePackage==1.0.4     # specific version
      python -m pip install 'SomePackage>=1.0.4'     # minimum version

.. tab:: Windows

   .. code-block:: shell

      py -m pip install SomePackage            # latest version
      py -m pip install SomePackage==1.0.4     # specific version
      py -m pip install 'SomePackage>=1.0.4'   # minimum version

For more information and examples, see the :ref:`pip install` reference.

.. _PyPI: https://pypi.org/

.. _`0-basic-authentication-credentials`:
.. rubric:: Basic Authentication Credentials

This is now covered in :doc:`topics/authentication`.

.. _`0-netrc-support`:
.. rubric:: netrc Support

This is now covered in :doc:`topics/authentication`.

.. _`0-keyring-support`:
.. rubric:: Keyring Support

This is now covered in :doc:`topics/authentication`.

Using a Proxy Server
====================

When installing packages from `PyPI`_, pip requires internet access, which
in many corporate environments requires an outbound HTTP proxy server.

pip can be configured to connect through a proxy server in various ways:

* using the ``--proxy`` command-line option to specify a proxy in the form
  ``scheme://[user:passwd@]proxy.server:port``
* using ``proxy`` in a :ref:`config-file`
* by setting the standard environment-variables ``http_proxy``, ``https_proxy``
  and ``no_proxy``.
* using the environment variable ``PIP_USER_AGENT_USER_DATA`` to include
  a JSON-encoded string in the user-agent variable used in pip's requests.


.. _`Requirements Files`:


Requirements Files
==================

"Requirements files" are files containing a list of items to be
installed using :ref:`pip install` like so:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install -r requirements.txt

.. tab:: Windows

   .. code-block:: shell

      py -m pip install -r requirements.txt

Details on the format of the files are here: :ref:`requirements-file-format`.

Logically, a Requirements file is just a list of :ref:`pip install` arguments
placed in a file. Note that you should not rely on the items in the file being
installed by pip in any particular order.

Requirements files can also be served via a URL, e.g.
http://example.com/requirements.txt besides as local files, so that they can
be stored and served in a centralized place.

In practice, there are 4 common uses of Requirements files:

1. Requirements files are used to hold the result from :ref:`pip freeze` for the
   purpose of achieving :doc:`topics/repeatable-installs`.  In
   this case, your requirement file contains a pinned version of everything that
   was installed when ``pip freeze`` was run.

   .. tab:: Unix/macOS

      .. code-block:: shell

         python -m pip freeze > requirements.txt
         python -m pip install -r requirements.txt

   .. tab:: Windows

      .. code-block:: shell

         py -m pip freeze > requirements.txt
         py -m pip install -r requirements.txt

2. Requirements files are used to force pip to properly resolve dependencies.
   pip 20.2 and earlier `doesn't have true dependency resolution
   `_, but instead simply uses the first
   specification it finds for a project. E.g. if ``pkg1`` requires
   ``pkg3>=1.0`` and ``pkg2`` requires ``pkg3>=1.0,<=2.0``, and if ``pkg1`` is
   resolved first, pip will only use ``pkg3>=1.0``, and could easily end up
   installing a version of ``pkg3`` that conflicts with the needs of ``pkg2``.
   To solve this problem, you can place ``pkg3>=1.0,<=2.0`` (i.e. the correct
   specification) into your requirements file directly along with the other top
   level requirements. Like so::

     pkg1
     pkg2
     pkg3>=1.0,<=2.0

3. Requirements files are used to force pip to install an alternate version of a
   sub-dependency.  For example, suppose ``ProjectA`` in your requirements file
   requires ``ProjectB``, but the latest version (v1.3) has a bug, you can force
   pip to accept earlier versions like so::

     ProjectA
     ProjectB<1.3

4. Requirements files are used to override a dependency with a local patch that
   lives in version control.  For example, suppose a dependency
   ``SomeDependency`` from PyPI has a bug, and you can't wait for an upstream
   fix.
   You could clone/copy the src, make the fix, and place it in VCS with the tag
   ``sometag``.  You'd reference it in your requirements file with a line like
   so::

     SomeDependency @ git+https://myvcs.com/some_dependency@sometag

   If ``SomeDependency`` was previously a top-level requirement in your
   requirements file, then **replace** that line with the new line. If
   ``SomeDependency`` is a sub-dependency, then **add** the new line.


It's important to be clear that pip determines package dependencies using
the project metadata (typically in ``pyproject.toml`` or ``setup.py``),
not by discovering ``requirements.txt`` files embedded in projects.

See also:

* :ref:`requirements-file-format`
* :ref:`pip freeze`
* `"setup.py vs requirements.txt" (an article by Donald Stufft)
  `_


.. _`Constraints Files`:


Constraints Files
=================

Constraints files are requirements files that only control which version of a
requirement is installed, not whether it is installed or not. Their syntax and
contents is a subset of :ref:`Requirements Files`, with several kinds of syntax
not allowed: constraints must have a name, they cannot be editable, and they
cannot specify extras. In terms of semantics, there is one key difference:
Including a package in a constraints file does not trigger installation of the
package.

Use a constraints file like so:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install -c constraints.txt

.. tab:: Windows

   .. code-block:: shell

      py -m pip install -c constraints.txt

Constraints files are used for exactly the same reason as requirements files
when you don't know exactly what things you want to install. For instance, say
that the "helloworld" package doesn't work in your environment, so you have a
local patched version. Some things you install depend on "helloworld", and some
don't.

One way to ensure that the patched version is used consistently is to
manually audit the dependencies of everything you install, and if "helloworld"
is present, write a requirements file to use when installing that thing.

Constraints files offer a better way: write a single constraints file for your
organisation and use that everywhere. If the thing being installed requires
"helloworld" to be installed, your fixed version specified in your constraints
file will be used.

Constraints file support was added in pip 7.1. In :ref:`Resolver
changes 2020` we did a fairly comprehensive overhaul, removing several
undocumented and unsupported quirks from the previous implementation,
and stripped constraints files down to being purely a way to specify
global (version) limits for packages.

Same as requirements files, constraints files can also be served via a URL,
e.g. http://example.com/constraints.txt, so that your organization can store and
serve them in a centralized place.


.. _`Build Constraints`:

Build Constraints
-----------------

.. versionadded:: 25.3

Build constraints are a type of constraints file that applies only to isolated
build environments used for building packages from source. Unlike regular
constraints, which affect the packages installed in your environment, build
constraints only influence the versions of packages available during the
build process.

This is useful when you need to constrain build dependencies
(such as ``setuptools``, ``cython``, etc.) without affecting the
final installed environment.

Use build constraints like so:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install --build-constraint build-constraints.txt SomePackage

.. tab:: Windows

   .. code-block:: shell

      py -m pip install --build-constraint build-constraints.txt SomePackage

Example build constraints file (``build-constraints.txt``):

.. code-block:: text

   # Constrain setuptools version during build
   setuptools>=45,<80
   # Pin Cython for packages that use it to build
   cython==0.29.24

Controlling Pre-release Installation
=====================================

.. versionadded:: 26.0

By default, pip installs stable versions of packages, unless their specifier includes
a pre-release version (e.g., ``SomePackage>=1.0a1``) or if there are no stable versions
available that satisfy the requirement. The ``--all-releases`` and ``--only-final``
options provide per-package control over pre-release selection.

Use ``--all-releases`` to allow pre-releases for specific packages:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install --all-releases=DependencyPackage SomePackage
      python -m pip install --all-releases=:all: SomePackage

.. tab:: Windows

   .. code-block:: shell

      py -m pip install --all-releases=DependencyPackage SomePackage
      py -m pip install --all-releases=:all: SomePackage

Use ``--only-final`` to explicitly disable pre-releases for specific packages:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install --only-final=DependencyPackage SomePackage
      python -m pip install --only-final=:all: SomePackage

.. tab:: Windows

   .. code-block:: shell

      py -m pip install --only-final=DependencyPackage SomePackage
      py -m pip install --only-final=:all: SomePackage

Both options accept ``:all:`` to apply to all packages, ``:none:`` to clear
the setting, or comma-separated package names. Package-specific settings
override ``:all:``. These options can also be used in requirements files.

.. note::

   The ``--pre`` flag is equivalent to ``--all-releases :all:`` but cannot
   be combined with ``--all-releases`` or ``--only-final``.


.. _`Filtering by Upload Time`:

Filtering by Upload Time
=========================

.. versionadded:: 26.0

The ``--uploaded-prior-to`` option allows you to filter packages by their upload time
to an index, only considering packages that were uploaded before a specified datetime.
This can be useful for creating reproducible builds by ensuring you only install
packages that were available at a known point in time.

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install --uploaded-prior-to=2025-03-16T00:00:00Z SomePackage

.. tab:: Windows

   .. code-block:: shell

      py -m pip install --uploaded-prior-to=2025-03-16T00:00:00Z SomePackage

The option accepts ISO 8601 datetime strings in several formats:

* ``2025-03-16`` - Date in local timezone
* ``2025-03-16T12:30:00`` - Datetime in local timezone
* ``2025-03-16T12:30:00Z`` - Datetime in UTC
* ``2025-03-16T12:30:00+05:00`` - Datetime in UTC offset

For consistency across machines, use either UTC format (with 'Z' suffix) or UTC offset
format (with timezone offset like '+05:00'). Local timezone formats may produce different
results on different machines.

.. note::

    This option only applies to packages from remote indexes, not local files or VCS
    requirements. Local package files are allowed regardless of the
    ``--uploaded-prior-to`` setting, e.g. ``pip install /path/to/package.whl``,
    packages from ``--find-links`` directories, or VCS requirements like
    ``git+https://...``.

    This option requires package indexes that provide upload-time metadata
    (such as PyPI). If the index does not provide upload-time metadata for a
    package file, pip will fail immediately with an error message indicating
    that upload-time metadata is required when using ``--uploaded-prior-to``.

You can combine this option with other filtering mechanisms like constraints files:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install -c constraints.txt --uploaded-prior-to=2025-03-16 SomePackage

.. tab:: Windows

   .. code-block:: shell

      py -m pip install -c constraints.txt --uploaded-prior-to=2025-03-16 SomePackage


.. _`Dependency Groups`:


Dependency Groups
=================

.. versionadded:: 25.1

"Dependency Groups" are lists of items to be installed stored in a
``pyproject.toml`` file.

A dependency group is logically just a list of requirements, similar to the
contents of :ref:`Requirements Files`. Unlike requirements files, dependency
groups cannot contain non-package arguments for :ref:`pip install`.

Groups can be declared like so:

.. code-block:: toml

    # pyproject.toml
    [dependency-groups]
    groupA = [
        "pkg1",
        "pkg2",
    ]

and installed with :ref:`pip install` like so:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install --group groupA

.. tab:: Windows

   .. code-block:: shell

      py -m pip install --group groupA

Full details on the contents of ``[dependency-groups]`` and more examples are
available in :ref:`the specification documentation `.

.. note::

    Dependency Groups are defined by a standard, and therefore do not support
    ``pip``-specific syntax for requirements, only :ref:`standard dependency
    specifiers `.

``pip`` does not search projects or directories to discover ``pyproject.toml``
files. The ``--group`` option is used to pass the path to the file,
and if the path is omitted, as in the example above, it defaults to
``pyproject.toml`` in the current directory. Using explicit paths,
:ref:`pip install` can use a file from another directory. For example:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install --group './project/subproject/pyproject.toml:groupA'

.. tab:: Windows

   .. code-block:: shell

      py -m pip install --group './project/subproject/pyproject.toml:groupA'


This also makes it possible to install groups from multiple different projects
at once. For example, with a directory structure like so::

    + project/
      + sub1/
        - pyproject.toml
      + sub2/
        - pyproject.toml

it is possible to install, from the ``project/`` directory, groups from the
subprojects thusly:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install --group './sub1/pyproject.toml:groupA' --group './sub2/pyproject.toml:groupB'

.. tab:: Windows

   .. code-block:: shell

      py -m pip install --group './sub1/pyproject.toml:groupA' --group './sub2/pyproject.toml:groupB'


.. _`Installing from Wheels`:


Installing from Wheels
======================

"Wheel" is a built, archive format that can greatly speed installation compared
to building and installing from source archives. For more information, see the
:ref:`specification `.

pip prefers Wheels where they are available. To disable this, use the
:ref:`--no-binary ` flag for :ref:`pip install`.

If no satisfactory wheels are found, pip will default to finding source
archives.


To install directly from a wheel archive:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install SomePackage-1.0-py2.py3-none-any.whl

.. tab:: Windows

   .. code-block:: shell

      py -m pip install SomePackage-1.0-py2.py3-none-any.whl

To include optional dependencies provided in the ``provides_extras``
metadata in the wheel, you must add quotes around the install target
name:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install './somepackage-1.0-py2.py3-none-any.whl[my-extras]'

.. tab:: Windows

   .. code-block:: shell

      py -m pip install './somepackage-1.0-py2.py3-none-any.whl[my-extras]'

.. note::

    In the future, the ``path[extras]`` syntax may become deprecated. It is
    recommended to use :ref:`standard `
    syntax wherever possible.

For the cases where wheels are not available, pip offers :ref:`pip wheel` as a
convenience, to build wheels for all your requirements and dependencies.

To build wheels for your requirements and all their dependencies to a local
directory:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install wheel
      python -m pip wheel --wheel-dir=/local/wheels -r requirements.txt

.. tab:: Windows

   .. code-block:: shell

      py -m pip install wheel
      py -m pip wheel --wheel-dir=/local/wheels -r requirements.txt

And *then* to install those requirements just using your local directory of
wheels (and not from PyPI):

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install --no-index --find-links=/local/wheels -r requirements.txt

.. tab:: Windows

   .. code-block:: shell

      py -m pip install --no-index --find-links=/local/wheels -r requirements.txt


Uninstalling Packages
=====================

pip is able to uninstall most packages like so:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip uninstall SomePackage

.. tab:: Windows

   .. code-block:: shell

      py -m pip uninstall SomePackage


pip also performs an automatic uninstall of an old version of a package
before upgrading to a newer version.

For more information and examples, see the :ref:`pip uninstall` reference.


Listing Packages
================

To list installed packages:

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip list
      docutils (0.9.1)
      Jinja2 (2.6)
      Pygments (1.5)
      Sphinx (1.1.2)

.. tab:: Windows

   .. code-block:: console

      C:\> py -m pip list
      docutils (0.9.1)
      Jinja2 (2.6)
      Pygments (1.5)
      Sphinx (1.1.2)


To list outdated packages, and show the latest version available:

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip list --outdated
      docutils (Current: 0.9.1 Latest: 0.10)
      Sphinx (Current: 1.1.2 Latest: 1.1.3)

.. tab:: Windows

   .. code-block:: console

      C:\> py -m pip list --outdated
      docutils (Current: 0.9.1 Latest: 0.10)
      Sphinx (Current: 1.1.2 Latest: 1.1.3)

To show details about an installed package:

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip show sphinx
      ---
      Name: Sphinx
      Version: 1.1.3
      Location: /my/env/lib/pythonx.x/site-packages
      Requires: Pygments, Jinja2, docutils

.. tab:: Windows

   .. code-block:: console

      C:\> py -m pip show sphinx
      ---
      Name: Sphinx
      Version: 1.1.3
      Location: /my/env/lib/pythonx.x/site-packages
      Requires: Pygments, Jinja2, docutils

For more information and examples, see the :ref:`pip list` and :ref:`pip show`
reference pages.


Searching for Packages
======================

pip can search `PyPI`_ for packages using the ``pip search``
command:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip search "query"

.. tab:: Windows

   .. code-block:: shell

      py -m pip search "query"

The query will be used to search the names and summaries of all
packages.

For more information and examples, see the :ref:`pip search` reference.

.. _`0-configuration`:
.. rubric:: Configuration

This is now covered in :doc:`topics/configuration`.

.. _`0-config-file`:
.. rubric:: Config file

This is now covered in :doc:`topics/configuration`.

.. _`0-environment-variables`:
.. rubric:: Environment Variables

This is now covered in :doc:`topics/configuration`.

.. _`0-config-precedence`:
.. rubric:: Config Precedence

This is now covered in :doc:`topics/configuration`.

Command Completion
==================

pip comes with support for command line completion in bash, zsh and fish.

To setup for bash::

    python -m pip completion --bash >> ~/.profile

To setup for zsh::

    python -m pip completion --zsh >> ~/.zprofile

To setup for fish::

    python -m pip completion --fish > ~/.config/fish/completions/pip.fish

To setup for powershell::

   python -m pip completion --powershell | Out-File -Encoding default -Append $PROFILE

Alternatively, you can use the result of the ``completion`` command directly
with the eval function of your shell, e.g. by adding the following to your
startup file::

    eval "`pip completion --bash`"



.. _`Installing from local packages`:


Installing from local packages
==============================

In some cases, you may want to install from local packages only, with no traffic
to PyPI.

First, download the archives that fulfill your requirements:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip download --destination-directory DIR -r requirements.txt

.. tab:: Windows

   .. code-block:: shell

      py -m pip download --destination-directory DIR -r requirements.txt

Note that ``pip download`` will look in your wheel cache first, before
trying to download from PyPI.  If you've never installed your requirements
before, you won't have a wheel cache for those items.  In that case, if some of
your requirements don't come as wheels from PyPI, and you want wheels, then run
this instead:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip wheel --wheel-dir DIR -r requirements.txt

.. tab:: Windows

   .. code-block:: shell

      py -m pip wheel --wheel-dir DIR -r requirements.txt

Then, to install from local only, you'll be using :ref:`--find-links
` and :ref:`--no-index ` like so:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install --no-index --find-links=DIR -r requirements.txt

.. tab:: Windows

   .. code-block:: shell

      py -m pip install --no-index --find-links=DIR -r requirements.txt


"Only if needed" Recursive Upgrade
==================================

``pip install --upgrade`` now has a ``--upgrade-strategy`` option which
controls how pip handles upgrading of dependencies. There are 2 upgrade
strategies supported:

- ``eager``: upgrades all dependencies regardless of whether they still satisfy
  the new parent requirements
- ``only-if-needed``: upgrades a dependency only if it does not satisfy the new
  parent requirements

The default strategy is ``only-if-needed``. This was changed in pip 10.0 due to
the breaking nature of ``eager`` when upgrading conflicting dependencies.

It is important to note that ``--upgrade`` affects *direct requirements* (e.g.
those specified on the command-line or via a requirements file) while
``--upgrade-strategy`` affects *indirect requirements* (dependencies of direct
requirements).

As an example, say ``SomePackage`` has a dependency, ``SomeDependency``, and
both of them are already installed but are not the latest available versions:

- ``pip install SomePackage``: will not upgrade the existing ``SomePackage`` or
  ``SomeDependency``.
- ``pip install --upgrade SomePackage``: will upgrade ``SomePackage``, but not
  ``SomeDependency`` (unless a minimum requirement is not met).
- ``pip install --upgrade SomePackage --upgrade-strategy=eager``: upgrades both
  ``SomePackage`` and ``SomeDependency``.

As an historic note, an earlier "fix" for getting the ``only-if-needed``
behaviour was:

.. tab:: Unix/macOS

   .. code-block:: shell

      python -m pip install --upgrade --no-deps SomePackage
      python -m pip install SomePackage

.. tab:: Windows

   .. code-block:: shell

      py -m pip install --upgrade --no-deps SomePackage
      py -m pip install SomePackage


A proposal for an ``upgrade-all`` command is being considered as a safer
alternative to the behaviour of eager upgrading.


User Installs
=============

With Python 2.6 came the `"user scheme" for installation
`_,
which means that all Python distributions support an alternative install
location that is specific to a user.  The default location for each OS is
explained in the python documentation for the `site.USER_BASE
`_ variable.
This mode of installation can be turned on by specifying the :ref:`--user
` option to ``pip install``.

Moreover, the "user scheme" can be customized by setting the
``PYTHONUSERBASE`` environment variable, which updates the value of
``site.USER_BASE``.

To install "SomePackage" into an environment with ``site.USER_BASE`` customized to
'/myappenv', do the following:

.. tab:: Unix/macOS

   .. code-block:: shell

      export PYTHONUSERBASE=/myappenv
      python -m pip install --user SomePackage

.. tab:: Windows

   .. code-block:: shell

      set PYTHONUSERBASE=c:/myappenv
      py -m pip install --user SomePackage

``pip install --user`` follows four rules:

#. When globally installed packages are on the python path, and they *conflict*
   with the installation requirements, they are ignored, and *not*
   uninstalled.
#. When globally installed packages are on the python path, and they *satisfy*
   the installation requirements, pip does nothing, and reports that
   requirement is satisfied (similar to how global packages can satisfy
   requirements when installing packages in a ``--system-site-packages``
   virtualenv).
#. pip will not perform a ``--user`` install in a ``--no-site-packages``
   virtualenv (i.e. the default kind of virtualenv), due to the user site not
   being on the python path.  The installation would be pointless.
#. In a ``--system-site-packages`` virtualenv, pip will not install a package
   that conflicts with a package in the virtualenv site-packages.  The --user
   installation would lack sys.path precedence and be pointless.


To make the rules clearer, here are some examples:

From within a ``--no-site-packages`` virtualenv (i.e. the default kind):

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip install --user SomePackage
      Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

.. tab:: Windows

   .. code-block:: console

      C:\> py -m pip install --user SomePackage
      Can not perform a '--user' install. User site-packages are not visible in this virtualenv.


From within a ``--system-site-packages`` virtualenv where ``SomePackage==0.3``
is already installed in the virtualenv:

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip install --user SomePackage==0.4
      Will not install to the user site because it will lack sys.path precedence

.. tab:: Windows

   .. code-block:: console

      C:\> py -m pip install --user SomePackage==0.4
      Will not install to the user site because it will lack sys.path precedence

From within a real python, where ``SomePackage`` is *not* installed globally:

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip install --user SomePackage
      [...]
      Successfully installed SomePackage

.. tab:: Windows

   .. code-block:: console

      C:\> py -m pip install --user SomePackage
      [...]
      Successfully installed SomePackage

From within a real python, where ``SomePackage`` *is* installed globally, but
is *not* the latest version:

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip install --user SomePackage
      [...]
      Requirement already satisfied (use --upgrade to upgrade)
      $ python -m pip install --user --upgrade SomePackage
      [...]
      Successfully installed SomePackage

.. tab:: Windows

   .. code-block:: console

      C:\> py -m pip install --user SomePackage
      [...]
      Requirement already satisfied (use --upgrade to upgrade)
      C:\> py -m pip install --user --upgrade SomePackage
      [...]
      Successfully installed SomePackage

From within a real python, where ``SomePackage`` *is* installed globally, and
is the latest version:

.. tab:: Unix/macOS

   .. code-block:: console

      $ python -m pip install --user SomePackage
      [...]
      Requirement already satisfied (use --upgrade to upgrade)
      $ python -m pip install --user --upgrade SomePackage
      [...]
      Requirement already up-to-date: SomePackage
      # force the install
      $ python -m pip install --user --ignore-installed SomePackage
      [...]
      Successfully installed SomePackage

.. tab:: Windows

   .. code-block:: console

      C:\> py -m pip install --user SomePackage
      [...]
      Requirement already satisfied (use --upgrade to upgrade)
      C:\> py -m pip install --user --upgrade SomePackage
      [...]
      Requirement already up-to-date: SomePackage
      # force the install
      C:\> py -m pip install --user --ignore-installed SomePackage
      [...]
      Successfully installed SomePackage

.. _`0-repeatability`:
.. _`0-ensuring-repeatability`:
.. rubric:: Ensuring Repeatability

This is now covered in :doc:`../topics/repeatable-installs`.

.. _`0-fixing-conflicting-dependencies`:
.. rubric:: Fixing conflicting dependencies

This is now covered in :doc:`../topics/dependency-resolution`.

.. _`Using pip from your program`:

Using pip from your program
===========================

As noted previously, pip is a command line program. While it is implemented in
Python, and so is available from your Python code via ``import pip``, you must
not use pip's internal APIs in this way. There are a number of reasons for this:

#. The pip code assumes that it is in sole control of the global state of the
   program.
   pip manages things like the logging system configuration, or the values of
   the standard IO streams, without considering the possibility that user code
   might be affected.

#. pip's code is *not* thread safe. If you were to run pip in a thread, there
   is no guarantee that either your code or pip's would work as you expect.

#. pip assumes that once it has finished its work, the process will terminate.
   It doesn't need to handle the possibility that other code will continue to
   run after that point, so (for example) calling pip twice in the same process
   is likely to have issues.

This does not mean that the pip developers are opposed in principle to the idea
that pip could be used as a library - it's just that this isn't how it was
written, and it would be a lot of work to redesign the internals for use as a
library, handling all of the above issues, and designing a usable, robust and
stable API that we could guarantee would remain available across multiple
releases of pip. And we simply don't currently have the resources to even
consider such a task.

What this means in practice is that everything inside of pip is considered an
implementation detail. Even the fact that the import name is ``pip`` is subject
to change without notice. While we do try not to break things as much as
possible, all the internal APIs can change at any time, for any reason. It also
means that we generally *won't* fix issues that are a result of using pip in an
unsupported way.

It should also be noted that installing packages into ``sys.path`` in a running
Python process is something that should only be done with care. The import
system caches certain data, and installing new packages while a program is
running may not always behave as expected. In practice, there is rarely an
issue, but it is something to be aware of.

Having said all of the above, it is worth covering the options available if you
decide that you do want to run pip from within your program. The most reliable
approach, and the one that is fully supported, is to run pip in a subprocess.
This is easily done using the standard ``subprocess`` module::

  subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'my_package'])

If you want to process the output further, use one of the other APIs in the module.
We are using `freeze`_ here which outputs installed packages in requirements format.::

  reqs = subprocess.check_output([sys.executable, '-m', 'pip', 'freeze'])

To programmatically monitor download progress use the ``--progress-bar=raw`` option.
This will print lines to stdout in the format ``Progress CURRENT of TOTAL``, where
``CURRENT`` and ``TOTAL`` are integers and the unit is bytes.
If the real total is unknown then ``TOTAL`` is set to ``0``. Be aware that the
specific formatting of pip's outputs are *not* guaranteed to be the same in future versions.

If you don't want to use pip's command line functionality, but are rather
trying to implement code that works with Python packages, their metadata, or
PyPI, then you should consider other, supported, packages that offer this type
of ability. Some examples that you could consider include:

* ``packaging`` - Utilities to work with standard package metadata (versions,
  requirements, etc.)

* ``importlib.metadata`` in the Python stdlib - Functions for querying what
  packages the user has installed on their system.

* ``distlib`` - Packaging and distribution utilities (including functions for
  interacting with PyPI).

.. _changes-to-the-pip-dependency-resolver-in-20-2-2020:

.. _`Resolver changes 2020`:

Changes to the pip dependency resolver in 20.3 (2020)
=====================================================

pip 20.3 has a new dependency resolver, on by default for Python 3
users. (pip 20.1 and 20.2 included pre-release versions of the new
dependency resolver, hidden behind optional user flags.) Read below
for a migration guide, how to invoke the legacy resolver, and the
deprecation timeline. We also made a `two-minute video explanation`_
you can watch.

We will continue to improve the pip dependency resolver in response to
testers' feedback. Please give us feedback through the `resolver
testing survey`_.

.. _`Migration guide for 2020 resolver changes`:

Watch out for
-------------

The big change in this release is to the pip dependency resolver
within pip.

Computers need to know the right order to install pieces of software
("to install ``x``, you need to install ``y`` first"). So, when Python
programmers share software as packages, they have to precisely describe
those installation prerequisites, and pip needs to navigate tricky
situations where it's getting conflicting instructions. This new
dependency resolver will make pip better at handling that tricky
logic, and make pip easier for you to use and troubleshoot.

The most significant changes to the resolver are:

* It will **reduce inconsistency**: it will *no longer install a
  combination of packages that is mutually inconsistent*. In older
  versions of pip, it is possible for pip to install a package which
  does not satisfy the declared requirements of another installed
  package. For example, in pip 20.0, ``pip install "six<1.12"
  "virtualenv==20.0.2"`` does the wrong thing, “successfully” installing
  ``six==1.11``, even though ``virtualenv==20.0.2`` requires
  ``six>=1.12.0,<2`` (`defined here
  `__).
  The new resolver, instead, outright rejects installing anything if it
  gets that input.

* It will be **stricter** - if you ask pip to install two packages with
  incompatible requirements, it will refuse (rather than installing a
  broken combination, like it did in previous versions).

So, if you have been using workarounds to force pip to deal with
incompatible or inconsistent requirements combinations, now's a good
time to fix the underlying problem in the packages, because pip will
be stricter from here on out.

This also means that, when you run a ``pip install`` command, pip only
considers the packages you are installing in that command, and **may
break already-installed packages**. It will not guarantee that your
environment will be consistent all the time. If you ``pip install x``
and then ``pip install y``, it's possible that the version of ``y``
you get will be different than it would be if you had run ``pip
install x y`` in a single command. We are considering changing this
behavior (per :issue:`7744`) and would like your thoughts on what
pip's behavior should be; please answer `our survey on upgrades that
create conflicts`_.

We are also changing our support for :ref:`Constraints Files`,
editable installs, and related functionality. We did a fairly
comprehensive overhaul and stripped constraints files down to being
purely a way to specify global (version) limits for packages, and so
some combinations that used to be allowed will now cause
errors. Specifically:

* Constraints don't override the existing requirements; they simply
  constrain what versions are visible as input to the resolver (see
  :issue:`9020`)
* Providing an editable requirement (``-e .``) does not cause pip to
  ignore version specifiers or constraints (see :issue:`8076`), and if
  you have a conflict between a pinned requirement and a local
  directory then pip will indicate that it cannot find a version
  satisfying both (see :issue:`8307`)
* Hash-checking mode requires that all requirements are specified as a
  ``==`` match on a version and may not work well in combination with
  constraints (see :issue:`9020` and :issue:`8792`)
* If necessary to satisfy constraints, pip will happily reinstall
  packages, upgrading or downgrading, without needing any additional
  command-line options (see :issue:`8115` and :doc:`development/architecture/upgrade-options`)
* Unnamed requirements are not allowed as constraints (see :issue:`6628` and :issue:`8210`)
* Links are not allowed as constraints (see :issue:`8253`)
* Constraints cannot have extras (see :issue:`6628`)

Per our :ref:`Python 2 Support` policy, pip 20.3 users who are using
Python 2 will use the legacy resolver by default. Python 2 users
should upgrade to Python 3 as soon as possible, since in pip 21.0 in
January 2021, pip dropped support for Python 2 altogether.


How to upgrade and migrate
--------------------------

1. **Install pip 20.3** with ``python -m pip install --upgrade pip``.

2. **Validate your current environment** by running ``pip check``. This
   will report if you have any inconsistencies in your set of installed
   packages. Having a clean installation will make it much less likely
   that you will hit issues with the new resolver (and may
   address hidden problems in your current environment!). If you run
   ``pip check`` and run into stuff you can’t figure out, please `ask
   for help in our issue tracker or chat `__.

3. **Test the new version of pip**.

   While we have tried to make sure that pip’s test suite covers as
   many cases as we can, we are very aware that there are people using
   pip with many different workflows and build processes, and we will
   not be able to cover all of those without your help.

   -  If you use pip to install your software, try out the new resolver
      and let us know if it works for you with ``pip install``. Try:

      - installing several packages simultaneously
      - re-creating an environment using a ``requirements.txt`` file
      - using ``pip install --force-reinstall`` to check whether
        it does what you think it should
      - using constraints files
      - the "Setups to test with special attention" and "Examples to try" below

   -  If you have a build pipeline that depends on pip installing your
      dependencies for you, check that the new resolver does what you
      need.

   -  Run your project’s CI (test suite, build process, etc.) using the
      new resolver, and let us know of any issues.
   -  If you have encountered resolver issues with pip in the past,
      check whether the new resolver fixes them, and read :ref:`Fixing
      conflicting dependencies`. Also, let us know if the new resolver
      has issues with any workarounds you put in to address the
      current resolver’s limitations. We’ll need to ensure that people
      can transition off such workarounds smoothly.
   -  If you develop or support a tool that wraps pip or uses it to
      deliver part of your functionality, please test your integration
      with pip 20.3.

4. **Troubleshoot and try these workarounds if necessary.**

   -  If pip is taking longer to install packages, read :doc:`Dependency
      resolution backtracking ` for ways to
      reduce the time pip spends backtracking due to dependency conflicts.
   -  If you don't want pip to actually resolve dependencies, use the
      ``--no-deps`` option. This is useful when you have a set of package
      versions that work together in reality, even though their metadata says
      that they conflict. For guidance on a long-term fix, read
      :ref:`Fixing conflicting dependencies`.
   -  If you run into resolution errors and need a workaround while you're
      fixing their root causes, you can choose the old resolver behavior using
      the flag ``--use-deprecated=legacy-resolver``. This will work until we
      release pip 21.0 (see
      :ref:`Deprecation timeline for 2020 resolver changes`).

5. **Please report bugs** through the `resolver testing survey`_.


Setups to test with special attention
-------------------------------------

*    Requirements files with 100+ packages

*    Installation workflows that involve multiple requirements files

*    Requirements files that include hashes (:ref:`hash-checking mode`)
     or pinned dependencies (perhaps as output from ``pip-compile`` within
     ``pip-tools``)

*    Using :ref:`Constraints Files`

*    Continuous integration/continuous deployment setups

*    Installing from any kind of version control systems (i.e., Git, Subversion, Mercurial, or CVS), per :doc:`topics/vcs-support`

*    Installing from source code held in local directories

Examples to try
^^^^^^^^^^^^^^^

Install:

* `tensorflow`_
* ``hacking``
* ``pycodestyle``
* ``pandas``
* ``tablib``
* ``elasticsearch`` and ``requests`` together
* ``six`` and ``cherrypy`` together
* ``pip install flake8-import-order==0.17.1 flake8==3.5.0 --use-feature=2020-resolver``
* ``pip install tornado==5.0 sprockets.http==1.5.0 --use-feature=2020-resolver``

Try:

* ``pip install``
* ``pip uninstall``
* ``pip check``
* ``pip cache``


Tell us about
-------------

Specific things we'd love to get feedback on:

*    Cases where the new resolver produces the wrong result,
     obviously. We hope there won't be too many of these, but we'd like
     to trap such bugs before we remove the legacy resolver.

*    Cases where the resolver produced an error when you believe it
     should have been able to work out what to do.

*    Cases where the resolver gives an error because there's a problem
     with your requirements, but you need better information to work out
     what's wrong.

*    If you have workarounds to address issues with the current resolver,
     does the new resolver let you remove those workarounds? Tell us!

Please let us know through the `resolver testing survey`_.

.. _`Deprecation timeline for 2020 resolver changes`:

Deprecation timeline
--------------------

We plan for the resolver changeover to proceed as follows, using
:ref:`Feature Flags` and following our :ref:`Release Cadence`:

*    pip 20.1: an alpha version of the new resolver was available,
     opt-in, using the optional flag
     ``--unstable-feature=resolver``. pip defaulted to legacy
     behavior.

*    pip 20.2: a beta of the new resolver was available, opt-in, using
     the flag ``--use-feature=2020-resolver``. pip defaulted to legacy
     behavior. Users of pip 20.2 who want pip to default to using the
     new resolver can run ``pip config set global.use-feature
     2020-resolver`` (for more on that and the alternate
     ``PIP_USE_FEATURE`` environment variable option, see `issue
     8661`_).

*    pip 20.3: pip defaults to the new resolver in Python 3 environments,
     but a user can opt-out and choose the old resolver behavior,
     using the flag ``--use-deprecated=legacy-resolver``. In Python 2
     environments, pip defaults to the old resolver, and the new one is
     available using the flag ``--use-feature=2020-resolver``.

*    pip 21.0: pip uses new resolver by default, and the old resolver is
     no longer supported. It will be removed after a currently undecided
     amount of time, as the removal is dependent on pip's volunteer
     maintainers' availability. Python 2 support is removed per our
     :ref:`Python 2 Support` policy.

Since this work will not change user-visible behavior described in the
pip documentation, this change is not covered by the :ref:`Deprecation
Policy`.

.. attention::

    The legacy resolver is deprecated and unsupported. New features, such
    as :doc:`reference/installation-report`, will not work with the
    legacy resolver and this resolver will be removed in a future
    release.

Context and followup
--------------------

As discussed in `our announcement on the PSF blog`_, the pip team are
in the process of developing a new "dependency resolver" (the part of
pip that works out what to install based on your requirements).

We're tracking our rollout in :issue:`6536` and you can watch for
announcements on the `low-traffic packaging announcements list`_ and
`the official Python blog`_.

.. _freeze: https://pip.pypa.io/en/latest/reference/pip_freeze/
.. _resolver testing survey: https://tools.simplysecure.org/survey/index.php?r=survey/index&sid=989272&lang=en
.. _issue 8661: https://github.com/pypa/pip/issues/8661
.. _our announcement on the PSF blog: http://pyfound.blogspot.com/2020/03/new-pip-resolver-to-roll-out-this-year.html
.. _two-minute video explanation: https://www.youtube.com/watch?v=B4GQCBBsuNU
.. _tensorflow: https://pypi.org/project/tensorflow/
.. _low-traffic packaging announcements list: https://mail.python.org/mailman3/lists/pypi-announce.python.org/
.. _our survey on upgrades that create conflicts: https://docs.google.com/forms/d/e/1FAIpQLSeBkbhuIlSofXqCyhi3kGkLmtrpPOEBwr6iJA6SzHdxWKfqdA/viewform
.. _the official Python blog: https://blog.python.org/
.. _Python Windows launcher: https://docs.python.org/3/using/windows.html#launcher

.. _`0-using-system-trust-stores-for-verifying-https`:
.. rubric:: Using system trust stores for verifying HTTPS

This is now covered in :doc:`topics/https-certificates`.


================================================
FILE: docs/html/ux-research-design/contribute.md
================================================
# How to Contribute

## Participate in UX Research

It is important that we hear from pip users so that we can:

- Understand how pip is currently used by the Python community
- Understand how pip users _need_ pip to behave
- Understand how pip users _would like_ pip to behave
- Understand pip’s strengths and shortcomings
- Make useful design recommendations for improving pip

If you are interested in participating in pip user research, please [join pip’s user panel](https://mail.python.org/mailman3/lists/pip-ux-studies.python.org/).

## Test New Features

You can help the team by testing new features as they are released to the community.

## Report and Work on UX Issues

If you believe that you have found a user experience bug in pip, or you have ideas for how pip could be made better for all users, please file an issue on the [pip issue tracker](https://github.com/pypa/pip/issues/new).

You can also help improve pip’s user experience by [working on UX issues](https://github.com/pypa/pip/issues?q=is%3Aissue+label%3AUX+is%3Aopen). Issues that are ideal for new contributors are marked with “[good first issue](https://github.com/pypa/pip/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)”. Explore the
[UX Guidance](guidance.md) if you have questions.


================================================
FILE: docs/html/ux-research-design/guidance.md
================================================
# UX Guidance

This section of the documentation is intended for contributors who wish to work on improving pip's user experience, including pip's documentation.

## What is User Centered Design?

User-centered design (UCD) or human-centered design (HCD) is an iterative process in which design decisions are informed by an understanding of users and their needs. There are many terms used to describe this type of work; in this document we will use "user experience (UX) research and design".

For the pip project, UX research and design can be used to:

- Develop a deeper understanding of pip's users, the context in which they use pip and the challenges that they face
- Inform the design of new or existing pip features, so that pip us more usable and accessible. This may include improving pip's output (including error messages), controls (e.g. commands and flags) and documentation
- Help pip's development team prioritize feature requests based on user needs

At a high level, the UX research and design process is comprised of:

1. **[Research](#conducting-research-for-pip)**, where a variety of techniques are used (e.g.[surveys](#surveys) and [interviews](#interviews)) to learn about users and what they want from the tools they use
2. **[Design](#user-interface-design)**, where solutions are proposed to response to the research conducted. UX research and design is conducted iteratively, with design proposals or prototypes tested with users to validate that they are effective in meeting users' needs. Often, it is necessary to complete several cycles of research, design and validation to find a solution that works:

![Graphic showing an iterative process of Research, Make (Design), Validate, around user goals and needs.](https://user-images.githubusercontent.com/3323703/124515613-c5bae880-ddd7-11eb-99d6-35c0a7522c7a.png)

For more information on how this process has been applied to the pip project, see [research results](research-results/index).

See also:

- [Introduction to user centered design from the interaction design foundation](https://www.interaction-design.org/literature/topics/user-centered-design)
- [User-Centered Design Basics from usability.gov](https://www.usability.gov/what-and-why/user-centered-design.html)
- [User-centered design articles and videos from Nielson Norman Group](https://www.nngroup.com/topic/user-centered-design/)

## Conducting Research for pip

User research can be used to answer a few different types of questions:

- _Understanding the context generally_ — e.g. how is pip used by people? What different environments and contexts is pip used in?
- _Understanding the users more broadly_ — e.g. who uses pip? How much experience do they have typically? How do they learn how to use pip? Are there any common characteristics between pip users? How diverse are the needs of pip's users?
- _Evaluating a specific need or challenge_ — e.g. how are pip users encountering a given issue? When does it come up? Do pip users regularly encounter this issue? How would a new feature address this issue?

During the research process, it is important to engage users for input, and incorporate their feedback into decision making.

Input and feedback from users is as valuable to an open source project as code contributions; end users may not be ready yet to submit a pull request or make fixes into the code directly, but their feedback can help to shape pip's priorities and direction.

There are many ways to engage users in open source projects, and sometimes input from community members can feel overwhelming! Providing a structure, such as surveys and interviews, can make it easier to collect and understand feedback. Some examples of how to engage users are:

- _Surveys_ — good for targeted feedback about specific issues and broad community context and understanding
- _Interviews_ — good for in-depth conversations to understand or explore a topic
- _Testing_ — good to evaluate an issue or validate a design idea
- _Open issue queues_ (e.g. GitHub issues) & support ticket systems — great data source to understand common challenges
- _Forums or discussion tools_ — great data source to understand common challenges or engage broader community in open discussion
- _Conferences and events_ — great opportunity to go lightweight interviews or testing of specific features

When running [UX research on pip in 2020](research-results/index), we found that surveys and interviews were particularly useful tools to engage with pip's users. Some general guidelines, as well as pip-specific recommendations are below.

### Surveys

Surveys are great for collecting broad, large scale input, e.g. learning more about pip's user community as a whole, or for getting targeted feedback about a specific issue.

Surveys can also be leveraged to get in-situ feedback with early releases of new tools, e.g. prompting users on the command line if they are using a beta version of a feature or asking people for feedback on a documentation page.

As an example, in 2020, the pip UX team published several surveys to learn about pip and pip's users. This included:

- Understanding 'who uses pip'
- Collecting feedback about pip's documentation
- Collecting feedback about pip's beta release of the 2020 dependency resolver
- Asking users how specific parts of pip's 2020 dependency resolver should behave

A full list of the surveys published in 2020 and their results [can be found here](research-results/index).

#### Designing Surveys

When designing surveys, it is important to first establish what you want to learn. It can be useful to write this down as research-results/index questions. Example pip research-results/index questions [can be found here](https://github.com/pypa/pip/issues/8518).

If you find that your topic is large, or you have many research-results/index questions, consider publishing several separate surveys, as long surveys risk a low response / high dropoff rate.

Below is a brief guide to building a survey for pip:

  1. Introduce your survey
    Explain the motivation for the survey, or (for surveys about pip's behaviour) set the scene with a scenario.
  2. Design your questions
    • Limit the number of questions you ask to avoid a low response rate. A good rule of thumb is: 3-4 questions about the specific topic, 2-3 questions about users level of experience / what they use Python or pip for.
      When asking about years of experience use the following groupings as options:
      • < 1 Year
      • 1-3 Years
      • 4-6 Years
      • 7-10 Years
      • 11-15 Years
      • 16+ Years
    • Use closed questions with a fixed number of possible responses (e.g. yes/no, multiple choice, checkboxes, or likert scale) for measuring behaviour, opinion or preferences
    • Use open questions to learn about reasoning. If you are using a lot of closed questions in your survey, it is useful to include some open questions to "fish" for less expected answers - e.g. asking a user "why?" they chose a particular option
  3. Pilot your survey and modify it based on feedback
    This could be as simple as sharing it with 1-2 people to see if it makes sense.
  4. Determine where to do outreach
    Establish who you want to hear from and where you should post the survey. Are there community members or groups that can help you reach more people?
    • Does the survey need to be translated into other languages to reach a broader set of the community?
    • Are you able to compensate people for their time?
    • Do participants want to be acknowledged as contributors?
  5. Launch and promote your survey
    See survey and interview outreach for recommendations on how to do outreach for pip based on the UX research-results/index conducted in 2020.
#### Survey Case Study The process described above was followed in 2020, when we wanted to establish whether pip [should install packages with conflicting dependencies](https://github.com/pypa/pip/issues/8452). First, we introduced the purpose of the survey, with a scenario: ![survey introduction with scenario with packages that conflict](https://user-images.githubusercontent.com/3323703/124516502-b046be00-ddd9-11eb-830c-62b8a6fb6182.png) Next, we asked a closed question to establish what the user prefers: ![survey question asking whether pip should allow users to install packages when there are conflicting dependencies](https://user-images.githubusercontent.com/3323703/124516576-e5eba700-ddd9-11eb-8baf-e07773e75742.png) Following this, we qualified the response with an open question: ![survey question asking respondents why pip should allow users to install packages with conflicting dependencies](https://user-images.githubusercontent.com/3323703/124516646-129fbe80-ddda-11eb-9c8a-da127f19fccd.png) This was followed by further questions about workarounds, syntax and behaviour preferences. Finally, we asked survey participants about themselves, including how much Python experience they have, and what they use Python for. This was to find out if different types of Python users answered the questions differently. This survey was shared with the pip team and improved several times, before it was published and promoted using a variety of [outreach channels](#survey-and-interview-outreach). In total, we received 415 responses, with [clear results](research-results/override-conflicting-dependencies) that helped us to make strong recommendations on how to move forward with this feature. #### Analysing Survey Results Surveys are particularly useful for being able to quickly understand trends from a larger population of responses. If your questions are designed well, then you should be able to easily aggregate the data and make statements such as: `X% of respondents said that Option B was the best option.` #### Contextualizing the Responses It's important to remember that the responses to your survey will be biased by the way that you did outreach for your survey, so unless you can be sure that the people who responded to your survey are representative of all of your users, then you need to be sure to contextualize the results to the participants. Within your survey responses it can be helpful to see if there is variation in the responses by different aspects of your users or your user community, e.g. - By experience level — Are responses consistent across experience level or do they vary? E.g. Do newer or more junior experience users have different responses, needs or challenges? - By background/context — Are responses consistent across background or context? E.g. Do users in a corporate context have similar responses to hobbyist/independent users? Do data analysts have similar responses to software engineers? #### How many responses is enough? It depends! This is a hard question to answer in research like this — Traditional statistics would suggest that "enough" depends on the total population you need the survey to represent. In UX research, the answer tends to be more around when you see variation in responses level out, and so it's more about signals and trends in the data. If you are finding that there aren't patterns in the data, it might mean that your questions weren't clear or provided too many options, or it might mean that you need to reach out to more people. See also: - [28 Tips for Creating Great Qualitative Surveys from Nielson Norman Group](https://www.nngroup.com/articles/qualitative-surveys/) - [Open vs. Closed Questions in User Research from Nielsen Norman Group](https://www.nngroup.com/videos/open-vs-closed-questions/) - [Survey questions 101: over 70 survey question examples + types of surveys and FAQs - from HotJar](https://www.hotjar.com/blog/survey-questions/) ### Interviews Interviews are a great way to have more in-depth conversations with users to better understand or explore a topic. Unlike surveys, they are not a great way to understand overall patterns, as it is hard to engage with a large number of people due to the time involved. It can be particularly useful to plan around conferences and events as a way to connect with many users in a more informal setting. #### Designing Interviews As with surveys, it's important to establish what you want to learn before you begin. Often, interviews are conducted with a script; this helps the interview run smoothly by providing some structure. However, it is also ok to go "off script" if the conversation is moving in an interesting or insightful direction. Below is a brief guide to running an interview for pip:
  1. Write your script
    This should include an introduction that sets the scene for the participant, explaining what the interview is about, how you (or observers) will take notes, how long it will take, how their feedback will be used (and shared) and any other pointers you want to share.
    Next, design your questions. Limit the number of questions, so that you have enough time to cover key points and the interview does not run for too long. Like in surveys, a good rule of thumb is 2-3 questions about users' level of experience, and what they use Python/pip for, plus 3-4 questions about the specific topic.
    There are four different types of interview questions:
    1. Descriptive — This type of question gives you concrete, specific stories and details. It also helps your interviewee "arrive" at the interview, resurfacing their relevant experiences and memories. E.g.
      • Tell me about a time…
      • Tell me about the first time…
      • Tell me about the last time…
      • Tell me about the worst/best time…
      • Walk me through how you…
    2. Reflective — These questions allow the interviewee to revisit and think more deeply about their experiences. Helping the interviewee reflect is at the heart of your interview. Don't rush – give them lots of space to put their thoughts together.
      • What do you think about…
      • How do you feel about…
      • Why do you do…
      • Why do you think…
      • What effects did it have when…
      • How has ... changed over time?
    3. Clarifying — This type of question gives interviewees the opportunity to expand on key points. Skillful clarifying questions also let you subtly direct the interviewee's storytelling towards the areas you find most intriguing and relevant.
      • What do you mean when you say…
      • So, in other words…
      • It sounds like you're saying [...]. Is that right?
      • Can you tell me more about that?
    4. Exploratory — These questions are an invitation to the interview-ee to think creatively about their situation, and are best left for the end of the interview. Careful, though – suggestions from a single person are rarely the answer to your design problem, and you need to be clear to them that you're just collecting ideas at this point.
      • How would you change…
      • What would happen if…
      • If you had a magic wand...
  2. Pilot interview with 1-2 people & modify based on their feedback
  3. Determine how to do outreach for interviews
    • Who do you want to be sure to hear from? Where do you need to post to contact people for interviews? Are there community members or groups that can help you reach specific people?
    • Do the interviews need to be translated into other languages to reach a broader set of the community or a specific community?
    • How will people sign up for your interview?
    • Are you able to compensate people for their time?
    • Do participants want to be acknowledged as contributors?
  4. Start outreach!
    See survey and interview outreach for recommendations on how to do outreach for pip based on the UX research conducted in 2020.
Here is an example user interview script used for speaking to users about pip's documentation: > **Introduction** > > - Firstly thank you for giving me your time and for your continued involvement. > - The purpose of this interview is to better understand how pip's documentation is perceived and used by Python community members > - The interview will take approximately 30 minutes. If you don't understand any of the questions please ask me to repeat or rephrase. If you don't have a good answer, feel free to tell me to skip. > - I will be taking notes. These will be shared on GitHub or the pip docs, but we will remove any identifying data to > protect your anonymity > - Please be honest - your feedback can help us make pip better. I won't be offended by anything you have to say :) > - (optional) Do you mind if I record this session? > > **Opening questions** > > - Can you tell me a bit about how you use Python? > - How long have you been using pip? > > **Solving problems** > > - Can you tell me about a time you had a problem when using pip? > - What happened? > - What did you do? > - Where did you go? > - How did you resolve your problem? > - Please go to[ https://pip.pypa.io/en/stable/](https://pip.pypa.io/en/stable/) > - Have you ever used this documentation? > - On a scale of 1-10 how useful was it? > - Why? > - Are there any projects that you use that you'd like us to look at when thinking about improving pip's docs? > - What makes that documentation good/useful? > > **Conclusion** > > - What one thing could the pip team do to help users troubleshoot pip problems? > - Do you have any questions? #### How many interviews is enough? This depends on the complexity of the issue you are discussing, and whether or not you feel that you have gained enough insight from the interviews you have conducted. It also depends on whether you feel you have heard from a wide enough range of people. For example, you may wish to stop interviewing only after you have heard from both expert _and_ novice pip users. Often, conducting just a few interviews will uncover so many problems that there is enough material to make recommendations to the team. #### Analyzing Interview Data Formal interview analysis typically uses a process called "coding" where multiple researchers review interview transcripts and label different statements or comments based on a code system or typology that has been developed to align with the research. This is a great practice and a great way to make sure that the researchers' bias is addressed as part of the process, but most teams do not have the staffing or resources to do this practice. Instead many smaller teams use lightweight processes of capturing interview statements into **themes**, e.g. specific topics or issue areas around needs or challenges. Interviews are also a great source for **quotes**, which can be helpful for providing an example of why something is important or when/how something comes up for users. Interview analysis is frequently done using sticky notes, where you can write a quote, issue or finding on a sticky note and then move the sticky notes around into clusters that can be labeled or categorized into the themes. Remotely this can be facilitated by any number of tools, e.g. digital sticky board tools like [Miro](https://miro.com/) or [Mural](https://www.mural.co/), or even kanban board tools like [Trello](https://trello.com/), [Wekan](https://wekan.github.io/) or [Cryptpad](https://cryptpad.fr/), or this can be done just with text documents or spreadsheets, using lists and categories. It can be helpful to use a [worksheet for debriefing](https://simplysecure.org/resources/interview_synthesis.pdf) at the end of each interview to capture insights and themes quickly before you forget topics from the specific interview. See also: - [User Interviews: How, When, and Why to Conduct Them from Nielson Norman Group](https://www.nngroup.com/articles/user-interviews/) - [Interviewing Users from Nielson Norman Group](https://www.nngroup.com/articles/interviewing-users/) ### Survey and Interview Outreach The following is a list of outreach platforms that the pip team used when conducting research in 2020. Some were more successful than others: #### Recommended: UX Research Panel As part of the [2020 UX Work](research-results/index), we published a form that asked people to join a research panel and be regularly contacted about surveys and interview opportunities. This is now a [mailing list that users can sign up for](https://mail.python.org/mailman3/lists/pip-ux-studies.python.org/), and will be used in an ongoing way in addition to broad public outreach. #### Recommended: Twitter We found Twitter to be a very effective platform for engaging with the Python community and drive participation in UX research. We recommend: 1. Asking [ThePSF](https://twitter.com/ThePSF), [PyPA](https://twitter.com/ThePyPA) and [PyPI](https://twitter.com/pypi) to retweet calls for survey and interview participation 2. Asking specific individuals (who have reach within specific communities, or general followings within the Python community) to retweet. 3. Explicitly asking for retweets within tweets 4. Responding to users within Twitter #### Recommended: Specific Interest Groups We engaged with the [PyLadies](https://pyladies.com/) community via their [Slack channel](https://slackin.pyladies.com/) to drive more participation from women using pip, as we found this demographic more difficult to reach via other channels #### Recommended: Conference Communities Due to the 2020 Global Pandemic we were unable to engage with users via PyCon (or other regional conferences) as we would have liked. However, we would still recommend this channel as a fast and insightful way to engage with large groups of interested people. #### Worth Exploring: Adding a prompt/path into pip's 'help' command We didn't have a chance to explore this opportunity, but the idea came up during workshops in December 2020 with Pypa Maintainers, and could be a great way to engage users and help point them towards opportunities to contribute. #### Not recommended: Forums (Discourse, etc) We used [discuss.python.org](https://discuss.python.org/) several times, posting to the [packaging forum](https://discuss.python.org/c/packaging/14) to ask packaging maintainers about their views on pip's functionality. Unfortunately, this was not as fruitful as we hoped, with very few responses. We found that engaging with packaging maintainers via Twitter was more effective. Posting surveys on Reddit was also not as useful as we had expected. If the user posting the survey or call for research participation does not have significant credit on Reddit, then the posting process itself can be challenging. Overall we did not see as much engagement in surveys or interviews come from Reddit relative to other outreach means. ## User Interface Design Many people associate the term "user interface" with websites or applications, however it is important to remember that a CLI is a user interface too, and deserves the same design consideration as graphical user interfaces. Designing for pip includes: - Designing pip's _input_ - establishing the best way to group functionality under commands, and how to name those commands so that they make sense to the user - Writing pip's _output_ - establishing how pip responds to commands and what information it provides the user. This includes writing success and error messages. - Providing supplemental materials - e.g. documentation that helps users understand pip's operation ### Error Message Format A good error message should mention: * what the user has tried to do * possible next steps to try and solve the error * possible steps need to go from "easiest" to "most complicated" * why the error has happened - include a way to see more information about the situation A [sample `ResolutionImpossible` error that follows this guidance is available](resolution-impossible-example). **Further reading** - - ### Design Principles / Usability Heuristics There are many interaction design principles that help designers design great experiences. Nielsen Norman's [10 Usability Heuristics for User Interface Design](https://www.nngroup.com/articles/ten-usability-heuristics) is a great place to start. Here are some of the ways these principles apply to pip: - Visibility of system status: ensure all commands result in clear feedback that is relevant to the user - but do not overload the user with too much information (see "Aesthetic and minimalist design") - Consistency and standards: when writing interfaces, strive for consistency with the rest of the Python packaging ecosystem, and (where possible) adopt familiar patterns from other CLI tools - Aesthetic and minimalist design: remove noise from CLI output to ensure the user can find the most important information - Help users recognize, diagnose, and recover from errors: clearly label and explain errors: what happened, why, and what the user can do to try and fix the error. Link to documentation where you need to provide a detailed explanation. - Help and documentation: provide help in context and ensure that documentation is task-focussed #### Additional Resources - [Command Line Interface Guidelines](https://clig.dev) - [10 design principles for delightful CLIs](https://blog.developer.atlassian.com/10-design-principles-for-delightful-clis/) ### Design Tools Tools that are frequently used in the design process are personas and guidelines, but also wireframing, prototyping, and testing, as well as creating flow diagrams or models. #### Personas _For a more in-depth overview of personas and using them in open source projects, this [resource from Simply Secure](https://simplysecure.org/blog/personas) may be helpful._ Personas are abstractions or archetypes of people who might use your tool. It often takes the form of a quick portrait including things like — name, age range, job title, enough to give you a sense of who this person is. You can capture this information into a [persona template](https://simplysecure.org/resources/persona-template-tech.pdf) and share them with your open source community as a resource see [examples from the Gitlab UX Team](https://about.gitlab.com/handbook/marketing/strategic-marketing/roles-personas/). Personas are particularly useful to help ground a feature design in priorities for specific needs of specific users. This helps provide useful constraints into the design process, so that you can focus your work, and not try to make every feature a swiss army knife of solutions for every user. In 2020, the pip UX team developed the following personas for the pip project: - Python Software User - Python Software Maker - Python Package Maintainer An in-depth write up on how the pip personas were created, and how they can be applied to future pip UX work can be [found here](research-results/personas). #### Prototyping In any UX project, it is important to prototype and test interfaces with real users. This provides the team with a feedback loop, and ensures that the solution shipped to the end user meets their needs. Prototyping CLIs can be a challenge. See [Creating rapid CLI prototypes with cli-output](https://www.ei8fdb.org/prototyping-command-line-interfaces-with-cli-output/) for recommendations. #### Copywriting Style Guides Given pip's interface is text, it is particularly important that clear and consistent language is used. The following copywriting Style Guides may be useful to the pip team: - [Warehouse (PyPI) copywriting styleguide and glossary of terms](https://warehouse.readthedocs.io/ui-principles.html#write-clearly-with-consistent-style-and-terminology) - Firefox: - [Voice and Tone](https://meet.google.com/linkredirect?authuser=0&dest=https%3A%2F%2Fdesign.firefox.com%2Fphoton%2Fcopy%2Fvoice-and-tone.html) - [Writing for users](https://meet.google.com/linkredirect?authuser=0&dest=https%3A%2F%2Fdesign.firefox.com%2Fphoton%2Fcopy%2Fwriting-for-users.html) - [Heroku CLI](https://devcenter.heroku.com/articles/cli-style-guide) (very specific to Heroku's CLI tools) - [Redhat Pattern Fly style guide](https://www.patternfly.org/v4/ux-writing/about) - [Writing for UIs from Simply Secure](https://simplysecure.org/blog/writing-for-uis) ### General Resources - Heroku talk on design of their CLI tools ([video](https://www.youtube.com/watch?v=PHiDG-_XoRk) transcript) - [Simply Secure: UX Starter Pack](https://simplysecure.org/ux-starter-pack/) - [Simply Secure: Feedback Gathering Guide](https://simplysecure.org/blog/feedback-gathering-guide) - [Simply Secure: Getting Quick Tool Feedback](https://simplysecure.org/blog/design-spot-tool-feedback) - [Internews: UX Feedback Collection Guidebook](https://globaltech.internews.org/our-resources/ux-feedback-collection-guidebook) - [Simply Secure: Knowledge Base](http://simplysecure.org/knowledge-base/) - [Open Source Design](https://opensourcedesign.net/resources/) - [Nielsen Norman Group](https://www.nngroup.com/articles/) - [Interaction Design Foundation](https://www.interaction-design.org/literature) ================================================ FILE: docs/html/ux-research-design/index.md ================================================ # UX Research & Design ```{toctree} :hidden: contribute guidance research-results/index ``` Welcome to pip’s UX research and design documentation. The purpose of this section of the documentation is to: - [Identify where new contributors can participate in or lead UX research and design activities](contribute) - [Share pip UX guidelines](guidance), including an introduction to User Centered Design practices, and how they can be applied to the pip project - Share [results of user research](research-results/index) that the pip team has already conducted ================================================ FILE: docs/html/ux-research-design/research-results/about-our-users.md ================================================ # About pip's Users ## Problem We want to understand users' background, their cultural environment, and how they experience the world, so that we can find better ways to serve them. [Skip to recommendations](#recommendations) ## Research To develop our understanding about pip's users, we published a "Who uses pip?" survey that asked users about: - Their location in the world - Their spoken language - If they identified as members of an underrepresented group in the Python community - Their disabilities and if those disabilities affected their usage of pip ## Results 164 people responded to the survey, with 40% of these coming from English speaking countries. 80% of participants came from Europe or North America. Approx. 60% did not identify as members of an underrepresented group. The majority of participants who did identify as underrepresented did so for gender reasons. The majority of participants (94%) responded that they did not have a disability. Of those that did have a disability, the majority were cognitive disabilities (Attention Deficit Hyperactivity Disorder aka ADHD, Autism, Aspergers, Dyslexia) or a hearing disability. ### Participant Demographics #### Location The majority of participants came from North America and Western Europe. Participation from pip users in Africa, Asia, and the Middle-East was low. ![Map of world showing distribution of participants as per table below](https://i.imgur.com/U2MYiK7.png) Fig. X: Global distribution of pip research participants. | Country Name | Number of participants | | ------------------------ | ---------------------- | | United States of America | 42 | | United Kingdom | 17 | | France | 12 | | Germany | 11 | | Canada | 10 | | Netherlands | 8 | | Spain | 6 | | Switzerland | 5 | | Nigeria | 4 | | India | 4 | | Czech Republic | 4 | | Argentina | 4 | | Sweden | 3 | | Australia | 3 | | Ukraine | 2 | | Taiwan | 2 | | Russia | 2 | | Greece | 2 | | Colombia | 2 | | Chile | 2 | | Brazil | 2 | | Belgium | 2 | | Uganda | 1 | | Turkey | 1 | | Singapore | 1 | | Serbia | 1 | | Norway | 1 | | Luxembourg | 1 | | Japan | 1 | | Italy | 1 | | Israel | 1 | | Ireland | 1 | | Hungary | 1 | | Ghana | 1 | | Finland | 1 | | Bulgaria | 1 | | Austria | 1 | | Total | 164 | #### Participant's First Language Even though the research was carried out mainly in English, 51% of participants spoke languages other than English. | What spoken language do you feel is your first? | Number of participants | | ----------------------------------------------- | ---------------------- | | English | 79 | | French | 18 | | Spanish | 12 | | German | 11 | | Russian | 5 | | Czech | 4 | | Italian | 4 | | Portuguese | 3 | | Dutch | 3 | | Ukrainian | 2 | | Swedish | 2 | | Greek | 2 | | Catalan | 2 | | Mandarin | 2 | | Hungarian | 2 | | Bengali | 1 | | Luxembourgish | 1 | | Bulgarian | 1 | | Romanian | 1 | | Chinese | 1 | | Norwegian | 1 | | Serbian | 1 | | Polish | 1 | | Hebrew | 1 | | Indonesian | 1 | | Malayalam | 1 | NB: English includes British English and American English. Some participants gave more than one answer, their first answer is included here. ### Participants who identified as underrepresented in the Python community We asked research participants if they identified as members of an underrepresented group within the Python community. The wording of this question was deliberately broad to discover participants' understanding of the term "underrepresented" - we listed gender, age, educational background, spoken language, and what they use Python for as a non-exhaustive list of examples. ![Pie chart showing 17.9% answering - I am not sure, 22.6% answering -yes, 59.4% answering - No to the question - Do you identify as an underrepresented group in the Python community](https://i.imgur.com/ghwzxg9.png) Of the 22.6% that responded "Yes" the answers were classified as follows : | Underrepresentation category | Count | | ---------------------------- | ----- | | Gender | 9 | | Cultural | 3 | | Age | 3 | | Immigration status | 2 | | Neurodiversity | 3 | | Other | 6 | | No answer | 8 | NB: This question was included after the survey was published. Total participants was 106, as opposed to all other questions which had 164. The majority of participants did not identify as part of an underrepresented group. However, due to the small sample size these results cannot be seen as representative of the whole pip user base. #### Participant comments about identifying (or not) as under-represented Here is a sample of noteworthy comments from these different groups: ##### Related to Gender > "(I am) LGBTQ/IA+" **- Participant 242608909** > "I am a 25 year old female Colombian developer." **- Participant 242611698** > "Female, 39, no computer science background whatsoever, self taught." **- Participant 242614039** ##### Related to Culture > "The hispanic community is quite underrepresented in the web in general" **- Participant 242599212** > "I am a 1st generation Dominican-American. My parents are from the Dominican Republic." **- Participant 242769361** ##### Related to Age > "Older age, I am 50 now." **- Participant 242769743** ##### Related to Neurodiversity > "I'm a woman. And autistic. But the latter might not be underrepresented ;)" **- Participant 243428773** ##### Other Noteworthy Comments > "Veterans who entered tech post-military" **- Participant 243524784** > "I'm a young white cis male, so by far not a minority in those aspects. But at the same time I'm from a third world country, Argentina, and that sometimes (and I emphasize, only sometimes) makes me feel like a minority. When participating in our local communities (Python Argentina), I feel clearly not-minority, and with the responsibility of helping minorities, trying to build a more welcoming and fair environment for them. But when I participate in the broader global community, at times I feel underrepresented, seeing it mostly guided by english-s[p]eaking people from first world countries. But if I have to choose, I would say I mostly feel not-minority, because I mostly interact with people from our local communities, where I'm not part of a minority." **- Participant 242592869** > "As a CIS male I conform the majoritarian group in the IT world. I'm hopeful that things are changing everywhere, and will keep changing: inclusion is getting bigger and better, more and more people are starting their careers as devs or similar, disregarding ethnicity and/or sexual orientation and that's great! And we need to keep fighting for that." **- Participant 243455292** ### Participant Disabilities Disabilities - physical, motor, cognitive, hearing, speech - alter how people perceive and interact with the world around them - software included. We asked participants about their disabilities and how it affected their usage of pip. Understanding these disabilities is important particularly when designing pip command structures, and designing pip output. The majority of participants (91%) responded that they did not have a disability. Of those that told us that have a disability, the majority were cognitive disabilities (Attention Deficit Hyperactivity Disorder (ADHD), Autism, Aspergers, Dyslexia, or a hearing disability. #### How many participants identified as having a disability? | Do you self-identify as someone who has a disability? | Number of responses | | ----------------------------------------------------- | ------------------- | | No | 150 | | Yes | 14 | | Grand Total | 164 | #### Vision Participants who answered yes to this question were partially sighted. Their vision disability was not corrected by glasses, but did not significantly affect their usage of pip. #### Hearing Five participants identified as having a hearing impairment, or hearing loss. While this disability made participants lives more difficult, it did not affect their usage of pip: > "Being hard of hearing/impaired makes my life much harder, but so far it never has impacted my usage of pip. Perhaps because I haven‘t used parts of it that would?" **- Participant 242934019** > "Not at all given that everything happens by text in my console." **- Participant 243455292** However it did affect the way they consume pip learning materials: if video is being used for learning or support, they should have captions/subtitles/transcriptions available. > "any videos released, it is so helpful if there is either a) transcripts, or b) captions." **- Participant 243524784** #### Cognitive Disabilities Nine participants expressed cognitive disabilities including undefined mental health conditions, Attention Deficit Hyperactivity Disorder (ADHD), Autism, Aspergers, Dyslexia. These participants did not explain how their cognitive disabilities affect their usage of pip, however there are guidelines and best practices for designing for people with cognitive disabilities. #### Physical or Mobility Disability One participant responded that they had a physical or mobility disability, but did not give detail about it in relation to their usage of pip. ### Participants use of Assistive Technology The term "assistive technology" (AT) is used to describe products or systems that support and assist individuals with disabilities, restricted mobility or other impairments to perform functions that might otherwise be difficult or impossible. A subset of these are used to make computer technology - hardware and software - more accessible. Common examples of AT used with computer technology are: screen readers, text-to-speech outputs/inputs. The majority of participants (94%) said that they have never used assistive technology. | Do you use assistive technology (AT) when using computers? | Number of responses | | ---------------------------------------------------------- | ------------------- | | No, I have never used it | 128 | | I only use it when needed | 3 | | I use it everyday | 1 | | I have used it in the past, but not anymore | 4 | Of the eight participants who have used assistive technology, one participant uses assistive technology every day with: - Text-to-speech output as "text to speech allow(s) me to listen and learn when my eyes get strained." - Speech-to-text input as they like using their "tablet and makes typing easier" - On-screen keyboards - Input switches/touch screens A further seven participants use assistive technology only as needed: > "I use custom display filter software to do things like colorize key lines of output automatically (to draw my eye/attention), and provide digit dilimination (I.E. help me tell 1000 and 10000 apart) when using a text console application." > "The standard Mac user interface design contains enough assistive technology without my needing to use any features which are specifically intended solely as assistive functions." > "I sometimes use it to make sure that my code will work correctly with AT." #### Operating systems used with assistive technology Participants use assistive technology across the three most popular desktop operating systems - Linux (most popular), Windows (2nd most popular), and Mac. ![Pie chart showing breakdown of most popular operating systems for pip users using assistive technology](https://i.imgur.com/CD2ev5P.png) #### Assistive technology when using pip We asked participants how well their assistive technologies worked when they use pip. All participants using assistive technology with pip said it worked well for them. We received some feedback about screen readers not coping well with long output, with users experiencing difficulties accessing content at the top of the current terminal window. Therefore, commands or actions (e.g. pip help, pip install, failed builds) that generate a lot of content can be a problem for screenreader users. ## Recommendations ### Supporting languages other than English As 51% of participants speak a language other than English, we recommend that the pip team add localization support to the pip documentation and reach out to the community to find pip users who might be willing to contribute translations. Translators that have [contributed translations to PyPI](https://hosted.weblate.org/projects/pypa/warehouse/) may be a good starting point. If this is not possible, we recommend linking to useful resources in languages other than English from the pip documentation, as we know from our other research that users use a mixture of the official documentation, search engine searches, Stack Overflow and blogs/websites to find solutions to their problems. ### Supporting pip users with disabilities Pip's operation is generally very good for users with disabilities. Being a command line application there are no distracting images or ancillary content, and the user has a large amount of control on how they experience pip via customisation of interface visual preferences (to use contrasting colours, font size and type) and visual and auditory alerts. To better support pip's users with disabilities, the pip team should: - Ensure any future video or audio support materials are provided with captions - Improve pip's output (see below) ### Improving pip output Pip's output is currently too verbose, generating an unhelpful amount of output during its operation. This causes usability issues for all users - especially users with cognitive disabilities. Pip's output should be improved by: - Retaining only the information that is important to users in their current moment (e.g. at install of a package) - Removing unimportant information from the terminal output. The information can still be logged to the log files if needed. - Reducing the number of verbosity levels to three. Right now there are seven levels of verbosity, which is overwhelming and in no way useful. We recommend: - Verbosity 0 - shows only what packages are to be installed, notifications identified as important about the operation, any errors and the final outcome - Verbosity 1 - shows more detail about the packages being installed - Verbosity 2 - shows full information which is also logged to logfiles ## Further reading Designing for people with disabilities: - [An Introduction to inclusive design](https://www.nomensa.com/blog/2011/introduction-inclusive-design) - [How ADHD and dyslexia teach you to do better UX design](https://themasters.io/blog/posts/how-adhd-dyslexia-teach-better-ux-design) - [Improve User Experience by Designing with Cognitive Differences in Mind](https://noti.st/elizabethschafer/fg3BR4) - [Designing accessible software - guidelines for different disabilities](https://ukhomeoffice.github.io/accessibility-posters/) - [Designing for Children with ADHD: The Search for Guidelines for Non-Experts](https://uxpamagazine.org/designing_children_adhd/) (written for children however applicable generally) - [Designing for dyslexia](https://uxplanet.org/designing-for-dyslexia-6d12e8c41cd7) ================================================ FILE: docs/html/ux-research-design/research-results/ci-cd.md ================================================ # How pip is used in interactive environments (i.e. CI, CD) ## Problem We want to know about the contexts in which pip users use pip - interactively (i.e. typing pip commands at the command line terminal) and in an automated environment (i.e. as part of continuous software integration or continuous software development pipelines). Different contexts of use mean that users have different important and common tasks; it means when, where and how they complete these tasks are different. Each of these contexts bring different needs: interactive usage requires the right feedback/output at the right time, whereas an automated environment requires little or no feedback in the moment but detailed feedback after the task has finished. We also wanted to know what users used pip for - as part of their software development toolchain, or purely as a software installer (analogous to Ubuntu Aptitude or Mac Appstore). We also asked about their need for pip to build packages from source. ## Research We created a survey and asked users to give answers to the following statements: - I use pip in an automated environment (e.g. CI/CD pipelines) - I have problems with pip in CI/CD pipelines - I use pip interactively (e.g. typing pip commands on the commandline) - I make software and use pip as part of my software development workflow - I use pip only to install and use Python packages - I need pip to build software packages from source ## Results Using pip interactively makes up the majority of pip usage (91%), the majority (73%) of this usage is basic usage - to only install and use Python packages. Half (51%) of all participants used pip in an automated environment, with only 9% having issues with pip in that automated environment. This points to a good use experience for these users. 71% use pip as part of their software toolchain, only 29% needing pip to build from source. These results show that the main context of use is interactive - users either writing code, installing software at the command line and we know from other research that interactive usage has its issues e.g. pip output being too verbose. While it is important to provide automated environment users with a good experience, interactive mode users are being underserved. ![Answer to question - I use pip in an automated environment](https://i.imgur.com/pLHqBpN.png) ![Answer to question - I use pip interactively](https://i.imgur.com/8ETVMYS.png) 91% of users said they used pip interactively. This does not preclude them from automated usage. ![Answer to the question - What do you use Python for?](https://i.imgur.com/ySlo2Es.png) ================================================ FILE: docs/html/ux-research-design/research-results/improving-pips-documentation.md ================================================ # Improving pip's Documentation ## Problem We want to establish whether or not the [official pip documentation](https://pip.pypa.io/en/stable/) helps users to solve their pip problems. We also want to identify possible improvements to the content and structure of the docs. [Skip to recommendations](#recommendations) ## Research ### Interviews We conducted interviews with pip users specifically discussing documentation. During these interviews we asked about: - Problems they had experienced while using pip, and how they solved them (with a focus on what information sources they used) - How they rate pip's documentation, and what we could do to make the docs more useful - What documentation (from other projects or languages) they find valuable, and why ### Surveys We collected documentation feedback via two surveys: - In our survey that profiled pip users, we asked "What would be your ideal way of getting help with pip?" - We also published a survey specific to pip's docs: ![Screenshot of survey](https://i.imgur.com/dtTnTQJ.png) ### Keyword research We used keyword research tools to understand what words ("keywords") people use when using search engines to troubleshoot pip problems. ### Other research methods We also: 1. Asked for volunteers to participate in a diary study, documenting their experience solving pip problems. Unfortunately this was not completed due to lack of interest from the community. 2. Asked for user feedback on the pip documentation site: ![screenshot of user feedback mechanism on pip docs](https://i.imgur.com/WJVjl8N.png) Unfortunately, we did not gather any useful feedback via this effort 3. [Installed analytics on the pip docs](https://github.com/pypa/pip/pull/9146). We are waiting for this to be merged and start providing useful data. ## Results In total, we: - Conducted 5 user interviews about pip's documentation - Received 141 responses to the question "What would be your ideal way of getting help with pip?" - Received 159 responses to the documentation survey In general, we found that pip's documentation is underutilized by the community, with many users not knowing that it exists. Instead, most users turn to common tools (Google, Stack Overflow) to solve their pip problems. In response to the question "When you have a problem using pip, what do you do?" (multiselect): - 81.9% of respondents Google it - 56.9% of respondents search or ask on Stack Overflow - 33.8% of respondents use pip help from the command line - **25.6% of respondents go to the pip docs** - 20.6% of respondents go the the Python Packaging User Guide - 8.1% of respondents ask on a forum, community board, or chat channel ![screenshot of survey results](https://i.imgur.com/qlt1b4n.png) Based on survey results, users find pip's docs: - Marginally more useful than not useful - Marginally more clear than unclear - Not opinionated enough Common feedback that emerged from both surveys and user interviews includes: - The documentation performs poorly in search engine results - The style and layout is dated (note: this feedback was collected before the [new theme was deployed](https://github.com/pypa/pip/pull/9012)) - There is not enough guidance/examples on how to resolve common problems, or achieve specific goals - The documentation information architecture is difficult to navigate (the monolithic structure of the user guide is a problem) and does not prioritise the most useful content - There should be more instructions specific to each user's different situation (e.g. what operating system they are using) - The scope of the documentation is unclear - The documentation should recognise that pip exists within an ecosystem of other packaging tools - ["There should be one-- and preferably only one --obvious way to do it."](https://www.python.org/dev/peps/pep-0020/) - i.e. the documentation should provide stronger recommendations While some users mentioned that video would be helpful, more said that video was too long, or inappropriate for the kind of problems they experience using pip. Some users mentioned that in person support, forums or chat would be helpful, with many unaware of existing support / community channels. Several users also noted that improving pip's error messages would reduce the need for better documentation. From our keyword research we identified seven _query types_: "about pip", "install pip", "uninstall pip" "update pip", "using pip", "errors", and "other".
See keyword research results ### About pip - what is pip - what is pip in python - what is pip python - what does pip mean - what does pip stand for - what does pip stand for python - pip meaning ### Install pip - get pip - python install pip - install pip - installing pip - how to install pip python - how to install pip - how to download pip - how to get pip - how to check if pip is installed - install pip mac - how to install pip on mac - install pip on mac - install pip linux - how to install pip linux - how to install pip on linux - how to install pip in ubuntu - how to install pip ubuntu - install pip ubuntu - ubuntu install pip - pip windows - install pip windows - pip install windows - how to install pip windows - how to install pip in windows - how to install pip on windows - how to pip install on windows - how to install pip on windows 10 - how to run pip on windows ### Uninstall pip - how to uninstall pip - uninstall pip - pip uninstall ### Update pip - how to update pip - how to upgrade pip - pip update - pip upgrade - upgrade pip - how to upgrade pip on windows ### Using pip - how to use pip - how to use pip install - how to pip install - how to use pip python - how to install with pip - how to run pip - python how to use pip - pip install requirements.txt - pip requirements.txt - pip freeze - pip update package - pip install specific version - pip upgrade package - pip uninstall package ### Errors - no module named pip - pip command not found - pip is not recognized - 'pip' is not recognized as an internal or external command, operable program or batch file. - -bash: pip: command not found - pip is not recognized as an internal or external command - pip install invalid syntax ### Other - how to add pip to path - how to check pip version - how does pip work - where does pip install packages - pip vs pip3 - where is pip installed

The prevalence of "install pip" queries strongly suggests that the current installation documentation should be improved and that users are searching for solutions specific to their operating system. The "about pip" queries also suggest that beginners would benefit from documentation that better explains pip basics - e.g. what pip is and what it does. ## Recommendations Based on our research, we recommend that the pip team: - Revise the structure of the documentation: - Break monolithic pages into standalone pages on different subjects, with appropriate meta tags. This will help the docs appear higher in search results for the 81.9% of users who use Google to troubleshoot their pip problems. - Prioritise most used features (see "[buy a feature](prioritizing-features)" results for guidance) - Add a "troubleshooting" section to the documentation that addresses common questions, explains error messages and tells users where they can find more help - Provide more context about pip's role in the Python packaging ecosystem by: - Introducing packaging concepts that users need to understand in order to use pip - Explaining pip's role/scope within the packaging ecosystem - Comparing pip to other tools - Develop a beginner's guide that walks new pip users through everything they need to know to use pip's most basic functionality. This should include addressing concepts outside of pip's scope (e.g. how to open and use a terminal, how to set up a virtual environment), that may block users from being successful - For each page, (where appropriate), add sections for: - "tips and tricks" - things to know / gotchas - "troubleshooting" - possible error messages and recommended solutions. Where appropriate, this should link to content in the troubleshooting section. - "see also" (links to external resources - e.g. useful stack overflow questions, blog articles, etc.) - In general, write content that: - Is opinionated. Prioritize solutions that will work in the majority of cases, while pointing to possible edge cases and workarounds in "tips and tricks", "troubleshooting" and "see also" content - Uses keywords to increase search results visibility - Provides instructions for different contexts - e.g. for users on Windows, Linux, MacOSX - Increases interlinking with external sources, including packaging.python.org ### Suggested site map Based on the above user input, we have developed a proposed [site map](https://i.imgur.com/UP5q09W.png) (link opens larger format image) to help guide the redevelopment of pip's documentation in line with the above recommendations. ![sitemap. for details see summary below](https://i.imgur.com/UP5q09W.png)
See notes for this site map #### Node 1.0: Quick reference _Page purpose:_ - To give pip users a quick overview of how to install pip, and use pip's main functionality - To link to other (more detailed) areas of the documentation _Suggested content:_ - Quick installation guide, including how to use a virtual environment. This is necessary for user who want to install more than one Python project on their machine. - Common commands / tasks (based on [buy a feature](prioritizing-features) data) --- #### Node 2.0: About pip _Page purpose:_ - To introduce pip to new users _Suggested content:_ - Introduce pip as a command line program - Explain what the command line is and how to use it in different operating systems - Explain what pip is/does, and what it stands for - Link to packaging concepts (node 2.1) - Explain pip's scope (e.g. to install and uninstall packages) and link to other tools (node 2.2) #### Node 2.1: Packaging concepts _Page purpose:_ - To introduce packaging concepts for new pip users _Suggested content:_ - What is a package? - What types of packages are there? e.g. file types - What is package versioning / what are requirement specifiers? (note: talk about potential dependency conflicts here) - Where do I get packages from? - How should I control how packages are installed on my system (e.g. virtualenv and environment isolation) - How can I reproduce an environment / ensure repeatability? (e.g requirements files) - What do I need to know about security? (e.g. hash checking, PyPI name squatting) - Link to node 2.2 ("pip vs other packaging tools") #### Node 2.2: pip vs other packaging tools _Page purpose:_ - To compare pip to other tools with the same scope - To highlight that pip exists within a _packaging ecosystem_ and link to other packaging tools _Suggested content:_ - Compare pip to other installation tools - e.g. poetry, pipenv, conda. What are the features, pros and cons of each? Why do packaging users choose one over the other? - Briefly introduce other packaging projects. Link to https://packaging.python.org/key_projects/ --- #### Node 3.0: Installing pip _Page purpose:_ - To help pip users install pip _Suggested content:_ - Refactor current page, emphasising pathways for different operating systems - Add "tips and tricks", "troubleshooting" and "see also" (link to external resources) sections to provide additional help --- #### Node 4.0: Tutorials _Page purpose:_ - To provide a jumping off place into pip's tutorials _Suggested content:_ - Link to tutorials, including sub pages, where appropriate #### Node 4.1: Using pip to install your first package _Page purpose:_ - To help new pip users get started with pip _Suggested content:_ Step by step tutorial (possibly broken into several pages) that covers: - Using the command line - Installing pip (or checking pip is installed) - Creating/activating a virtual env (use venv for this, but point to alternatives) - Installing a package - Showing where the package has been installed - Deactivating/reactivating virtualenv - Uninstalling a package #### Node 4.2: Advanced tutorial - using pip behind a proxy _Page purpose:_ - To help advanced pip users achieve specific goals _Suggested content:_ - Step by step tutorial for using pip behind a proxy NB: other advanced tutorials should be added as identified by the team and/or requested by the community. --- #### 5.0: Using pip _Page purpose:_ - To provide a jumping off point for the user guide and reference guide _Suggested content:_ - Link to each subject in the user guide - Link to reference guide #### 5.1: User guide _Page purpose:_ - To provide users with specific detailed instructions on pip's key features _Suggested content:_ Break down current user guide into separate pages, or pages linked by subject. Suggested order: - Running pip - Installing Packages - Uninstalling Packages - Environment recreation with requirements files - sub heading: "pinned version numbers" - sub heading: "hash checking mode" - Listing Packages - Searching for Packages - Installing from local packages - Installing from Wheels - Wheel bundles - “Only if needed” Recursive Upgrade - Configuration - User Installs - Command Completion - Basic Authentication Credentials - Using a Proxy Server (includes link to tutorial) - Constraints Files - Using pip from your program Where possible, each page should include: - "tips and tricks" for workarounds, common _gotchas_ and edge use cases - "troubleshooting" information, linking to content in node 6.2 ("Troubleshooting error messages") where applicable - "see also", linking to external resources (e.g. stack overflow questions, useful threads on message boards, blogs posts, etc. Note: the following content should be moved: - Fixing conflicting dependencies (move to node 6.2 - "Troubleshooting error messages") - Dependency resolution backtracking (move to node 6.2 - "Troubleshooting error messages") - Changes to the pip dependency resolver in 20.3 (move to node 7.0 - "News, changelog and roadmap") #### 5.2: Reference guide _Page purpose:_ - To document pip's CLI _Suggested content:_ - https://pip.pypa.io/en/stable/reference/ --- #### 6.0: Help _Page purpose:_ - To provide a jumping off place for users to find answers to their pip questions _Suggested content:_ - Links to - 6.1 "FAQs" - 6.2 "Troubleshooting error messages" - 6.3 "Finding more help" #### 6.1: FAQs _Page purpose:_ - To answer common pip questions / search terms _Suggested content:_ - What is the difference between pip and pip3? - Where does pip install packages? - How can I check pip's version? - How can I add pip to my path? - Where is pip installed? - What does pip stand for? See [popular questions on Stack Overflow](https://stackoverflow.com/search?q=pip&s=ec4ee117-277a-4c5d-a3f5-c921ca6c5da6) for more examples. #### 6.2: Troubleshooting error messages _Page purpose:_ - To help pip users solve their problem when they experience an error using pip _Suggested content:_ For each (common) error message: - Explain what happened - Explain why it happened - Explain what the user can do to resolve the problem Note: the [ResolutionImpossible](https://pip.pypa.io/en/stable/user_guide/#fixing-conflicting-dependencies) and [dependency resolution backtracking](https://pip.pypa.io/en/stable/user_guide/#dependency-resolution-backtracking) documentation should both be moved here. #### 6.3: Finding more help _Page purpose:_ - To point pip users to other resources if they cannot find the information they need within the pip documentation _Suggested content:_ - See [getting help](https://pip.pypa.io/en/stable/user_guide/#getting-help) --- #### 7.0: News, changelog and roadmap _Page purpose:_ - To share information about: - Recent changes to pip - Upcoming changes to pip - Ideas for improving pip, specifically highlighting where funding would be useful _Suggested content:_ - [Changes to the pip dependency resolver in 20.3 (2020)](https://pip.pypa.io/en/stable/user_guide/#changes-to-the-pip-dependency-resolver-in-20-3-2020) - Links to PSF blog posts about pip - Link to [fundable packaging improvements](https://github.com/psf/fundable-packaging-improvements/blob/master/FUNDABLES.md) --- #### 8.0: Contributing _Page purpose:_ - To encourage new people to contribute to the pip project - To demonstrate that the project values different _types_ of contributions, e.g. not just development - To recognise past and current contributors _Suggested content:_ - Introduction to pip as an open source project - Contributors code of conduct - Recognition of the different types of contributions that are valued - Credit list of contributors, including pip maintainers #### 8.1: Development _Page purpose:_ - To onboard people who want to contribute code to pip _Suggested content:_ - https://pip.pypa.io/en/stable/development/ #### 8.2: UX design _Page purpose:_ - To onboard people who want to contribute UX (research or design) to pip - To share UX knowledge and research results with the pip team _Suggested content:_ - UX guidelines, and how they apply to the pip project - Current UX initiatives (e.g. open surveys, interview slots, etc.) - Previous research and results, including UX artifacts (e.g. personas) #### 8.3: Documentation _Page purpose:_ - To onboard people who want to contribute to pip's docs - To share previous research and recommendations related to pip's docs _Suggested content:_ - This guide - Writing styleguide / glossary of terms - see the [Warehouse documentation](https://warehouse.readthedocs.io/ui-principles.html#write-clearly-with-consistent-style-and-terminology) for an example.
### Future research suggestions To continue to improve pip's documentation, we suggest: - Conducting [card sorting](https://www.nngroup.com/articles/card-sorting-definition/) with pip users to establish the ideal order and grouping of pages - Regularly reviewing the documentation analytics, to understand those pages which are most/least visited - Regularly reviewing Stack Overflow to identify questions for the FAQ - Setting up a mechanism for collecting user feedback while users are on the documentation site ================================================ FILE: docs/html/ux-research-design/research-results/index.md ================================================ # UX Research Results Over the course of 2020, the pip team worked on improving pip's user experience, developing a better understanding of pip's UX challenges and opportunities, with a particular focus on pip's new dependency resolver. The [Simply Secure](https://simplysecure.org/) team focused on 4 key areas: - [Understanding who uses pip](https://github.com/pypa/pip/issues/8518) - [Understanding how pip compares to other package managers, and supports other Python packaging tools](https://github.com/pypa/pip/issues/8515) - [Understanding how pip's functionality is used could be improved](https://github.com/pypa/pip/issues/8516), and - [Understanding how pip's documentation is used, and how it could be improved](https://github.com/pypa/pip/issues/8517) Some key outcomes from the 2020 work are: - This documentation & resource section! - A pip UX research panel ([Sign up here!](https://mail.python.org/mailman3/lists/pip-ux-studies.python.org/)) - New and expanded GitHub issues - UX improvements in 2020 - UX work supporting the dependency resolver - Improved error messaging - Supporting Documentation - UX Training for the Pypa + pip maintainers This work was made possible through the [pip donor funded roadmap](https://wiki.python.org/psf/Pip2020DonorFundedRoadmap). ## Outreach We [recruited participants](https://www.ei8fdb.org/thoughts/2020/03/pip-ux-study-recruitment/) for a user research panel that we could contact when we wanted to run surveys and interviews about pip. In total 472 people signed up to the panel, although some unsubscribed during the research period. At the end of the 2020 research, we asked users to opt-in to a [long-term panel](https://mail.python.org/mailman3/lists/pip-ux-studies.python.org/), where they can be contacted for future UX studies. Should the pip team wish to continue to build this panel, we recommend translating the sign-up form into multiple languages and better leveraging local communities and outreach groups (e.g. PyLadies) to increase the diversity of the participants. ## User Interviews In total, we **interviewed 48 pip users**, recruited from the user panel, and through social media channels. During the interviews, we asked users about: - How they use Python - How long they have been using pip - Whether or not they use a virtual environment - If and how they address security issues associated with pip - Which pip commands they regularly use - How they install packages with pip - Their experience using pip list, pip show and pip freeze - Their experience using pip wheel - Whether or not they use other package managers, and how pip compares to their experience with these other tools - What the pip team could do to improve pip - Problems they have experienced while using pip, and how they solved these problems - Their perception and use of the pip documentation - What other technical documentation they value, and how the pip docs could take inspiration from these - What other resources the pip team could provide to help pip users solve their problems ## Surveys We **published 10 surveys** to gather feedback about pip's users and their preferences:
Title Purpose Results
Pip research panel survey Recruit pip users to participate in user research, user tests and participate in future surveys. See associated blog post for more information. 472 full sign-ups
Feedback for testing the new pip resolver Understand use cases where the new resolver fails due to dependency conflicts. See associated blog post for more information. 459 responses via the feedback form, approx. 8 issues transferred to issue tracker
How should pip handle conflicts with already installed packages when updating other packages? Determine if the way that pip handles package upgrades is in-line with user's expectations/needs. See related blog post and GitHub issue for more information. See write up, including recommendations
Learning about our users Learn about pip's users, including:
  • their usage of Python and pip
  • why and how they started using Python
  • if they are living with any disabilities, and if so what effect (if any) this has on their usage of Python and pip
  • if they use assistive technologies when using Python and pip and how this work for them
  • where they get support when you have issues with pip
See write up
Buy a pip feature Establish which features are most important to pip's users See write up
Should pip install conflicting dependencies? Establish whether pip should provide an override that allows users to install packages with conflicting dependencies See write up
How should pip force reinstall work? Establish whether or not pip force reinstall should continue to behave the way it currently does, if the functionality should be changed, or if the option should be removed See write up
Feedback on pip search To establish whether or not to remove or redesign pip search. See this GitHub issue for more information. See write up
Feedback on pip's docs To gather feedback on pip's docs, supplementing feedback gathered in user interviews See write up
## All Results ```{toctree} :maxdepth: 1 about-our-users mental-models users-and-security ci-cd personas prioritizing-features override-conflicting-dependencies pip-force-reinstall pip-search pip-upgrade-conflict improving-pips-documentation ``` ## Read More - [Pip team midyear report (blog, July 2020)](https://pyfound.blogspot.com/2020/07/pip-team-midyear-report.html) - [Creating rapid CLI prototypes with cli-output (blog, Oct 2020)](https://www.ei8fdb.org/prototyping-command-line-interfaces-with-cli-output/) - [Changes are coming to pip (video)](https://www.youtube.com/watch?v=B4GQCBBsuNU) - [How should pip handle dependency conflicts when updating already installed packages? (blog, July 2020)](https://www.ei8fdb.org/how-should-pip-handle-conflicts-when-updating-already-installed-packages/) - [Test pip's alpha resolver and help us document dependency conflicts (blog, May 2020)](https://www.ei8fdb.org/test-pips-alpha-resolver-and-help-us-document-dependency-conflicts/) - [How do you deal with conflicting dependencies caused by pip installs? (blog, April 2020)](https://www.ei8fdb.org/how-do-you-deal-with-conflicting-dependencies-caused-by-pip-installs/) - [pip UX studies: response data (blog, March 2020)](https://www.ei8fdb.org/pip-ux-studies-response-data/) Other PyPA UX work: - [PyPI User Research (blog, July 2018)](https://whoisnicoleharris.com/2018/07/22/pypi-user-research.html) - [Warehouse - The Future of PyPI](https://whoisnicoleharris.com/warehouse/) - [Accessibility on Warehouse (PyPI) (blog, May 2018)](https://whoisnicoleharris.com/2018/05/17/warehouse-accessibility.html) - [User Testing Warehouse (blog, Mar 2018)](https://whoisnicoleharris.com/2018/03/13/user-testing-warehouse.html) - [Designing Warehouse - An Overview (blog, Dec 2015)](https://whoisnicoleharris.com/2015/12/31/designing-warehouse-an-overview.html) ================================================ FILE: docs/html/ux-research-design/research-results/mental-models.md ================================================ # How Users Understand pip ## Problem We want to understand how pip's users understand pip as a tool: what they think it is and what it does. [Skip to recommendations](#recommendations) ## Research In order to capture participants mental models of pip and how package management works, we asked participants the following questions: - In your own words, explain what pip is - In your own words, explain what happens when pip installs a software package - In your own words, explain what a Python package dependency is When we talk about mental models, we talk about "deep" or "shallow" mental models. When a user has a deep mental models of something, their have a deep understanding with a lot of detail, shallow models are the opposite. In order to evaluate those mental models - do they match the reality of pip and package management - we worked with the maintainers to identify 1. pip's behaviours and activities (18 aspects), and 2. the aspects of package dependencies (13), and what a Python package dependency is (10). We then scored participants' answers against those. ## Results The analysis focused on participants with between 2 and 10 years of Python experience. Over 90% of participants did not have a deep understanding of pip - with limited understanding of what pip is, what it does during the install process, and of package management in general. However, while participants' understanding was low, only 4 participants had factually incorrect understandings of what pip is and does. Participants had a slightly deeper understanding of what happens during a pip install process. The most in depth answer included 7 of the 13 identified aspects. The median was 3. Answers focused on resolving dependencies, finding possible package names, downloading assets and installing the package. Participants' understanding of software dependencies was again shallow - the most in depth answer included 8 identified aspects. The median was 3. Answers focused on the fact that software dependencies were a result of code reuse, that constraining package versions reduced the possibility of dependency conflicts. The full data is available in[ this spreadsheet](https://docs.google.com/spreadsheets/d/1HBiNyehaILxhzZKWcBavkKXDzJr6gIt_Y8Jm8RRgJYg/edit#gid=0). ### Responses to "In your own words, explain what pip is" > "pip is a standard command-line tool for managing python packages. It has three primary functions: (1) obtaining & caching python packages and/or their dependencies from a repository (typically pypi), (2) building (if needed) and installing python packages--and related dependencies--to a 'site-packages' location in the python path, and (optionally) (3) uninstalling previously-installed packages." **- participant 242608909 (Scientist, Professor in the Earth and Atmospheric Sciences Department, using Python for 7 - 10 years)** > "Pip is a package management system for python. Kind of like apt in linux, it can be used to install packages in public or private repositories into the current version or environment of Python that invoked the pip command." **- participant 240364032 (Professional software developer using Python for 7-10 years)** > "pip allows to install/update remove python libraries in your environment. pip manage the library. you will need something else to manage your environment. To use it the easiest is pip install `package-name` I recommend using a requirements.txt and add as you go the library and do pip install -r requirements.txt each time. it avoid to forget a library at the end of the project :)" **- participant 241178995 (Data scientist working in software engineering)** > "python's npm/cargo/opam... dedicated package manager and ecosystem for python libraries and applications" **- participant 240306262 (self-taught Python creative artist and web developer, using Python for 5-6 years)** > "A tool to download & install packages and resolve dependencies. I see it in the same area as yum, zypper or apt-get install in the Linux world." **- participant 240306204 (Using Python for scientific research and data analysis for 3 - 4 years)** > "Pip is the tool primarily used in the Python community to install packages. ("Package" means two different things in Python; it can be a target of the `import` statement that includes modules and other packages, or it can mean a collection of code with a defined interface that can be installed for reuse. I'm referring to the second thing here.) Pip's implementation defines what it means for a package to be installed in a Python environment. Any other tool that wishes to install software into a Python environment (e.g. conda) must match Pip's implementation." **- participant 240313922 (Computer security researcher at a university, using Python for 7-10 years)** ### Responses to "In your own words, explain what happens when pip installs a software package" > "I think pip looks up package "tea" in the repository of packages (PyPI by default, but can be changed). If it doesn't find it, it gives an error. If it exists, it downloads some information about the package, like what form it exists in. This can be a wheel, or a package that needs to be built. If it is a wheel, it checks the dependencies and installs them, then it installs the wheel (not sure what this means, probably it extracts it). The wheel is specific to a python distribution and base OS, so it might be available on certain platforms but not others. If it is a package that needs to be built, pip downloads the package source (or clones the repository), and runs setup.py, which installs dependencies and other packages, then the package itself. I forgot to mention that before installing there is some check for checking compatibility of the version required and the versions required by other packages." **- participant 240426799 (Scientific researcher - data analysis and computer vision models, using Python for 5-6 years)** > "pip searches for a package source (and for me uses the default, so Pypi), then ask the package source for a package with the given name and versions (if specified), then if the package is available download the package in the most appropriate format (depending on my platform), then unzip the package and runs the installer (most probably calls setuptools with the included setup.py file) which will perform the required installation steps. This installation process may contain dependencies (typically specified in setup.py), which will trigger the same process for the dependencies, and so on until all dependencies are installed (if everything is OK)." **- participant 240670292 (Software developer industrial systems control, using Python for 5-6 years)** > "Pip checks PyPI (default package index, assuming that wasn't overridden) for the package matching `tea`. It uses the various specifiers (eg. OS compatibility, Python compatibility, etc) to find the latest version of `tea` compatible with my system. Within that version, it finds the best possible installation match (eg. a `wheel`, if supported on my system and my version of `pip` contains the relevant versioned support [eg. most recently manylinux2010], potentially falling back all the way to a source distribution). After downloading the relevant distribution, it performs the same operations recursively up the dependency chain as specified by the `install_requires` of the `setuptools.setup()` method. After grabbing all relevant packages, it performs the installations as specified in their setup methods -- generally, this involves extracting python files to specific system paths, but various levels of complexity may be added as need be such as compilations, system library bindings, etc. I believe the new resolver changes the above by performing all the lookups simultaneously (eg. by building and solving a dependency graph rather than traversing incrementally) but have not yet read the PEP to learn more. I've answered the above with setuptools in mind -- I believe there was a step added recently to check pyproject.toml first to allow for alternate systems here, but I find the added customization to be a net negative to the ecosystem and have not yet played with it -- the entire Poetry/Pipenv/Pipfile.lock/Flit thing just seems to be adding unnecessary complexity; users who know what they're doing have solved all these issues years ago for their packages and users who find the porcelain makes their lives easier are likely going to run into UX trouble no matter the veneer." **- participant 241463652 (Using Python for 5-6 years)** > "pip accesses the tea package from pypi (guessing that's where, online at least) and downloads a copy of the files into my local venv" **- participant 243434435 (Data analysis & machine learning, using Python for 1-2 years)** > "Looking up the latest version of of the package from pypi" **- participant 243897973 (Software testing/writing automated tests using Python 3 - 4 years)** > "Download, unpack, sometimes compile a module for my target arch" **- participant 243428875 (System administration using Python 7 - 10 years)** ## Recommendations It's difficult to know what to recommend. Some ideas: - Question: Is it actually necessary for users to know everything that pip is doing? - Better documentation: - Describing the "blocks of functionality" that pip carries out and how to deal with them when it breaks - Curating package manager training and help - Improving pip output to expose the different pip functionality blocks ================================================ FILE: docs/html/ux-research-design/research-results/override-conflicting-dependencies.md ================================================ # Providing an override to install packages with conflicting dependencies ## Problem Currently, when a user has dependency conflicts in their project they may be unaware there is a problem, because pip will install conflicting packages without raising an error. The new pip resolver is more strict and will no longer allow users to install packages that have conflicting dependencies. As a result, some users may feel that newer versions of pip are "broken" when pip refuses to install conflicting packages. For this reason, the pip team wanted to know if they should provide an override that allows users to install conflicting packages. [Skip to recommendations](#recommendations) ## Research We published a survey with the following introduction:
Imagine you have packages tea and coffee: tea 1.0.0 depends on water <1.12.
coffee 1.0.0 depends on water>=1.12
Installing tea 1.0.0 and coffee 1.0.0 will cause a conflict because they each rely on different versions of water - this is known as a "dependency conflict". The pip team has recently changed the way that pip resolves dependency conflicts. The new implementation is stricter than before: pip will no longer install packages where there is a dependency conflict - instead it will show an error. The purpose of this survey is to gather feedback on providing a way to override this behaviour. All questions are optional - please provide as much information as you can.
We then asked users: - If pip should provide an override that allows users to install packages when there are dependency conflicts - Why they answered yes or no - For users that answered yes, we asked: - When they would use the override - How often they would use the override - How easy it would be to find a workaround, if pip did not provide an override - What syntax they prefer ## Results In total, we received 415 responses to the survey. An overwhelming majority (>70%) of respondents indicated that they want some kind of override that allows them to install packages when there are dependency conflicts. Despite desiring this feature, most respondents said if it exists they would use it "not often" — this indicates that it is an advanced feature that is not critical to day-to-day usage. Nevertheless, because it would be difficult or very difficult to find a workaround (>60%), we suggest that pip should offer a override feature (see recommendations, below). Over half of the respondents said that `pip install tea coffee --ignore-conflicts` was the most ideal syntax for this command when installing multiple packages at once with a conflicting dependency. When using the `pip install --ignore-conflicts` command, a majority (>48%) of respondents said they would prefer pip to install to the most recent version of the conflicted dependency. Most respondents suggested that installing the latest version by default is safer, because it could include security fixes or features that would be difficult to replicate on their own. They also trust that dependencies will be largely backwards-compatible. However, they said it was very important that it is necessary to have a way to override this default behavior, in case they need to use an older version of the conflicted package. ## Recommendations Based on this research we recommend that the pip team: - Implement an `--ignore-conflicts` option, that allows users to install packages with conflicting dependencies - Ensure that `--ignore-conflicts` installs the most recent version of the conflicting package. For example, for conflicting package `water<1.1.2` and `water≥1.1.2`, pip should prefer to install `water≥1.1.2`. - Allow users to override this default behavior by specifying the version of the conflicting packages. For example, `pip install tea coffee water==1.1.1 --ignore-conflicts` - Warn users that they used the `--ignore-conflicts` flag and that this may cause unexpected behavior in their program ================================================ FILE: docs/html/ux-research-design/research-results/personas.md ================================================ # pip Personas ## Problem We want to develop personas for pip's user to facilitate faster user-centered decision making for the pip development team. [Skip to recommendations](#recommendations) ## Research From early interviews with pip users, and from desk research into the different communities that use Python, it was our expectation that there were large communities who were not professional software developers. For example the SciPy library is widely used in the science and engineering communities for mathematical analysis, signal and image processing. Based on this, we expected a lot of these users would have different expectations, challenges and needs from pip. Our hypothesis was that: 1. Python users fall into 3 main user types - a software user, a software maker and a software/package maintainer 2. That the majority (over 60%) would define themselves as Python software users 3. That the minority would define themselves as Python software maintainers ### Usertype definitions During the research we've met different user types in the Python community. The 3 types of Python users, we proposed were: #### The Python Software User "I use Python software mainly as a tool to help me do what I want to do. This might be running scientific experiments, making music or analysing data with Python software I install with pip. I don't write Python software for others." #### The Python Software Maker "I use the Python software language and Python software packages to make software for others, mostly for other people. An example might be - building web applications for my customers. To make this web application I might use the Django framework, and a number of Python packages and libraries." #### The Python Package Maintainer "I spend a lot of my time creating Python software packages and libraries for other people to use in the software they make. I might make Python packages and libraries and then publish them on pypi.org or other software repositories." ## Results During our research we found that these user types did fit with participants' sense of their usage of Python. Participants did not identify significantly different Python user types when asked. Each of these user types is a spectrum. Some Python users after time, and with experience/training, a need to use code more than once, started to make their own Python software. Identifying as one of these user types does not preclude users from also being another user type. Python users were more likely to Python software makers, but rarely Python software maintainers. Most (86%) participants identified as being a Python software user. This ranged a) from using Python applications - SciPy, Scikit-Learn - as a tool, with no knowledge, or interest to do more, to b) more advanced usage of Python involving modifying others code/scripts, possibly using libraries to create code specifically for their needs. 75% identified as a Python software maker - as with Python software user, this ranged from writing basic scripts, code, to being a professional software developer. 40% identified as a Python software maintainer - the activities of a maintainer were seen as only available to someone who had many years of Python experience, was heavily involved in a particular package or application, or did it as part of their job. ### I am a Python software user As expected, almost all participants identified as a Python software user (86%). This was the most fundamental user type - both trained software developers and those who came to Python as a result of their job were users. Non-software developer users identified Python as a language to get stuff done - > "Almost everyone falls into the user (category) - that’s the target. It's not an obscure language that's meant for specific domains - it's a broad general purpose language designed to get stuff done. It's used by many who don't know other languages, they just need a language to get what they're doing finished." **- Participant 240312164** However, "using Python software" meant different things depending on who you ask - participants identified as a Python software user on a spectrum.
I am a Python software user Number of responses
I agree 50
I disagree 4
I have no opinion 11
I strongly agree 70
I strongly disagree 4
Grand Total 140
![Pie chart with responses to question - I am a Python software user](https://i.imgur.com/ir3tP3B.png) #### Low end of the spectrum Python software applications were identified by some as a tool they use to do their "actual" work - the scientist, the data analyst, the engineer, the journalist. Here, they were "using" Python applications like SciPy, PsychPi, NumPy, to run scientific experiments, to gather data, to analyse data, with the objective of creating knowledge to make decisions, to identify what to do next. These were users who 1) who were new to Python software, 2) came across these Python applications in their profession, and used them as tools. They describe NumPy, or SciPy as a Python software application in itself, analogous to being a Windows user, or a Mac user. These users are not "classically trained programmers" as one participant identified themselves. As a result, they may not have the training, or knowledge about programming concepts like software dependencies. When they are expected to deal with complex or confusing error messages or instructions they have problems, often stopping them. #### High-end of the spectrum Python users who "move up the spectrum" to more advanced Python usage had been using Python for longer periods - many years. Again they may not have been classically trained developers, but through exposure - from work colleagues and their own usage - they started to experiment. This experimentation was in the form of modifying others scripts, taking classes, reading books so they could use code for other purposes. This was _making_ software - this software could be used by them as part of their day-job, but it could also be used by many others. We asked participants to explain the progression on this user spectrum - what is the difference between a user and a maker? Participants spoke about "are you working on something reusable or are you using the tools to achieve a one time task?" > "I didn't have classic software development training, more statistical analysis experience. I was clueless to the idea that it was a repository that anyone could upload packages to and become a maintainer." **- Participant \_240396891 (Data scientist at an applied research lab using Python do to network traffic analysis/parsing or Machine Learning)** > "Firstly I use my own software written in Python, I use Python libraries from pip. I use Django, Flask, libraries like requests." **- Participant 240302171** > "I am not a classically trained programmer, so it's a great way for me to learn and keep current in techniques. Not being a classically trained programmer, in some cases it detracts, I have a reasonable knowledge of the way to use hashes, but if I wanted to change Python's hash I'd have to read books. I can find information out there." **- Participant 240312164 (Nuclear physicist using Python for computer simulations, designing experimental methods)** ### I am a Python software maker Being a "Python software maker" was a natural progression for some Python users, particularly those who had software development training - either on the job, personal learning or formal education. This training was important to understand fundamental programming concepts. As discussed earlier, some participants identified as "advanced" Python users, using Python software to modify or create other software. These users were likely to progress onto being software makers. 55% of participants who identified as a software maker had between 5-20+ years of experience with Python. Only 18% of software makers had less than 2 years of experience. ![Pie chart with responses to question - I am a Python software maker](https://i.imgur.com/aqg1kaL.png) We did not ask these participants about the "quality" of the software they created, but apart from the professional software developers, the opinion of these users was they were not software developers.
I am a Python software user Number of responses
I agree 50
I disagree 9
I have no opinion 14
I strongly agree 56
I strongly disagree 10
Grand Total 140
Making software was as defined earlier as "are you working on something reusable or are you using the tools to achieve a one time task?" > "I'm using Python software and libraries to make this product I'm working on, it's foundation is based on Python, with React, D3 and all built on Python. The cloud assets are Python and testing is Python." **- Participant 240315927 (a professional IT developer building a Python based data analysis application)** > "I make software in Python. My day job is making software in python. Mainly Django web design. I work for a retail company, where I write calculating orders, creating data in other inventory management systems. Data analysis." **- Participant 240393825** > "I have written software, sometimes for business and personal reasons. At one point I worked on a django website project, that was being used by 1000s of people. I don't think any of my live projects are based. > "Most of it is for sysadmin, automation. I [like] to use python instead of shell scripting. I manage a server with wordpress sites. I wrote a script to update these sites, mailman list and sql DB management, and for different utilities." **- Participant 240313542** > "I use Python for creating things - like outputs for data scientist, software engineer. I make software to look at patterns, and analyse stuff. I think I'm a maker because someone else is using - they are colleagues. Usually its non-technical colleagues. I produce outputs - make data understandable. They use the results, or a package it behind a flask app. Or analyse graphs." **- Participant 240426799** ### I am a Python software maintainer The Python software/package maintainer user type was seen as requiring a significant amount of time and experience - domain experience as the software could be very specific (e.g. SciKit Learn, SciPy, etc), technical/coding experience, and experience in the community. You need to have spent time in doing the other jobs, before you could become a maintainer. For large projects it was seen as necessary to have core code contributors, and maintainers. Maintainers did not always write code - they could be more involved with technical architecture, technical design, than writing code. An aspect of the software maintainer role that wasn’t mentioned a lot was the community management aspect. ![Pie chart with responses to question - I am a Python software maintainer](https://i.imgur.com/gXPc946.png)
I am a Python package maintainer Number of responses
I agree 39
I disagree 24
I have no opinion 20
I strongly agree 18
I strongly disagree 38
Grand Total 140
> "You can become a maintainer once you get past a certain level of experience." **- Participant 240278297** > "To be a package maintainer, you'd have to spend a lot of time fixing issues, e.g. your package is on Github and you'd be looking at issues, reviewing PRs, writing documentation. A package maintainer is someone heavily involved in the project. They deal with more support calls, they do more thinking about issues to get your package into multiple environments. That's the good thing about the Python community - I was trying to use a Python package but there was an issue with the documentation. I said, there's a better way of doing this example. They answered and said "great, do you want to do it? Doing package maintaining, it doesn't interest me, I don't have time for it really - if I have a specific issue I will focus on it. It'd be nice (to do more)." **- Participant 240278297 (professional Python software developer)** > "I am a core developer of scikit-learn, I spend time writing code. These days strictly speaking - writing code is the least thing I do - mostly I do reviews of other people's code. There is a lot of API design work, it can translate into writing code. I may be the one writing the code or not. I am involved with the CI every now and then. [...] I have been the release manager for the last 2 releases. There are different types of maintainer - writing code maintainers, but you do need core devs writing code. But being a maintainer and building a community -that is about communication and PRs, and mentoring people." **- Participant 240306385 (core maintainer of SciKit-Learn)** ## Recommendations ### Provide documentation recommending "best/recommended ways" The majority of participants were using Python as a tool, as a participant said: "it's a broad general purpose language designed to get stuff done." The majority of participants - scientists, product/electronic engineers, data analysts, nuclear physicists - used Python for their work - they may write Python software, for themselves, possibly for colleagues. A smaller number are maintainers of widely used Python packages. As a result they are not classically trained software developers and so may not have "the right" understanding of important software programming concepts. Users of all types, and experience struggled with knowing the "right" way to do something. They often spoke about the "recommended way" to do something - to start a new project, to make a package: > "As a new comer, it's not easy to figure out what should be in the right way to structure a _setup.py_ or _pyproject.toml_. There is a good guide, but it's not easy to figure out what to use. I wish there was a guide like 'Make an application (or library) in 30 minutes'." ================================================ FILE: docs/html/ux-research-design/research-results/pip-force-reinstall.md ================================================ # pip --force-reinstall ## Problem Currently, when `pip install [package-name] --force-reinstall` is executed, instead of reinstalling the package at the version previously installed, pip installs the package at the newest version available. i.e. `pip install [package name] --force-reinstall` acts as `pip [package name] --upgrade` We want to find out if users understand (or desire) this implicit behaviour. More information can be found on [this GitHub issue](https://github.com/pypa/pip/issues/8238). [Skip to recommendations](#recommendations) ## Research To help us understand what users want from the `--force-reinstall` option, we launched a survey with the following scenario:
You have the requests package and its dependencies installed: requests==2.22.0
asgiref==3.2.10
certifi==2020.6.20
chardet==3.0.4
Django==3.1
idna==2.8
pytz==2020.1
sqlparse==0.3.1
urllib3==1.25.10
You run 'pip install requests --force-reinstall'. What should happen?
Respondents could choose from one of the following options: - pip reinstalls the same version of requests. pip does not reinstall request's dependencies. - pip reinstalls requests and its dependencies, updating all these packages to the latest compatible versions - pip reinstalls requests and its dependencies, keeping every package on the same version - pip reinstalls requests, updating it to the latest version. pip updates request's dependencies where necessary to support the newer version. - I don't know what pip should do - I don't understand the question - Other (allows respondent to provide their own answer) We also asked how useful `pip --force-reinstall` is, and how often it is used. ## Results In total we received 190 responses to our survey, with 186 people telling us what pip should do when the `--force-reinstall` option is executed. ![pie chart with survey results](https://i.imgur.com/yoN02o9.png) - **31.7%** (59/186) of respondents said that pip should reinstall requests and its dependencies, keeping every package on the same version - **28%** (52/186) of respondents said that pip should reinstall requests, updating it to the latest version, with pip updating request's dependencies where necessary to support the newer version. - **15.6%** (29/186) of respondents said that pip should reinstall requests and its dependencies, updating all these packages to the latest compatible versions - **14%** (26/186) of respondents said that pip should reinstall the same version of requests, and not reinstall request's dependencies If we group responses into "upgrade" or "do not upgrade" (ignoring responses that could not be grouped), we find: - 46.32% (88/186) of respondents thought that pip should install the same version of requests - i.e. that `--force-reinstall` should _not_ implicitly upgrade - 43.16% (82/186) of respondents thought that pip should upgrade requests to the latest version - i.e that `--force-reinstall` _should_ implicitly upgrade Most respondents use `--force-reinstall` "almost never" (65.6%): ![screenshot of survey question of how often users use --force-reinstall](https://i.imgur.com/fjLQUPV.png) ![bar chart of how often users use --force-reinstall](https://i.imgur.com/Xe1XDkI.png) Amongst respondents who said they use `--force-reinstall` often or very often: - 54.54% (6/11) of respondents thought that pip should install the same version of requests - i.e. that `--force-reinstall` should _not_ implicitly upgrade - 45.45% (5/11) of respondents thought that pip should upgrade requests to the latest version - i.e that `--force-reinstall` _should_ implicitly upgrade Respondents find `--force-reinstall` less useful than useful: ![screenshot of survey question of how useful users find --force-reinstall](https://i.imgur.com/6cv4lFn.png) ![bar chart of how useful users find --force-reinstall](https://i.imgur.com/gMUBDBo.png) Amongst respondents who said they find `--force-reinstall` useful or very useful: - 38.46% (20/52) of respondents thought that pip should install the same version of requests - i.e. that `--force-reinstall` should _not_ implicitly upgrade - 50% (26/52) of respondents thought that pip should upgrade requests to the latest version - i.e that `--force-reinstall` _should_ implicitly upgrade ## Recommendations Given that this option is not regularly used and not strongly rated as useful, we recommend that the development team consider removing `--force-reinstall` _should they wish to reduce maintenance overhead_. In this case, we recommend showing the following message when a user tries to use `--force-reinstall`: > Error: the pip install --force-reinstall option no longer exists. Use pip uninstall then pip install to replace up-to-date packages, or pip install --upgrade to update your packages to the latest available versions. Should the pip development team wish to keep `--force-reinstall`, we recommend maintaining the current (implicit upgrade) behaviour, as pip's users have not expressed a clear preference for a different behaviour. In this case, we recommend upgrading the [help text](https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-force-reinstall) to be more explicit: Old help text: > Reinstall all packages even if they are already up-to-date. New help text: > Reinstall package(s), and their dependencies, even if they are already up-to-date. Where package(s) are not up-to-date, upgrade these to the latest version (unless version specifiers are used). ================================================ FILE: docs/html/ux-research-design/research-results/pip-search.md ================================================ # pip search ## Problem By default, `pip search` searches packages on PyPI.org from the command line. However, the team are [considering removing it](https://github.com/pypa/pip/issues/5216), because they think it's not that useful and using too many resources on PyPI ([PyPI XMLRPC search has been disabled](https://status.python.org/incidents/grk0k7sz6zkp) because of abuse/overuse). [Skip to recommendations](#recommendations) ## Research Prior to PyPI XMLRPC search being disabled, we: - Gathered feedback on pip search via the "buy a feature" survey - Published a survey specifically about pip search, asking users about: - Their current use of pip search - How useful they find pip search results - How clear they find pip search results - Where users expect pip to search (e.g. PyPI vs private index) - What data pip should search _other_ than project name - What changes or additions they would make to pip search ## Results In total, we received 1070 responses to the buy a feature survey, with 541 (50.4%) respondents selecting "Search pypi.org for packages" in their top 10 features. However, search ranked lower than the following features: 1. Run pip without requiring any user input (e.g. in CI) _718_ 2. Show information about all installed packages _707_ 3. Show information about a single installed package _596_ We received 302 responses to the pip search survey, with 62 of the 302 (20.5%) respondents either not knowing that the command existed, never using it, or using it "rarely". We found that the remaining ~80% of respondents who do use pip search use it to: - Find/search for the right/new/alternate packages to install: - Checking package name (verify correct spelling) - Assessing functionality (check a package's description) - Verifying availability (check if such package exists) - Search for the latest version of a package (verify version) - Find package libraries and new modules In general, pip search is regarded as: - more useful than not useful - more clear than not clear When asked if pip should search on items _other_ than the package name, respondents most commonly asked to search the package description: ![wordcloud of common search terms](https://i.imgur.com/lxS2TG6.png) Some users also mentioned that they would like the search to be configurable, e.g. by passing flags/options. When asked how they would improve pip search, users said they would improve: **1. Search methods:** - fuzzy search and insensitive case should be acceptable - users should have the option to filter/sort by description, name, tag **2. Search results:** - relevancy: the results should show both the exact match and closest match - order/category: the result should display items in a certain order, e.g highest number of downloads (popularity), development status (last updated/latest version), etc. - there should be a limited number of search results **3. User interface:** - link package to pypi page - use color coding / system for better clarity - distinguish exact match search results from others: by highlighting, or using a different color - indicate version compatibility ## Recommendations ### Deprecation strategy Given that the [PyPI](https://pypi.org/pypi) search API is currently disabled (as of 1st Jan, 2021) for technical and sustainability reasons, we recommend that the pip team display a clear error message to users who use the command: ``` The PyPI search API has been disabled due to unmanageable load. To search PyPI, open your browser to search for packages at https://pypi.org Alternatively, you can search a different index using the --index command. ``` In the longer term, **we recommend that the PyPI team investigate alternative methods of serving search results (e.g. via caching)** that would enable pip search to work again. This recommendation is supported by our research which suggests that many pip users find this functionality useful. If this is not possible, the pip team should create clear instructions that tells users what to use instead. Some suggestions (based on common user flows) are listed below: #### Finding a new package based on tags and keywords This is the most common feature that you would expect from `pip search` and likely the hardest to replace after deprecation. As mentioned above, the pip CLI should - as soon as possible - hide the full-trace error message present when a user types `pip search`. Instead, pip should show a message that encourages users to use the search index on the website itself (in their browser) by providing a link directly to [https://pypi.org](https://pypi.org). Also, pip should provide a short hint on how to use an alternative index. ``` $ pip search pytest The PyPI search API has been disabled due to unmanageable load. Please open your browser to search for packages at https://pypi.org Alternatively, you can use a different index using the --index command. pip search pytest --index ``` In addition, the pip team could implement an alternative to the PyPI search API that works without a hard dependency on a centralized service. Similar to other distribution systems like `apt` and `yum`, the metadata of all package names could be downloaded on the user's machine with an opt-in workflow: ``` $ pip search pytest Using pip search on the command line requires you to download the index first. Alternatively, you can open your browser to search for packages at https://pypi.org Download the index to /System/Library/Frameworks/Python.framework/ Versions/2.7/Resources/Python.app/Contents/MacOS/search.db? (y/n) y ......... done! $ pip search pytest ``` This is a more complex route that will require more engineering time, but can aim to provide command line users with a similar functionality to the old `pip search` command. It can also check the age of the local index and show a warning if it is getting old. #### Verifying the latest version of a package Users also use the `pip search` command to find or verify a particular package's version. As a replacement, the pip team could do either of the following: 1. Extend the `pip show` feature to include known latest versions of the package; 2. Create a `pip outdated` command which scans the current dependency tree and outputs the packages that are outdated (compared to the latest versions on the configured index). ### UX improvements Should it be possible to continue to support pip search, we strongly recommend the following UX improvements: - Adding support for [fuzzy search](https://en.wikipedia.org/wiki/Approximate_string_matching), or suggesting alternative/related search terms - Adding support for case insensitive search - Searching based on a package's description - Linking search results to a package's PyPI page (where appropriate) Other user feedback (as detailed above) should also be considered by the team on a case-by-case basis. ================================================ FILE: docs/html/ux-research-design/research-results/pip-upgrade-conflict.md ================================================ # pip Upgrade Conflict ## Problem Currently, pip does _not_ take into account packages that are already installed when a user asks pip to upgrade a package. This can cause dependency conflicts for pip's users. [Skip to recommendations](#recommendations) ## Research We published a [survey](https://bit.ly/2ZqJijr) asking users how they would solve the following scenario:
Imagine you have package tea and coffee with the following dependencies: tea 1.0.0 - depends on water<1.12
tea 2.0.0 - depends on water>=1.12
coffee 1.0.0 - depends on water<1.12
coffee 2.0.0 - depends on water>=1.12
You have the following packages installed: tea 1.0.0
coffee 1.0.0
water 1.11.0
You ask pip to upgrade tea. What should pip do? If pip upgrades tea to 2.0.0, water needs to be upgraded as well, creating a conflict with coffee...
We gave users four choices: 1. Upgrade tea and water. Show a warning explaining that coffee now has unsatisfied requirements. 2. Upgrade coffee automatically to 2.0.0 3. Install nothing. Tell the user that everything is up-to-date (since the version of tea they have installed is the latest version without conflicts). 4. Install nothing. Show an error explaining that the upgrade would cause incompatibilities. We allowed users to post their own solution, and asked why they came to their decision. ## Results In total, we received 693 responses, 407 of which included an explanation of why a particular solution was best. ![](https://i.imgur.com/UdBWkaQ.png) - 497 responses (71.7%) preferred option 4: that pip should install nothing and raise an error message - 102 responses (14.7%) preferred option 2: that pip should upgrade package_coffee - 79 responses (11.4%) preferred option 1: that pip should upgrade tea and water - 15 responses (2.2%) preferred option 3: that pip should install nothing and tell the user that everything is up to date From the 407 responses that answered "why" a particular solution was best, the following key themes emerged: - "explicit is better than implicit" - pip should not create "side effects" that the user does not understand, has not anticipated, and has not consented to - pip should do everything in its power to avoid introducing conflicts (pip should not "break" the development environment) - Telling the user that everything is up to date (option 3) is misleading / dishonest - pip could be more flexible by: - allowing the user to choose how they want to resolve the situation - allowing the user to override the default behaviour (using flags) ## Recommendations Based on the results of this research, the pip UX team has made the following recommendations to the development team: - While the current behaviour exists, [warn the user when conflicts are introduced](https://github.com/pypa/pip/issues/7744#issuecomment-717573440) - [Change the current behaviour](https://github.com/pypa/pip/issues/9094), so that pip takes into account packages that are already installed when upgrading other packages. Show the user a warning when pip anticipates a dependency conflict (as per option 4) - Explore [the possibility of adding additional flags to the upgrade command](https://github.com/pypa/pip/issues/9095), to give users more control ================================================ FILE: docs/html/ux-research-design/research-results/prioritizing-features.md ================================================ # Prioritizing pip Features ## Problem The pip development team is small, and has limited time and energy to work on issues reported via the [issue tracker](https://github.com/pypa/pip/issues). There is also a significant backlog of issues (782 as of November, 2020) for the team to respond to. For the team to prioritize their work based on what will have the most impact, we need to develop a better understanding of what users want from pip. [Skip to recommendations](#recommendations) ## Research To help answer this question, we developed a "buy a feature" survey, with the following scenario:
Help us to understand what's important to you by participating in our "buy a feature" game: You have an allocated budget of $200 to spend on redesigning pip. With your $200 budget, "buy" the functionality you'd most like to keep. You don't have to spend the whole $200, but you should also not overspend your budget!
We asked users to spend their first $100 on features related to `pip install`, and to spend their remaining $100 on other pip features. We also gave users an additional $10 to suggest a new feature: ![survey question where users are asked to buy features for pip install](https://i.imgur.com/2QShgYo.png) ![survey question where users are asked to buy features other than pip install](https://i.imgur.com/sY8gdXD.png) ![survey question where users are asked to spend an additional ten dollars](https://i.imgur.com/hvgjdEG.png) ## Results We received 1076 responses, 1070 of which were valid. The most popular features included the core competencies of pip: - Recreating an environment from a list of installed dependencies; - Install, uninstall, and upgrade packages from a virtual control system, file, or local directory; - Warn about broken or conflicting dependencies. ### pip install The top ten features related to pip install were: ![pip install results](https://i.imgur.com/1rNIOB7.png) 1. Install and uninstall packages 2. Upgrade packages to the latest version 3. Warn about broken dependencies 4. Install a package from a version control system (e.g. Git, Mercurial, etc.) 5. Install packages as specified in a file 6. Install a package from a local directory 7. Verify downloaded packages against hashes 8. Install packages from an alternative package index, or indexes (default is PyPI only) 9. Install a package from wheels (no need for compiling code) 10. Control where you want your installed package to live on your computer ### Other pip functionality The top ten features related to other pip functionality were: ![other pip functionality results](https://i.imgur.com/xrp9XWw.png) 1. Generate a list of installed packages that can be used to recreate the environment 2. Check that your installed packages do not have dependency conflicts 3. Run pip without requiring any user input (e.g. in CI) 4. Show information about all installed packages 5. Show information about a single installed package 6. Search pypi.org for packages 7. Show information about pip (version information, help information, etc.) 8. Download packages, build wheels and keep them in a directory for offline use 9. Manage pip's default configuration (e.g. by using configuration files) 10. Customise pip's output (e.g. reduce or increase verbosity, suppress colors, send output to a log) Results varied by the amount of Python experience the user had.
See how likely users are to select a feature based on their experience level #### Verify downloaded packages against hashes ![screenshot of verify downloaded packages against hashes](https://i.imgur.com/oVHOGBQ.png) #### Warn about broken dependencies ![Screenshot of Warn about broken dependencies](https://i.imgur.com/uNv2tnG.png) #### Upgrade packages to the latest version ![Screenshot of Upgrade packages to the latest version](https://i.imgur.com/pQgCLBO.png) #### Install packages from an alternative package index, or indexes ![Screenshot of Install packages from an alternative package index, or indexes](https://i.imgur.com/E1LnTBt.png) #### Install packages as specified in a file ![Screenshot of Install packages as specified in a file](https://i.imgur.com/87uh4xp.png) #### Install and uninstall packages ![Screenshot of Install and uninstall packages](https://i.imgur.com/GRsazBy.png) #### Install packages from a version control system ![Screenshot of Install packages from a version control system](https://i.imgur.com/iW7d0Sq.png) #### Install a package from wheels ![Screenshot of Install a package from wheels](https://i.imgur.com/9DMBfNL.png) #### Install a package from a local directory ![Screenshot of Install a package from a local directory](https://i.imgur.com/Jp95rak.png) #### Control where you want your installed package to live on your computer ![Screenshot of Control where you want your installed package to live on your computer](https://i.imgur.com/32fpww2.png)
## Recommendations ### Environment recreation Environment recreation is already included in pip as part of the `requirements.txt` feature; however, with it's popularity and demand, we recommend that **pip should improve it's support of this feature.** - Improve environment recreation user output and help guides directly in the pip CLI; - Improve pip documentation & user guide to prominently feature environment recreation as a core feature of pip; - Improve environment recreation process itself by considering virtual environments as a core competency "built-in" to pip. **Recreating an environment from a list of installed dependencies was the most valued feature request overall** as well as in each user group, _except for those with less than 6 months of experience and those with 16-19 years of experience (for which it was the second most valued)._ When asked to enter a feature request with freetext, users placed the words 'built-in,' 'virtual,' 'automatic,' and 'isolation' alongside the word 'environment,' which suggest that users expect pip to recreate environments with a high level of intelligence and usability. **Selected direct quotes** > Make pip warn you when you are not in virtualenv > Automatic virtual env creation with a command line argument > Eliminate virtual environments. Just use ./python_modules/ like everyone else > I would love to see pip manage the python version and virtual env similar to the minicona > Would spend all my $200 on this: Integrate pipenv or venv into pip so installing an application doesn't install it's dependencies in the system package store. And allow pinning dependency versions for application packages (like how pip-compile does it) ### Dependency management We recommend that the pip team improve warning and error messages related to dependencies (e.g., conflicts) with practical hints for resolution. This can be rolled out in multiple timescales, including: - Give hints to the user on how to resolve this issue directly alongside the error message; - Prominently include virtual environment creation in the documentation, upon `pip install` conflict errors, and if possible as a built-in feature of pip; - Upgrading the dependency resolver (in progress). It is clear that dependency management, including warning about conflicting packages and upgrades, is important for pip users. By helping users better manage their dependencies through virtual environments, pip can reduce the overall warnings and conflict messages that users encounter. ================================================ FILE: docs/html/ux-research-design/research-results/users-and-security.md ================================================ # How pip users think about security ## Problem We wanted to understand how pip users think about security when installing packages with pip. [Skip to recommendations](#recommendations) ## Research We asked participants about their behaviours and practices in terms of the security and integrity of the Python packages they install with pip, and of the software they create. We asked participants to tell us how often they: 1. Carry out a code audit of the Python software they install with pip 2. Think about the security and integrity of the (Python) software they install (with pip) 3. Think about the security and integrity of the (Python) code they create ## Results While the security and integrity of the software users install (51%) and make (71%) is important to research participants, less than 7% do code audits of the packages or code they install with pip. This is due to lack of time to audit large packages, lack of expertise, reliance on widely adopted Python packages, the expectation that pip automatically checks hashes, and reliance of the wider Python community to act as canary in the coalmine. This behaviour was common across all user types, and baselines of software development experience. These results - particularly the lack of expertise in auditing packages fits in with the overall findings that the majority of pip users are not "classically trained" (i.e. having formally learned software development) software developers and so lack the expertise and/or formal training in software development practices. There is a gulf between what the maintainers expect users to think, and worry about, and what the users actually worry and think about. Right now, pip leaves users to "fend for themselves" in terms of providing them with assurance of the software they install. This isn't meant as a criticism, but an observation. ### Responses to question: before I install any Python software with pip, I carry out a code audit The vast majority of participants, 82%, do not (rarely or never) do a code audit of the software packages they install using pip, the reasons are explained below. | Before I install any Python software with pip, I carry out a code audit: | Number of responses | | ------------------------------------------------------------------------ | ------------------- | | Always | 3 | | Frequently | 9 | | Rarely | 66 | | Never | 68 | | I'm not sure what this means | 5 | | No opinion | 13 | | **Total number of participants** | **164** | ### Responses to question: I think about the security and integrity of the software I install ![screenshot of responses to question about security](https://i.imgur.com/wy4lGwJ.png) The vast majority of participants did think about the security and integrity of the software they installed - and unlike responses about code audits, in some cases participants made attempts to verify the security and integrity of the software they installed. Most attempts were made by those who had experience in software development, however in some cases, people gave up. Those who were not classically trained software developers did not know where to start. Both of these groups identified their "sphere of influence" and did their best to cover this. ### User thoughts about security Selected quotes from research participants #### Responsibility as author Participants who spent a lot of their time writing Python code - either for community or as part of their job - expressed a responsibility to their users for the code they wrote - people who wrote code which was made public expressed a stronger responsibility. They thought about where the software would be used, who would use it, and possible attack surfaces. > "On the basic point, I have to think about attack surfaces. If I am writing the thing (software), I have to give a crap. I have to answer the emails! In the code I push to[ pypi.org](http://pypi.org/) I think about it doubley. What could people do with this code? Whether I do a good job, that's different! I am aware of it when publishing it or making it [publicly] available. Whether I do a good job, that's different! I am aware of it when publishing it or making it [publicly] available. I rely on community resources - Python security related, I follow security people blogs, Twitter. I use Hypothesis for fuzz-testing. I also rely on having security policies in place and a reporting mechanism. I steer clear of crypto, I rely on other peoples. There's a certain amount of knowledge in the Python community, I am actively involved in it. If something happens, I will hear about it. I use Twitter, if something happens, in the morning it can take me awhile to figure out what's happened. I have a lot of trust in the ecosystem to be self healing. As long as you don't stray too far-off the reservation (into using odd or uncommon or new packages), it's a better sense of security." **- Participant (data scientist turned Python developer)** > Yes, because I'm liable for that. If the problem is my code, and I deliver something and they get attacked. I'm screwed. **- Participant (professional Python developer and trainer)** #### Reliance on software packages Participants also explained they rely on code security scanning and checking software packages. > "I use linters (Bandit), I scan the code I have created and when there is an issue I raise a red flag." > "I use Hypothesis for fuzz-testing." #### Reliance on good software development practices A small number of participants explained they have good software practices in place, which help with writing secure software. > "We have a book about ethics of code - we have mandatory certification." > "I also rely on having security policies in place and a reporting mechanism. I steer clear of crypto, I rely on other peoples." Of the users who have used pip's hash checking functionality: - One finds the error messages "too annoying and loud", and has difficulty matching the file name to the hash - Another finds the process of explicitly pinning hashes to be too tiresome (especially for dependencies) One user mentioned that he likes [NPM audit](https://docs.npmjs.com/cli/v6/commands/npm-audit) and would like to see something similar in the Python ecosystem. #### Lack of time The lack of time to carry out the audit of the package code, and that of the dependencies, was cited as a very common reason. In most cases participants used Python code as a means to achieving their goal. #### Lack of expertise to carry out the audit The lack of expertise or knowledge of auditing software was mainly due to participants expertise not being software development. However, in the case participants were "classically" software developers, lack of expertise was also a commonly given reason for not carrying out audits. #### Use of only widely used, well-established packages Use of well-established, high-quality packages was a common reason amongst all types of participants - professional Python software developers and those who used Python as a tool. "Well-established, high-quality packages" were defined by users as packages that: - have been in existence for many years - are popular, or commonly used by those in their community or industry - have responsive maintainers - maintained by people the participant has heard of - have many hundreds or thousands of users - are in active development (many open issues, many forks, Github stars) - are developed in the open, and transparently - their history is known, or can be found out publicly #### Reliance on the Python community to find issues There was a reliance on the community to find issues and make them know publicly - "Many eyes shallow bugs". > "I rarely do code audits. Most of the time I rely on the opinions of the community. I look at how many maintainers there are. Maybe it's not good practice but I don't have time to go through the code." **- Participant 240315091** #### Use of only internal packages > "I only install internal packages, so I don't need to worry about this." This theme was not that common, mainly in large software development environments or where security was of high importance. #### Expectation that pip audits packages Some users expect/assume that pip (and PyPI) should "protect" them from malicious actors - e.g. by automatically checking hashes, or detecting malicious packages. > "If I was downloading a package on my own I check the hash, if it's installed by pip, then no. I expect pip to do it. If it doesn't do it, it does surprise me. Every package manager checks the hash against what it downloads. The hashes are already known on pypi." **- Participant 240312164 (Nuclear physicist)** #### Other notable comments > "Never. I should but I never do [audit code]. I don't stray, I am risk adverse. I install packages that are good already. I consider my risk surface small. I don't have time or resources to audit them. I have sufficient faith in the ecosystem to be self-auditing. If something turned up in a well known package, the community is well known for making a stink. And anyway a code audit wouldn't pick it up." **- Participant 240326752 (professional Python developer)** > "On the private level (work) the code is developed internally. I don't audit the code on pypi - due to lack of time auditing the dependencies, and I trust it. I know they had a security breach a few years ago, but it doesn't happen that often. I know they don't audit anything but I still don't audit the code." > "I wouldn't know how to [audit code], also I'm writing this stuff for myself. It'll work or not. Sometimes I end up installing 2 or 3 packages and find out that I need to install something else. I move on if it doesn't work. The last resort is I will write the code myself." > "I'm quite trusting - Python is open source, I'm assuming that if a package is on[ pypi.org](http://pypi.org/) - it must be alright. I install the package first, then I look at it. I find a package by figuring out - we need to do a certain task, we search for it on the Internet, look at the documentation, we install it and then see if it is what we want" **- Participant 240278297** > "If I want to install a package, it's for a reason. I want to calculate the azimuth and elevation of the moon with PyEphem. Do a code audit? Pffff. Most of the stuff I do is banal. It needs to meet a dependency, so I install it. I'm not going to do a code audit. I don't care. Never, but this is one of the things - is the package on pypi the exact source I see on Github? You could end up with files that are distributed differently. Probably (I don't do it) because I am too scared to look. There is this thing that pip verifies (the packages) hash - so that is a feature to guard against this. What is the hash of? No idea. It's located in the local python install." **- Participant 240426799 (systems administrator)** > "No [I don't audit code]. [laughs] Coz, I'm not going to read thousands of lines of code before I install a package. Oh my God. [..] I wouldn't be able to find it. I'm trading off - honestly how popular the package is, number of stars on GH. pypi doesn't have any UI way to tell me how many downloads it has. If it did I would use that." **- Participant 240386315 (IT administrator)** > "Well, I don't have the background to do a code audit of something like Numerical Python. Most packages I use are huge. Most people aren't doing code of those packages, except the maintainer. I am relying on whatever is built into pip to do package security. I also assume if there is an exploit someone will find it and let the world now. I'm really lazy." **- Participant 240312164 (Nuclear physicist)** > "I would like some security advisor, [like in npm](https://docs.npmjs.com/auditing-package-dependencies-for-security-vulnerabilities) - it works very well, when you install a package "there are security vulns. with this package - 1 low, 5 medium, 8 high. I haven't come across security issues with Python packages." **- CZI convening research participant** ## Recommendations ### Provide package security guidance or auditing mechanism A small number of participants (3-4) over the research period mentioned the[ NPM audit command](https://docs.npmjs.com/auditing-package-dependencies-for-security-vulnerabilities) as an example of a good way to assess package security. It may provide a model for how to approach this user need. ### Automatically check package hashes pip should **by default** check packages hashes during install, providing a way for users to turn this behaviour off. In the case of no hash being available, pip should warn users and provide recommendations for users - from simplest to most advanced. ### Mechanism to report suspicious packages Users should have a mechanism to report suspicious, or malicious, packages/behaviour. Where this mechanism should exist is open to discussion. The minimum should be a mechanism for users to flag packages on pypi.org. ### Improve the output of pips activities easier to understand Right now pip's output is overwhelming and while it contains a lot of information, little of it is perceivable to the user - meaning is lost in "the wall of text". Pip's output must be redesigned to provide users with the right information - including security warnings - at the right time. ================================================ FILE: docs/html/ux-research-design/resolution-impossible-example.md ================================================ --- orphan: --- # Example error: ResolutionImpossible ## What if there are user-provided pinned packages? Where a user wants to install packages (with 1 or more pinned version) with default verbose level ``` $ pip install peach=1.0 apple=2.0 Due to conflicting dependencies pip cannot install Peach1.0 and Apple2.0: * Peach 1.0 depends on Banana 3.0 * Apple2.0 depends on Banana2.0 There are a number of possible solutions. You can try: 1. removing package versions from your requirements, and letting pip try to resolve the problem for you 2. Trying a version of Peach that depends on Banana2.0. Try `pip-search peach —dep banana2.0` 3. replacing Apple or Peach with a different package altogether 4. patching Apple2.0 to use Banana3.0 5. force installing (Be aware!) For instructions on how to do these steps visit: https://pypa.io/SomeLink To debug this further you can run `pip-tree` to see all of your dependencies. ``` **with verbose level -vv** If a user ran the same pip command with more verbosity, what would they see? **with verbose level -vvv** If a user ran the same pip command with more verbosity, what would they see? ## What if there are no user-provided version restrictions? NB: We are assuming this resolver behaviour gets implemented, based on [GH issues 8249](https://github.com/pypa/pip/issues/8249). **with default verbose level** ``` $ pip install apple peach Due to conflicting dependencies pip cannot install apple or peach. Both depend on banana, but pip can't find a version of either where they depend on the same banana version. There are a number of possible solutions. You can try: 1. replacing apple or peach with a different package altogether 2. patching apple or peach to use the same version of banana 3. force installing (Be aware!) To debug this further you can run pip-tree to see all of your dependencies. ``` **with verbose level -vv** If a user ran the same pip command with more verbosity, what would they see? **with verbose level -vvv** If a user ran the same pip command with more verbosity, what would they see? **What should be in the "documentation" page?** * ways to swap a package for another * how to patch a package to support a version (various ways) ## Recommendations * Write official documentation / guide "How to resolve dependency conflicts" explaining: * Why conflicts can exist * How you can avoid them (pinning) * How you can resolve them * Use alternative package * Use older version * Patch package * Introduce new commands to pip, inspired by poetry: * Tree: Show full tree of dependencies * Show `` Show details of a package, including it's dependencies * latest - shows latest vs installed versions * outdated - shows only outdated versions * Expose commands / help link in output?? * when particular issue happens provide ways to move on (ala pipenv), e.g. * run this command to see X * is it your internet connection? * is it the pypi website? * Aspirational commands * `pip search PackageName —dep PackageNameVersion` * a command that will search for a version of a package that has a dependency on another packageversion ================================================ FILE: docs/man/commands/cache.rst ================================================ :orphan: ========= pip-cache ========= Description *********** .. pip-command-description:: cache Usage ***** .. pip-command-usage:: cache Options ******* .. pip-command-options:: cache ================================================ FILE: docs/man/commands/check.rst ================================================ :orphan: ========= pip-check ========= Description *********** .. pip-command-description:: check Usage ***** .. pip-command-usage:: check Options ******* .. pip-command-options:: check ================================================ FILE: docs/man/commands/config.rst ================================================ :orphan: ========== pip-config ========== Description *********** .. pip-command-description:: config Usage ***** .. pip-command-usage:: config Options ******* .. pip-command-options:: config ================================================ FILE: docs/man/commands/debug.rst ================================================ :orphan: ========== pip-debug ========== Description *********** .. pip-command-description:: debug Usage ***** .. pip-command-usage:: debug .. warning:: This command is only meant for debugging. Its options and outputs are provisional and may change without notice. Options ******* .. pip-command-options:: debug ================================================ FILE: docs/man/commands/download.rst ================================================ :orphan: ============ pip-download ============ Description *********** .. pip-command-description:: download Usage ***** .. pip-command-usage:: download Options ******* .. pip-command-options:: download ================================================ FILE: docs/man/commands/freeze.rst ================================================ :orphan: ========== pip-freeze ========== Description *********** .. pip-command-description:: freeze Usage ***** .. pip-command-usage:: freeze Options ******* .. pip-command-options:: freeze ================================================ FILE: docs/man/commands/hash.rst ================================================ :orphan: ======== pip-hash ======== Description *********** .. pip-command-description:: hash Usage ***** .. pip-command-usage:: hash Options ******* .. pip-command-options:: hash ================================================ FILE: docs/man/commands/help.rst ================================================ :orphan: ======== pip-help ======== Description *********** .. pip-command-description:: help Usage ***** .. pip-command-usage:: help Options ******* .. pip-command-options:: help ================================================ FILE: docs/man/commands/index.rst ================================================ :orphan: =========== pip-index =========== Description *********** .. pip-command-description:: index Usage ***** .. pip-command-usage:: index Options ******* .. pip-command-options:: index ================================================ FILE: docs/man/commands/install.rst ================================================ :orphan: =========== pip-install =========== Description *********** .. pip-command-description:: install Usage ***** .. pip-command-usage:: install Options ******* .. pip-command-options:: install ================================================ FILE: docs/man/commands/list.rst ================================================ :orphan: ======== pip-list ======== Description *********** .. pip-command-description:: list Usage ***** .. pip-command-usage:: list Options ******* .. pip-command-options:: list ================================================ FILE: docs/man/commands/lock.rst ================================================ :orphan: ======== pip-lock ======== Description *********** .. pip-command-description:: lock Usage ***** .. pip-command-usage:: lock Options ******* .. pip-command-options:: lock ================================================ FILE: docs/man/commands/search.rst ================================================ :orphan: ========== pip-search ========== Description *********** .. pip-command-description:: search Usage ***** .. pip-command-usage:: search Options ******* .. pip-command-options:: search ================================================ FILE: docs/man/commands/show.rst ================================================ :orphan: ======== pip-show ======== Description *********** .. pip-command-description:: show Usage ***** .. pip-command-usage:: show Options ******* .. pip-command-options:: show ================================================ FILE: docs/man/commands/uninstall.rst ================================================ :orphan: ============= pip-uninstall ============= Description *********** .. pip-command-description:: uninstall Usage ***** .. pip-command-usage:: uninstall Options ******* .. pip-command-options:: uninstall ================================================ FILE: docs/man/commands/wheel.rst ================================================ :orphan: ========= pip-wheel ========= Description *********** .. pip-command-description:: wheel Usage ***** .. pip-command-usage:: wheel Options ******* .. pip-command-options:: wheel ================================================ FILE: docs/man/index.rst ================================================ :orphan: ======== Man Page ======== SYNOPSIS ******** pip [options] DESCRIPTION *********** pip is the PyPA recommended package manager for Python packages OPTIONS ******* .. pip-general-options:: COMMANDS ******** pip-install(1) Install packages. pip-download(1) Download packages. pip-uninstall(1) Uninstall packages. pip-freeze(1) Output installed packages in requirements format. pip-lock(1) Generate a lock file for requirements and their dependencies. pip-list(1) List installed packages. pip-show(1) Show information about installed packages. pip-check(1) Verify installed packages have compatible dependencies. pip-search(1) Search PyPI for packages. pip-wheel(1) Build wheels from your requirements. pip-hash(1) Compute hashes of package archives. pip-help(1) Show help for pip commands. ================================================ FILE: docs/pip_sphinxext.py ================================================ """pip sphinx extensions""" from __future__ import annotations import optparse import pathlib import re import sys from collections.abc import Iterable, Iterator from textwrap import dedent from docutils import nodes, statemachine from docutils.parsers import rst from docutils.statemachine import StringList, ViewList from sphinx.application import Sphinx from pip._internal.cli import cmdoptions from pip._internal.commands import commands_dict, create_command from pip._internal.configuration import _normalize_name from pip._internal.req.req_file import SUPPORTED_OPTIONS def convert_cli_option_to_envvar(opt_name: str) -> str: undashed_opt_name = _normalize_name(opt_name) normalized_opt_name = undashed_opt_name.upper().replace("-", "_") return f"PIP_{normalized_opt_name}" def convert_cli_opt_names_to_envvars(original_cli_opt_names: list[str]) -> list[str]: return [ convert_cli_option_to_envvar(opt_name) for opt_name in original_cli_opt_names ] class PipNewsInclude(rst.Directive): required_arguments = 1 def _is_version_section_title_underline(self, prev: str | None, curr: str) -> bool: """Find a ==== line that marks the version section title.""" if prev is None: return False if re.match(r"^=+$", curr) is None: return False if len(curr) < len(prev): return False return True def _iter_lines_with_refs(self, lines: Iterable[str]) -> Iterator[str]: """Transform the input lines to add a ref before each section title. This is done by looking one line ahead and locate a title's underline, and add a ref before the title text. Dots in the version is converted into dash, and a ``v`` is prefixed. This makes Sphinx use them as HTML ``id`` verbatim without generating auto numbering (which would make the the anchors unstable). """ prev = None for line in lines: # Transform the previous line to include an explicit ref. if self._is_version_section_title_underline(prev, line): assert prev is not None vref = prev.split(None, 1)[0].replace(".", "-") yield f".. _`v{vref}`:" yield "" # Empty line between ref and the title. if prev is not None: yield prev prev = line if prev is not None: yield prev def run(self) -> list[nodes.Node]: source = self.state_machine.input_lines.source( self.lineno - self.state_machine.input_offset - 1, ) path = ( pathlib.Path(source).resolve().parent.joinpath(self.arguments[0]).resolve() ) include_lines = statemachine.string2lines( path.read_text(encoding="utf-8"), self.state.document.settings.tab_width, convert_whitespace=True, ) include_lines = list(self._iter_lines_with_refs(include_lines)) self.state_machine.insert_input(include_lines, str(path)) return [] class PipCommandUsage(rst.Directive): required_arguments = 1 optional_arguments = 3 def run(self) -> list[nodes.Node]: cmd = create_command(self.arguments[0]) cmd_prefix = "python -m pip" if len(self.arguments) > 1: cmd_prefix = " ".join(self.arguments[1:]) cmd_prefix = cmd_prefix.strip('"') cmd_prefix = cmd_prefix.strip("'") usage = dedent(cmd.usage.replace("%prog", f"{cmd_prefix} {cmd.name}")).strip() node = nodes.literal_block(usage, usage) return [node] class PipCommandDescription(rst.Directive): required_arguments = 1 def run(self) -> list[nodes.Node]: node = nodes.paragraph() node.document = self.state.document desc = ViewList() cmd = create_command(self.arguments[0]) assert cmd.__doc__ is not None description = dedent(cmd.__doc__) for line in description.split("\n"): desc.append(line, "") self.state.nested_parse(desc, 0, node) return [node] class PipOptions(rst.Directive): def _format_option( self, option: optparse.Option, cmd_name: str | None = None ) -> list[str]: bookmark_line = ( f".. _`{cmd_name}_{option._long_opts[0]}`:" if cmd_name else f".. _`{option._long_opts[0]}`:" ) line = ".. option:: " if option._short_opts: line += option._short_opts[0] if option._short_opts and option._long_opts: line += ", " + option._long_opts[0] elif option._long_opts: line += option._long_opts[0] if option.takes_value(): metavar = option.metavar or option.dest assert metavar is not None line += f" <{metavar.lower()}>" # fix defaults assert option.help is not None opt_help = option.help.replace("%default", str(option.default)) # fix paths with sys.prefix opt_help = opt_help.replace(sys.prefix, "") env_var_names = convert_cli_opt_names_to_envvars(option._long_opts) env_var_names_src = ", ".join(f"``{env_var}``" for env_var in env_var_names) return [ bookmark_line, "", line, "", f" {opt_help}", "", f" (environment variable: {env_var_names_src})", "", ] def _format_options( self, options: Iterable[optparse.Option], cmd_name: str | None = None ) -> None: for option in options: if option.help == optparse.SUPPRESS_HELP: continue for line in self._format_option(option, cmd_name): self.view_list.append(line, "") def run(self) -> list[nodes.Node]: node = nodes.paragraph() node.document = self.state.document self.view_list = ViewList() self.process_options() self.state.nested_parse(self.view_list, 0, node) return [node] class PipGeneralOptions(PipOptions): def process_options(self) -> None: self._format_options([o() for o in cmdoptions.general_group["options"]]) class PipIndexOptions(PipOptions): required_arguments = 1 def process_options(self) -> None: cmd_name = self.arguments[0] self._format_options( [o() for o in cmdoptions.index_group["options"]], cmd_name=cmd_name, ) class PipPackageSelectionOptions(PipOptions): required_arguments = 1 def process_options(self) -> None: cmd_name = self.arguments[0] self._format_options( [o() for o in cmdoptions.package_selection_group["options"]], cmd_name=cmd_name, ) class PipCommandOptions(PipOptions): required_arguments = 1 def process_options(self) -> None: cmd = create_command(self.arguments[0]) self._format_options( cmd.parser.option_groups[0].option_list, cmd_name=cmd.name, ) class PipReqFileOptionsReference(PipOptions): def determine_opt_prefix(self, opt_name: str) -> str: for command in commands_dict: cmd = create_command(command) if cmd.cmd_opts.has_option(opt_name): return command raise KeyError(f"Could not identify prefix of opt {opt_name}") def process_options(self) -> None: for option in SUPPORTED_OPTIONS: if getattr(option, "deprecated", False): continue opt = option() opt_name = opt._long_opts[0] if opt._short_opts: short_opt_name = f"{opt._short_opts[0]}, " else: short_opt_name = "" if option in cmdoptions.general_group["options"]: prefix = "" else: prefix = f"{self.determine_opt_prefix(opt_name)}_" self.view_list.append( f"* :ref:`{short_opt_name}{opt_name}<{prefix}{opt_name}>`", "\n", ) class PipCLIDirective(rst.Directive): """ - Only works when used in a MyST document. - Requires sphinx-inline-tabs' tab directive. """ has_content = True optional_arguments = 1 def run(self) -> list[nodes.Node]: node = nodes.paragraph() node.document = self.state.document os_variants = { "Linux": { "highlighter": "console", "executable": "python", "prompt": "$", }, "MacOS": { "highlighter": "console", "executable": "python", "prompt": "$", }, "Windows": { "highlighter": "doscon", "executable": "py", "prompt": "C:>", }, } if self.arguments: assert self.arguments == ["in-a-venv"] in_virtual_environment = True else: in_virtual_environment = False lines = [] # Create a tab for each OS for os, variant in os_variants.items(): # Unpack the values prompt = variant["prompt"] highlighter = variant["highlighter"] if in_virtual_environment: executable = "python" pip_spelling = "pip" else: executable = variant["executable"] pip_spelling = f"{executable} -m pip" # Substitute the various "prompts" into the correct variants substitution_pipeline = [ ( r"(^|(?<=\n))\$ python", f"{prompt} {executable}", ), ( r"(^|(?<=\n))\$ pip", f"{prompt} {pip_spelling}", ), ] content = self.block_text for pattern, substitution in substitution_pipeline: content = re.sub(pattern, substitution, content) # Write the tab lines.append(f"````{{tab}} {os}") lines.append(f"```{highlighter}") lines.append(f"{content}") lines.append("```") lines.append("````") string_list = StringList(lines) self.state.nested_parse(string_list, 0, node) return [node] def setup(app: Sphinx) -> dict[str, bool | str]: app.add_directive("pip-command-usage", PipCommandUsage) app.add_directive("pip-command-description", PipCommandDescription) app.add_directive("pip-command-options", PipCommandOptions) app.add_directive("pip-general-options", PipGeneralOptions) app.add_directive("pip-index-options", PipIndexOptions) app.add_directive("pip-package-selection-options", PipPackageSelectionOptions) app.add_directive( "pip-requirements-file-options-ref-list", PipReqFileOptionsReference ) app.add_directive("pip-news-include", PipNewsInclude) app.add_directive("pip-cli", PipCLIDirective) return { "parallel_read_safe": True, "parallel_write_safe": True, } ================================================ FILE: news/.gitignore ================================================ !.gitignore ================================================ FILE: news/13226.bugfix.rst ================================================ Fix misleading error message when a constraint file cannot be opened. ================================================ FILE: news/13826.process.rst ================================================ Add an explicit AI policy. ================================================ FILE: news/13845.trivial.rst ================================================ Add Python 3.15 to CI and fix ``importlib.metadata`` compatibility. ================================================ FILE: noxfile.py ================================================ """Automation using nox.""" import argparse import glob import os import shutil import sys from collections.abc import Iterator from pathlib import Path import nox # fmt: off sys.path.append(".") from tools import release # isort:skip sys.path.pop() # fmt: on nox.options.reuse_existing_virtualenvs = True nox.options.sessions = ["lint"] nox.needs_version = ">=2024.03.02" # for session.run_install() LOCATIONS = { "common-wheels": "tests/data/common_wheels", "protected-pip": "tools/protected_pip.py", } AUTHORS_FILE = "AUTHORS.txt" VERSION_FILE = "src/pip/__init__.py" def run_with_protected_pip(session: nox.Session, *arguments: str) -> None: """Do a session.run("pip", *arguments), using a "protected" pip. This invokes a wrapper script, that forwards calls to original virtualenv (stable) version, and not the code being tested. This ensures pip being used is not the code being tested. """ env = {"VIRTUAL_ENV": session.virtualenv.location} command = ("python", LOCATIONS["protected-pip"]) + arguments # By using run_install(), these installation steps can be skipped when -R # or --no-install is passed. session.run_install(*command, env=env, silent=True) def should_update_common_wheels(session: nox.Session) -> bool: """Determine if the common wheels cache needs to be updated. The cache is invalidated if: 1. It doesn't exist yet 2. pyproject.toml was modified after the cache was created 3. The cached wheels cannot satisfy the current Python version's requirements """ # If the cache hasn't been created, create it. if not os.path.exists(LOCATIONS["common-wheels"]): return True # If the pyproject.toml was updated after cache, we'll repopulate it. cache_last_populated_at = os.path.getmtime(LOCATIONS["common-wheels"]) pyproject_updated_at = os.path.getmtime("pyproject.toml") need_to_repopulate = pyproject_updated_at > cache_last_populated_at if not need_to_repopulate: # Check all common wheels are available for the current Python version, # by using --ignore-installed and --dry-run against the common-wheels # directory. result = session.run( "python", LOCATIONS["protected-pip"], "install", "--dry-run", "--ignore-installed", "--no-index", "--find-links", LOCATIONS["common-wheels"], "--group", "test-common-wheels", env={"VIRTUAL_ENV": session.virtualenv.location}, silent=True, success_codes=[0, 1], # Accept both success and failure and check result ) # Result is the stdout of the pip install command. if result is None or "Would install" not in result: session.log( "Regenerating common wheels as cached wheels " "cannot satisfy test-common-wheels" ) need_to_repopulate = True # Clear the stale cache. if need_to_repopulate: shutil.rmtree(LOCATIONS["common-wheels"], ignore_errors=True) return need_to_repopulate def get_common_wheels(session: nox.Session) -> None: """Build the common wheels needed by tests.""" if should_update_common_wheels(session): # fmt: off run_with_protected_pip( session, "wheel", "-w", LOCATIONS["common-wheels"], "--group", "test-common-wheels", ) # fmt: on else: msg = f"Reusing existing common-wheels at {LOCATIONS['common-wheels']}." session.log(msg) # ----------------------------------------------------------------------------- # Development Commands # ----------------------------------------------------------------------------- @nox.session(name="common-wheels") def common_wheels(session: nox.Session) -> None: """Build the common wheels needed by tests.""" get_common_wheels(session) @nox.session(python=["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15", "pypy3"]) def test(session: nox.Session) -> None: # Get the common wheels. get_common_wheels(session) # Build source distribution # HACK: we want to skip building and installing pip when nox's --no-install # flag is given (to save time when running tests back to back with different # arguments), but unfortunately nox does not expose this configuration state # yet. https://github.com/wntrblm/nox/issues/710 no_install = "-R" in sys.argv or "--no-install" in sys.argv sdist_dir = os.path.join(session.virtualenv.location, "sdist") if not no_install and os.path.exists(sdist_dir): shutil.rmtree(sdist_dir, ignore_errors=True) run_with_protected_pip(session, "install", "build") # build uses the pip present in the outer environment (aka the nox environment) # as an optimization. This will crash if the last test run installed a broken # pip, so uninstall pip to force build to provision a known good version of pip. run_with_protected_pip(session, "uninstall", "pip", "-y") # fmt: off session.run_install( "python", "-I", "-m", "build", "--sdist", "--outdir", sdist_dir, silent=True, ) # fmt: on generated_files = os.listdir(sdist_dir) assert len(generated_files) == 1 generated_sdist = os.path.join(sdist_dir, generated_files[0]) # Install source distribution run_with_protected_pip(session, "install", generated_sdist) # Install test dependencies run_with_protected_pip(session, "install", "--group", "test") # Parallelize tests as much as possible, by default. arguments = session.posargs or ["-n", "auto"] # Run the tests # LC_CTYPE is set to get UTF-8 output inside of the subprocesses that our # tests use. session.run( "pytest", *arguments, env={ "LC_CTYPE": "en_US.UTF-8", }, ) @nox.session def docs(session: nox.Session) -> None: session.install("-e", ".") session.install("--group", "docs") def get_sphinx_build_command(kind: str) -> list[str]: # Having the conf.py in the docs/html is weird but needed because we # can not use a different configuration directory vs source directory # on RTD currently. So, we'll pass "-c docs/html" here. # See https://github.com/rtfd/readthedocs.org/issues/1543. # fmt: off return [ "sphinx-build", "--keep-going", "--tag", kind, "-W", "-c", "docs/html", # see note above "-d", "docs/build/doctrees/" + kind, "-b", kind, "--jobs", "auto", "docs/" + kind, "docs/build/" + kind, ] # fmt: on shutil.rmtree("docs/build", ignore_errors=True) session.run(*get_sphinx_build_command("html")) session.run(*get_sphinx_build_command("man")) @nox.session(name="docs-live") def docs_live(session: nox.Session) -> None: session.install("-e", ".") session.install("--group", "docs", "sphinx-autobuild") session.run( "sphinx-autobuild", "-d=docs/build/doctrees/livehtml", "-b=dirhtml", "docs/html", "docs/build/livehtml", "--jobs=auto", *session.posargs, ) @nox.session def lint(session: nox.Session) -> None: session.install("pre-commit") if session.posargs: args = session.posargs + ["--all-files"] else: args = ["--all-files", "--show-diff-on-failure"] session.run("pre-commit", "run", *args) # NOTE: This session will COMMIT upgrades to vendored libraries. # You should therefore not run it directly against `main`. If you # do (assuming you started with a clean main), you can run: # # git checkout -b vendoring-updates # git checkout main # git reset --hard origin/main @nox.session def vendoring(session: nox.Session) -> None: # Ensure that the session Python is running 3.10+ # so that truststore can be installed correctly. session.run( "python", "-c", "import sys; sys.exit(1 if sys.version_info < (3, 10) else 0)" ) parser = argparse.ArgumentParser(prog="nox -s vendoring") parser.add_argument("--upgrade-all", action="store_true") parser.add_argument("--upgrade", action="append", default=[]) parser.add_argument("--skip", action="append", default=[]) args = parser.parse_args(session.posargs) session.install("vendoring~=1.2.0") if not (args.upgrade or args.upgrade_all): session.run("vendoring", "sync", "-v") return def pinned_requirements(path: Path) -> Iterator[tuple[str, str]]: for line in path.read_text().splitlines(keepends=False): one, sep, two = line.partition("==") if not sep: continue name = one.strip() version = two.split("#", 1)[0].strip() if name and version: yield name, version vendor_txt = Path("src/pip/_vendor/vendor.txt") for name, old_version in pinned_requirements(vendor_txt): if name in args.skip: continue if args.upgrade and name not in args.upgrade: continue # update requirements.txt session.run("vendoring", "update", ".", name) # get the updated version new_version = old_version for inner_name, inner_version in pinned_requirements(vendor_txt): if inner_name == name: # this is a dedicated assignment, to make lint happy new_version = inner_version break else: session.error(f"Could not find {name} in {vendor_txt}") # check if the version changed. if new_version == old_version: continue # no change, nothing more to do here. # synchronize the contents session.run("vendoring", "sync", ".") # Determine the correct message message = f"Upgrade {name} to {new_version}" # Write our news fragment news_file = Path("news") / (name + ".vendor.rst") news_file.write_text(message + "\n") # "\n" appeases end-of-line-fixer # Commit the changes release.commit_file(session, ".", message=message) @nox.session def coverage(session: nox.Session) -> None: # Install source distribution run_with_protected_pip(session, "install", ".") # Install test dependencies run_with_protected_pip(session, "install", "--group", "tests") if not os.path.exists(".coverage-output"): os.mkdir(".coverage-output") session.run( "pytest", "--cov=pip", "--cov-config=./setup.cfg", *session.posargs, env={ "COVERAGE_OUTPUT_DIR": "./.coverage-output", "COVERAGE_PROCESS_START": os.fsdecode(Path("setup.cfg").resolve()), }, ) # ----------------------------------------------------------------------------- # Release Commands # ----------------------------------------------------------------------------- @nox.session(name="prepare-release") def prepare_release(session: nox.Session) -> None: version = release.get_version_from_arguments(session) if not version: session.error("Usage: nox -s prepare-release -- ") session.log("# Ensure nothing is staged") if release.modified_files_in_git("--staged"): session.error("There are files staged in git") session.log(f"# Updating {AUTHORS_FILE}") release.generate_authors(AUTHORS_FILE) if release.modified_files_in_git(): release.commit_file(session, AUTHORS_FILE, message=f"Update {AUTHORS_FILE}") else: session.log(f"# No changes to {AUTHORS_FILE}") session.log("# Generating NEWS") release.generate_news(session, version) if sys.stdin.isatty(): input( "Please review the NEWS file, make necessary edits, and stage them.\n" "Press Enter to continue..." ) session.log(f"# Bumping for release {version}") release.update_version_file(version, VERSION_FILE) release.commit_file(session, VERSION_FILE, message="Bump for release") session.log("# Tagging release") release.create_git_tag(session, version, message=f"Release {version}") session.log("# Bumping for development") next_dev_version = release.get_next_development_version(version) release.update_version_file(next_dev_version, VERSION_FILE) release.commit_file(session, VERSION_FILE, message="Bump for development") @nox.session(name="build-release") def build_release(session: nox.Session) -> None: version = release.get_version_from_arguments(session) if not version: session.error("Usage: nox -s build-release -- YY.N[.P]") session.log("# Ensure no files in dist/") if release.have_files_in_folder("dist"): session.error( "There are files in dist/. Remove them and try again. " "You can use `git clean -fxdi -- dist` command to do this" ) session.log("# Install dependencies") session.install("twine") with release.isolated_temporary_checkout(session, version) as build_dir: session.log( "# Start the build in an isolated, " f"temporary Git checkout at {build_dir!s}", ) with release.workdir(session, build_dir): tmp_dists = build_dists(session) tmp_dist_paths = (build_dir / p for p in tmp_dists) session.log(f"# Copying dists from {build_dir}") os.makedirs("dist", exist_ok=True) for dist, final in zip(tmp_dist_paths, tmp_dists): session.log(f"# Copying {dist} to {final}") shutil.copy(dist, final) def build_dists(session: nox.Session) -> list[str]: """Return dists with valid metadata.""" session.log( "# Check if there's any Git-untracked files before building the wheel", ) has_forbidden_git_untracked_files = any( # Don't report the environment this session is running in not untracked_file.startswith(".nox/build-release/") for untracked_file in release.get_git_untracked_files() ) if has_forbidden_git_untracked_files: session.error( "There are untracked files in the working directory. " "Remove them and try again", ) session.log("# Build distributions") session.run("python", "build-project/build-project.py", silent=True) produced_dists = glob.glob("dist/*") session.log(f"# Verify distributions: {', '.join(produced_dists)}") session.run("twine", "check", "--strict", *produced_dists, silent=True) return produced_dists @nox.session(name="upload-release") def upload_release(session: nox.Session) -> None: version = release.get_version_from_arguments(session) if not version: session.error("Usage: nox -s upload-release -- YY.N[.P]") session.log("# Install dependencies") session.install("twine") distribution_files = glob.glob("dist/*") session.log(f"# Distribution files: {distribution_files}") # Sanity check: Make sure there's 2 distribution files. count = len(distribution_files) if count != 2: session.error( f"Expected 2 distribution files for upload, got {count}. " f"Remove dist/ and run 'nox -s build-release -- {version}'" ) # Sanity check: Make sure the files are correctly named. distfile_names = (os.path.basename(fn) for fn in distribution_files) expected_distribution_files = [ f"pip-{version}-py3-none-any.whl", f"pip-{version}.tar.gz", ] if sorted(distfile_names) != sorted(expected_distribution_files): session.error(f"Distribution files do not seem to be for {version} release.") session.log("# Upload distributions") session.run("twine", "upload", *distribution_files) ================================================ FILE: pyproject.toml ================================================ [project] dynamic = ["version"] name = "pip" description = "The PyPA recommended tool for installing Python packages." readme = "README.rst" license = "MIT" license-files = [ "AUTHORS.txt", "LICENSE.txt", "src/pip/_vendor/**/*COPYING*", "src/pip/_vendor/**/*LICENSE*", ] classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Topic :: Software Development :: Build Tools", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] authors = [ {name = "The pip developers", email = "distutils-sig@python.org"}, ] # NOTE: requires-python is duplicated in __pip-runner__.py. # When changing this value, please change the other copy as well. requires-python = ">=3.9" [project.scripts] pip = "pip._internal.cli.main:main" pip3 = "pip._internal.cli.main:main" [project.urls] Homepage = "https://pip.pypa.io/" Documentation = "https://pip.pypa.io" Source = "https://github.com/pypa/pip" Changelog = "https://pip.pypa.io/en/stable/news/" [build-system] requires = ["flit-core >=3.11,<4"] build-backend = "flit_core.buildapi" [dependency-groups] test = [ "cryptography", "flit-core >= 3.11, < 4", "freezegun", "installer", # pytest-subket requires 7.0+ "pytest >= 7.0", "pytest-cov", "pytest-rerunfailures", "pytest-xdist", "pytest-subket", "scripttest", "setuptools", # macOS (darwin) arm64 always uses virtualenv >= 20.0 # for other platforms, it depends on python version "virtualenv < 20.0 ; python_version < '3.10' and (sys_platform != 'darwin' or platform_machine != 'arm64')", "virtualenv >= 20.0 ; python_version >= '3.10' or (sys_platform == 'darwin' and platform_machine == 'arm64')", "werkzeug", "tomli-w", "proxy.py", ] test-common-wheels = [ "flit-core >= 3.11, < 4", # We pin setuptools<80 because our test suite currently # depends on setup.py develop to generate egg-link files. "setuptools >= 70.1.0, <80", # As required by pytest-cov. "coverage >= 4.4", "pytest-subket >= 0.8.1", "keyring", ] docs = [ "sphinx ~= 7.0", # currently incompatible with sphinxcontrib-towncrier # https://github.com/sphinx-contrib/sphinxcontrib-towncrier/issues/92 "towncrier < 24", "furo", "myst_parser", "sphinx-copybutton", "sphinx-inline-tabs", "sphinxcontrib-towncrier >= 0.2.0a0", "sphinx-issues", ] [tool.flit.sdist] include = [ "NEWS.rst", "SECURITY.md", "AI_POLICY.md", "build-project/.python-version", "build-project/build-project.py", "build-project/build-requirements.in", "build-project/build-requirements.txt", "docs/**/*.css", "docs/**/*.dot", "docs/**/*.md", "docs/**/*.png", "docs/**/*.py", "docs/**/*.rst", ] exclude = [ ".devcontainer/devcontainer.json", "src/pip/_vendor/**/*.pyi", ] ###################################################################################### # towncrier # [tool.towncrier] # For finding the __version__ package = "pip" package_dir = "src" # For writing into the correct file filename = "NEWS.rst" # For finding the news fragments directory = "news/" # For rendering properly for this project issue_format = "`#{issue} `_" template = "tools/news/template.rst" # Grouping of entries, within our changelog type = [ { name = "Deprecations and Removals", directory = "removal", showcontent = true }, { name = "Features", directory = "feature", showcontent = true }, { name = "Bug Fixes", directory = "bugfix", showcontent = true }, { name = "Vendored Libraries", directory = "vendor", showcontent = true }, { name = "Improved Documentation", directory = "doc", showcontent = true }, { name = "Process", directory = "process", showcontent = true }, { name = "Trivial Changes", directory = "trivial", showcontent = false }, ] ###################################################################################### # vendoring # [tool.vendoring] destination = "src/pip/_vendor/" requirements = "src/pip/_vendor/vendor.txt" namespace = "pip._vendor" protected-files = ["__init__.py", "README.rst", "vendor.txt"] patches-dir = "tools/vendoring/patches" [tool.vendoring.transformations] substitute = [ # pkg_resource's vendored packages are directly vendored in pip. { match='pkg_resources\.extern', replace="pip._vendor" }, { match='from \.extern', replace="from pip._vendor" }, { match='''\('pygments\.lexers\.''', replace="('pip._vendor.pygments.lexers." }, ] drop = [ # contains unnecessary scripts "bin/", # interpreter and OS specific msgpack libs "msgpack/*.so", # optional accelerator extension libraries "*mypyc*.so", "tomli/*.so", # unneeded parts of setuptools "easy_install.py", "setuptools", "pkg_resources/_vendor/", "_distutils_hack", "distutils-precedence.pth", "pkg_resources/extern/", # trim vendored pygments styles, lexers, formatters, and CLI "pygments/styles/[!_]*.py", '^pygments/lexers/(?!python|__init__|_mapping).*\.py$', '^pygments/formatters/(?!__init__|_mapping).*\.py$', '^pygments/cmdline\.py$', # trim rich's markdown support "rich/markdown.py", # trim parts of distlib that aren't related to scripts '^distlib/(?!__init__|compat|resources|scripts|util).*\.py$', ] [tool.vendoring.typing-stubs] distro = [] [tool.vendoring.license.directories] setuptools = "pkg_resources" [tool.vendoring.license.fallback-urls] distlib = "https://bitbucket.org/pypa/distlib/raw/master/LICENSE.txt" ###################################################################################### # ruff # [tool.ruff] # Pinned to delay pyupgrade changes (https://github.com/pypa/pip/issues/13236) target-version = "py39" # Pin Ruff to Python 3.9 src = ["src"] line-length = 88 extend-exclude = [ "_vendor", "./build", ".scratch", "data", ] [tool.ruff.lint] ignore = [ "B020", "B904", # Ruff enables opinionated warnings by default "B905", # Ruff enables opinionated warnings by default "C420", # unnecessary-dict-comprehension-for-iterable (worsens readability) ] select = [ "ASYNC", "B", "C4", "C90", "E", "F", "FA", "G", "I", "ISC", "PIE810", "PLE", "PLR0", "RUF100", "UP", "W", ] [tool.ruff.lint.isort] section-order = [ "future", "standard-library", "third-party", "vendored", "first-party", "tests", "local-folder", ] [tool.ruff.lint.isort.sections] "vendored" = ["pip._vendor"] "tests" = ["tests"] [tool.ruff.lint.mccabe] max-complexity = 33 # default is 10 [tool.ruff.lint.per-file-ignores] "noxfile.py" = ["G"] "src/pip/_internal/*" = ["PERF203"] "tests/*" = ["B011"] "tests/unit/test_finder.py" = ["C414"] "src/pip/__pip-runner__.py" = ["UP"] # Must be compatible with Python 2.7 [tool.ruff.lint.pylint] max-args = 15 # default is 5 max-branches = 28 # default is 12 max-returns = 15 # default is 6 max-statements = 134 # default is 50 [tool.ruff.per-file-target-version] # `__pip-runner__.py` should be Python 2.7 compatible but the # earliest version of Python ruff will check is 3.7 "src/pip/__pip-runner__.py" = "py37" ###################################################################################### # mypy # [tool.mypy] mypy_path = "$MYPY_CONFIG_FILE_DIR/src" strict = true no_implicit_reexport = false disallow_subclassing_any = false disallow_untyped_calls = false warn_return_any = false ignore_missing_imports = true [[tool.mypy.overrides]] module = "pip._internal.utils._jaraco_text" ignore_errors = true [[tool.mypy.overrides]] module = "pip._vendor.*" ignore_errors = true # These vendored libraries use runtime magic to populate things and don't sit # well with static typing out of the box. Eventually we should provide correct # typing information for their public interface and remove these configs. [[tool.mypy.overrides]] module = "pip._vendor.pkg_resources" follow_imports = "skip" [[tool.mypy.overrides]] module = "pip._vendor.requests.*" follow_imports = "skip" ###################################################################################### # pytest # [tool.pytest.ini_options] addopts = [ "-r=aR", "--color=yes", "--ignore=src/pip/_vendor", "--ignore=tests/tests_cache", "--disable-socket", "--allow-unix-socket", "--allow-hosts=localhost", ] xfail_strict = true markers = [ "network: tests that need network", "incompatible_with_sysconfig", "incompatible_with_venv", "no_auto_tempdir_manager", "unit: unit tests", "integration: integration tests", "bzr: VCS: Bazaar", "svn: VCS: Subversion", "mercurial: VCS: Mercurial", "git: VCS: git", "search: tests for 'pip search'", ] ###################################################################################### # coverage # [tool.coverage.run] branch = true # Do not gather coverage for vendored libraries. omit = "*/_vendor/*" # Centralized absolute file prefix for coverage files. data_file = "${COVERAGE_OUTPUT_DIR}/.coverage" # By default, each covered process will try to truncate and then write to # `data_file`, but with `parallel`, they will write to separate files suffixed # with hostname, pid, and a timestamp. parallel = true # If not set, then at the termination of each worker (when using pytest-xdist), # the following is traced: "Coverage.py warning: Module pip was previously # imported, but not measured (module-not-measured)" disable_warnings = "module-not-measured" [tool.coverage.paths] # We intentionally use "source0" here because pytest-cov unconditionally sets # "source" after loading the config. source0 = [ # The primary source code path which other paths will be combined into. "src/pip/", # Unit test source directory e.g. # `.tox/coverage-py3/lib/pythonX.Y/site-packages/pip/...` "*/site-packages/pip/", # Functional test virtual environment directories, which look like # `tmpdir/pip0/pip/src/pip/...` "*/pip/src/pip/", ] [tool.coverage.report] exclude_also = [ # This excludes typing-specific code, which will be validated by mypy anyway. "if TYPE_CHECKING", ] [tool.check-sdist] git-only = [ "tests/**", "tools/**", "news/.gitignore", ".devcontainer/**", ".gitattributes", ".gitignore", ".git-blame-ignore-revs", ".mailmap", ".readthedocs-custom-redirects.yml" ] ================================================ FILE: src/pip/__init__.py ================================================ from __future__ import annotations __version__ = "26.1.dev0" def main(args: list[str] | None = None) -> int: """This is an internal API only meant for use by pip's own console scripts. For additional details, see https://github.com/pypa/pip/issues/7498. """ from pip._internal.utils.entrypoints import _wrapper return _wrapper(args) ================================================ FILE: src/pip/__main__.py ================================================ import os import sys # Remove '' and current working directory from the first entry # of sys.path, if present to avoid using current directory # in pip commands check, freeze, install, list and show, # when invoked as python -m pip if sys.path[0] in ("", os.getcwd()): sys.path.pop(0) # If we are running from a wheel, add the wheel to sys.path # This allows the usage python pip-*.whl/pip install pip-*.whl if __package__ == "": # __file__ is pip-*.whl/pip/__main__.py # first dirname call strips of '/__main__.py', second strips off '/pip' # Resulting path is the name of the wheel itself # Add that to sys.path so we can import pip path = os.path.dirname(os.path.dirname(__file__)) sys.path.insert(0, path) if __name__ == "__main__": from pip._internal.cli.main import main as _main sys.exit(_main()) ================================================ FILE: src/pip/__pip-runner__.py ================================================ """Execute exactly this copy of pip, within a different environment. This file is named as it is, to ensure that this module can't be imported via an import statement. """ # /!\ This version compatibility check section must be Python 2 compatible. /!\ import sys # Copied from pyproject.toml PYTHON_REQUIRES = (3, 9) def version_str(version): # type: ignore return ".".join(str(v) for v in version) if sys.version_info[:2] < PYTHON_REQUIRES: raise SystemExit( "This version of pip does not support python {} (requires >={}).".format( version_str(sys.version_info[:2]), version_str(PYTHON_REQUIRES) ) ) # From here on, we can use Python 3 features, but the syntax must remain # Python 2 compatible. import runpy # noqa: E402 from importlib.machinery import PathFinder # noqa: E402 from os.path import dirname # noqa: E402 PIP_SOURCES_ROOT = dirname(dirname(__file__)) class PipImportRedirectingFinder: @classmethod def find_spec(self, fullname, path=None, target=None): # type: ignore if fullname != "pip": return None spec = PathFinder.find_spec(fullname, [PIP_SOURCES_ROOT], target) assert spec, (PIP_SOURCES_ROOT, fullname) return spec sys.meta_path.insert(0, PipImportRedirectingFinder()) assert __name__ == "__main__", "Cannot run __pip-runner__.py as a non-main module" runpy.run_module("pip", run_name="__main__", alter_sys=True) ================================================ FILE: src/pip/_internal/__init__.py ================================================ from __future__ import annotations from pip._internal.utils import _log # init_logging() must be called before any call to logging.getLogger() # which happens at import of most modules. _log.init_logging() def main(args: list[str] | None = None) -> int: """This is preserved for old console scripts that may still be referencing it. For additional details, see https://github.com/pypa/pip/issues/7498. """ from pip._internal.utils.entrypoints import _wrapper return _wrapper(args) ================================================ FILE: src/pip/_internal/build_env.py ================================================ """Build Environment used for isolation during sdist building""" from __future__ import annotations import logging import os import pathlib import site import sys import textwrap from collections import OrderedDict from collections.abc import Iterable, Sequence from contextlib import AbstractContextManager as ContextManager from contextlib import nullcontext from io import StringIO from types import TracebackType from typing import TYPE_CHECKING, Protocol, TypedDict from pip._vendor.packaging.version import Version from pip import __file__ as pip_location from pip._internal.cli.spinners import open_rich_spinner, open_spinner from pip._internal.exceptions import ( BuildDependencyInstallError, DiagnosticPipError, InstallWheelBuildError, PipError, ) from pip._internal.locations import get_platlib, get_purelib, get_scheme from pip._internal.metadata import get_default_environment, get_environment from pip._internal.utils.deprecation import deprecated from pip._internal.utils.logging import VERBOSE, capture_logging from pip._internal.utils.packaging import get_requirement from pip._internal.utils.subprocess import call_subprocess from pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds if TYPE_CHECKING: from pip._internal.cache import WheelCache from pip._internal.index.package_finder import PackageFinder from pip._internal.operations.build.build_tracker import BuildTracker from pip._internal.req.req_install import InstallRequirement from pip._internal.resolution.base import BaseResolver class ExtraEnviron(TypedDict, total=False): extra_environ: dict[str, str] logger = logging.getLogger(__name__) def _dedup(a: str, b: str) -> tuple[str] | tuple[str, str]: return (a, b) if a != b else (a,) class _Prefix: def __init__(self, path: str) -> None: self.path = path self.setup = False scheme = get_scheme("", prefix=path) self.bin_dir = scheme.scripts self.lib_dirs = _dedup(scheme.purelib, scheme.platlib) def get_runnable_pip() -> str: """Get a file to pass to a Python executable, to run the currently-running pip. This is used to run a pip subprocess, for installing requirements into the build environment. """ source = pathlib.Path(pip_location).resolve().parent if not source.is_dir(): # This would happen if someone is using pip from inside a zip file. In that # case, we can use that directly. return str(source) return os.fsdecode(source / "__pip-runner__.py") def _get_system_sitepackages() -> set[str]: """Get system site packages Usually from site.getsitepackages, but fallback on `get_purelib()/get_platlib()` if unavailable (e.g. in a virtualenv created by virtualenv<20) Returns normalized set of strings. """ if hasattr(site, "getsitepackages"): system_sites = site.getsitepackages() else: # virtualenv < 20 overwrites site.py without getsitepackages # fallback on get_purelib/get_platlib. # this is known to miss things, but shouldn't in the cases # where getsitepackages() has been removed (inside a virtualenv) system_sites = [get_purelib(), get_platlib()] return {os.path.normcase(path) for path in system_sites} class BuildEnvironmentInstaller(Protocol): """ Interface for installing build dependencies into an isolated build environment. """ def install( self, requirements: Iterable[str], prefix: _Prefix, *, kind: str, for_req: InstallRequirement | None, ) -> None: ... class SubprocessBuildEnvironmentInstaller: """ Install build dependencies by calling pip in a subprocess. """ def __init__( self, finder: PackageFinder, build_constraints: list[str] | None = None, build_constraint_feature_enabled: bool = False, ) -> None: self.finder = finder self._build_constraints = build_constraints or [] self._build_constraint_feature_enabled = build_constraint_feature_enabled def _deprecation_constraint_check(self) -> None: """ Check for deprecation warning: PIP_CONSTRAINT affecting build environments. This warns when build-constraint feature is NOT enabled and PIP_CONSTRAINT is not empty. """ if self._build_constraint_feature_enabled or self._build_constraints: return pip_constraint = os.environ.get("PIP_CONSTRAINT") if not pip_constraint or not pip_constraint.strip(): return deprecated( reason=( "Setting PIP_CONSTRAINT will not affect " "build constraints in the future," ), replacement=( "to specify build constraints using --build-constraint or " "PIP_BUILD_CONSTRAINT. To disable this warning without " "any build constraints set --use-feature=build-constraint or " 'PIP_USE_FEATURE="build-constraint"' ), gone_in="26.2", issue=None, ) def install( self, requirements: Iterable[str], prefix: _Prefix, *, kind: str, for_req: InstallRequirement | None, ) -> None: self._deprecation_constraint_check() finder = self.finder args: list[str] = [ sys.executable, get_runnable_pip(), "install", "--ignore-installed", "--no-user", "--prefix", prefix.path, "--no-warn-script-location", "--disable-pip-version-check", # As the build environment is ephemeral, it's wasteful to # pre-compile everything, especially as not every Python # module will be used/compiled in most cases. "--no-compile", # The prefix specified two lines above, thus # target from config file or env var should be ignored "--target", "", ] if logger.getEffectiveLevel() <= logging.DEBUG: args.append("-vv") elif logger.getEffectiveLevel() <= VERBOSE: args.append("-v") for format_control in ("no_binary", "only_binary"): formats = getattr(finder.format_control, format_control) args.extend( ( "--" + format_control.replace("_", "-"), ",".join(sorted(formats or {":none:"})), ) ) if finder.release_control is not None: # Use ordered args to preserve the user's original command-line order # This is important because later flags can override earlier ones for attr_name, value in finder.release_control.get_ordered_args(): args.extend(("--" + attr_name.replace("_", "-"), value)) index_urls = finder.index_urls if index_urls: args.extend(["-i", index_urls[0]]) for extra_index in index_urls[1:]: args.extend(["--extra-index-url", extra_index]) else: args.append("--no-index") for link in finder.find_links: args.extend(["--find-links", link]) if finder.proxy: args.extend(["--proxy", finder.proxy]) for host in finder.trusted_hosts: args.extend(["--trusted-host", host]) if finder.custom_cert: args.extend(["--cert", finder.custom_cert]) if finder.client_cert: args.extend(["--client-cert", finder.client_cert]) if finder.prefer_binary: args.append("--prefer-binary") # Handle build constraints if self._build_constraint_feature_enabled: args.extend(["--use-feature", "build-constraint"]) if self._build_constraints: # Build constraints must be passed as both constraints # and build constraints, so that nested builds receive # build constraints for constraint_file in self._build_constraints: args.extend(["--constraint", constraint_file]) args.extend(["--build-constraint", constraint_file]) extra_environ: ExtraEnviron = {} if self._build_constraint_feature_enabled and not self._build_constraints: # If there are no build constraints but the build constraints # feature is enabled then we must ignore regular constraints # in the isolated build environment extra_environ = {"extra_environ": {"_PIP_IN_BUILD_IGNORE_CONSTRAINTS": "1"}} if finder.uploaded_prior_to: args.extend(["--uploaded-prior-to", finder.uploaded_prior_to.isoformat()]) args.append("--") args.extend(requirements) identify_requirement = ( f" for {for_req.name}" if for_req and for_req.name else "" ) with open_spinner(f"Installing {kind}") as spinner: call_subprocess( args, command_desc=f"installing {kind}{identify_requirement}", spinner=spinner, **extra_environ, ) class InprocessBuildEnvironmentInstaller: """ Build dependency installer that runs in the same pip process. This contains a stripped down version of the install command with only the logic necessary for installing build dependencies. The finder, session, build tracker, and wheel cache are reused, but new instances of everything else are created as needed. Options are inherited from the parent install command unless they don't make sense for build dependencies (in which case, they are hard-coded, see comments below). """ def __init__( self, *, finder: PackageFinder, build_tracker: BuildTracker, wheel_cache: WheelCache, build_constraints: Sequence[InstallRequirement] = (), verbosity: int = 0, ) -> None: from pip._internal.operations.prepare import RequirementPreparer self._finder = finder self._build_constraints = build_constraints self._wheel_cache = wheel_cache self._level = 0 build_dir = TempDirectory(kind="build-env-install", globally_managed=True) self._preparer = RequirementPreparer( build_isolation_installer=self, # Inherited options or state. finder=finder, session=finder._link_collector.session, build_dir=build_dir.path, build_tracker=build_tracker, verbosity=verbosity, # This is irrelevant as it only applies to editable requirements. src_dir="", # Hard-coded options (that should NOT be inherited). download_dir=None, build_isolation=True, check_build_deps=False, progress_bar="off", # TODO: hash-checking should be extended to build deps, but that is # deferred for later as it'd be a breaking change. require_hashes=False, use_user_site=False, lazy_wheel=False, legacy_resolver=False, ) def install( self, requirements: Iterable[str], prefix: _Prefix, *, kind: str, for_req: InstallRequirement | None, ) -> None: """Install entrypoint. Manages output capturing and error handling.""" capture_logs = not logger.isEnabledFor(VERBOSE) and self._level == 0 if capture_logs: # Hide the logs from the installation of build dependencies. # They will be shown only if an error occurs. capture_ctx: ContextManager[StringIO] = capture_logging() spinner: ContextManager[None] = open_rich_spinner(f"Installing {kind}") else: # Otherwise, pass-through all logs (with a header). capture_ctx, spinner = nullcontext(StringIO()), nullcontext() logger.info("Installing %s ...", kind) try: self._level += 1 with spinner, capture_ctx as stream: self._install_impl(requirements, prefix) except DiagnosticPipError as exc: # Format similar to a nested subprocess error, where the # causing error is shown first, followed by the build error. logger.info(textwrap.dedent(stream.getvalue())) logger.error("%s", exc, extra={"rich": True}) logger.info("") raise BuildDependencyInstallError( for_req, requirements, cause=exc, log_lines=None ) except Exception as exc: logs: list[str] | None = textwrap.dedent(stream.getvalue()).splitlines() if not capture_logs: # If logs aren't being captured, then display the error inline # with the rest of the logs. logs = None if isinstance(exc, PipError): logger.error("%s", exc) else: logger.exception("pip crashed unexpectedly") raise BuildDependencyInstallError( for_req, requirements, cause=exc, log_lines=logs ) finally: self._level -= 1 def _install_impl(self, requirements: Iterable[str], prefix: _Prefix) -> None: """Core build dependency install logic.""" from pip._internal.commands.install import installed_packages_summary from pip._internal.req import install_given_reqs from pip._internal.req.constructors import install_req_from_line from pip._internal.wheel_builder import build ireqs = [install_req_from_line(req, user_supplied=True) for req in requirements] ireqs.extend(self._build_constraints) resolver = self._make_resolver() resolved_set = resolver.resolve(ireqs, check_supported_wheels=True) self._preparer.prepare_linked_requirements_more( resolved_set.requirements.values() ) reqs_to_build = [ r for r in resolved_set.requirements_to_install if not r.is_wheel ] _, build_failures = build(reqs_to_build, self._wheel_cache, verify=True) if build_failures: raise InstallWheelBuildError(build_failures) installed = install_given_reqs( resolver.get_installation_order(resolved_set), prefix=prefix.path, # Hard-coded options (that should NOT be inherited). root=None, home=None, warn_script_location=False, use_user_site=False, # As the build environment is ephemeral, it's wasteful to # pre-compile everything since not all modules will be used. pycompile=False, progress_bar="off", ) env = get_environment(list(prefix.lib_dirs)) if summary := installed_packages_summary(installed, env): logger.info(summary) def _make_resolver(self) -> BaseResolver: """Create a new resolver for one time use.""" # Legacy installer never used the legacy resolver so create a # resolvelib resolver directly. Yuck. from pip._internal.req.constructors import install_req_from_req_string from pip._internal.resolution.resolvelib.resolver import Resolver return Resolver( make_install_req=install_req_from_req_string, # Inherited state. preparer=self._preparer, finder=self._finder, wheel_cache=self._wheel_cache, # Hard-coded options (that should NOT be inherited). ignore_requires_python=False, use_user_site=False, ignore_dependencies=False, ignore_installed=True, force_reinstall=False, upgrade_strategy="to-satisfy-only", py_version_info=None, ) class BuildEnvironment: """Creates and manages an isolated environment to install build deps""" def __init__(self, installer: BuildEnvironmentInstaller) -> None: self.installer = installer temp_dir = TempDirectory(kind=tempdir_kinds.BUILD_ENV, globally_managed=True) self._prefixes = OrderedDict( (name, _Prefix(os.path.join(temp_dir.path, name))) for name in ("normal", "overlay") ) self._bin_dirs: list[str] = [] self._lib_dirs: list[str] = [] for prefix in reversed(list(self._prefixes.values())): self._bin_dirs.append(prefix.bin_dir) self._lib_dirs.extend(prefix.lib_dirs) # Customize site to: # - ensure .pth files are honored # - prevent access to system site packages system_sites = _get_system_sitepackages() self._site_dir = os.path.join(temp_dir.path, "site") if not os.path.exists(self._site_dir): os.mkdir(self._site_dir) with open( os.path.join(self._site_dir, "sitecustomize.py"), "w", encoding="utf-8" ) as fp: fp.write( textwrap.dedent( """ import os, site, sys # First, drop system-sites related paths. original_sys_path = sys.path[:] known_paths = set() for path in {system_sites!r}: site.addsitedir(path, known_paths=known_paths) system_paths = set( os.path.normcase(path) for path in sys.path[len(original_sys_path):] ) original_sys_path = [ path for path in original_sys_path if os.path.normcase(path) not in system_paths ] sys.path = original_sys_path # Second, add lib directories. # ensuring .pth file are processed. for path in {lib_dirs!r}: assert not path in sys.path site.addsitedir(path) """ ).format(system_sites=system_sites, lib_dirs=self._lib_dirs) ) def __enter__(self) -> None: self._save_env = { name: os.environ.get(name, None) for name in ("PATH", "PYTHONNOUSERSITE", "PYTHONPATH") } path = self._bin_dirs[:] old_path = self._save_env["PATH"] if old_path: path.extend(old_path.split(os.pathsep)) pythonpath = [self._site_dir] os.environ.update( { "PATH": os.pathsep.join(path), "PYTHONNOUSERSITE": "1", "PYTHONPATH": os.pathsep.join(pythonpath), } ) def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None, ) -> None: for varname, old_value in self._save_env.items(): if old_value is None: os.environ.pop(varname, None) else: os.environ[varname] = old_value def check_requirements( self, reqs: Iterable[str] ) -> tuple[set[tuple[str, str]], set[str]]: """Return 2 sets: - conflicting requirements: set of (installed, wanted) reqs tuples - missing requirements: set of reqs """ missing = set() conflicting = set() if reqs: env = ( get_environment(self._lib_dirs) if hasattr(self, "_lib_dirs") else get_default_environment() ) for req_str in reqs: req = get_requirement(req_str) # We're explicitly evaluating with an empty extra value, since build # environments are not provided any mechanism to select specific extras. if req.marker is not None and not req.marker.evaluate({"extra": ""}): continue dist = env.get_distribution(req.name) if not dist: missing.add(req_str) continue if isinstance(dist.version, Version): installed_req_str = f"{req.name}=={dist.version}" else: installed_req_str = f"{req.name}==={dist.version}" if not req.specifier.contains(dist.version, prereleases=True): conflicting.add((installed_req_str, req_str)) # FIXME: Consider direct URL? return conflicting, missing def install_requirements( self, requirements: Iterable[str], prefix_as_string: str, *, kind: str, for_req: InstallRequirement | None = None, ) -> None: prefix = self._prefixes[prefix_as_string] assert not prefix.setup prefix.setup = True if not requirements: return self.installer.install(requirements, prefix, kind=kind, for_req=for_req) class NoOpBuildEnvironment(BuildEnvironment): """A no-op drop-in replacement for BuildEnvironment""" def __init__(self) -> None: pass def __enter__(self) -> None: pass def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None, ) -> None: pass def cleanup(self) -> None: pass def install_requirements( self, requirements: Iterable[str], prefix_as_string: str, *, kind: str, for_req: InstallRequirement | None = None, ) -> None: raise NotImplementedError() ================================================ FILE: src/pip/_internal/cache.py ================================================ """Cache Management""" from __future__ import annotations import hashlib import json import logging import os from pathlib import Path from typing import Any from pip._vendor.packaging.tags import Tag, interpreter_name, interpreter_version from pip._vendor.packaging.utils import canonicalize_name from pip._internal.exceptions import InvalidWheelFilename from pip._internal.models.direct_url import DirectUrl from pip._internal.models.link import Link from pip._internal.models.wheel import Wheel from pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds from pip._internal.utils.urls import path_to_url logger = logging.getLogger(__name__) ORIGIN_JSON_NAME = "origin.json" def _hash_dict(d: dict[str, str]) -> str: """Return a stable sha224 of a dictionary.""" s = json.dumps(d, sort_keys=True, separators=(",", ":"), ensure_ascii=True) return hashlib.sha224(s.encode("ascii")).hexdigest() class Cache: """An abstract class - provides cache directories for data from links :param cache_dir: The root of the cache. """ def __init__(self, cache_dir: str) -> None: super().__init__() assert not cache_dir or os.path.isabs(cache_dir) self.cache_dir = cache_dir or None def _get_cache_path_parts(self, link: Link) -> list[str]: """Get parts of part that must be os.path.joined with cache_dir""" # We want to generate an url to use as our cache key, we don't want to # just reuse the URL because it might have other items in the fragment # and we don't care about those. key_parts = {"url": link.url_without_fragment} if link.hash_name is not None and link.hash is not None: key_parts[link.hash_name] = link.hash if link.subdirectory_fragment: key_parts["subdirectory"] = link.subdirectory_fragment # Include interpreter name, major and minor version in cache key # to cope with ill-behaved sdists that build a different wheel # depending on the python version their setup.py is being run on, # and don't encode the difference in compatibility tags. # https://github.com/pypa/pip/issues/7296 key_parts["interpreter_name"] = interpreter_name() key_parts["interpreter_version"] = interpreter_version() # Encode our key url with sha224, we'll use this because it has similar # security properties to sha256, but with a shorter total output (and # thus less secure). However the differences don't make a lot of # difference for our use case here. hashed = _hash_dict(key_parts) # We want to nest the directories some to prevent having a ton of top # level directories where we might run out of sub directories on some # FS. parts = [hashed[:2], hashed[2:4], hashed[4:6], hashed[6:]] return parts def _get_candidates(self, link: Link, canonical_package_name: str) -> list[Any]: can_not_cache = not self.cache_dir or not canonical_package_name or not link if can_not_cache: return [] path = self.get_path_for_link(link) if os.path.isdir(path): return [(candidate, path) for candidate in os.listdir(path)] return [] def get_path_for_link(self, link: Link) -> str: """Return a directory to store cached items in for link.""" raise NotImplementedError() def get( self, link: Link, package_name: str | None, supported_tags: list[Tag], ) -> Link: """Returns a link to a cached item if it exists, otherwise returns the passed link. """ raise NotImplementedError() class SimpleWheelCache(Cache): """A cache of wheels for future installs.""" def __init__(self, cache_dir: str) -> None: super().__init__(cache_dir) def get_path_for_link(self, link: Link) -> str: """Return a directory to store cached wheels for link Because there are M wheels for any one sdist, we provide a directory to cache them in, and then consult that directory when looking up cache hits. We only insert things into the cache if they have plausible version numbers, so that we don't contaminate the cache with things that were not unique. E.g. ./package might have dozens of installs done for it and build a version of 0.0...and if we built and cached a wheel, we'd end up using the same wheel even if the source has been edited. :param link: The link of the sdist for which this will cache wheels. """ parts = self._get_cache_path_parts(link) assert self.cache_dir # Store wheels within the root cache_dir return os.path.join(self.cache_dir, "wheels", *parts) def get( self, link: Link, package_name: str | None, supported_tags: list[Tag], ) -> Link: candidates = [] if not package_name: return link canonical_package_name = canonicalize_name(package_name) for wheel_name, wheel_dir in self._get_candidates(link, canonical_package_name): try: wheel = Wheel(wheel_name) except InvalidWheelFilename: continue if wheel.name != canonical_package_name: logger.debug( "Ignoring cached wheel %s for %s as it " "does not match the expected distribution name %s.", wheel_name, link, package_name, ) continue if not wheel.supported(supported_tags): # Built for a different python/arch/etc continue candidates.append( ( wheel.support_index_min(supported_tags), wheel_name, wheel_dir, ) ) if not candidates: return link _, wheel_name, wheel_dir = min(candidates) return Link(path_to_url(os.path.join(wheel_dir, wheel_name))) class EphemWheelCache(SimpleWheelCache): """A SimpleWheelCache that creates it's own temporary cache directory""" def __init__(self) -> None: self._temp_dir = TempDirectory( kind=tempdir_kinds.EPHEM_WHEEL_CACHE, globally_managed=True, ) super().__init__(self._temp_dir.path) class CacheEntry: def __init__( self, link: Link, persistent: bool, ): self.link = link self.persistent = persistent self.origin: DirectUrl | None = None origin_direct_url_path = Path(self.link.file_path).parent / ORIGIN_JSON_NAME if origin_direct_url_path.exists(): try: self.origin = DirectUrl.from_json( origin_direct_url_path.read_text(encoding="utf-8") ) except Exception as e: logger.warning( "Ignoring invalid cache entry origin file %s for %s (%s)", origin_direct_url_path, link.filename, e, ) class WheelCache(Cache): """Wraps EphemWheelCache and SimpleWheelCache into a single Cache This Cache allows for gracefully degradation, using the ephem wheel cache when a certain link is not found in the simple wheel cache first. """ def __init__(self, cache_dir: str) -> None: super().__init__(cache_dir) self._wheel_cache = SimpleWheelCache(cache_dir) self._ephem_cache = EphemWheelCache() def get_path_for_link(self, link: Link) -> str: return self._wheel_cache.get_path_for_link(link) def get_ephem_path_for_link(self, link: Link) -> str: return self._ephem_cache.get_path_for_link(link) def get( self, link: Link, package_name: str | None, supported_tags: list[Tag], ) -> Link: cache_entry = self.get_cache_entry(link, package_name, supported_tags) if cache_entry is None: return link return cache_entry.link def get_cache_entry( self, link: Link, package_name: str | None, supported_tags: list[Tag], ) -> CacheEntry | None: """Returns a CacheEntry with a link to a cached item if it exists or None. The cache entry indicates if the item was found in the persistent or ephemeral cache. """ retval = self._wheel_cache.get( link=link, package_name=package_name, supported_tags=supported_tags, ) if retval is not link: return CacheEntry(retval, persistent=True) retval = self._ephem_cache.get( link=link, package_name=package_name, supported_tags=supported_tags, ) if retval is not link: return CacheEntry(retval, persistent=False) return None @staticmethod def record_download_origin(cache_dir: str, download_info: DirectUrl) -> None: origin_path = Path(cache_dir) / ORIGIN_JSON_NAME if origin_path.exists(): try: origin = DirectUrl.from_json(origin_path.read_text(encoding="utf-8")) except Exception as e: logger.warning( "Could not read origin file %s in cache entry (%s). " "Will attempt to overwrite it.", origin_path, e, ) else: # TODO: use DirectUrl.equivalent when # https://github.com/pypa/pip/pull/10564 is merged. if origin.url != download_info.url: logger.warning( "Origin URL %s in cache entry %s does not match download URL " "%s. This is likely a pip bug or a cache corruption issue. " "Will overwrite it with the new value.", origin.url, cache_dir, download_info.url, ) origin_path.write_text(download_info.to_json(), encoding="utf-8") ================================================ FILE: src/pip/_internal/cli/__init__.py ================================================ """Subpackage containing all of pip's command line interface related code""" # This file intentionally does not import submodules ================================================ FILE: src/pip/_internal/cli/autocompletion.py ================================================ """Logic that powers autocompletion installed by ``pip completion``.""" from __future__ import annotations import optparse import os import sys from collections.abc import Iterable from itertools import chain from typing import Any from pip._internal.cli.main_parser import create_main_parser from pip._internal.commands import commands_dict, create_command from pip._internal.metadata import get_default_environment def autocomplete() -> None: """Entry Point for completion of main and subcommand options.""" # Don't complete if user hasn't sourced bash_completion file. if "PIP_AUTO_COMPLETE" not in os.environ: return # Don't complete if autocompletion environment variables # are not present if not os.environ.get("COMP_WORDS") or not os.environ.get("COMP_CWORD"): return cwords = os.environ["COMP_WORDS"].split()[1:] cword = int(os.environ["COMP_CWORD"]) try: current = cwords[cword - 1] except IndexError: current = "" parser = create_main_parser() subcommands = list(commands_dict) options = [] # subcommand subcommand_name: str | None = None for word in cwords: if word in subcommands: subcommand_name = word break # subcommand options if subcommand_name is not None: # special case: 'help' subcommand has no options if subcommand_name == "help": sys.exit(1) # special case: list locally installed dists for show and uninstall should_list_installed = not current.startswith("-") and subcommand_name in [ "show", "uninstall", ] if should_list_installed: env = get_default_environment() lc = current.lower() installed = [ dist.canonical_name for dist in env.iter_installed_distributions(local_only=True) if dist.canonical_name.startswith(lc) and dist.canonical_name not in cwords[1:] ] # if there are no dists installed, fall back to option completion if installed: for dist in installed: print(dist) sys.exit(1) should_list_installables = ( not current.startswith("-") and subcommand_name == "install" ) if should_list_installables: for path in auto_complete_paths(current, "path"): print(path) sys.exit(1) subcommand = create_command(subcommand_name) for opt in subcommand.parser.option_list_all: if opt.help != optparse.SUPPRESS_HELP: options += [ (opt_str, opt.nargs) for opt_str in opt._long_opts + opt._short_opts ] # filter out previously specified options from available options prev_opts = [x.split("=")[0] for x in cwords[1 : cword - 1]] options = [(x, v) for (x, v) in options if x not in prev_opts] # filter options by current input options = [(k, v) for k, v in options if k.startswith(current)] # get completion type given cwords and available subcommand options completion_type = get_path_completion_type( cwords, cword, subcommand.parser.option_list_all, ) # get completion files and directories if ``completion_type`` is # ````, ```` or ```` if completion_type: paths = auto_complete_paths(current, completion_type) options = [(path, 0) for path in paths] for option in options: opt_label = option[0] # append '=' to options which require args if option[1] and option[0][:2] == "--": opt_label += "=" print(opt_label) # Complete sub-commands (unless one is already given). if not any(name in cwords for name in subcommand.handler_map()): for handler_name in subcommand.handler_map(): if handler_name.startswith(current): print(handler_name) else: # show main parser options only when necessary opts = [i.option_list for i in parser.option_groups] opts.append(parser.option_list) flattened_opts = chain.from_iterable(opts) if current.startswith("-"): for opt in flattened_opts: if opt.help != optparse.SUPPRESS_HELP: subcommands += opt._long_opts + opt._short_opts else: # get completion type given cwords and all available options completion_type = get_path_completion_type(cwords, cword, flattened_opts) if completion_type: subcommands = list(auto_complete_paths(current, completion_type)) print(" ".join([x for x in subcommands if x.startswith(current)])) sys.exit(1) def get_path_completion_type( cwords: list[str], cword: int, opts: Iterable[Any] ) -> str | None: """Get the type of path completion (``file``, ``dir``, ``path`` or None) :param cwords: same as the environmental variable ``COMP_WORDS`` :param cword: same as the environmental variable ``COMP_CWORD`` :param opts: The available options to check :return: path completion type (``file``, ``dir``, ``path`` or None) """ if cword < 2 or not cwords[cword - 2].startswith("-"): return None for opt in opts: if opt.help == optparse.SUPPRESS_HELP: continue for o in str(opt).split("/"): if cwords[cword - 2].split("=")[0] == o: if not opt.metavar or any( x in ("path", "file", "dir") for x in opt.metavar.split("/") ): return opt.metavar return None def auto_complete_paths(current: str, completion_type: str) -> Iterable[str]: """If ``completion_type`` is ``file`` or ``path``, list all regular files and directories starting with ``current``; otherwise only list directories starting with ``current``. :param current: The word to be completed :param completion_type: path completion type(``file``, ``path`` or ``dir``) :return: A generator of regular files and/or directories """ directory, filename = os.path.split(current) current_path = os.path.abspath(directory) # Don't complete paths if they can't be accessed if not os.access(current_path, os.R_OK): return filename = os.path.normcase(filename) # list all files that start with ``filename`` file_list = ( x for x in os.listdir(current_path) if os.path.normcase(x).startswith(filename) ) for f in file_list: opt = os.path.join(current_path, f) comp_file = os.path.normcase(os.path.join(directory, f)) # complete regular files when there is not ```` after option # complete directories when there is ````, ```` or # ````after option if completion_type != "dir" and os.path.isfile(opt): yield comp_file elif os.path.isdir(opt): yield os.path.join(comp_file, "") ================================================ FILE: src/pip/_internal/cli/base_command.py ================================================ """Base Command class, and related routines""" from __future__ import annotations import logging import logging.config import optparse import os import sys import traceback from optparse import Values from typing import Callable from pip._vendor.rich import reconfigure from pip._vendor.rich import traceback as rich_traceback from pip._internal.cli import cmdoptions from pip._internal.cli.command_context import CommandContextMixIn from pip._internal.cli.parser import ConfigOptionParser, UpdatingDefaultsHelpFormatter from pip._internal.cli.status_codes import ( ERROR, PREVIOUS_BUILD_DIR_ERROR, UNKNOWN_ERROR, VIRTUALENV_NOT_FOUND, ) from pip._internal.exceptions import ( BadCommand, CommandError, DiagnosticPipError, InstallationError, NetworkConnectionError, PreviousBuildDirError, ) from pip._internal.utils.filesystem import check_path_owner from pip._internal.utils.logging import BrokenStdoutLoggingError, setup_logging from pip._internal.utils.misc import get_prog, normalize_path from pip._internal.utils.temp_dir import TempDirectoryTypeRegistry as TempDirRegistry from pip._internal.utils.temp_dir import global_tempdir_manager, tempdir_registry from pip._internal.utils.virtualenv import running_under_virtualenv __all__ = ["Command"] logger = logging.getLogger(__name__) class Command(CommandContextMixIn): usage: str = "" ignore_require_venv: bool = False def __init__(self, name: str, summary: str, isolated: bool = False) -> None: super().__init__() self.name = name self.summary = summary self.parser = ConfigOptionParser( usage=self.usage, prog=f"{get_prog()} {name}", formatter=UpdatingDefaultsHelpFormatter(), add_help_option=False, name=name, description=self.__doc__, isolated=isolated, ) self.tempdir_registry: TempDirRegistry | None = None # Commands should add options to this option group optgroup_name = f"{self.name.capitalize()} Options" self.cmd_opts = optparse.OptionGroup(self.parser, optgroup_name) # Add the general options gen_opts = cmdoptions.make_option_group( cmdoptions.general_group, self.parser, ) self.parser.add_option_group(gen_opts) self.add_options() def add_options(self) -> None: pass def handle_pip_version_check(self, options: Values) -> None: """ This is a no-op so that commands by default do not do the pip version check. """ # Make sure we do the pip version check if the index_group options # are present. assert not hasattr(options, "no_index") def run(self, options: Values, args: list[str]) -> int: raise NotImplementedError def _run_wrapper(self, level_number: int, options: Values, args: list[str]) -> int: def _inner_run() -> int: try: return self.run(options, args) finally: self.handle_pip_version_check(options) if options.debug_mode: rich_traceback.install(show_locals=True) return _inner_run() try: status = _inner_run() assert isinstance(status, int) return status except DiagnosticPipError as exc: logger.error("%s", exc, extra={"rich": True}) logger.debug("Exception information:", exc_info=True) return ERROR except PreviousBuildDirError as exc: logger.critical(str(exc)) logger.debug("Exception information:", exc_info=True) return PREVIOUS_BUILD_DIR_ERROR except ( InstallationError, BadCommand, NetworkConnectionError, ) as exc: logger.critical(str(exc)) logger.debug("Exception information:", exc_info=True) return ERROR except CommandError as exc: logger.critical("%s", exc) logger.debug("Exception information:", exc_info=True) return ERROR except BrokenStdoutLoggingError: # Bypass our logger and write any remaining messages to # stderr because stdout no longer works. print("ERROR: Pipe to stdout was broken", file=sys.stderr) if level_number <= logging.DEBUG: traceback.print_exc(file=sys.stderr) return ERROR except KeyboardInterrupt: logger.critical("Operation cancelled by user") logger.debug("Exception information:", exc_info=True) return ERROR except BaseException: logger.critical("Exception:", exc_info=True) return UNKNOWN_ERROR def parse_args(self, args: list[str]) -> tuple[Values, list[str]]: # factored out for testability return self.parser.parse_args(args) def main(self, args: list[str]) -> int: try: with self.main_context(): return self._main(args) finally: logging.shutdown() def _main(self, args: list[str]) -> int: # We must initialize this before the tempdir manager, otherwise the # configuration would not be accessible by the time we clean up the # tempdir manager. self.tempdir_registry = self.enter_context(tempdir_registry()) # Intentionally set as early as possible so globally-managed temporary # directories are available to the rest of the code. self.enter_context(global_tempdir_manager()) options, args = self.parse_args(args) # Set verbosity so that it can be used elsewhere. self.verbosity = options.verbose - options.quiet if options.debug_mode: self.verbosity = 2 if hasattr(options, "progress_bar") and options.progress_bar == "auto": options.progress_bar = "on" if self.verbosity >= 0 else "off" reconfigure(no_color=options.no_color) level_number = setup_logging( verbosity=self.verbosity, no_color=options.no_color, user_log_file=options.log, ) always_enabled_features = set(options.features_enabled) & set( cmdoptions.ALWAYS_ENABLED_FEATURES ) if always_enabled_features: logger.warning( "The following features are always enabled: %s. ", ", ".join(sorted(always_enabled_features)), ) # Make sure that the --python argument isn't specified after the # subcommand. We can tell, because if --python was specified, # we should only reach this point if we're running in the created # subprocess, which has the _PIP_RUNNING_IN_SUBPROCESS environment # variable set. if options.python and "_PIP_RUNNING_IN_SUBPROCESS" not in os.environ: logger.critical( "The --python option must be placed before the pip subcommand name" ) sys.exit(ERROR) # TODO: Try to get these passing down from the command? # without resorting to os.environ to hold these. # This also affects isolated builds and it should. if options.no_input: os.environ["PIP_NO_INPUT"] = "1" if options.exists_action: os.environ["PIP_EXISTS_ACTION"] = " ".join(options.exists_action) if options.require_venv and not self.ignore_require_venv: # If a venv is required check if it can really be found if not running_under_virtualenv(): logger.critical("Could not find an activated virtualenv (required).") sys.exit(VIRTUALENV_NOT_FOUND) if options.cache_dir: options.cache_dir = normalize_path(options.cache_dir) if not check_path_owner(options.cache_dir): logger.warning( "The directory '%s' or its parent directory is not owned " "or is not writable by the current user. The cache " "has been disabled. Check the permissions and owner of " "that directory. If executing pip with sudo, you should " "use sudo's -H flag.", options.cache_dir, ) options.cache_dir = None if ( "inprocess-build-deps" in options.features_enabled and os.environ.get("PIP_CONSTRAINT", "") and "build-constraint" not in options.features_enabled ): logger.warning( "In-process build dependencies are enabled, " "PIP_CONSTRAINT will have no effect for build dependencies" ) options.features_enabled.append("build-constraint") return self._run_wrapper(level_number, options, args) def handler_map(self) -> dict[str, Callable[[Values, list[str]], None]]: """ map of names to handler actions for commands with sub-actions """ return {} ================================================ FILE: src/pip/_internal/cli/cmdoptions.py ================================================ """ shared options and groups The principle here is to define options once, but *not* instantiate them globally. One reason being that options with action='append' can carry state between parses. pip parses general options twice internally, and shouldn't pass on state. To be consistent, all options will follow this design. """ # The following comment should be removed at some point in the future. # mypy: strict-optional=False from __future__ import annotations import logging import os import pathlib import textwrap from functools import partial from optparse import SUPPRESS_HELP, Option, OptionGroup, OptionParser, Values from textwrap import dedent from typing import Any, Callable from pip._vendor.packaging.utils import canonicalize_name from pip._internal.cli.parser import ConfigOptionParser from pip._internal.exceptions import CommandError from pip._internal.locations import USER_CACHE_DIR, get_src_prefix from pip._internal.models.format_control import FormatControl from pip._internal.models.index import PyPI from pip._internal.models.release_control import ReleaseControl from pip._internal.models.target_python import TargetPython from pip._internal.utils.datetime import parse_iso_datetime from pip._internal.utils.hashes import STRONG_HASHES from pip._internal.utils.misc import strtobool logger = logging.getLogger(__name__) def raise_option_error(parser: OptionParser, option: Option, msg: str) -> None: """ Raise an option parsing error using parser.error(). Args: parser: an OptionParser instance. option: an Option instance. msg: the error text. """ msg = f"{option} error: {msg}" msg = textwrap.fill(" ".join(msg.split())) parser.error(msg) def make_option_group(group: dict[str, Any], parser: ConfigOptionParser) -> OptionGroup: """ Return an OptionGroup object group -- assumed to be dict with 'name' and 'options' keys parser -- an optparse Parser """ option_group = OptionGroup(parser, group["name"]) for option in group["options"]: option_group.add_option(option()) return option_group def check_dist_restriction(options: Values, check_target: bool = False) -> None: """Function for determining if custom platform options are allowed. :param options: The OptionParser options. :param check_target: Whether or not to check if --target is being used. """ dist_restriction_set = any( [ options.python_version, options.platforms, options.abis, options.implementation, ] ) binary_only = FormatControl(set(), {":all:"}) sdist_dependencies_allowed = ( options.format_control != binary_only and not options.ignore_dependencies ) # Installations or downloads using dist restrictions must not combine # source distributions and dist-specific wheels, as they are not # guaranteed to be locally compatible. if dist_restriction_set and sdist_dependencies_allowed: raise CommandError( "When restricting platform and interpreter constraints using " "--python-version, --platform, --abi, or --implementation, " "either --no-deps must be set, or --only-binary=:all: must be " "set and --no-binary must not be set (or must be set to " ":none:)." ) if check_target: if not options.dry_run and dist_restriction_set and not options.target_dir: raise CommandError( "Can not use any platform or abi specific options unless " "installing via '--target' or using '--dry-run'" ) def check_build_constraints(options: Values) -> None: """Function for validating build constraints options. :param options: The OptionParser options. """ if hasattr(options, "build_constraints") and options.build_constraints: if not options.build_isolation: raise CommandError( "--build-constraint cannot be used with --no-build-isolation." ) # Import here to avoid circular imports from pip._internal.network.session import PipSession from pip._internal.req.req_file import get_file_content # Eagerly check build constraints file contents # is valid so that we don't fail in when trying # to check constraints in isolated build process with PipSession() as session: for constraint_file in options.build_constraints: get_file_content(constraint_file, session) def _path_option_check(option: Option, opt: str, value: str) -> str: return os.path.expanduser(value) def _package_name_option_check(option: Option, opt: str, value: str) -> str: return canonicalize_name(value) class PipOption(Option): TYPES = Option.TYPES + ("path", "package_name") TYPE_CHECKER = Option.TYPE_CHECKER.copy() TYPE_CHECKER["package_name"] = _package_name_option_check TYPE_CHECKER["path"] = _path_option_check ########### # options # ########### help_: Callable[..., Option] = partial( Option, "-h", "--help", dest="help", action="help", help="Show help.", ) debug_mode: Callable[..., Option] = partial( Option, "--debug", dest="debug_mode", action="store_true", default=False, help=( "Let unhandled exceptions propagate outside the main subroutine, " "instead of logging them to stderr." ), ) isolated_mode: Callable[..., Option] = partial( Option, "--isolated", dest="isolated_mode", action="store_true", default=False, help=( "Run pip in an isolated mode, ignoring environment variables and user " "configuration." ), ) require_virtualenv: Callable[..., Option] = partial( Option, "--require-virtualenv", "--require-venv", dest="require_venv", action="store_true", default=False, help=( "Allow pip to only run in a virtual environment; exit with an error otherwise." ), ) override_externally_managed: Callable[..., Option] = partial( Option, "--break-system-packages", dest="override_externally_managed", action="store_true", help="Allow pip to modify an EXTERNALLY-MANAGED Python installation", ) python: Callable[..., Option] = partial( Option, "--python", dest="python", help="Run pip with the specified Python interpreter.", ) verbose: Callable[..., Option] = partial( Option, "-v", "--verbose", dest="verbose", action="count", default=0, help="Give more output. Option is additive, and can be used up to 3 times.", ) no_color: Callable[..., Option] = partial( Option, "--no-color", dest="no_color", action="store_true", default=False, help="Suppress colored output.", ) version: Callable[..., Option] = partial( Option, "-V", "--version", dest="version", action="store_true", help="Show version and exit.", ) quiet: Callable[..., Option] = partial( Option, "-q", "--quiet", dest="quiet", action="count", default=0, help=( "Give less output. Option is additive, and can be used up to 3" " times (corresponding to WARNING, ERROR, and CRITICAL logging" " levels)." ), ) progress_bar: Callable[..., Option] = partial( Option, "--progress-bar", dest="progress_bar", type="choice", choices=["auto", "on", "off", "raw"], default="auto", help=( "Specify whether the progress bar should be used. In 'auto'" " mode, --quiet will suppress all progress bars." " [auto, on, off, raw] (default: auto)" ), ) log: Callable[..., Option] = partial( PipOption, "--log", "--log-file", "--local-log", dest="log", metavar="path", type="path", help="Path to a verbose appending log.", ) no_input: Callable[..., Option] = partial( Option, # Don't ask for input "--no-input", dest="no_input", action="store_true", default=False, help="Disable prompting for input.", ) keyring_provider: Callable[..., Option] = partial( Option, "--keyring-provider", dest="keyring_provider", choices=["auto", "disabled", "import", "subprocess"], default="auto", help=( "Enable the credential lookup via the keyring library if user input is allowed." " Specify which mechanism to use [auto, disabled, import, subprocess]." " (default: %default)" ), ) proxy: Callable[..., Option] = partial( Option, "--proxy", dest="proxy", type="str", default="", help="Specify a proxy in the form scheme://[user:passwd@]proxy.server:port.", ) retries: Callable[..., Option] = partial( Option, "--retries", dest="retries", type="int", default=5, help="Maximum attempts to establish a new HTTP connection. (default: %default)", ) resume_retries: Callable[..., Option] = partial( Option, "--resume-retries", dest="resume_retries", type="int", default=5, help="Maximum attempts to resume or restart an incomplete download. " "(default: %default)", ) timeout: Callable[..., Option] = partial( Option, "--timeout", "--default-timeout", metavar="sec", dest="timeout", type="float", default=15, help="Set the socket timeout (default %default seconds).", ) def exists_action() -> Option: return Option( # Option when path already exist "--exists-action", dest="exists_action", type="choice", choices=["s", "i", "w", "b", "a"], default=[], action="append", metavar="action", help="Default action when a path already exists: " "(s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.", ) cert: Callable[..., Option] = partial( PipOption, "--cert", dest="cert", type="path", metavar="path", help=( "Path to PEM-encoded CA certificate bundle. " "If provided, overrides the default. " "See 'SSL Certificate Verification' in pip documentation " "for more information." ), ) client_cert: Callable[..., Option] = partial( PipOption, "--client-cert", dest="client_cert", type="path", default=None, metavar="path", help="Path to SSL client certificate, a single file containing the " "private key and the certificate in PEM format.", ) index_url: Callable[..., Option] = partial( Option, "-i", "--index-url", "--pypi-url", dest="index_url", metavar="URL", default=PyPI.simple_url, help="Base URL of the Python Package Index (default %default). " "This should point to a repository compliant with PEP 503 " "(the simple repository API) or a local directory laid out " "in the same format.", ) def extra_index_url() -> Option: return Option( "--extra-index-url", dest="extra_index_urls", metavar="URL", action="append", default=[], help="Extra URLs of package indexes to use in addition to " "--index-url. Should follow the same rules as " "--index-url.", ) no_index: Callable[..., Option] = partial( Option, "--no-index", dest="no_index", action="store_true", default=False, help="Ignore package index (only looking at --find-links URLs instead).", ) def find_links() -> Option: return Option( "-f", "--find-links", dest="find_links", action="append", default=[], metavar="url", help="If a URL or path to an html file, then parse for links to " "archives such as sdist (.tar.gz) or wheel (.whl) files. " "If a local path or file:// URL that's a directory, " "then look for archives in the directory listing. " "Links to VCS project URLs are not supported.", ) def _handle_uploaded_prior_to( option: Option, opt: str, value: str, parser: OptionParser ) -> None: """ This is an optparse.Option callback for the --uploaded-prior-to option. Parses an ISO 8601 datetime string. If no timezone is specified in the string, local timezone is used. Note: This option only works with indexes that provide upload-time metadata as specified in the simple repository API: https://packaging.python.org/en/latest/specifications/simple-repository-api/ """ if value is None: return None try: uploaded_prior_to = parse_iso_datetime(value) # Use local timezone if no offset is given in the ISO string. if uploaded_prior_to.tzinfo is None: uploaded_prior_to = uploaded_prior_to.astimezone() parser.values.uploaded_prior_to = uploaded_prior_to except ValueError as exc: msg = ( f"invalid value: {value!r}: {exc}. " f"Expected an ISO 8601 datetime string, " f"e.g '2023-01-01' or '2023-01-01T00:00:00Z'" ) raise_option_error(parser, option=option, msg=msg) def uploaded_prior_to() -> Option: return Option( "--uploaded-prior-to", dest="uploaded_prior_to", metavar="datetime", action="callback", callback=_handle_uploaded_prior_to, type="str", help=( "Only consider packages uploaded prior to the given date time. " "Accepts ISO 8601 strings (e.g., '2023-01-01T00:00:00Z'). " "Uses local timezone if none specified. Only effective when " "installing from indexes that provide upload-time metadata." ), ) def trusted_host() -> Option: return Option( "--trusted-host", dest="trusted_hosts", action="append", metavar="HOSTNAME", default=[], help="Mark this host or host:port pair as trusted, even though it " "does not have valid or any HTTPS.", ) def constraints() -> Option: return Option( "-c", "--constraint", dest="constraints", action="append", default=[], metavar="file", help="Constrain versions using the given constraints file. " "This option can be used multiple times.", ) def build_constraints() -> Option: return Option( "--build-constraint", dest="build_constraints", action="append", type="str", default=[], metavar="file", help=( "Constrain build dependencies using the given constraints file. " "This option can be used multiple times." ), ) def requirements() -> Option: return Option( "-r", "--requirement", dest="requirements", action="append", default=[], metavar="file", help="Install from the given requirements file. " "This option can be used multiple times.", ) def requirements_from_scripts() -> Option: return Option( "--requirements-from-script", action="append", default=[], dest="requirements_from_scripts", metavar="file", help="Install dependencies of the given script file" "as defined by PEP 723 inline metadata. ", ) def editable() -> Option: return Option( "-e", "--editable", dest="editables", action="append", default=[], metavar="path/url", help=( "Install a project in editable mode (i.e. setuptools " '"develop mode") from a local project path or a VCS url.' ), ) def _handle_src(option: Option, opt_str: str, value: str, parser: OptionParser) -> None: value = os.path.abspath(value) setattr(parser.values, option.dest, value) src: Callable[..., Option] = partial( PipOption, "--src", "--source", "--source-dir", "--source-directory", dest="src_dir", type="path", metavar="dir", default=get_src_prefix(), action="callback", callback=_handle_src, help="Directory to check out editable projects into. " 'The default in a virtualenv is "/src". ' 'The default for global installs is "/src".', ) def _get_format_control(values: Values, option: Option) -> Any: """Get a format_control object.""" return getattr(values, option.dest) def _handle_no_binary( option: Option, opt_str: str, value: str, parser: OptionParser ) -> None: existing = _get_format_control(parser.values, option) FormatControl.handle_mutual_excludes( value, existing.no_binary, existing.only_binary, ) def _handle_only_binary( option: Option, opt_str: str, value: str, parser: OptionParser ) -> None: existing = _get_format_control(parser.values, option) FormatControl.handle_mutual_excludes( value, existing.only_binary, existing.no_binary, ) def no_binary() -> Option: format_control = FormatControl(set(), set()) return Option( "--no-binary", dest="format_control", action="callback", callback=_handle_no_binary, type="str", default=format_control, help="Do not use binary packages. Can be supplied multiple times, and " 'each time adds to the existing value. Accepts either ":all:" to ' 'disable all binary packages, ":none:" to empty the set (notice ' "the colons), or one or more package names with commas between " "them (no colons). Note that some packages are tricky to compile " "and may fail to install when this option is used on them.", ) def only_binary() -> Option: format_control = FormatControl(set(), set()) return Option( "--only-binary", dest="format_control", action="callback", callback=_handle_only_binary, type="str", default=format_control, help="Do not use source packages. Can be supplied multiple times, and " 'each time adds to the existing value. Accepts either ":all:" to ' 'disable all source packages, ":none:" to empty the set, or one ' "or more package names with commas between them. Packages " "without binary distributions will fail to install when this " "option is used on them.", ) def _get_release_control(values: Values, option: Option) -> Any: """Get a release_control object.""" return getattr(values, option.dest) def _handle_all_releases( option: Option, opt_str: str, value: str, parser: OptionParser ) -> None: existing = _get_release_control(parser.values, option) existing.handle_mutual_excludes( value, existing.all_releases, existing.only_final, "all_releases", ) def _handle_only_final( option: Option, opt_str: str, value: str, parser: OptionParser ) -> None: existing = _get_release_control(parser.values, option) existing.handle_mutual_excludes( value, existing.only_final, existing.all_releases, "only_final", ) def all_releases() -> Option: release_control = ReleaseControl(set(), set()) return Option( "--all-releases", dest="release_control", action="callback", callback=_handle_all_releases, type="str", default=release_control, help="Allow all release types (including pre-releases) for a package. " "Can be supplied multiple times, and each time adds to the existing " 'value. Accepts either ":all:" to allow pre-releases for all ' 'packages, ":none:" to empty the set (notice the colons), or one or ' "more package names with commas between them (no colons). Cannot be " "used with --pre.", ) def only_final() -> Option: release_control = ReleaseControl(set(), set()) return Option( "--only-final", dest="release_control", action="callback", callback=_handle_only_final, type="str", default=release_control, help="Only allow final releases (no pre-releases) for a package. Can be " "supplied multiple times, and each time adds to the existing value. " 'Accepts either ":all:" to disable pre-releases for all packages, ' '":none:" to empty the set, or one or more package names with commas ' "between them. Cannot be used with --pre.", ) def check_release_control_exclusive(options: Values) -> None: """ Raise an error if --pre is used with --all-releases or --only-final, and transform --pre into --all-releases :all: if used alone. """ if not hasattr(options, "pre") or not options.pre: return release_control = options.release_control if release_control.all_releases or release_control.only_final: raise CommandError("--pre cannot be used with --all-releases or --only-final.") # Transform --pre into --all-releases :all: release_control.all_releases.add(":all:") platforms: Callable[..., Option] = partial( Option, "--platform", dest="platforms", metavar="platform", action="append", default=None, help=( "Only use wheels compatible with . Defaults to the " "platform of the running system. Use this option multiple times to " "specify multiple platforms supported by the target interpreter." ), ) # This was made a separate function for unit-testing purposes. def _convert_python_version(value: str) -> tuple[tuple[int, ...], str | None]: """ Convert a version string like "3", "37", or "3.7.3" into a tuple of ints. :return: A 2-tuple (version_info, error_msg), where `error_msg` is non-None if and only if there was a parsing error. """ if not value: # The empty string is the same as not providing a value. return (None, None) parts = value.split(".") if len(parts) > 3: return ((), "at most three version parts are allowed") if len(parts) == 1: # Then we are in the case of "3" or "37". value = parts[0] if len(value) > 1: parts = [value[0], value[1:]] try: version_info = tuple(int(part) for part in parts) except ValueError: return ((), "each version part must be an integer") return (version_info, None) def _handle_python_version( option: Option, opt_str: str, value: str, parser: OptionParser ) -> None: """ Handle a provided --python-version value. """ version_info, error_msg = _convert_python_version(value) if error_msg is not None: msg = f"invalid --python-version value: {value!r}: {error_msg}" raise_option_error(parser, option=option, msg=msg) parser.values.python_version = version_info python_version: Callable[..., Option] = partial( Option, "--python-version", dest="python_version", metavar="python_version", action="callback", callback=_handle_python_version, type="str", default=None, help=dedent( """\ The Python interpreter version to use for wheel and "Requires-Python" compatibility checks. Defaults to a version derived from the running interpreter. The version can be specified using up to three dot-separated integers (e.g. "3" for 3.0.0, "3.7" for 3.7.0, or "3.7.3"). A major-minor version can also be given as a string without dots (e.g. "37" for 3.7.0). """ ), ) implementation: Callable[..., Option] = partial( Option, "--implementation", dest="implementation", metavar="implementation", default=None, help=( "Only use wheels compatible with Python " "implementation , e.g. 'pp', 'jy', 'cp', " " or 'ip'. If not specified, then the current " "interpreter implementation is used. Use 'py' to force " "implementation-agnostic wheels." ), ) abis: Callable[..., Option] = partial( Option, "--abi", dest="abis", metavar="abi", action="append", default=None, help=( "Only use wheels compatible with Python abi , e.g. 'pypy_41'. " "If not specified, then the current interpreter abi tag is used. " "Use this option multiple times to specify multiple abis supported " "by the target interpreter. Generally you will need to specify " "--implementation, --platform, and --python-version when using this " "option." ), ) def add_target_python_options(cmd_opts: OptionGroup) -> None: cmd_opts.add_option(platforms()) cmd_opts.add_option(python_version()) cmd_opts.add_option(implementation()) cmd_opts.add_option(abis()) def make_target_python(options: Values) -> TargetPython: target_python = TargetPython( platforms=options.platforms, py_version_info=options.python_version, abis=options.abis, implementation=options.implementation, ) return target_python def prefer_binary() -> Option: return Option( "--prefer-binary", dest="prefer_binary", action="store_true", default=False, help=( "Prefer binary packages over source packages, even if the " "source packages are newer." ), ) cache_dir: Callable[..., Option] = partial( PipOption, "--cache-dir", dest="cache_dir", default=USER_CACHE_DIR, metavar="dir", type="path", help="Store the cache data in .", ) def _handle_no_cache_dir( option: Option, opt: str, value: str, parser: OptionParser ) -> None: """ Process a value provided for the --no-cache-dir option. This is an optparse.Option callback for the --no-cache-dir option. """ # The value argument will be None if --no-cache-dir is passed via the # command-line, since the option doesn't accept arguments. However, # the value can be non-None if the option is triggered e.g. by an # environment variable, like PIP_NO_CACHE_DIR=true. if value is not None: # Then parse the string value to get argument error-checking. try: strtobool(value) except ValueError as exc: raise_option_error(parser, option=option, msg=str(exc)) # Originally, setting PIP_NO_CACHE_DIR to a value that strtobool() # converted to 0 (like "false" or "no") caused cache_dir to be disabled # rather than enabled (logic would say the latter). Thus, we disable # the cache directory not just on values that parse to True, but (for # backwards compatibility reasons) also on values that parse to False. # In other words, always set it to False if the option is provided in # some (valid) form. parser.values.cache_dir = False no_cache: Callable[..., Option] = partial( Option, "--no-cache-dir", dest="cache_dir", action="callback", callback=_handle_no_cache_dir, help="Disable the cache.", ) no_deps: Callable[..., Option] = partial( Option, "--no-deps", "--no-dependencies", dest="ignore_dependencies", action="store_true", default=False, help="Don't install package dependencies.", ) def _handle_dependency_group( option: Option, opt: str, value: str, parser: OptionParser ) -> None: """ Process a value provided for the --group option. Splits on the rightmost ":", and validates that the path (if present) ends in `pyproject.toml`. Defaults the path to `pyproject.toml` when one is not given. `:` cannot appear in dependency group names, so this is a safe and simple parse. This is an optparse.Option callback for the dependency_groups option. """ path, sep, groupname = value.rpartition(":") if not sep: path = "pyproject.toml" else: # check for 'pyproject.toml' filenames using pathlib if pathlib.PurePath(path).name != "pyproject.toml": msg = "group paths use 'pyproject.toml' filenames" raise_option_error(parser, option=option, msg=msg) parser.values.dependency_groups.append((path, groupname)) dependency_groups: Callable[..., Option] = partial( Option, "--group", dest="dependency_groups", default=[], type=str, action="callback", callback=_handle_dependency_group, metavar="[path:]group", help='Install a named dependency-group from a "pyproject.toml" file. ' 'If a path is given, the name of the file must be "pyproject.toml". ' 'Defaults to using "pyproject.toml" in the current directory.', ) ignore_requires_python: Callable[..., Option] = partial( Option, "--ignore-requires-python", dest="ignore_requires_python", action="store_true", help="Ignore the Requires-Python information.", ) no_build_isolation: Callable[..., Option] = partial( Option, "--no-build-isolation", dest="build_isolation", action="store_false", default=True, help="Disable isolation when building a modern source distribution. " "Build dependencies specified by PEP 518 must be already installed " "if this option is used.", ) check_build_deps: Callable[..., Option] = partial( Option, "--check-build-dependencies", dest="check_build_deps", action="store_true", default=False, help="Check the build dependencies.", ) use_pep517: Any = partial( Option, "--use-pep517", dest="use_pep517", action="store_true", default=True, help=SUPPRESS_HELP, ) def _handle_config_settings( option: Option, opt_str: str, value: str, parser: OptionParser ) -> None: key, sep, val = value.partition("=") if sep != "=": parser.error(f"Arguments to {opt_str} must be of the form KEY=VAL") dest = getattr(parser.values, option.dest) if dest is None: dest = {} setattr(parser.values, option.dest, dest) if key in dest: if isinstance(dest[key], list): dest[key].append(val) else: dest[key] = [dest[key], val] else: dest[key] = val config_settings: Callable[..., Option] = partial( Option, "-C", "--config-settings", dest="config_settings", type=str, action="callback", callback=_handle_config_settings, metavar="settings", help="Configuration settings to be passed to the build backend. " "Settings take the form KEY=VALUE. Use multiple --config-settings options " "to pass multiple keys to the backend.", ) no_clean: Callable[..., Option] = partial( Option, "--no-clean", action="store_true", default=False, help="Don't clean up build directories.", ) pre: Callable[..., Option] = partial( Option, "--pre", action="store_true", default=False, help="Include pre-release and development versions. By default, " "pip only finds stable versions.", ) json: Callable[..., Option] = partial( Option, "--json", action="store_true", default=False, help="Output data in a machine-readable JSON format.", ) disable_pip_version_check: Callable[..., Option] = partial( Option, "--disable-pip-version-check", dest="disable_pip_version_check", action="store_true", default=False, help="Don't periodically check PyPI to determine whether a new version " "of pip is available for download. Implied with --no-index.", ) root_user_action: Callable[..., Option] = partial( Option, "--root-user-action", dest="root_user_action", default="warn", choices=["warn", "ignore"], help="Action if pip is run as a root user [warn, ignore] (default: warn)", ) def _handle_merge_hash( option: Option, opt_str: str, value: str, parser: OptionParser ) -> None: """Given a value spelled "algo:digest", append the digest to a list pointed to in a dict by the algo name.""" if not parser.values.hashes: parser.values.hashes = {} try: algo, digest = value.split(":", 1) except ValueError: parser.error( f"Arguments to {opt_str} must be a hash name " "followed by a value, like --hash=sha256:" "abcde..." ) if algo not in STRONG_HASHES: parser.error( "Allowed hash algorithms for {} are {}.".format( opt_str, ", ".join(STRONG_HASHES) ) ) parser.values.hashes.setdefault(algo, []).append(digest) hash: Callable[..., Option] = partial( Option, "--hash", # Hash values eventually end up in InstallRequirement.hashes due to # __dict__ copying in process_line(). dest="hashes", action="callback", callback=_handle_merge_hash, type="string", help="Verify that the package's archive matches this " "hash before installing. Example: --hash=sha256:abcdef...", ) require_hashes: Callable[..., Option] = partial( Option, "--require-hashes", dest="require_hashes", action="store_true", default=False, help="Require a hash to check each requirement against, for " "repeatable installs. This option is implied when any package in a " "requirements file has a --hash option.", ) list_path: Callable[..., Option] = partial( PipOption, "--path", dest="path", type="path", action="append", help="Restrict to the specified installation path for listing " "packages (can be used multiple times).", ) def check_list_path_option(options: Values) -> None: if options.path and (options.user or options.local): raise CommandError("Cannot combine '--path' with '--user' or '--local'") list_exclude: Callable[..., Option] = partial( PipOption, "--exclude", dest="excludes", action="append", metavar="package", type="package_name", help="Exclude specified package from the output", ) no_python_version_warning: Callable[..., Option] = partial( Option, "--no-python-version-warning", dest="no_python_version_warning", action="store_true", default=False, help=SUPPRESS_HELP, # No-op, a hold-over from the Python 2->3 transition. ) # Features that are now always on. A warning is printed if they are used. ALWAYS_ENABLED_FEATURES = [ "truststore", # always on since 24.2 "no-binary-enable-wheel-cache", # always on since 23.1 ] use_new_feature: Callable[..., Option] = partial( Option, "--use-feature", dest="features_enabled", metavar="feature", action="append", default=[], choices=[ "fast-deps", "build-constraint", "inprocess-build-deps", ] + ALWAYS_ENABLED_FEATURES, help="Enable new functionality, that may be backward incompatible.", ) use_deprecated_feature: Callable[..., Option] = partial( Option, "--use-deprecated", dest="deprecated_features_enabled", metavar="feature", action="append", default=[], choices=[ "legacy-resolver", "legacy-certs", ], help=("Enable deprecated functionality, that will be removed in the future."), ) ########## # groups # ########## general_group: dict[str, Any] = { "name": "General Options", "options": [ help_, debug_mode, isolated_mode, require_virtualenv, python, verbose, version, quiet, log, no_input, keyring_provider, proxy, retries, timeout, exists_action, trusted_host, cert, client_cert, cache_dir, no_cache, disable_pip_version_check, no_color, no_python_version_warning, use_new_feature, use_deprecated_feature, resume_retries, ], } index_group: dict[str, Any] = { "name": "Package Index Options", "options": [ index_url, extra_index_url, no_index, find_links, uploaded_prior_to, ], } package_selection_group: dict[str, Any] = { "name": "Package Selection Options", "options": [ pre, all_releases, only_final, no_binary, only_binary, prefer_binary, ], } ================================================ FILE: src/pip/_internal/cli/command_context.py ================================================ from collections.abc import Generator from contextlib import AbstractContextManager, ExitStack, contextmanager from typing import TypeVar _T = TypeVar("_T", covariant=True) class CommandContextMixIn: def __init__(self) -> None: super().__init__() self._in_main_context = False self._main_context = ExitStack() @contextmanager def main_context(self) -> Generator[None, None, None]: assert not self._in_main_context self._in_main_context = True try: with self._main_context: yield finally: self._in_main_context = False def enter_context(self, context_provider: AbstractContextManager[_T]) -> _T: assert self._in_main_context return self._main_context.enter_context(context_provider) ================================================ FILE: src/pip/_internal/cli/index_command.py ================================================ """ Contains command classes which may interact with an index / the network. Unlike its sister module, req_command, this module still uses lazy imports so commands which don't always hit the network (e.g. list w/o --outdated or --uptodate) don't need waste time importing PipSession and friends. """ from __future__ import annotations import logging import os import sys from functools import lru_cache from optparse import Values from typing import TYPE_CHECKING from pip._vendor import certifi from pip._internal.cli.base_command import Command from pip._internal.cli.command_context import CommandContextMixIn if TYPE_CHECKING: from ssl import SSLContext from pip._vendor.packaging.utils import NormalizedName from pip._internal.network.session import PipSession logger = logging.getLogger(__name__) @lru_cache def _create_truststore_ssl_context() -> SSLContext | None: if sys.version_info < (3, 10): logger.debug("Disabling truststore because Python version isn't 3.10+") return None try: import ssl except ImportError: logger.warning("Disabling truststore since ssl support is missing") return None try: from pip._vendor import truststore except ImportError: logger.warning("Disabling truststore because platform isn't supported") return None ctx = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ctx.load_verify_locations(certifi.where()) return ctx class SessionCommandMixin(CommandContextMixIn): """ A class mixin for command classes needing _build_session(). """ def __init__(self) -> None: super().__init__() self._session: PipSession | None = None @classmethod def _get_index_urls(cls, options: Values) -> list[str] | None: """Return a list of index urls from user-provided options.""" index_urls = [] if not getattr(options, "no_index", False): url = getattr(options, "index_url", None) if url: index_urls.append(url) urls = getattr(options, "extra_index_urls", None) if urls: index_urls.extend(urls) # Return None rather than an empty list return index_urls or None def get_default_session(self, options: Values) -> PipSession: """Get a default-managed session.""" if self._session is None: self._session = self.enter_context(self._build_session(options)) # there's no type annotation on requests.Session, so it's # automatically ContextManager[Any] and self._session becomes Any, # then https://github.com/python/mypy/issues/7696 kicks in assert self._session is not None return self._session def _build_session( self, options: Values, retries: int | None = None, timeout: int | None = None, ) -> PipSession: from pip._internal.network.session import PipSession cache_dir = options.cache_dir assert not cache_dir or os.path.isabs(cache_dir) if "legacy-certs" not in options.deprecated_features_enabled: ssl_context = _create_truststore_ssl_context() else: ssl_context = None session = PipSession( cache=os.path.join(cache_dir, "http-v2") if cache_dir else None, retries=retries if retries is not None else options.retries, resume_retries=options.resume_retries, trusted_hosts=options.trusted_hosts, index_urls=self._get_index_urls(options), ssl_context=ssl_context, ) # Handle custom ca-bundles from the user if options.cert: session.verify = options.cert # Handle SSL client certificate if options.client_cert: session.cert = options.client_cert # Handle timeouts if options.timeout or timeout: session.timeout = timeout if timeout is not None else options.timeout # Handle configured proxies if options.proxy: session.proxies = { "http": options.proxy, "https": options.proxy, } session.trust_env = False session.pip_proxy = options.proxy # Determine if we can prompt the user for authentication or not session.auth.prompting = not options.no_input session.auth.keyring_provider = options.keyring_provider return session def _pip_self_version_check(session: PipSession, options: Values) -> None: from pip._internal.self_outdated_check import pip_self_version_check as check check(session, options) class IndexGroupCommand(Command, SessionCommandMixin): """ Abstract base class for commands with the index_group options. This also corresponds to the commands that permit the pip version check. """ def should_exclude_prerelease( self, options: Values, package_name: NormalizedName ) -> bool: """ Determine if pre-releases should be excluded for a package. """ # Check per-package release control settings if options.release_control: allow_prereleases = options.release_control.allows_prereleases(package_name) if allow_prereleases is True: return False # Include pre-releases elif allow_prereleases is False: return True # Exclude pre-releases # No specific setting: exclude prereleases by default return True def handle_pip_version_check(self, options: Values) -> None: """ Do the pip version check if not disabled. This overrides the default behavior of not doing the check. """ # Make sure the index_group options are present. assert hasattr(options, "no_index") if options.disable_pip_version_check or options.no_index: return try: # Otherwise, check if we're using the latest version of pip available. session = self._build_session( options, retries=0, timeout=min(5, options.timeout), ) with session: _pip_self_version_check(session, options) except Exception: logger.warning("There was an error checking the latest version of pip.") logger.debug("See below for error", exc_info=True) ================================================ FILE: src/pip/_internal/cli/main.py ================================================ """Primary application entrypoint.""" from __future__ import annotations import locale import logging import os import sys import warnings logger = logging.getLogger(__name__) # Do not import and use main() directly! Using it directly is actively # discouraged by pip's maintainers. The name, location and behavior of # this function is subject to change, so calling it directly is not # portable across different pip versions. # In addition, running pip in-process is unsupported and unsafe. This is # elaborated in detail at # https://pip.pypa.io/en/stable/user_guide/#using-pip-from-your-program. # That document also provides suggestions that should work for nearly # all users that are considering importing and using main() directly. # However, we know that certain users will still want to invoke pip # in-process. If you understand and accept the implications of using pip # in an unsupported manner, the best approach is to use runpy to avoid # depending on the exact location of this entry point. # The following example shows how to use runpy to invoke pip in that # case: # # sys.argv = ["pip", your, args, here] # runpy.run_module("pip", run_name="__main__") # # Note that this will exit the process after running, unlike a direct # call to main. As it is not safe to do any processing after calling # main, this should not be an issue in practice. def main(args: list[str] | None = None) -> int: # NOTE: Lazy imports to speed up import of this module, # which is imported from the pip console script. This doesn't # speed up normal pip execution, but might be important in the future # if we use ``multiprocessing`` module, # which imports __main__ for each spawned subprocess. from pip._internal.cli.autocompletion import autocomplete from pip._internal.cli.main_parser import parse_command from pip._internal.commands import create_command from pip._internal.exceptions import PipError from pip._internal.utils import deprecation if args is None: args = sys.argv[1:] # Suppress the pkg_resources deprecation warning # Note - we use a module of .*pkg_resources to cover # the normal case (pip._vendor.pkg_resources) and the # devendored case (a bare pkg_resources) warnings.filterwarnings( action="ignore", category=DeprecationWarning, module=".*pkg_resources" ) # Configure our deprecation warnings to be sent through loggers deprecation.install_warning_logger() autocomplete() try: cmd_name, cmd_args = parse_command(args) except PipError as exc: sys.stderr.write(f"ERROR: {exc}") sys.stderr.write(os.linesep) sys.exit(1) # Needed for locale.getpreferredencoding(False) to work # in pip._internal.utils.encoding.auto_decode try: locale.setlocale(locale.LC_ALL, "") except locale.Error as e: # setlocale can apparently crash if locale are uninitialized logger.debug("Ignoring error %s when setting locale", e) command = create_command(cmd_name, isolated=("--isolated" in cmd_args)) return command.main(cmd_args) ================================================ FILE: src/pip/_internal/cli/main_parser.py ================================================ """A single place for constructing and exposing the main parser""" from __future__ import annotations import os import subprocess import sys from pip._vendor.rich.markup import escape from pip._internal.build_env import get_runnable_pip from pip._internal.cli import cmdoptions from pip._internal.cli.parser import ConfigOptionParser, UpdatingDefaultsHelpFormatter from pip._internal.commands import commands_dict, get_similar_commands from pip._internal.exceptions import CommandError from pip._internal.utils.misc import get_pip_version, get_prog __all__ = ["create_main_parser", "parse_command"] def create_main_parser() -> ConfigOptionParser: """Creates and returns the main parser for pip's CLI""" parser = ConfigOptionParser( usage="\n%prog [options]", add_help_option=False, formatter=UpdatingDefaultsHelpFormatter(), name="global", prog=get_prog(), ) parser.disable_interspersed_args() parser.version = get_pip_version() # add the general options gen_opts = cmdoptions.make_option_group(cmdoptions.general_group, parser) parser.add_option_group(gen_opts) # so the help formatter knows parser.main = True # type: ignore # create command listing for description description = [""] + [ f"[optparse.longargs]{name:27}[/] {escape(command_info.summary)}" for name, command_info in commands_dict.items() ] parser.description = "\n".join(description) return parser def identify_python_interpreter(python: str) -> str | None: # If the named file exists, use it. # If it's a directory, assume it's a virtual environment and # look for the environment's Python executable. if os.path.exists(python): if os.path.isdir(python): # bin/python for Unix, Scripts/python.exe for Windows # Try both in case of odd cases like cygwin. for exe in ("bin/python", "Scripts/python.exe"): py = os.path.join(python, exe) if os.path.exists(py): return py else: return python # Could not find the interpreter specified return None def parse_command(args: list[str]) -> tuple[str, list[str]]: parser = create_main_parser() # Note: parser calls disable_interspersed_args(), so the result of this # call is to split the initial args into the general options before the # subcommand and everything else. # For example: # args: ['--timeout=5', 'install', '--user', 'INITools'] # general_options: ['--timeout==5'] # args_else: ['install', '--user', 'INITools'] general_options, args_else = parser.parse_args(args) # --python if general_options.python and "_PIP_RUNNING_IN_SUBPROCESS" not in os.environ: # Re-invoke pip using the specified Python interpreter interpreter = identify_python_interpreter(general_options.python) if interpreter is None: raise CommandError( f"Could not locate Python interpreter {general_options.python}" ) pip_cmd = [ interpreter, get_runnable_pip(), ] pip_cmd.extend(args) # Set a flag so the child doesn't re-invoke itself, causing # an infinite loop. os.environ["_PIP_RUNNING_IN_SUBPROCESS"] = "1" returncode = 0 try: proc = subprocess.run(pip_cmd) returncode = proc.returncode except (subprocess.SubprocessError, OSError) as exc: raise CommandError(f"Failed to run pip under {interpreter}: {exc}") sys.exit(returncode) # --version if general_options.version: sys.stdout.write(parser.version) sys.stdout.write(os.linesep) sys.exit() # pip || pip help -> print_help() if not args_else or (args_else[0] == "help" and len(args_else) == 1): parser.print_help() sys.exit() # the subcommand name cmd_name = args_else[0] if cmd_name not in commands_dict: guess = get_similar_commands(cmd_name) msg = [f'unknown command "{cmd_name}"'] if guess: msg.append(f'maybe you meant "{guess}"') raise CommandError(" - ".join(msg)) # all the args without the subcommand cmd_args = args[:] cmd_args.remove(cmd_name) return cmd_name, cmd_args ================================================ FILE: src/pip/_internal/cli/parser.py ================================================ """Base option parser setup""" from __future__ import annotations import logging import optparse import os import re import shutil import sys import textwrap from collections.abc import Generator from contextlib import suppress from typing import Any, NoReturn from pip._vendor.rich.markup import escape from pip._vendor.rich.theme import Theme from pip._internal.cli.status_codes import UNKNOWN_ERROR from pip._internal.configuration import Configuration, ConfigurationError from pip._internal.utils.logging import PipConsole from pip._internal.utils.misc import redact_auth_from_url, strtobool logger = logging.getLogger(__name__) class PrettyHelpFormatter(optparse.IndentedHelpFormatter): """A prettier/less verbose help formatter for optparse.""" styles = { "optparse.shortargs": "green", "optparse.longargs": "cyan", "optparse.groups": "bold blue", "optparse.metavar": "yellow", } highlights = { r"\s(-{1}[\w]+[\w-]*)": "shortargs", # highlight -letter as short args r"\s(-{2}[\w]+[\w-]*)": "longargs", # highlight --words as long args } def __init__(self, *args: Any, **kwargs: Any) -> None: # help position must be aligned with __init__.parseopts.description kwargs["max_help_position"] = 30 kwargs["indent_increment"] = 1 kwargs["width"] = shutil.get_terminal_size()[0] - 2 super().__init__(*args, **kwargs) def format_option_strings(self, option: optparse.Option) -> str: """Return a comma-separated list of option strings and metavars.""" opts = [] if option._short_opts: opts.append(f"[optparse.shortargs]{option._short_opts[0]}[/]") if option._long_opts: opts.append(f"[optparse.longargs]{option._long_opts[0]}[/]") if len(opts) > 1: opts.insert(1, ", ") if option.takes_value(): assert option.dest is not None metavar = option.metavar or option.dest.lower() opts.append(f" [optparse.metavar]<{escape(metavar.lower())}>[/]") return "".join(opts) def format_option(self, option: optparse.Option) -> str: """Overridden method with Rich support.""" # fmt: off result = [] opts = self.option_strings[option] opt_width = self.help_position - self.current_indent - 2 # Remove the rich style tags before calculating width during # text wrap calculations. Also store the length removed to adjust # the padding in the else branch. stripped = re.sub(r"(\[[a-z.]+\])|(\[\/\])", "", opts) style_tag_length = len(opts) - len(stripped) if len(stripped) > opt_width: opts = "%*s%s\n" % (self.current_indent, "", opts) # noqa: UP031 indent_first = self.help_position else: # start help on same line as opts opts = "%*s%-*s " % (self.current_indent, "", # noqa: UP031 opt_width + style_tag_length, opts) indent_first = 0 result.append(opts) if option.help: help_text = self.expand_default(option) help_lines = textwrap.wrap(help_text, self.help_width) result.append("%*s%s\n" % (indent_first, "", help_lines[0])) # noqa: UP031 result.extend(["%*s%s\n" % (self.help_position, "", line) # noqa: UP031 for line in help_lines[1:]]) elif opts[-1] != "\n": result.append("\n") return "".join(result) # fmt: on def format_heading(self, heading: str) -> str: if heading == "Options": return "" return "[optparse.groups]" + escape(heading) + ":[/]\n" def format_usage(self, usage: str) -> str: """ Ensure there is only one newline between usage and the first heading if there is no description. """ contents = self.indent_lines(textwrap.dedent(usage), " ") msg = f"\n[optparse.groups]Usage:[/] {escape(contents)}\n" return msg def format_description(self, description: str | None) -> str: # leave full control over description to us if description: if hasattr(self.parser, "main"): label = "[optparse.groups]Commands:[/]" else: label = "[optparse.groups]Description:[/]" # some doc strings have initial newlines, some don't description = description.lstrip("\n") # some doc strings have final newlines and spaces, some don't description = description.rstrip() # dedent, then reindent description = self.indent_lines(textwrap.dedent(description), " ") description = f"{label}\n{description}\n" return description else: return "" def format_epilog(self, epilog: str | None) -> str: # leave full control over epilog to us if epilog: return escape(epilog) else: return "" def expand_default(self, option: optparse.Option) -> str: """Overridden HelpFormatter.expand_default() which colorizes flags.""" help = escape(super().expand_default(option)) for regex, style in self.highlights.items(): help = re.sub(regex, rf"[optparse.{style}] \1[/]", help) return help def indent_lines(self, text: str, indent: str) -> str: new_lines = [indent + line for line in text.split("\n")] return "\n".join(new_lines) class UpdatingDefaultsHelpFormatter(PrettyHelpFormatter): """Custom help formatter for use in ConfigOptionParser. This is updates the defaults before expanding them, allowing them to show up correctly in the help listing. Also redact auth from url type options """ def expand_default(self, option: optparse.Option) -> str: default_values = None if self.parser is not None: assert isinstance(self.parser, ConfigOptionParser) self.parser._update_defaults(self.parser.defaults) assert option.dest is not None default_values = self.parser.defaults.get(option.dest) help_text = super().expand_default(option) if default_values and option.metavar == "URL": if isinstance(default_values, str): default_values = [default_values] # If its not a list, we should abort and just return the help text if not isinstance(default_values, list): default_values = [] for val in default_values: help_text = help_text.replace(val, redact_auth_from_url(val)) return help_text class CustomOptionParser(optparse.OptionParser): def insert_option_group( self, idx: int, *args: Any, **kwargs: Any ) -> optparse.OptionGroup: """Insert an OptionGroup at a given position.""" group = self.add_option_group(*args, **kwargs) self.option_groups.pop() self.option_groups.insert(idx, group) return group @property def option_list_all(self) -> list[optparse.Option]: """Get a list of all options, including those in option groups.""" res = self.option_list[:] for i in self.option_groups: res.extend(i.option_list) return res class ConfigOptionParser(CustomOptionParser): """Custom option parser which updates its defaults by checking the configuration files and environmental variables""" def __init__( self, *args: Any, name: str, isolated: bool = False, **kwargs: Any, ) -> None: self.name = name self.config = Configuration(isolated) assert self.name super().__init__(*args, **kwargs) def check_default(self, option: optparse.Option, key: str, val: Any) -> Any: try: return option.check_value(key, val) except optparse.OptionValueError as exc: print(f"An error occurred during configuration: {exc}") sys.exit(3) def _get_ordered_configuration_items( self, ) -> Generator[tuple[str, Any], None, None]: # Configuration gives keys in an unordered manner. Order them. override_order = ["global", self.name, ":env:"] # Pool the options into different groups # Use a dict because we need to implement the fallthrough logic after PR 12201 # was merged which removed the fallthrough logic for options section_items_dict: dict[str, dict[str, Any]] = { name: {} for name in override_order } for _, value in self.config.items(): for section_key, val in value.items(): section, key = section_key.split(".", 1) if section in override_order: section_items_dict[section][key] = val # Now that we a dict of items per section, convert to list of tuples # Make sure we completely remove empty values again section_items = { name: [(k, v) for k, v in section_items_dict[name].items() if v] for name in override_order } # Yield each group in their override order for section in override_order: yield from section_items[section] def _update_defaults(self, defaults: dict[str, Any]) -> dict[str, Any]: """Updates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).""" # Accumulate complex default state. self.values = optparse.Values(self.defaults) late_eval = set() # Then set the options with those values for key, val in self._get_ordered_configuration_items(): # '--' because configuration supports only long names option = self.get_option("--" + key) # Ignore options not present in this parser. E.g. non-globals put # in [global] by users that want them to apply to all applicable # commands. if option is None: continue assert option.dest is not None if option.action in ("store_true", "store_false"): try: val = strtobool(val) except ValueError: self.error( f"{val} is not a valid value for {key} option, " "please specify a boolean value like yes/no, " "true/false or 1/0 instead." ) elif option.action == "count": with suppress(ValueError): val = strtobool(val) with suppress(ValueError): val = int(val) if not isinstance(val, int) or val < 0: self.error( f"{val} is not a valid value for {key} option, " "please instead specify either a non-negative integer " "or a boolean value like yes/no or false/true " "which is equivalent to 1/0." ) elif option.action == "append": val = val.split() val = [self.check_default(option, key, v) for v in val] elif option.action == "callback": assert option.callback is not None late_eval.add(option.dest) opt_str = option.get_opt_string() val = option.convert_value(opt_str, val) # From take_action args = option.callback_args or () kwargs = option.callback_kwargs or {} option.callback(option, opt_str, val, self, *args, **kwargs) else: val = self.check_default(option, key, val) defaults[option.dest] = val for key in late_eval: defaults[key] = getattr(self.values, key) self.values = None return defaults def get_default_values(self) -> optparse.Values: """Overriding to make updating the defaults after instantiation of the option parser possible, _update_defaults() does the dirty work.""" if not self.process_default_values: # Old, pre-Optik 1.5 behaviour. return optparse.Values(self.defaults) # Load the configuration, or error out in case of an error try: self.config.load() except ConfigurationError as err: self.exit(UNKNOWN_ERROR, str(err)) defaults = self._update_defaults(self.defaults.copy()) # ours for option in self._get_all_options(): assert option.dest is not None default = defaults.get(option.dest) if isinstance(default, str): opt_str = option.get_opt_string() defaults[option.dest] = option.check_value(opt_str, default) return optparse.Values(defaults) def error(self, msg: str) -> NoReturn: self.print_usage(sys.stderr) self.exit(UNKNOWN_ERROR, f"{msg}\n") def print_help(self, file: Any = None) -> None: # This is unfortunate but necessary since arguments may have not been # parsed yet at this point, so detect --no-color manually. no_color = ( "--no-color" in sys.argv or bool(strtobool(os.environ.get("PIP_NO_COLOR", "no") or "no")) or "NO_COLOR" in os.environ ) console = PipConsole( theme=Theme(PrettyHelpFormatter.styles), no_color=no_color, file=file ) console.print(self.format_help().rstrip(), highlight=False) ================================================ FILE: src/pip/_internal/cli/progress_bars.py ================================================ from __future__ import annotations import functools import sys from collections.abc import Generator, Iterable, Iterator from typing import TYPE_CHECKING, Callable, Literal, TypeVar from pip._vendor.rich.progress import ( BarColumn, DownloadColumn, FileSizeColumn, MofNCompleteColumn, Progress, ProgressColumn, SpinnerColumn, TextColumn, TimeElapsedColumn, TimeRemainingColumn, TransferSpeedColumn, ) from pip._internal.cli.spinners import RateLimiter from pip._internal.utils.logging import get_console, get_indentation if TYPE_CHECKING: from pip._internal.req.req_install import InstallRequirement T = TypeVar("T") ProgressRenderer = Callable[[Iterable[T]], Iterator[T]] BarType = Literal["on", "off", "raw"] def _rich_download_progress_bar( iterable: Iterable[bytes], *, bar_type: BarType, size: int | None, initial_progress: int | None = None, ) -> Generator[bytes, None, None]: assert bar_type == "on", "This should only be used in the default mode." if not size: total = float("inf") columns: tuple[ProgressColumn, ...] = ( TextColumn("[progress.description]{task.description}"), SpinnerColumn("line", speed=1.5), FileSizeColumn(), TransferSpeedColumn(), TimeElapsedColumn(), ) else: total = size columns = ( TextColumn("[progress.description]{task.description}"), BarColumn(), DownloadColumn(), TransferSpeedColumn(), TextColumn("{task.fields[time_description]}"), TimeRemainingColumn(elapsed_when_finished=True), ) progress = Progress(*columns, refresh_per_second=5) task_id = progress.add_task( " " * (get_indentation() + 2), total=total, time_description="eta" ) if initial_progress is not None: progress.update(task_id, advance=initial_progress) with progress: for chunk in iterable: yield chunk progress.update(task_id, advance=len(chunk)) progress.update(task_id, time_description="") def _rich_install_progress_bar( iterable: Iterable[InstallRequirement], *, total: int ) -> Iterator[InstallRequirement]: columns = ( TextColumn("{task.fields[indent]}"), BarColumn(), MofNCompleteColumn(), TextColumn("{task.description}"), ) console = get_console() bar = Progress(*columns, refresh_per_second=6, console=console, transient=True) # Hiding the progress bar at initialization forces a refresh cycle to occur # until the bar appears, avoiding very short flashes. task = bar.add_task("", total=total, indent=" " * get_indentation(), visible=False) with bar: for req in iterable: bar.update(task, description=rf"\[{req.name}]", visible=True) yield req bar.advance(task) def _raw_progress_bar( iterable: Iterable[bytes], *, size: int | None, initial_progress: int | None = None, ) -> Generator[bytes, None, None]: def write_progress(current: int, total: int) -> None: sys.stdout.write(f"Progress {current} of {total}\n") sys.stdout.flush() current = initial_progress or 0 total = size or 0 rate_limiter = RateLimiter(0.25) write_progress(current, total) for chunk in iterable: current += len(chunk) if rate_limiter.ready() or current == total: write_progress(current, total) rate_limiter.reset() yield chunk def get_download_progress_renderer( *, bar_type: BarType, size: int | None = None, initial_progress: int | None = None ) -> ProgressRenderer[bytes]: """Get an object that can be used to render the download progress. Returns a callable, that takes an iterable to "wrap". """ if bar_type == "on": return functools.partial( _rich_download_progress_bar, bar_type=bar_type, size=size, initial_progress=initial_progress, ) elif bar_type == "raw": return functools.partial( _raw_progress_bar, size=size, initial_progress=initial_progress, ) else: return iter # no-op, when passed an iterator def get_install_progress_renderer( *, bar_type: BarType, total: int ) -> ProgressRenderer[InstallRequirement]: """Get an object that can be used to render the install progress. Returns a callable, that takes an iterable to "wrap". """ if bar_type == "on": return functools.partial(_rich_install_progress_bar, total=total) else: return iter ================================================ FILE: src/pip/_internal/cli/req_command.py ================================================ """Contains the RequirementCommand base class. This class is in a separate module so the commands that do not always need PackageFinder capability don't unnecessarily import the PackageFinder machinery and all its vendored dependencies, etc. """ from __future__ import annotations import logging import os from functools import partial from optparse import Values from typing import Any, Callable, TypeVar from pip._internal.build_env import ( BuildEnvironmentInstaller, InprocessBuildEnvironmentInstaller, SubprocessBuildEnvironmentInstaller, ) from pip._internal.cache import WheelCache from pip._internal.cli import cmdoptions from pip._internal.cli.cmdoptions import make_target_python from pip._internal.cli.index_command import IndexGroupCommand from pip._internal.cli.index_command import SessionCommandMixin as SessionCommandMixin from pip._internal.exceptions import ( CommandError, PreviousBuildDirError, UnsupportedPythonVersion, ) from pip._internal.index.collector import LinkCollector from pip._internal.index.package_finder import PackageFinder from pip._internal.models.selection_prefs import SelectionPreferences from pip._internal.models.target_python import TargetPython from pip._internal.network.session import PipSession from pip._internal.operations.build.build_tracker import BuildTracker from pip._internal.operations.prepare import RequirementPreparer from pip._internal.req.constructors import ( install_req_from_editable, install_req_from_line, install_req_from_parsed_requirement, install_req_from_req_string, ) from pip._internal.req.pep723 import PEP723Exception, pep723_metadata from pip._internal.req.req_dependency_group import parse_dependency_groups from pip._internal.req.req_file import parse_requirements from pip._internal.req.req_install import InstallRequirement from pip._internal.resolution.base import BaseResolver from pip._internal.utils.packaging import check_requires_python from pip._internal.utils.temp_dir import ( TempDirectory, TempDirectoryTypeRegistry, tempdir_kinds, ) logger = logging.getLogger(__name__) def should_ignore_regular_constraints(options: Values) -> bool: """ Check if regular constraints should be ignored because we are in a isolated build process and build constraints feature is enabled but no build constraints were passed. """ return os.environ.get("_PIP_IN_BUILD_IGNORE_CONSTRAINTS") == "1" KEEPABLE_TEMPDIR_TYPES = [ tempdir_kinds.BUILD_ENV, tempdir_kinds.EPHEM_WHEEL_CACHE, tempdir_kinds.REQ_BUILD, ] _CommandT = TypeVar("_CommandT", bound="RequirementCommand") def with_cleanup( func: Callable[[_CommandT, Values, list[str]], int], ) -> Callable[[_CommandT, Values, list[str]], int]: """Decorator for common logic related to managing temporary directories. """ def configure_tempdir_registry(registry: TempDirectoryTypeRegistry) -> None: for t in KEEPABLE_TEMPDIR_TYPES: registry.set_delete(t, False) def wrapper(self: _CommandT, options: Values, args: list[str]) -> int: assert self.tempdir_registry is not None if options.no_clean: configure_tempdir_registry(self.tempdir_registry) try: return func(self, options, args) except PreviousBuildDirError: # This kind of conflict can occur when the user passes an explicit # build directory with a pre-existing folder. In that case we do # not want to accidentally remove it. configure_tempdir_registry(self.tempdir_registry) raise return wrapper def parse_constraint_files( constraint_files: list[str], finder: PackageFinder, options: Values, session: PipSession, ) -> list[InstallRequirement]: requirements = [] for filename in constraint_files: for parsed_req in parse_requirements( filename, constraint=True, finder=finder, options=options, session=session, ): req_to_add = install_req_from_parsed_requirement( parsed_req, isolated=options.isolated_mode, user_supplied=False, ) requirements.append(req_to_add) return requirements class RequirementCommand(IndexGroupCommand): def __init__(self, *args: Any, **kw: Any) -> None: super().__init__(*args, **kw) self.cmd_opts.add_option(cmdoptions.dependency_groups()) self.cmd_opts.add_option(cmdoptions.no_clean()) @staticmethod def determine_resolver_variant(options: Values) -> str: """Determines which resolver should be used, based on the given options.""" if "legacy-resolver" in options.deprecated_features_enabled: return "legacy" return "resolvelib" @classmethod def make_requirement_preparer( cls, temp_build_dir: TempDirectory, options: Values, build_tracker: BuildTracker, session: PipSession, finder: PackageFinder, use_user_site: bool, download_dir: str | None = None, verbosity: int = 0, ) -> RequirementPreparer: """ Create a RequirementPreparer instance for the given parameters. """ temp_build_dir_path = temp_build_dir.path assert temp_build_dir_path is not None legacy_resolver = False resolver_variant = cls.determine_resolver_variant(options) if resolver_variant == "resolvelib": lazy_wheel = "fast-deps" in options.features_enabled if lazy_wheel: logger.warning( "pip is using lazily downloaded wheels using HTTP " "range requests to obtain dependency information. " "This experimental feature is enabled through " "--use-feature=fast-deps and it is not ready for " "production." ) else: legacy_resolver = True lazy_wheel = False if "fast-deps" in options.features_enabled: logger.warning( "fast-deps has no effect when used with the legacy resolver." ) # Handle build constraints build_constraints = getattr(options, "build_constraints", []) build_constraint_feature_enabled = ( "build-constraint" in options.features_enabled ) env_installer: BuildEnvironmentInstaller if "inprocess-build-deps" in options.features_enabled: build_constraint_reqs = parse_constraint_files( build_constraints, finder, options, session ) env_installer = InprocessBuildEnvironmentInstaller( finder=finder, build_tracker=build_tracker, build_constraints=build_constraint_reqs, verbosity=verbosity, wheel_cache=WheelCache(options.cache_dir), ) else: env_installer = SubprocessBuildEnvironmentInstaller( finder, build_constraints=build_constraints, build_constraint_feature_enabled=build_constraint_feature_enabled, ) return RequirementPreparer( build_dir=temp_build_dir_path, src_dir=options.src_dir, download_dir=download_dir, build_isolation=options.build_isolation, build_isolation_installer=env_installer, check_build_deps=options.check_build_deps, build_tracker=build_tracker, session=session, progress_bar=options.progress_bar, finder=finder, require_hashes=options.require_hashes, use_user_site=use_user_site, lazy_wheel=lazy_wheel, verbosity=verbosity, legacy_resolver=legacy_resolver, ) @classmethod def make_resolver( cls, preparer: RequirementPreparer, finder: PackageFinder, options: Values, wheel_cache: WheelCache | None = None, use_user_site: bool = False, ignore_installed: bool = True, ignore_requires_python: bool = False, force_reinstall: bool = False, upgrade_strategy: str = "to-satisfy-only", py_version_info: tuple[int, ...] | None = None, ) -> BaseResolver: """ Create a Resolver instance for the given parameters. """ make_install_req = partial( install_req_from_req_string, isolated=options.isolated_mode, ) resolver_variant = cls.determine_resolver_variant(options) # The long import name and duplicated invocation is needed to convince # Mypy into correctly typechecking. Otherwise it would complain the # "Resolver" class being redefined. if resolver_variant == "resolvelib": import pip._internal.resolution.resolvelib.resolver return pip._internal.resolution.resolvelib.resolver.Resolver( preparer=preparer, finder=finder, wheel_cache=wheel_cache, make_install_req=make_install_req, use_user_site=use_user_site, ignore_dependencies=options.ignore_dependencies, ignore_installed=ignore_installed, ignore_requires_python=ignore_requires_python, force_reinstall=force_reinstall, upgrade_strategy=upgrade_strategy, py_version_info=py_version_info, ) import pip._internal.resolution.legacy.resolver return pip._internal.resolution.legacy.resolver.Resolver( preparer=preparer, finder=finder, wheel_cache=wheel_cache, make_install_req=make_install_req, use_user_site=use_user_site, ignore_dependencies=options.ignore_dependencies, ignore_installed=ignore_installed, ignore_requires_python=ignore_requires_python, force_reinstall=force_reinstall, upgrade_strategy=upgrade_strategy, py_version_info=py_version_info, ) def get_requirements( self, args: list[str], options: Values, finder: PackageFinder, session: PipSession, ) -> list[InstallRequirement]: """ Parse command-line arguments into the corresponding requirements. """ requirements: list[InstallRequirement] = [] if not should_ignore_regular_constraints(options): constraints = parse_constraint_files( options.constraints, finder, options, session ) requirements.extend(constraints) for req in args: if not req.strip(): continue req_to_add = install_req_from_line( req, comes_from=None, isolated=options.isolated_mode, user_supplied=True, config_settings=getattr(options, "config_settings", None), ) requirements.append(req_to_add) if options.dependency_groups: for req in parse_dependency_groups(options.dependency_groups): req_to_add = install_req_from_req_string( req, isolated=options.isolated_mode, user_supplied=True, ) requirements.append(req_to_add) for req in options.editables: req_to_add = install_req_from_editable( req, user_supplied=True, isolated=options.isolated_mode, config_settings=getattr(options, "config_settings", None), ) requirements.append(req_to_add) # NOTE: options.require_hashes may be set if --require-hashes is True for filename in options.requirements: for parsed_req in parse_requirements( filename, finder=finder, options=options, session=session ): req_to_add = install_req_from_parsed_requirement( parsed_req, isolated=options.isolated_mode, user_supplied=True, config_settings=( parsed_req.options.get("config_settings") if parsed_req.options else None ), ) requirements.append(req_to_add) if options.requirements_from_scripts: if len(options.requirements_from_scripts) > 1: raise CommandError("--requirements-from-script can only be given once") script = options.requirements_from_scripts[0] try: script_metadata = pep723_metadata(script) except PEP723Exception as exc: raise CommandError(exc.msg) script_requires_python = script_metadata.get("requires-python", "") if script_requires_python and not options.ignore_requires_python: target_python = make_target_python(options) if not check_requires_python( requires_python=script_requires_python, version_info=target_python.py_version_info, ): raise UnsupportedPythonVersion( f"Script {script!r} requires a different Python: " f"{target_python.py_version} not in {script_requires_python!r}" ) for req in script_metadata.get("dependencies", []): req_to_add = install_req_from_req_string( req, isolated=options.isolated_mode, user_supplied=True, ) requirements.append(req_to_add) # If any requirement has hash options, enable hash checking. if any(req.has_hash_options for req in requirements): options.require_hashes = True if not ( args or options.editables or options.requirements or options.dependency_groups or options.requirements_from_scripts ): opts = {"name": self.name} if options.find_links: raise CommandError( "You must give at least one requirement to {name} " '(maybe you meant "pip {name} {links}"?)'.format( **dict(opts, links=" ".join(options.find_links)) ) ) else: raise CommandError( "You must give at least one requirement to {name} " '(see "pip help {name}")'.format(**opts) ) return requirements @staticmethod def trace_basic_info(finder: PackageFinder) -> None: """ Trace basic information about the provided objects. """ # Display where finder is looking for packages search_scope = finder.search_scope locations = search_scope.get_formatted_locations() if locations: logger.info(locations) def _build_package_finder( self, options: Values, session: PipSession, target_python: TargetPython | None = None, ignore_requires_python: bool | None = None, ) -> PackageFinder: """ Create a package finder appropriate to this requirement command. :param ignore_requires_python: Whether to ignore incompatible "Requires-Python" values in links. Defaults to False. """ link_collector = LinkCollector.create(session, options=options) selection_prefs = SelectionPreferences( allow_yanked=True, format_control=options.format_control, release_control=options.release_control, prefer_binary=options.prefer_binary, ignore_requires_python=ignore_requires_python, ) return PackageFinder.create( link_collector=link_collector, selection_prefs=selection_prefs, target_python=target_python, uploaded_prior_to=options.uploaded_prior_to, ) ================================================ FILE: src/pip/_internal/cli/spinners.py ================================================ from __future__ import annotations import contextlib import itertools import logging import sys import time from collections.abc import Generator from typing import IO, Final from pip._vendor.rich.console import ( Console, ConsoleOptions, RenderableType, RenderResult, ) from pip._vendor.rich.live import Live from pip._vendor.rich.measure import Measurement from pip._vendor.rich.text import Text from pip._internal.utils.compat import WINDOWS from pip._internal.utils.logging import get_console, get_indentation logger = logging.getLogger(__name__) SPINNER_CHARS: Final = r"-\|/" SPINS_PER_SECOND: Final = 8 class SpinnerInterface: def spin(self) -> None: raise NotImplementedError() def finish(self, final_status: str) -> None: raise NotImplementedError() class InteractiveSpinner(SpinnerInterface): def __init__( self, message: str, file: IO[str] | None = None, spin_chars: str = SPINNER_CHARS, # Empirically, 8 updates/second looks nice min_update_interval_seconds: float = 1 / SPINS_PER_SECOND, ): self._message = message if file is None: file = sys.stdout self._file = file self._rate_limiter = RateLimiter(min_update_interval_seconds) self._finished = False self._spin_cycle = itertools.cycle(spin_chars) self._file.write(" " * get_indentation() + self._message + " ... ") self._width = 0 def _write(self, status: str) -> None: assert not self._finished # Erase what we wrote before by backspacing to the beginning, writing # spaces to overwrite the old text, and then backspacing again backup = "\b" * self._width self._file.write(backup + " " * self._width + backup) # Now we have a blank slate to add our status self._file.write(status) self._width = len(status) self._file.flush() self._rate_limiter.reset() def spin(self) -> None: if self._finished: return if not self._rate_limiter.ready(): return self._write(next(self._spin_cycle)) def finish(self, final_status: str) -> None: if self._finished: return self._write(final_status) self._file.write("\n") self._file.flush() self._finished = True # Used for dumb terminals, non-interactive installs (no tty), etc. # We still print updates occasionally (once every 60 seconds by default) to # act as a keep-alive for systems like Travis-CI that take lack-of-output as # an indication that a task has frozen. class NonInteractiveSpinner(SpinnerInterface): def __init__(self, message: str, min_update_interval_seconds: float = 60.0) -> None: self._message = message self._finished = False self._rate_limiter = RateLimiter(min_update_interval_seconds) self._update("started") def _update(self, status: str) -> None: assert not self._finished self._rate_limiter.reset() logger.info("%s: %s", self._message, status) def spin(self) -> None: if self._finished: return if not self._rate_limiter.ready(): return self._update("still running...") def finish(self, final_status: str) -> None: if self._finished: return self._update(f"finished with status '{final_status}'") self._finished = True class RateLimiter: def __init__(self, min_update_interval_seconds: float) -> None: self._min_update_interval_seconds = min_update_interval_seconds self._last_update: float = 0 def ready(self) -> bool: now = time.time() delta = now - self._last_update return delta >= self._min_update_interval_seconds def reset(self) -> None: self._last_update = time.time() @contextlib.contextmanager def open_spinner(message: str) -> Generator[SpinnerInterface, None, None]: # Interactive spinner goes directly to sys.stdout rather than being routed # through the logging system, but it acts like it has level INFO, # i.e. it's only displayed if we're at level INFO or better. # Non-interactive spinner goes through the logging system, so it is always # in sync with logging configuration. if sys.stdout.isatty() and logger.getEffectiveLevel() <= logging.INFO: spinner: SpinnerInterface = InteractiveSpinner(message) else: spinner = NonInteractiveSpinner(message) try: with hidden_cursor(sys.stdout): yield spinner except KeyboardInterrupt: spinner.finish("canceled") raise except Exception: spinner.finish("error") raise else: spinner.finish("done") class _PipRichSpinner: """ Custom rich spinner that matches the style of the legacy spinners. (*) Updates will be handled in a background thread by a rich live panel which will call render() automatically at the appropriate time. """ def __init__(self, label: str) -> None: self.label = label self._spin_cycle = itertools.cycle(SPINNER_CHARS) self._spinner_text = "" self._finished = False self._indent = get_indentation() * " " def __rich_console__( self, console: Console, options: ConsoleOptions ) -> RenderResult: yield self.render() def __rich_measure__( self, console: Console, options: ConsoleOptions ) -> Measurement: text = self.render() return Measurement.get(console, options, text) def render(self) -> RenderableType: if not self._finished: self._spinner_text = next(self._spin_cycle) return Text.assemble(self._indent, self.label, " ... ", self._spinner_text) def finish(self, status: str) -> None: """Stop spinning and set a final status message.""" self._spinner_text = status self._finished = True @contextlib.contextmanager def open_rich_spinner(label: str, console: Console | None = None) -> Generator[None]: if not logger.isEnabledFor(logging.INFO): # Don't show spinner if --quiet is given. yield return console = console or get_console() spinner = _PipRichSpinner(label) with Live(spinner, refresh_per_second=SPINS_PER_SECOND, console=console): try: yield except KeyboardInterrupt: spinner.finish("canceled") raise except Exception: spinner.finish("error") raise else: spinner.finish("done") HIDE_CURSOR = "\x1b[?25l" SHOW_CURSOR = "\x1b[?25h" @contextlib.contextmanager def hidden_cursor(file: IO[str]) -> Generator[None, None, None]: # The Windows terminal does not support the hide/show cursor ANSI codes, # even via colorama. So don't even try. if WINDOWS: yield # We don't want to clutter the output with control characters if we're # writing to a file, or if the user is running with --quiet. # See https://github.com/pypa/pip/issues/3418 elif not file.isatty() or logger.getEffectiveLevel() > logging.INFO: yield else: file.write(HIDE_CURSOR) try: yield finally: file.write(SHOW_CURSOR) ================================================ FILE: src/pip/_internal/cli/status_codes.py ================================================ SUCCESS = 0 ERROR = 1 UNKNOWN_ERROR = 2 VIRTUALENV_NOT_FOUND = 3 PREVIOUS_BUILD_DIR_ERROR = 4 NO_MATCHES_FOUND = 23 ================================================ FILE: src/pip/_internal/commands/__init__.py ================================================ """ Package containing all pip commands """ from __future__ import annotations import importlib from collections import namedtuple from typing import Any from pip._internal.cli.base_command import Command CommandInfo = namedtuple("CommandInfo", "module_path, class_name, summary") # This dictionary does a bunch of heavy lifting for help output: # - Enables avoiding additional (costly) imports for presenting `--help`. # - The ordering matters for help display. # # Even though the module path starts with the same "pip._internal.commands" # prefix, the full path makes testing easier (specifically when modifying # `commands_dict` in test setup / teardown). commands_dict: dict[str, CommandInfo] = { "install": CommandInfo( "pip._internal.commands.install", "InstallCommand", "Install packages.", ), "lock": CommandInfo( "pip._internal.commands.lock", "LockCommand", "Generate a lock file.", ), "download": CommandInfo( "pip._internal.commands.download", "DownloadCommand", "Download packages.", ), "uninstall": CommandInfo( "pip._internal.commands.uninstall", "UninstallCommand", "Uninstall packages.", ), "freeze": CommandInfo( "pip._internal.commands.freeze", "FreezeCommand", "Output installed packages in requirements format.", ), "inspect": CommandInfo( "pip._internal.commands.inspect", "InspectCommand", "Inspect the python environment.", ), "list": CommandInfo( "pip._internal.commands.list", "ListCommand", "List installed packages.", ), "show": CommandInfo( "pip._internal.commands.show", "ShowCommand", "Show information about installed packages.", ), "check": CommandInfo( "pip._internal.commands.check", "CheckCommand", "Verify installed packages have compatible dependencies.", ), "config": CommandInfo( "pip._internal.commands.configuration", "ConfigurationCommand", "Manage local and global configuration.", ), "search": CommandInfo( "pip._internal.commands.search", "SearchCommand", "Search PyPI for packages.", ), "cache": CommandInfo( "pip._internal.commands.cache", "CacheCommand", "Inspect and manage pip's wheel cache.", ), "index": CommandInfo( "pip._internal.commands.index", "IndexCommand", "Inspect information available from package indexes.", ), "wheel": CommandInfo( "pip._internal.commands.wheel", "WheelCommand", "Build wheels from your requirements.", ), "hash": CommandInfo( "pip._internal.commands.hash", "HashCommand", "Compute hashes of package archives.", ), "completion": CommandInfo( "pip._internal.commands.completion", "CompletionCommand", "A helper command used for command completion.", ), "debug": CommandInfo( "pip._internal.commands.debug", "DebugCommand", "Show information useful for debugging.", ), "help": CommandInfo( "pip._internal.commands.help", "HelpCommand", "Show help for commands.", ), } def create_command(name: str, **kwargs: Any) -> Command: """ Create an instance of the Command class with the given name. """ module_path, class_name, summary = commands_dict[name] module = importlib.import_module(module_path) command_class = getattr(module, class_name) command = command_class(name=name, summary=summary, **kwargs) return command def get_similar_commands(name: str) -> str | None: """Command name auto-correct.""" from difflib import get_close_matches name = name.lower() close_commands = get_close_matches(name, commands_dict.keys()) if close_commands: return close_commands[0] else: return None ================================================ FILE: src/pip/_internal/commands/cache.py ================================================ import os import textwrap from optparse import Values from typing import Callable from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.exceptions import CommandError, PipError from pip._internal.utils import filesystem from pip._internal.utils.logging import getLogger from pip._internal.utils.misc import format_size logger = getLogger(__name__) class CacheCommand(Command): """ Inspect and manage pip's wheel cache. Subcommands: - dir: Show the cache directory. - info: Show information about the cache. - list: List filenames of packages stored in the cache. - remove: Remove one or more package from the cache. - purge: Remove all items from the cache. ```` can be a glob expression or a package name. """ ignore_require_venv = True usage = """ %prog dir %prog info %prog list [] [--format=[human, abspath]] %prog remove %prog purge """ def add_options(self) -> None: self.cmd_opts.add_option( "--format", action="store", dest="list_format", default="human", choices=("human", "abspath"), help="Select the output format among: human (default) or abspath", ) self.parser.insert_option_group(0, self.cmd_opts) def handler_map(self) -> dict[str, Callable[[Values, list[str]], None]]: return { "dir": self.get_cache_dir, "info": self.get_cache_info, "list": self.list_cache_items, "remove": self.remove_cache_items, "purge": self.purge_cache, } def run(self, options: Values, args: list[str]) -> int: handler_map = self.handler_map() if not options.cache_dir: logger.error("pip cache commands can not function since cache is disabled.") return ERROR # Determine action if not args or args[0] not in handler_map: logger.error( "Need an action (%s) to perform.", ", ".join(sorted(handler_map)), ) return ERROR action = args[0] # Error handling happens here, not in the action-handlers. try: handler_map[action](options, args[1:]) except PipError as e: logger.error(e.args[0]) return ERROR return SUCCESS def get_cache_dir(self, options: Values, args: list[str]) -> None: if args: raise CommandError("Too many arguments") logger.info(options.cache_dir) def get_cache_info(self, options: Values, args: list[str]) -> None: if args: raise CommandError("Too many arguments") num_http_files = len(self._find_http_files(options)) num_packages = len(self._find_wheels(options, "*")) http_cache_location = self._cache_dir(options, "http-v2") old_http_cache_location = self._cache_dir(options, "http") wheels_cache_location = self._cache_dir(options, "wheels") http_cache_size = filesystem.format_size( filesystem.directory_size(http_cache_location) + filesystem.directory_size(old_http_cache_location) ) wheels_cache_size = filesystem.format_directory_size(wheels_cache_location) message = ( textwrap.dedent( """ Package index page cache location (pip v23.3+): {http_cache_location} Package index page cache location (older pips): {old_http_cache_location} Package index page cache size: {http_cache_size} Number of HTTP files: {num_http_files} Locally built wheels location: {wheels_cache_location} Locally built wheels size: {wheels_cache_size} Number of locally built wheels: {package_count} """ # noqa: E501 ) .format( http_cache_location=http_cache_location, old_http_cache_location=old_http_cache_location, http_cache_size=http_cache_size, num_http_files=num_http_files, wheels_cache_location=wheels_cache_location, package_count=num_packages, wheels_cache_size=wheels_cache_size, ) .strip() ) logger.info(message) def list_cache_items(self, options: Values, args: list[str]) -> None: if len(args) > 1: raise CommandError("Too many arguments") if args: pattern = args[0] else: pattern = "*" files = self._find_wheels(options, pattern) if options.list_format == "human": self.format_for_human(files) else: self.format_for_abspath(files) def format_for_human(self, files: list[str]) -> None: if not files: logger.info("No locally built wheels cached.") return results = [] for filename in files: wheel = os.path.basename(filename) size = filesystem.format_file_size(filename) results.append(f" - {wheel} ({size})") logger.info("Cache contents:\n") logger.info("\n".join(sorted(results))) def format_for_abspath(self, files: list[str]) -> None: if files: logger.info("\n".join(sorted(files))) def remove_cache_items(self, options: Values, args: list[str]) -> None: if len(args) > 1: raise CommandError("Too many arguments") if not args: raise CommandError("Please provide a pattern") files = self._find_wheels(options, args[0]) no_matching_msg = "No matching packages" if args[0] == "*": # Only fetch http files if no specific pattern given files += self._find_http_files(options) else: # Add the pattern to the log message no_matching_msg += f' for pattern "{args[0]}"' if not files: logger.warning(no_matching_msg) bytes_removed = 0 for filename in files: bytes_removed += os.stat(filename).st_size os.unlink(filename) logger.verbose("Removed %s", filename) http_dirs = filesystem.subdirs_without_files(self._cache_dir(options, "http")) wheel_dirs = filesystem.subdirs_without_wheels( self._cache_dir(options, "wheels") ) dirs = [*http_dirs, *wheel_dirs] for subdir in dirs: try: for file in subdir.iterdir(): file.unlink(missing_ok=True) subdir.rmdir() except FileNotFoundError: # If the directory is already gone, that's fine. pass logger.verbose("Removed %s", subdir) # selfcheck.json is no longer used by pip. selfcheck_json = self._cache_dir(options, "selfcheck.json") if os.path.isfile(selfcheck_json): os.remove(selfcheck_json) logger.verbose("Removed legacy selfcheck.json file") logger.info("Files removed: %s (%s)", len(files), format_size(bytes_removed)) logger.info("Directories removed: %s", len(dirs)) def purge_cache(self, options: Values, args: list[str]) -> None: if args: raise CommandError("Too many arguments") return self.remove_cache_items(options, ["*"]) def _cache_dir(self, options: Values, subdir: str) -> str: return os.path.join(options.cache_dir, subdir) def _find_http_files(self, options: Values) -> list[str]: old_http_dir = self._cache_dir(options, "http") new_http_dir = self._cache_dir(options, "http-v2") return filesystem.find_files(old_http_dir, "*") + filesystem.find_files( new_http_dir, "*" ) def _find_wheels(self, options: Values, pattern: str) -> list[str]: wheel_dir = self._cache_dir(options, "wheels") # The wheel filename format, as specified in PEP 427, is: # {distribution}-{version}(-{build})?-{python}-{abi}-{platform}.whl # # Additionally, non-alphanumeric values in the distribution are # normalized to underscores (_), meaning hyphens can never occur # before `-{version}`. # # Given that information: # - If the pattern we're given contains a hyphen (-), the user is # providing at least the version. Thus, we can just append `*.whl` # to match the rest of it. # - If the pattern we're given doesn't contain a hyphen (-), the # user is only providing the name. Thus, we append `-*.whl` to # match the hyphen before the version, followed by anything else. # # PEP 427: https://www.python.org/dev/peps/pep-0427/ pattern = pattern + ("*.whl" if "-" in pattern else "-*.whl") return filesystem.find_files(wheel_dir, pattern) ================================================ FILE: src/pip/_internal/commands/check.py ================================================ import logging from optparse import Values from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.metadata import get_default_environment from pip._internal.operations.check import ( check_package_set, check_unsupported, create_package_set_from_installed, ) from pip._internal.utils.compatibility_tags import get_supported from pip._internal.utils.misc import write_output logger = logging.getLogger(__name__) class CheckCommand(Command): """Verify installed packages have compatible dependencies.""" ignore_require_venv = True usage = """ %prog [options]""" def run(self, options: Values, args: list[str]) -> int: package_set, parsing_probs = create_package_set_from_installed() missing, conflicting = check_package_set(package_set) unsupported = list( check_unsupported( get_default_environment().iter_installed_distributions(), get_supported(), ) ) for project_name in missing: version = package_set[project_name].version for dependency in missing[project_name]: write_output( "%s %s requires %s, which is not installed.", project_name, version, dependency[0], ) for project_name in conflicting: version = package_set[project_name].version for dep_name, dep_version, req in conflicting[project_name]: write_output( "%s %s has requirement %s, but you have %s %s.", project_name, version, req, dep_name, dep_version, ) for package in unsupported: write_output( "%s %s is not supported on this platform", package.raw_name, package.version, ) if missing or conflicting or parsing_probs or unsupported: return ERROR else: write_output("No broken requirements found.") return SUCCESS ================================================ FILE: src/pip/_internal/commands/completion.py ================================================ import sys import textwrap from optparse import Values from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import SUCCESS from pip._internal.utils.misc import get_prog BASE_COMPLETION = """ # pip {shell} completion start{script}# pip {shell} completion end """ COMPLETION_SCRIPTS = { "bash": """ _pip_completion() {{ local IFS=$' \\t\\n' COMPREPLY=( $( COMP_WORDS="${{COMP_WORDS[*]}}" \\ COMP_CWORD=$COMP_CWORD \\ PIP_AUTO_COMPLETE=1 "$1" 2>/dev/null ) ) }} complete -o default -F _pip_completion {prog} """, "zsh": """ #compdef -P pip[0-9.]# __pip() {{ compadd $( COMP_WORDS="$words[*]" \\ COMP_CWORD=$((CURRENT-1)) \\ PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null ) }} if [[ $zsh_eval_context[-1] == loadautofunc ]]; then # autoload from fpath, call function directly __pip "$@" else # eval/source/. command, register function for later compdef __pip -P 'pip[0-9.]#' fi """, "fish": """ function __fish_complete_pip set -lx COMP_WORDS \\ (commandline --current-process --tokenize --cut-at-cursor) \\ (commandline --current-token --cut-at-cursor) set -lx COMP_CWORD (math (count $COMP_WORDS) - 1) set -lx PIP_AUTO_COMPLETE 1 set -l completions if string match -q '2.*' $version set completions (eval $COMP_WORDS[1]) else set completions ($COMP_WORDS[1]) end string split \\ -- $completions end complete -fa "(__fish_complete_pip)" -c {prog} """, "powershell": """ if ((Test-Path Function:\\TabExpansion) -and -not ` (Test-Path Function:\\_pip_completeBackup)) {{ Rename-Item Function:\\TabExpansion _pip_completeBackup }} function TabExpansion($line, $lastWord) {{ $lastBlock = [regex]::Split($line, '[|;]')[-1].TrimStart() if ($lastBlock.StartsWith("{prog} ")) {{ $Env:COMP_WORDS=$lastBlock $Env:COMP_CWORD=$lastBlock.Split().Length - 1 $Env:PIP_AUTO_COMPLETE=1 (& {prog}).Split() Remove-Item Env:COMP_WORDS Remove-Item Env:COMP_CWORD Remove-Item Env:PIP_AUTO_COMPLETE }} elseif (Test-Path Function:\\_pip_completeBackup) {{ # Fall back on existing tab expansion _pip_completeBackup $line $lastWord }} }} """, } class CompletionCommand(Command): """A helper command to be used for command completion.""" ignore_require_venv = True def add_options(self) -> None: self.cmd_opts.add_option( "--bash", "-b", action="store_const", const="bash", dest="shell", help="Emit completion code for bash", ) self.cmd_opts.add_option( "--zsh", "-z", action="store_const", const="zsh", dest="shell", help="Emit completion code for zsh", ) self.cmd_opts.add_option( "--fish", "-f", action="store_const", const="fish", dest="shell", help="Emit completion code for fish", ) self.cmd_opts.add_option( "--powershell", "-p", action="store_const", const="powershell", dest="shell", help="Emit completion code for powershell", ) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: list[str]) -> int: """Prints the completion code of the given shell""" shells = COMPLETION_SCRIPTS.keys() shell_options = ["--" + shell for shell in sorted(shells)] if options.shell in shells: script = textwrap.dedent( COMPLETION_SCRIPTS.get(options.shell, "").format(prog=get_prog()) ) print(BASE_COMPLETION.format(script=script, shell=options.shell)) return SUCCESS else: sys.stderr.write( "ERROR: You must pass {}\n".format(" or ".join(shell_options)) ) return SUCCESS ================================================ FILE: src/pip/_internal/commands/configuration.py ================================================ from __future__ import annotations import logging import os import subprocess from optparse import Values from typing import Any, Callable from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.configuration import ( Configuration, Kind, get_configuration_files, kinds, ) from pip._internal.exceptions import PipError from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import get_prog, write_output logger = logging.getLogger(__name__) class ConfigurationCommand(Command): """ Manage local and global configuration. Subcommands: - list: List the active configuration (or from the file specified) - edit: Edit the configuration file in an editor - get: Get the value associated with command.option - set: Set the command.option=value - unset: Unset the value associated with command.option - debug: List the configuration files and values defined under them Configuration keys should be dot separated command and option name, with the special prefix "global" affecting any command. For example, "pip config set global.index-url https://example.org/" would configure the index url for all commands, but "pip config set download.timeout 10" would configure a 10 second timeout only for "pip download" commands. If none of --user, --global and --site are passed, a virtual environment configuration file is used if one is active and the file exists. Otherwise, all modifications happen to the user file by default. """ ignore_require_venv = True usage = """ %prog [] list %prog [] [--editor ] edit %prog [] get command.option %prog [] set command.option value %prog [] unset command.option %prog [] debug """ def add_options(self) -> None: self.cmd_opts.add_option( "--editor", dest="editor", action="store", default=None, help=( "Editor to use to edit the file. Uses VISUAL or EDITOR " "environment variables if not provided." ), ) self.cmd_opts.add_option( "--global", dest="global_file", action="store_true", default=False, help="Use the system-wide configuration file only", ) self.cmd_opts.add_option( "--user", dest="user_file", action="store_true", default=False, help="Use the user configuration file only", ) self.cmd_opts.add_option( "--site", dest="site_file", action="store_true", default=False, help="Use the current environment configuration file only", ) self.parser.insert_option_group(0, self.cmd_opts) def handler_map(self) -> dict[str, Callable[[Values, list[str]], None]]: return { "list": self.list_values, "edit": self.open_in_editor, "get": self.get_name, "set": self.set_name_value, "unset": self.unset_name, "debug": self.list_config_values, } def run(self, options: Values, args: list[str]) -> int: handler_map = self.handler_map() # Determine action if not args or args[0] not in handler_map: logger.error( "Need an action (%s) to perform.", ", ".join(sorted(handler_map)), ) return ERROR action = args[0] # Determine which configuration files are to be loaded # Depends on whether the command is modifying. try: load_only = self._determine_file( options, need_value=(action in ["get", "set", "unset", "edit"]) ) except PipError as e: logger.error(e.args[0]) return ERROR # Load a new configuration self.configuration = Configuration( isolated=options.isolated_mode, load_only=load_only ) self.configuration.load() # Error handling happens here, not in the action-handlers. try: handler_map[action](options, args[1:]) except PipError as e: logger.error(e.args[0]) return ERROR return SUCCESS def _determine_file(self, options: Values, need_value: bool) -> Kind | None: file_options = [ key for key, value in ( (kinds.USER, options.user_file), (kinds.GLOBAL, options.global_file), (kinds.SITE, options.site_file), ) if value ] if not file_options: if not need_value: return None # Default to user, unless there's a site file. elif any( os.path.exists(site_config_file) for site_config_file in get_configuration_files()[kinds.SITE] ): return kinds.SITE else: return kinds.USER elif len(file_options) == 1: return file_options[0] raise PipError( "Need exactly one file to operate upon " "(--user, --site, --global) to perform." ) def list_values(self, options: Values, args: list[str]) -> None: self._get_n_args(args, "list", n=0) for key, value in sorted(self.configuration.items()): for key, value in sorted(value.items()): write_output("%s=%r", key, value) def get_name(self, options: Values, args: list[str]) -> None: key = self._get_n_args(args, "get [name]", n=1) value = self.configuration.get_value(key) write_output("%s", value) def set_name_value(self, options: Values, args: list[str]) -> None: key, value = self._get_n_args(args, "set [name] [value]", n=2) self.configuration.set_value(key, value) self._save_configuration() def unset_name(self, options: Values, args: list[str]) -> None: key = self._get_n_args(args, "unset [name]", n=1) self.configuration.unset_value(key) self._save_configuration() def list_config_values(self, options: Values, args: list[str]) -> None: """List config key-value pairs across different config files""" self._get_n_args(args, "debug", n=0) self.print_env_var_values() # Iterate over config files and print if they exist, and the # key-value pairs present in them if they do for variant, files in sorted(self.configuration.iter_config_files()): write_output("%s:", variant) for fname in files: with indent_log(): file_exists = os.path.exists(fname) write_output("%s, exists: %r", fname, file_exists) if file_exists: self.print_config_file_values(variant, fname) def print_config_file_values(self, variant: Kind, fname: str) -> None: """Get key-value pairs from the file of a variant""" for name, value in self.configuration.get_values_in_config(variant).items(): with indent_log(): if name == fname: for confname, confvalue in value.items(): write_output("%s: %s", confname, confvalue) def print_env_var_values(self) -> None: """Get key-values pairs present as environment variables""" write_output("%s:", "env_var") with indent_log(): for key, value in sorted(self.configuration.get_environ_vars()): env_var = f"PIP_{key.upper()}" write_output("%s=%r", env_var, value) def open_in_editor(self, options: Values, args: list[str]) -> None: editor = self._determine_editor(options) fname = self.configuration.get_file_to_edit() if fname is None: raise PipError("Could not determine appropriate file.") elif '"' in fname: # This shouldn't happen, unless we see a username like that. # If that happens, we'd appreciate a pull request fixing this. raise PipError( f'Can not open an editor for a file name containing "\n{fname}' ) try: subprocess.check_call(f'{editor} "{fname}"', shell=True) except FileNotFoundError as e: if not e.filename: e.filename = editor raise except subprocess.CalledProcessError as e: raise PipError(f"Editor Subprocess exited with exit code {e.returncode}") def _get_n_args(self, args: list[str], example: str, n: int) -> Any: """Helper to make sure the command got the right number of arguments""" if len(args) != n: msg = ( f"Got unexpected number of arguments, expected {n}. " f'(example: "{get_prog()} config {example}")' ) raise PipError(msg) if n == 1: return args[0] else: return args def _save_configuration(self) -> None: # We successfully ran a modifying command. Need to save the # configuration. try: self.configuration.save() except Exception: logger.exception( "Unable to save configuration. Please report this as a bug." ) raise PipError("Internal Error.") def _determine_editor(self, options: Values) -> str: if options.editor is not None: return options.editor elif "VISUAL" in os.environ: return os.environ["VISUAL"] elif "EDITOR" in os.environ: return os.environ["EDITOR"] else: raise PipError("Could not determine editor to use.") ================================================ FILE: src/pip/_internal/commands/debug.py ================================================ from __future__ import annotations import locale import logging import os import sys from optparse import Values from types import ModuleType from typing import Any import pip._vendor from pip._vendor.certifi import where from pip._vendor.packaging.version import parse as parse_version from pip._internal.cli import cmdoptions from pip._internal.cli.base_command import Command from pip._internal.cli.cmdoptions import make_target_python from pip._internal.cli.status_codes import SUCCESS from pip._internal.configuration import Configuration from pip._internal.metadata import get_environment from pip._internal.utils.compat import open_text_resource from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import get_pip_version logger = logging.getLogger(__name__) def show_value(name: str, value: Any) -> None: logger.info("%s: %s", name, value) def show_sys_implementation() -> None: logger.info("sys.implementation:") implementation_name = sys.implementation.name with indent_log(): show_value("name", implementation_name) def create_vendor_txt_map() -> dict[str, str]: with open_text_resource("pip._vendor", "vendor.txt") as f: # Purge non version specifying lines. # Also, remove any space prefix or suffixes (including comments). lines = [ line.strip().split(" ", 1)[0] for line in f.readlines() if "==" in line ] # Transform into "module" -> version dict. return dict(line.split("==", 1) for line in lines) def get_module_from_module_name(module_name: str) -> ModuleType | None: # Module name can be uppercase in vendor.txt for some reason... module_name = module_name.lower().replace("-", "_") # PATCH: setuptools is actually only pkg_resources. if module_name == "setuptools": module_name = "pkg_resources" try: __import__(f"pip._vendor.{module_name}", globals(), locals(), level=0) return getattr(pip._vendor, module_name) except ImportError: # We allow 'truststore' to fail to import due # to being unavailable on Python 3.9 and earlier. if module_name == "truststore" and sys.version_info < (3, 10): return None raise def get_vendor_version_from_module(module_name: str) -> str | None: module = get_module_from_module_name(module_name) version = getattr(module, "__version__", None) if module and not version: # Try to find version in debundled module info. assert module.__file__ is not None env = get_environment([os.path.dirname(module.__file__)]) dist = env.get_distribution(module_name) if dist: version = str(dist.version) return version def show_actual_vendor_versions(vendor_txt_versions: dict[str, str]) -> None: """Log the actual version and print extra info if there is a conflict or if the actual version could not be imported. """ for module_name, expected_version in vendor_txt_versions.items(): extra_message = "" actual_version = get_vendor_version_from_module(module_name) if not actual_version: extra_message = ( " (Unable to locate actual module version, using" " vendor.txt specified version)" ) actual_version = expected_version elif parse_version(actual_version) != parse_version(expected_version): extra_message = ( " (CONFLICT: vendor.txt suggests version should" f" be {expected_version})" ) logger.info("%s==%s%s", module_name, actual_version, extra_message) def show_vendor_versions() -> None: logger.info("vendored library versions:") vendor_txt_versions = create_vendor_txt_map() with indent_log(): show_actual_vendor_versions(vendor_txt_versions) def show_tags(options: Values) -> None: tag_limit = 10 target_python = make_target_python(options) tags = target_python.get_sorted_tags() # Display the target options that were explicitly provided. formatted_target = target_python.format_given() suffix = "" if formatted_target: suffix = f" (target: {formatted_target})" msg = f"Compatible tags: {len(tags)}{suffix}" logger.info(msg) if options.verbose < 1 and len(tags) > tag_limit: tags_limited = True tags = tags[:tag_limit] else: tags_limited = False with indent_log(): for tag in tags: logger.info(str(tag)) if tags_limited: msg = f"...\n[First {tag_limit} tags shown. Pass --verbose to show all.]" logger.info(msg) def ca_bundle_info(config: Configuration) -> str: levels = {key.split(".", 1)[0] for key, _ in config.items()} if not levels: return "Not specified" levels_that_override_global = ["install", "wheel", "download"] global_overriding_level = [ level for level in levels if level in levels_that_override_global ] if not global_overriding_level: return "global" if "global" in levels: levels.remove("global") return ", ".join(levels) class DebugCommand(Command): """ Display debug information. """ usage = """ %prog """ ignore_require_venv = True def add_options(self) -> None: cmdoptions.add_target_python_options(self.cmd_opts) self.parser.insert_option_group(0, self.cmd_opts) self.parser.config.load() def run(self, options: Values, args: list[str]) -> int: logger.warning( "This command is only meant for debugging. " "Do not use this with automation for parsing and getting these " "details, since the output and options of this command may " "change without notice." ) show_value("pip version", get_pip_version()) show_value("sys.version", sys.version) show_value("sys.executable", sys.executable) show_value("sys.getdefaultencoding", sys.getdefaultencoding()) show_value("sys.getfilesystemencoding", sys.getfilesystemencoding()) show_value( "locale.getpreferredencoding", locale.getpreferredencoding(), ) show_value("sys.platform", sys.platform) show_sys_implementation() show_value("'cert' config value", ca_bundle_info(self.parser.config)) show_value("REQUESTS_CA_BUNDLE", os.environ.get("REQUESTS_CA_BUNDLE")) show_value("CURL_CA_BUNDLE", os.environ.get("CURL_CA_BUNDLE")) show_value("pip._vendor.certifi.where()", where()) show_value("pip._vendor.DEBUNDLED", pip._vendor.DEBUNDLED) show_vendor_versions() show_tags(options) return SUCCESS ================================================ FILE: src/pip/_internal/commands/download.py ================================================ import logging import os from optparse import Values from pip._internal.cli import cmdoptions from pip._internal.cli.cmdoptions import make_target_python from pip._internal.cli.req_command import RequirementCommand, with_cleanup from pip._internal.cli.status_codes import SUCCESS from pip._internal.operations.build.build_tracker import get_build_tracker from pip._internal.utils.misc import ensure_dir, normalize_path, write_output from pip._internal.utils.temp_dir import TempDirectory logger = logging.getLogger(__name__) class DownloadCommand(RequirementCommand): """ Download packages from: - PyPI (and other indexes) using requirement specifiers. - VCS project urls. - Local project directories. - Local or remote source archives. pip also supports downloading from "requirements files", which provide an easy way to specify a whole environment to be downloaded. """ usage = """ %prog [options] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] ... %prog [options] ... %prog [options] ...""" def add_options(self) -> None: self.cmd_opts.add_option(cmdoptions.constraints()) self.cmd_opts.add_option(cmdoptions.build_constraints()) self.cmd_opts.add_option(cmdoptions.requirements()) self.cmd_opts.add_option(cmdoptions.requirements_from_scripts()) self.cmd_opts.add_option(cmdoptions.no_deps()) self.cmd_opts.add_option(cmdoptions.src()) self.cmd_opts.add_option(cmdoptions.require_hashes()) self.cmd_opts.add_option(cmdoptions.progress_bar()) self.cmd_opts.add_option(cmdoptions.no_build_isolation()) self.cmd_opts.add_option(cmdoptions.use_pep517()) self.cmd_opts.add_option(cmdoptions.check_build_deps()) self.cmd_opts.add_option(cmdoptions.ignore_requires_python()) self.cmd_opts.add_option( "-d", "--dest", "--destination-dir", "--destination-directory", dest="download_dir", metavar="dir", default=os.curdir, help="Download packages into .", ) cmdoptions.add_target_python_options(self.cmd_opts) index_opts = cmdoptions.make_option_group( cmdoptions.index_group, self.parser, ) selection_opts = cmdoptions.make_option_group( cmdoptions.package_selection_group, self.parser, ) self.parser.insert_option_group(0, index_opts) self.parser.insert_option_group(0, selection_opts) self.parser.insert_option_group(0, self.cmd_opts) @with_cleanup def run(self, options: Values, args: list[str]) -> int: options.ignore_installed = True # editable doesn't really make sense for `pip download`, but the bowels # of the RequirementSet code require that property. options.editables = [] cmdoptions.check_dist_restriction(options) cmdoptions.check_build_constraints(options) cmdoptions.check_release_control_exclusive(options) options.download_dir = normalize_path(options.download_dir) ensure_dir(options.download_dir) session = self.get_default_session(options) target_python = make_target_python(options) finder = self._build_package_finder( options=options, session=session, target_python=target_python, ignore_requires_python=options.ignore_requires_python, ) build_tracker = self.enter_context(get_build_tracker()) directory = TempDirectory( delete=not options.no_clean, kind="download", globally_managed=True, ) reqs = self.get_requirements(args, options, finder, session) preparer = self.make_requirement_preparer( temp_build_dir=directory, options=options, build_tracker=build_tracker, session=session, finder=finder, download_dir=options.download_dir, use_user_site=False, verbosity=self.verbosity, ) resolver = self.make_resolver( preparer=preparer, finder=finder, options=options, ignore_requires_python=options.ignore_requires_python, py_version_info=options.python_version, ) self.trace_basic_info(finder) requirement_set = resolver.resolve(reqs, check_supported_wheels=True) preparer.prepare_linked_requirements_more(requirement_set.requirements.values()) downloaded: list[str] = [] for req in requirement_set.requirements.values(): if req.satisfied_by is None: assert req.name is not None preparer.save_linked_requirement(req) downloaded.append(req.name) if downloaded: write_output("Successfully downloaded %s", " ".join(downloaded)) return SUCCESS ================================================ FILE: src/pip/_internal/commands/freeze.py ================================================ import sys from optparse import Values from pip._internal.cli import cmdoptions from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import SUCCESS from pip._internal.operations.freeze import freeze from pip._internal.utils.compat import stdlib_pkgs def _should_suppress_build_backends() -> bool: return sys.version_info < (3, 12) def _dev_pkgs() -> set[str]: pkgs = {"pip"} if _should_suppress_build_backends(): pkgs |= {"setuptools", "distribute", "wheel"} return pkgs class FreezeCommand(Command): """ Output installed packages in requirements format. packages are listed in a case-insensitive sorted order. """ ignore_require_venv = True usage = """ %prog [options]""" def add_options(self) -> None: self.cmd_opts.add_option( "-r", "--requirement", dest="requirements", action="append", default=[], metavar="file", help=( "Use the order in the given requirements file and its " "comments when generating output. This option can be " "used multiple times." ), ) self.cmd_opts.add_option( "-l", "--local", dest="local", action="store_true", default=False, help=( "If in a virtualenv that has global access, do not output " "globally-installed packages." ), ) self.cmd_opts.add_option( "--user", dest="user", action="store_true", default=False, help="Only output packages installed in user-site.", ) self.cmd_opts.add_option(cmdoptions.list_path()) self.cmd_opts.add_option( "--all", dest="freeze_all", action="store_true", help=( "Do not skip these packages in the output:" " {}".format(", ".join(_dev_pkgs())) ), ) self.cmd_opts.add_option( "--exclude-editable", dest="exclude_editable", action="store_true", help="Exclude editable package from output.", ) self.cmd_opts.add_option(cmdoptions.list_exclude()) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: list[str]) -> int: skip = set(stdlib_pkgs) if not options.freeze_all: skip.update(_dev_pkgs()) if options.excludes: skip.update(options.excludes) cmdoptions.check_list_path_option(options) for line in freeze( requirement=options.requirements, local_only=options.local, user_only=options.user, paths=options.path, isolated=options.isolated_mode, skip=skip, exclude_editable=options.exclude_editable, ): sys.stdout.write(line + "\n") return SUCCESS ================================================ FILE: src/pip/_internal/commands/hash.py ================================================ import hashlib import logging import sys from optparse import Values from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.utils.hashes import FAVORITE_HASH, STRONG_HASHES from pip._internal.utils.misc import read_chunks, write_output logger = logging.getLogger(__name__) class HashCommand(Command): """ Compute a hash of a local package archive. These can be used with --hash in a requirements file to do repeatable installs. """ usage = "%prog [options] ..." ignore_require_venv = True def add_options(self) -> None: self.cmd_opts.add_option( "-a", "--algorithm", dest="algorithm", choices=STRONG_HASHES, action="store", default=FAVORITE_HASH, help="The hash algorithm to use: one of {}".format( ", ".join(STRONG_HASHES) ), ) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: list[str]) -> int: if not args: self.parser.print_usage(sys.stderr) return ERROR algorithm = options.algorithm for path in args: write_output( "%s:\n--hash=%s:%s", path, algorithm, _hash_of_file(path, algorithm) ) return SUCCESS def _hash_of_file(path: str, algorithm: str) -> str: """Return the hash digest of a file.""" with open(path, "rb") as archive: hash = hashlib.new(algorithm) for chunk in read_chunks(archive): hash.update(chunk) return hash.hexdigest() ================================================ FILE: src/pip/_internal/commands/help.py ================================================ from optparse import Values from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import SUCCESS from pip._internal.exceptions import CommandError class HelpCommand(Command): """Show help for commands""" usage = """ %prog """ ignore_require_venv = True def run(self, options: Values, args: list[str]) -> int: from pip._internal.commands import ( commands_dict, create_command, get_similar_commands, ) try: # 'pip help' with no args is handled by pip.__init__.parseopt() cmd_name = args[0] # the command we need help for except IndexError: return SUCCESS if cmd_name not in commands_dict: guess = get_similar_commands(cmd_name) msg = [f'unknown command "{cmd_name}"'] if guess: msg.append(f'maybe you meant "{guess}"') raise CommandError(" - ".join(msg)) command = create_command(cmd_name) command.parser.print_help() return SUCCESS ================================================ FILE: src/pip/_internal/commands/index.py ================================================ from __future__ import annotations import json import logging from collections.abc import Iterable from optparse import Values from typing import Any, Callable from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.packaging.version import Version from pip._internal.cli import cmdoptions from pip._internal.cli.req_command import IndexGroupCommand from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.commands.search import ( get_installed_distribution, print_dist_installation_info, ) from pip._internal.exceptions import CommandError, DistributionNotFound, PipError from pip._internal.index.collector import LinkCollector from pip._internal.index.package_finder import PackageFinder from pip._internal.models.selection_prefs import SelectionPreferences from pip._internal.models.target_python import TargetPython from pip._internal.network.session import PipSession from pip._internal.utils.misc import write_output logger = logging.getLogger(__name__) class IndexCommand(IndexGroupCommand): """ Inspect information available from package indexes. """ ignore_require_venv = True usage = """ %prog versions """ def add_options(self) -> None: cmdoptions.add_target_python_options(self.cmd_opts) self.cmd_opts.add_option(cmdoptions.ignore_requires_python()) self.cmd_opts.add_option(cmdoptions.json()) index_opts = cmdoptions.make_option_group( cmdoptions.index_group, self.parser, ) selection_opts = cmdoptions.make_option_group( cmdoptions.package_selection_group, self.parser, ) self.parser.insert_option_group(0, index_opts) self.parser.insert_option_group(0, selection_opts) self.parser.insert_option_group(0, self.cmd_opts) def handler_map(self) -> dict[str, Callable[[Values, list[str]], None]]: return { "versions": self.get_available_package_versions, } def run(self, options: Values, args: list[str]) -> int: cmdoptions.check_release_control_exclusive(options) handler_map = self.handler_map() # Determine action if not args or args[0] not in handler_map: logger.error( "Need an action (%s) to perform.", ", ".join(sorted(handler_map)), ) return ERROR action = args[0] # Error handling happens here, not in the action-handlers. try: handler_map[action](options, args[1:]) except PipError as e: logger.error(e.args[0]) return ERROR return SUCCESS def _build_package_finder( self, options: Values, session: PipSession, target_python: TargetPython | None = None, ignore_requires_python: bool | None = None, ) -> PackageFinder: """ Create a package finder appropriate to the index command. """ link_collector = LinkCollector.create(session, options=options) # Pass allow_yanked=False to ignore yanked versions. selection_prefs = SelectionPreferences( allow_yanked=False, release_control=options.release_control, format_control=options.format_control, ignore_requires_python=ignore_requires_python, ) return PackageFinder.create( link_collector=link_collector, selection_prefs=selection_prefs, target_python=target_python, uploaded_prior_to=options.uploaded_prior_to, ) def get_available_package_versions(self, options: Values, args: list[Any]) -> None: if len(args) != 1: raise CommandError("You need to specify exactly one argument") target_python = cmdoptions.make_target_python(options) query = args[0] with self._build_session(options) as session: finder = self._build_package_finder( options=options, session=session, target_python=target_python, ignore_requires_python=options.ignore_requires_python, ) versions: Iterable[Version] = ( candidate.version for candidate in finder.find_all_candidates(query) ) if self.should_exclude_prerelease(options, canonicalize_name(query)): versions = ( version for version in versions if not version.is_prerelease ) versions = set(versions) if not versions: raise DistributionNotFound( f"No matching distribution found for {query}" ) formatted_versions = [str(ver) for ver in sorted(versions, reverse=True)] latest = formatted_versions[0] dist = get_installed_distribution(query) if options.json: structured_output = { "name": query, "versions": formatted_versions, "latest": latest, } if dist is not None: structured_output["installed_version"] = str(dist.version) write_output(json.dumps(structured_output)) else: write_output(f"{query} ({latest})") write_output("Available versions: {}".format(", ".join(formatted_versions))) print_dist_installation_info(latest, dist) ================================================ FILE: src/pip/_internal/commands/inspect.py ================================================ import logging from optparse import Values from typing import Any from pip._vendor.packaging.markers import default_environment from pip._vendor.rich import print_json from pip import __version__ from pip._internal.cli import cmdoptions from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import SUCCESS from pip._internal.metadata import BaseDistribution, get_environment from pip._internal.utils.compat import stdlib_pkgs from pip._internal.utils.urls import path_to_url logger = logging.getLogger(__name__) class InspectCommand(Command): """ Inspect the content of a Python environment and produce a report in JSON format. """ ignore_require_venv = True usage = """ %prog [options]""" def add_options(self) -> None: self.cmd_opts.add_option( "--local", action="store_true", default=False, help=( "If in a virtualenv that has global access, do not list " "globally-installed packages." ), ) self.cmd_opts.add_option( "--user", dest="user", action="store_true", default=False, help="Only output packages installed in user-site.", ) self.cmd_opts.add_option(cmdoptions.list_path()) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: list[str]) -> int: cmdoptions.check_list_path_option(options) dists = get_environment(options.path).iter_installed_distributions( local_only=options.local, user_only=options.user, skip=set(stdlib_pkgs), ) output = { "version": "1", "pip_version": __version__, "installed": [self._dist_to_dict(dist) for dist in dists], "environment": default_environment(), # TODO tags? scheme? } print_json(data=output) return SUCCESS def _dist_to_dict(self, dist: BaseDistribution) -> dict[str, Any]: res: dict[str, Any] = { "metadata": dist.metadata_dict, "metadata_location": dist.info_location, } # direct_url. Note that we don't have download_info (as in the installation # report) since it is not recorded in installed metadata. direct_url = dist.direct_url if direct_url is not None: res["direct_url"] = direct_url.to_dict() else: # Emulate direct_url for legacy editable installs. editable_project_location = dist.editable_project_location if editable_project_location is not None: res["direct_url"] = { "url": path_to_url(editable_project_location), "dir_info": { "editable": True, }, } # installer installer = dist.installer if dist.installer: res["installer"] = installer # requested if dist.installed_with_dist_info: res["requested"] = dist.requested return res ================================================ FILE: src/pip/_internal/commands/install.py ================================================ from __future__ import annotations import errno import json import operator import os import shutil import site from optparse import SUPPRESS_HELP, Values from pathlib import Path from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.requests.exceptions import InvalidProxyURL from pip._vendor.rich import print_json # Eagerly import self_outdated_check to avoid crashes. Otherwise, # this module would be imported *after* pip was replaced, resulting # in crashes if the new self_outdated_check module was incompatible # with the rest of pip that's already imported, or allowing a # wheel to execute arbitrary code on install by replacing # self_outdated_check. import pip._internal.self_outdated_check # noqa: F401 from pip._internal.cache import WheelCache from pip._internal.cli import cmdoptions from pip._internal.cli.cmdoptions import make_target_python from pip._internal.cli.req_command import ( RequirementCommand, with_cleanup, ) from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.exceptions import ( CommandError, InstallationError, InstallWheelBuildError, ) from pip._internal.locations import get_scheme from pip._internal.metadata import BaseEnvironment, get_environment from pip._internal.models.installation_report import InstallationReport from pip._internal.operations.build.build_tracker import get_build_tracker from pip._internal.operations.check import ConflictDetails, check_install_conflicts from pip._internal.req import InstallationResult, install_given_reqs from pip._internal.req.req_install import ( InstallRequirement, ) from pip._internal.utils.compat import WINDOWS from pip._internal.utils.filesystem import test_writable_dir from pip._internal.utils.logging import getLogger from pip._internal.utils.misc import ( check_externally_managed, ensure_dir, get_pip_version, protect_pip_from_modification_on_windows, warn_if_run_as_root, write_output, ) from pip._internal.utils.temp_dir import TempDirectory from pip._internal.utils.virtualenv import ( running_under_virtualenv, virtualenv_no_global, ) from pip._internal.wheel_builder import build logger = getLogger(__name__) class InstallCommand(RequirementCommand): """ Install packages from: - PyPI (and other indexes) using requirement specifiers. - VCS project urls. - Local project directories. - Local or remote source archives. pip also supports installing from "requirements files", which provide an easy way to specify a whole environment to be installed. """ usage = """ %prog [options] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] [-e] ... %prog [options] [-e] ... %prog [options] ...""" def add_options(self) -> None: self.cmd_opts.add_option(cmdoptions.requirements()) self.cmd_opts.add_option(cmdoptions.constraints()) self.cmd_opts.add_option(cmdoptions.build_constraints()) self.cmd_opts.add_option(cmdoptions.requirements_from_scripts()) self.cmd_opts.add_option(cmdoptions.no_deps()) self.cmd_opts.add_option(cmdoptions.editable()) self.cmd_opts.add_option( "--dry-run", action="store_true", dest="dry_run", default=False, help=( "Don't actually install anything, just print what would be. " "Can be used in combination with --ignore-installed " "to 'resolve' the requirements." ), ) self.cmd_opts.add_option( "-t", "--target", dest="target_dir", metavar="dir", default=None, help=( "Install packages into . " "By default this will not replace existing files/folders in " ". Use --upgrade to replace existing packages in " "with new versions." ), ) cmdoptions.add_target_python_options(self.cmd_opts) self.cmd_opts.add_option( "--user", dest="use_user_site", action="store_true", help=( "Install to the Python user install directory for your " "platform. Typically ~/.local/, or %APPDATA%\\Python on " "Windows. (See the Python documentation for site.USER_BASE " "for full details.)" ), ) self.cmd_opts.add_option( "--no-user", dest="use_user_site", action="store_false", help=SUPPRESS_HELP, ) self.cmd_opts.add_option( "--root", dest="root_path", metavar="dir", default=None, help="Install everything relative to this alternate root directory.", ) self.cmd_opts.add_option( "--prefix", dest="prefix_path", metavar="dir", default=None, help=( "Installation prefix where lib, bin and other top-level " "folders are placed. Note that the resulting installation may " "contain scripts and other resources which reference the " "Python interpreter of pip, and not that of ``--prefix``. " "See also the ``--python`` option if the intention is to " "install packages into another (possibly pip-free) " "environment." ), ) self.cmd_opts.add_option(cmdoptions.src()) self.cmd_opts.add_option( "-U", "--upgrade", dest="upgrade", action="store_true", help=( "Upgrade all specified packages to the newest available " "version. The handling of dependencies depends on the " "upgrade-strategy used." ), ) self.cmd_opts.add_option( "--upgrade-strategy", dest="upgrade_strategy", default="only-if-needed", choices=["only-if-needed", "eager"], help=( "Determines how dependency upgrading should be handled " "[default: %default]. " '"eager" - dependencies are upgraded regardless of ' "whether the currently installed version satisfies the " "requirements of the upgraded package(s). " '"only-if-needed" - are upgraded only when they do not ' "satisfy the requirements of the upgraded package(s)." ), ) self.cmd_opts.add_option( "--force-reinstall", dest="force_reinstall", action="store_true", help="Reinstall all packages even if they are already up-to-date.", ) self.cmd_opts.add_option( "-I", "--ignore-installed", dest="ignore_installed", action="store_true", help=( "Ignore the installed packages, overwriting them. " "This can break your system if the existing package " "is of a different version or was installed " "with a different package manager!" ), ) self.cmd_opts.add_option(cmdoptions.ignore_requires_python()) self.cmd_opts.add_option(cmdoptions.no_build_isolation()) self.cmd_opts.add_option(cmdoptions.use_pep517()) self.cmd_opts.add_option(cmdoptions.check_build_deps()) self.cmd_opts.add_option(cmdoptions.override_externally_managed()) self.cmd_opts.add_option(cmdoptions.config_settings()) self.cmd_opts.add_option( "--compile", action="store_true", dest="compile", default=True, help="Compile Python source files to bytecode", ) self.cmd_opts.add_option( "--no-compile", action="store_false", dest="compile", help="Do not compile Python source files to bytecode", ) self.cmd_opts.add_option( "--no-warn-script-location", action="store_false", dest="warn_script_location", default=True, help="Do not warn when installing scripts outside PATH", ) self.cmd_opts.add_option( "--no-warn-conflicts", action="store_false", dest="warn_about_conflicts", default=True, help="Do not warn about broken dependencies", ) self.cmd_opts.add_option(cmdoptions.require_hashes()) self.cmd_opts.add_option(cmdoptions.progress_bar()) self.cmd_opts.add_option(cmdoptions.root_user_action()) index_opts = cmdoptions.make_option_group( cmdoptions.index_group, self.parser, ) selection_opts = cmdoptions.make_option_group( cmdoptions.package_selection_group, self.parser, ) self.parser.insert_option_group(0, index_opts) self.parser.insert_option_group(0, selection_opts) self.parser.insert_option_group(0, self.cmd_opts) self.cmd_opts.add_option( "--report", dest="json_report_file", metavar="file", default=None, help=( "Generate a JSON file describing what pip did to install " "the provided requirements. " "Can be used in combination with --dry-run and --ignore-installed " "to 'resolve' the requirements. " "When - is used as file name it writes to stdout. " "When writing to stdout, please combine with the --quiet option " "to avoid mixing pip logging output with JSON output." ), ) @with_cleanup def run(self, options: Values, args: list[str]) -> int: if options.use_user_site and options.target_dir is not None: raise CommandError("Can not combine '--user' and '--target'") # Check whether the environment we're installing into is externally # managed, as specified in PEP 668. Specifying --root, --target, or # --prefix disables the check, since there's no reliable way to locate # the EXTERNALLY-MANAGED file for those cases. An exception is also # made specifically for "--dry-run --report" for convenience. installing_into_current_environment = ( not (options.dry_run and options.json_report_file) and options.root_path is None and options.target_dir is None and options.prefix_path is None ) if ( installing_into_current_environment and not options.override_externally_managed ): check_externally_managed() upgrade_strategy = "to-satisfy-only" if options.upgrade: upgrade_strategy = options.upgrade_strategy cmdoptions.check_build_constraints(options) cmdoptions.check_dist_restriction(options, check_target=True) cmdoptions.check_release_control_exclusive(options) logger.verbose("Using %s", get_pip_version()) options.use_user_site = decide_user_install( options.use_user_site, prefix_path=options.prefix_path, target_dir=options.target_dir, root_path=options.root_path, isolated_mode=options.isolated_mode, ) target_temp_dir: TempDirectory | None = None target_temp_dir_path: str | None = None if options.target_dir: options.ignore_installed = True options.target_dir = os.path.abspath(options.target_dir) if ( # fmt: off os.path.exists(options.target_dir) and not os.path.isdir(options.target_dir) # fmt: on ): raise CommandError( "Target path exists but is not a directory, will not continue." ) # Create a target directory for using with the target option target_temp_dir = TempDirectory(kind="target") target_temp_dir_path = target_temp_dir.path self.enter_context(target_temp_dir) session = self.get_default_session(options) target_python = make_target_python(options) finder = self._build_package_finder( options=options, session=session, target_python=target_python, ignore_requires_python=options.ignore_requires_python, ) build_tracker = self.enter_context(get_build_tracker()) directory = TempDirectory( delete=not options.no_clean, kind="install", globally_managed=True, ) try: reqs = self.get_requirements(args, options, finder, session) wheel_cache = WheelCache(options.cache_dir) # Only when installing is it permitted to use PEP 660. # In other circumstances (pip wheel, pip download) we generate # regular (i.e. non editable) metadata and wheels. for req in reqs: req.permit_editable_wheels = True preparer = self.make_requirement_preparer( temp_build_dir=directory, options=options, build_tracker=build_tracker, session=session, finder=finder, use_user_site=options.use_user_site, verbosity=self.verbosity, ) resolver = self.make_resolver( preparer=preparer, finder=finder, options=options, wheel_cache=wheel_cache, use_user_site=options.use_user_site, ignore_installed=options.ignore_installed, ignore_requires_python=options.ignore_requires_python, force_reinstall=options.force_reinstall, upgrade_strategy=upgrade_strategy, py_version_info=options.python_version, ) self.trace_basic_info(finder) requirement_set = resolver.resolve( reqs, check_supported_wheels=not options.target_dir ) if options.json_report_file: report = InstallationReport(requirement_set.requirements_to_install) if options.json_report_file == "-": print_json(data=report.to_dict()) else: with open(options.json_report_file, "w", encoding="utf-8") as f: json.dump(report.to_dict(), f, indent=2, ensure_ascii=False) if options.dry_run: would_install_items = sorted( (r.metadata["name"], r.metadata["version"]) for r in requirement_set.requirements_to_install ) if would_install_items: write_output( "Would install %s", " ".join("-".join(item) for item in would_install_items), ) return SUCCESS # If there is any more preparation to do for the actual installation, do # so now. This includes actually downloading the files in the case that # we have been using PEP-658 metadata so far. preparer.prepare_linked_requirements_more( requirement_set.requirements.values() ) try: pip_req = requirement_set.get_requirement("pip") except KeyError: modifying_pip = False else: # If we're not replacing an already installed pip, # we're not modifying it. modifying_pip = pip_req.satisfied_by is None protect_pip_from_modification_on_windows(modifying_pip=modifying_pip) reqs_to_build = [ r for r in requirement_set.requirements_to_install if not r.is_wheel ] _, build_failures = build( reqs_to_build, wheel_cache=wheel_cache, verify=True, ) if build_failures: raise InstallWheelBuildError(build_failures) to_install = resolver.get_installation_order(requirement_set) # Check for conflicts in the package set we're installing. conflicts: ConflictDetails | None = None should_warn_about_conflicts = ( not options.ignore_dependencies and options.warn_about_conflicts ) if should_warn_about_conflicts: conflicts = self._determine_conflicts(to_install) # Don't warn about script install locations if # --target or --prefix has been specified warn_script_location = options.warn_script_location if options.target_dir or options.prefix_path: warn_script_location = False installed = install_given_reqs( to_install, root=options.root_path, home=target_temp_dir_path, prefix=options.prefix_path, warn_script_location=warn_script_location, use_user_site=options.use_user_site, pycompile=options.compile, progress_bar=options.progress_bar, ) lib_locations = get_lib_location_guesses( user=options.use_user_site, home=target_temp_dir_path, root=options.root_path, prefix=options.prefix_path, isolated=options.isolated_mode, ) env = get_environment(lib_locations) if conflicts is not None: self._warn_about_conflicts( conflicts, resolver_variant=self.determine_resolver_variant(options), ) if summary := installed_packages_summary(installed, env): write_output(summary) except OSError as error: show_traceback = self.verbosity >= 1 message = create_os_error_message( error, show_traceback, options.use_user_site, ) logger.error(message, exc_info=show_traceback) return ERROR if options.target_dir: assert target_temp_dir self._handle_target_dir( options.target_dir, target_temp_dir, options.upgrade ) if options.root_user_action == "warn": warn_if_run_as_root() return SUCCESS def _handle_target_dir( self, target_dir: str, target_temp_dir: TempDirectory, upgrade: bool ) -> None: ensure_dir(target_dir) # Checking both purelib and platlib directories for installed # packages to be moved to target directory lib_dir_list = [] # Checking both purelib and platlib directories for installed # packages to be moved to target directory scheme = get_scheme("", home=target_temp_dir.path) purelib_dir = scheme.purelib platlib_dir = scheme.platlib data_dir = scheme.data if os.path.exists(purelib_dir): lib_dir_list.append(purelib_dir) if os.path.exists(platlib_dir) and platlib_dir != purelib_dir: lib_dir_list.append(platlib_dir) if os.path.exists(data_dir): lib_dir_list.append(data_dir) for lib_dir in lib_dir_list: for item in os.listdir(lib_dir): if lib_dir == data_dir: ddir = os.path.join(data_dir, item) if any(s.startswith(ddir) for s in lib_dir_list[:-1]): continue target_item_dir = os.path.join(target_dir, item) if os.path.exists(target_item_dir): if not upgrade: logger.warning( "Target directory %s already exists. Specify " "--upgrade to force replacement.", target_item_dir, ) continue if os.path.islink(target_item_dir): logger.warning( "Target directory %s already exists and is " "a link. pip will not automatically replace " "links, please remove if replacement is " "desired.", target_item_dir, ) continue if os.path.isdir(target_item_dir): shutil.rmtree(target_item_dir) else: os.remove(target_item_dir) shutil.move(os.path.join(lib_dir, item), target_item_dir) def _determine_conflicts( self, to_install: list[InstallRequirement] ) -> ConflictDetails | None: try: return check_install_conflicts(to_install) except Exception: logger.exception( "Error while checking for conflicts. Please file an issue on " "pip's issue tracker: https://github.com/pypa/pip/issues/new" ) return None def _warn_about_conflicts( self, conflict_details: ConflictDetails, resolver_variant: str ) -> None: package_set, (missing, conflicting) = conflict_details if not missing and not conflicting: return parts: list[str] = [] if resolver_variant == "legacy": parts.append( "pip's legacy dependency resolver does not consider dependency " "conflicts when selecting packages. This behaviour is the " "source of the following dependency conflicts." ) else: assert resolver_variant == "resolvelib" parts.append( "pip's dependency resolver does not currently take into account " "all the packages that are installed. This behaviour is the " "source of the following dependency conflicts." ) # NOTE: There is some duplication here, with commands/check.py for project_name in missing: version = package_set[project_name][0] for dependency in missing[project_name]: message = ( f"{project_name} {version} requires {dependency[1]}, " "which is not installed." ) parts.append(message) for project_name in conflicting: version = package_set[project_name][0] for dep_name, dep_version, req in conflicting[project_name]: message = ( "{name} {version} requires {requirement}, but {you} have " "{dep_name} {dep_version} which is incompatible." ).format( name=project_name, version=version, requirement=req, dep_name=dep_name, dep_version=dep_version, you=("you" if resolver_variant == "resolvelib" else "you'll"), ) parts.append(message) logger.critical("\n".join(parts)) def installed_packages_summary( installed: list[InstallationResult], env: BaseEnvironment ) -> str: # Format a summary of installed packages, with extra care to # display a package name as it was requested by the user. installed.sort(key=operator.attrgetter("name")) summary = [] installed_versions = {} for distribution in env.iter_all_distributions(): installed_versions[distribution.canonical_name] = distribution.version for package in installed: display_name = package.name version = installed_versions.get(canonicalize_name(display_name), None) if version: text = f"{display_name}-{version}" else: text = display_name summary.append(text) if not summary: return "" return f"Successfully installed {' '.join(summary)}" def get_lib_location_guesses( user: bool = False, home: str | None = None, root: str | None = None, isolated: bool = False, prefix: str | None = None, ) -> list[str]: scheme = get_scheme( "", user=user, home=home, root=root, isolated=isolated, prefix=prefix, ) return [scheme.purelib, scheme.platlib] def site_packages_writable(root: str | None, isolated: bool) -> bool: return all( test_writable_dir(d) for d in set(get_lib_location_guesses(root=root, isolated=isolated)) ) def decide_user_install( use_user_site: bool | None, prefix_path: str | None = None, target_dir: str | None = None, root_path: str | None = None, isolated_mode: bool = False, ) -> bool: """Determine whether to do a user install based on the input options. If use_user_site is False, no additional checks are done. If use_user_site is True, it is checked for compatibility with other options. If use_user_site is None, the default behaviour depends on the environment, which is provided by the other arguments. """ # In some cases (config from tox), use_user_site can be set to an integer # rather than a bool, which 'use_user_site is False' wouldn't catch. if (use_user_site is not None) and (not use_user_site): logger.debug("Non-user install by explicit request") return False # If we have been asked for a user install explicitly, check compatibility. if use_user_site: if prefix_path: raise CommandError( "Can not combine '--user' and '--prefix' as they imply " "different installation locations" ) if virtualenv_no_global(): raise InstallationError( "Can not perform a '--user' install. User site-packages " "are not visible in this virtualenv." ) # Catch all remaining cases which honour the site.ENABLE_USER_SITE # value, such as a plain Python installation (e.g. no virtualenv). if not site.ENABLE_USER_SITE: raise InstallationError( "Can not perform a '--user' install. User site-packages " "are disabled for this Python." ) logger.debug("User install by explicit request") return True # If we are here, user installs have not been explicitly requested/avoided assert use_user_site is None # user install incompatible with --prefix/--target if prefix_path or target_dir: logger.debug("Non-user install due to --prefix or --target option") return False # If user installs are not enabled, choose a non-user install if not site.ENABLE_USER_SITE: logger.debug("Non-user install because user site-packages disabled") return False # If we have permission for a non-user install, do that, # otherwise do a user install. if site_packages_writable(root=root_path, isolated=isolated_mode): logger.debug("Non-user install because site-packages writeable") return False logger.info( "Defaulting to user installation because normal site-packages " "is not writeable" ) return True def create_os_error_message( error: OSError, show_traceback: bool, using_user_site: bool ) -> str: """Format an error message for an OSError It may occur anytime during the execution of the install command. """ parts = [] # Mention the error if we are not going to show a traceback parts.append("Could not install packages due to an OSError") if not show_traceback: parts.append(": ") parts.append(str(error)) else: parts.append(".") # Spilt the error indication from a helper message (if any) parts[-1] += "\n" # Suggest useful actions to the user: # (1) using user site-packages or (2) verifying the permissions if error.errno == errno.EACCES: user_option_part = "Consider using the `--user` option" permissions_part = "Check the permissions" if not running_under_virtualenv() and not using_user_site: parts.extend( [ user_option_part, " or ", permissions_part.lower(), ] ) else: parts.append(permissions_part) parts.append(".\n") # Suggest to check "pip config debug" in case of invalid proxy if type(error) is InvalidProxyURL: parts.append( 'Consider checking your local proxy configuration with "pip config debug"' ) parts.append(".\n") # On Windows, errors like EINVAL or ENOENT may occur # if a file or folder name exceeds 255 characters, # or if the full path exceeds 260 characters and long path support isn't enabled. # This condition checks for such cases and adds a hint to the error output. if WINDOWS and error.errno in (errno.EINVAL, errno.ENOENT) and error.filename: if any(len(part) > 255 for part in Path(error.filename).parts): parts.append( "HINT: This error might be caused by a file or folder name exceeding " "255 characters, which is a Windows limitation even if long paths " "are enabled.\n " ) if len(error.filename) > 260: parts.append( "HINT: This error might have occurred since " "this system does not have Windows Long Path " "support enabled. You can find information on " "how to enable this at " "https://pip.pypa.io/warnings/enable-long-paths\n" ) return "".join(parts).strip() + "\n" ================================================ FILE: src/pip/_internal/commands/list.py ================================================ from __future__ import annotations import json import logging from collections.abc import Generator, Sequence from email.parser import Parser from optparse import Values from typing import TYPE_CHECKING, cast from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.packaging.version import InvalidVersion, Version from pip._internal.cli import cmdoptions from pip._internal.cli.index_command import IndexGroupCommand from pip._internal.cli.status_codes import SUCCESS from pip._internal.exceptions import CommandError from pip._internal.metadata import BaseDistribution, get_environment from pip._internal.models.selection_prefs import SelectionPreferences from pip._internal.utils.compat import stdlib_pkgs from pip._internal.utils.misc import tabulate, write_output if TYPE_CHECKING: from pip._internal.index.package_finder import PackageFinder from pip._internal.network.session import PipSession class _DistWithLatestInfo(BaseDistribution): """Give the distribution object a couple of extra fields. These will be populated during ``get_outdated()``. This is dirty but makes the rest of the code much cleaner. """ latest_version: Version latest_filetype: str _ProcessedDists = Sequence[_DistWithLatestInfo] logger = logging.getLogger(__name__) class ListCommand(IndexGroupCommand): """ List installed packages, including editables. Packages are listed in a case-insensitive sorted order. """ ignore_require_venv = True usage = """ %prog [options]""" def add_options(self) -> None: self.cmd_opts.add_option( "-o", "--outdated", action="store_true", default=False, help="List outdated packages", ) self.cmd_opts.add_option( "-u", "--uptodate", action="store_true", default=False, help="List uptodate packages", ) self.cmd_opts.add_option( "-e", "--editable", action="store_true", default=False, help="List editable projects.", ) self.cmd_opts.add_option( "-l", "--local", action="store_true", default=False, help=( "If in a virtualenv that has global access, do not list " "globally-installed packages." ), ) self.cmd_opts.add_option( "--user", dest="user", action="store_true", default=False, help="Only output packages installed in user-site.", ) self.cmd_opts.add_option(cmdoptions.list_path()) self.cmd_opts.add_option( "--format", action="store", dest="list_format", default="columns", choices=("columns", "freeze", "json"), help=( "Select the output format among: columns (default), freeze, or json. " "The 'freeze' format cannot be used with the --outdated option." ), ) self.cmd_opts.add_option( "--not-required", action="store_true", dest="not_required", help="List packages that are not dependencies of installed packages.", ) self.cmd_opts.add_option( "--exclude-editable", action="store_false", dest="include_editable", help="Exclude editable package from output.", ) self.cmd_opts.add_option( "--include-editable", action="store_true", dest="include_editable", help="Include editable package in output.", default=True, ) self.cmd_opts.add_option(cmdoptions.list_exclude()) index_opts = cmdoptions.make_option_group(cmdoptions.index_group, self.parser) selection_opts = cmdoptions.make_option_group( cmdoptions.package_selection_group, self.parser, ) self.parser.insert_option_group(0, index_opts) self.parser.insert_option_group(0, selection_opts) self.parser.insert_option_group(0, self.cmd_opts) def handle_pip_version_check(self, options: Values) -> None: if options.outdated or options.uptodate: super().handle_pip_version_check(options) def _build_package_finder( self, options: Values, session: PipSession ) -> PackageFinder: """ Create a package finder appropriate to this list command. """ # Lazy import the heavy index modules as most list invocations won't need 'em. from pip._internal.index.collector import LinkCollector from pip._internal.index.package_finder import PackageFinder link_collector = LinkCollector.create(session, options=options) # Pass allow_yanked=False to ignore yanked versions. selection_prefs = SelectionPreferences( allow_yanked=False, release_control=options.release_control, ) return PackageFinder.create( link_collector=link_collector, selection_prefs=selection_prefs, ) def run(self, options: Values, args: list[str]) -> int: cmdoptions.check_release_control_exclusive(options) if options.outdated and options.uptodate: raise CommandError("Options --outdated and --uptodate cannot be combined.") if options.outdated and options.list_format == "freeze": raise CommandError( "List format 'freeze' cannot be used with the --outdated option." ) cmdoptions.check_list_path_option(options) skip = set(stdlib_pkgs) if options.excludes: skip.update(canonicalize_name(n) for n in options.excludes) packages: _ProcessedDists = [ cast("_DistWithLatestInfo", d) for d in get_environment(options.path).iter_installed_distributions( local_only=options.local, user_only=options.user, editables_only=options.editable, include_editables=options.include_editable, skip=skip, ) ] # get_not_required must be called firstly in order to find and # filter out all dependencies correctly. Otherwise a package # can't be identified as requirement because some parent packages # could be filtered out before. if options.not_required: packages = self.get_not_required(packages, options) if options.outdated: packages = self.get_outdated(packages, options) elif options.uptodate: packages = self.get_uptodate(packages, options) self.output_package_listing(packages, options) return SUCCESS def get_outdated( self, packages: _ProcessedDists, options: Values ) -> _ProcessedDists: return [ dist for dist in self.iter_packages_latest_infos(packages, options) if dist.latest_version > dist.version ] def get_uptodate( self, packages: _ProcessedDists, options: Values ) -> _ProcessedDists: return [ dist for dist in self.iter_packages_latest_infos(packages, options) if dist.latest_version == dist.version ] def get_not_required( self, packages: _ProcessedDists, options: Values ) -> _ProcessedDists: dep_keys = { canonicalize_name(dep.name) for dist in packages for dep in (dist.iter_dependencies() or ()) } # Create a set to remove duplicate packages, and cast it to a list # to keep the return type consistent with get_outdated and # get_uptodate return list({pkg for pkg in packages if pkg.canonical_name not in dep_keys}) def iter_packages_latest_infos( self, packages: _ProcessedDists, options: Values ) -> Generator[_DistWithLatestInfo, None, None]: with self._build_session(options) as session: finder = self._build_package_finder(options, session) def latest_info( dist: _DistWithLatestInfo, ) -> _DistWithLatestInfo | None: all_candidates = finder.find_all_candidates(dist.canonical_name) if self.should_exclude_prerelease(options, dist.canonical_name): all_candidates = [ candidate for candidate in all_candidates if not candidate.version.is_prerelease ] evaluator = finder.make_candidate_evaluator( project_name=dist.canonical_name, ) best_candidate = evaluator.sort_best_candidate(all_candidates) if best_candidate is None: return None remote_version = best_candidate.version if best_candidate.link.is_wheel: typ = "wheel" else: typ = "sdist" dist.latest_version = remote_version dist.latest_filetype = typ return dist for dist in map(latest_info, packages): if dist is not None: yield dist def output_package_listing( self, packages: _ProcessedDists, options: Values ) -> None: packages = sorted( packages, key=lambda dist: dist.canonical_name, ) if options.list_format == "columns" and packages: data, header = format_for_columns(packages, options) self.output_package_listing_columns(data, header) elif options.list_format == "freeze": for dist in packages: try: req_string = f"{dist.raw_name}=={dist.version}" except InvalidVersion: req_string = f"{dist.raw_name}==={dist.raw_version}" if options.verbose >= 1: write_output("%s (%s)", req_string, dist.location) else: write_output(req_string) elif options.list_format == "json": write_output(format_for_json(packages, options)) def output_package_listing_columns( self, data: list[list[str]], header: list[str] ) -> None: # insert the header first: we need to know the size of column names if len(data) > 0: data.insert(0, header) pkg_strings, sizes = tabulate(data) # Create and add a separator. if len(data) > 0: pkg_strings.insert(1, " ".join("-" * x for x in sizes)) for val in pkg_strings: write_output(val) def format_for_columns( pkgs: _ProcessedDists, options: Values ) -> tuple[list[list[str]], list[str]]: """ Convert the package data into something usable by output_package_listing_columns. """ header = ["Package", "Version"] running_outdated = options.outdated if running_outdated: header.extend(["Latest", "Type"]) def wheel_build_tag(dist: BaseDistribution) -> str | None: try: wheel_file = dist.read_text("WHEEL") except FileNotFoundError: return None return Parser().parsestr(wheel_file).get("Build") build_tags = [wheel_build_tag(p) for p in pkgs] has_build_tags = any(build_tags) if has_build_tags: header.append("Build") has_editables = any(x.editable for x in pkgs) if has_editables: header.append("Editable project location") if options.verbose >= 1: header.append("Location") if options.verbose >= 1: header.append("Installer") data = [] for i, proj in enumerate(pkgs): # if we're working on the 'outdated' list, separate out the # latest_version and type row = [proj.raw_name, proj.raw_version] if running_outdated: row.append(str(proj.latest_version)) row.append(proj.latest_filetype) if has_build_tags: row.append(build_tags[i] or "") if has_editables: row.append(proj.editable_project_location or "") if options.verbose >= 1: row.append(proj.location or "") if options.verbose >= 1: row.append(proj.installer) data.append(row) return data, header def format_for_json(packages: _ProcessedDists, options: Values) -> str: data = [] for dist in packages: try: version = str(dist.version) except InvalidVersion: version = dist.raw_version info = { "name": dist.raw_name, "version": version, } if options.verbose >= 1: info["location"] = dist.location or "" info["installer"] = dist.installer if options.outdated: info["latest_version"] = str(dist.latest_version) info["latest_filetype"] = dist.latest_filetype editable_project_location = dist.editable_project_location if editable_project_location: info["editable_project_location"] = editable_project_location data.append(info) return json.dumps(data) ================================================ FILE: src/pip/_internal/commands/lock.py ================================================ import sys from optparse import Values from pathlib import Path from pip._vendor import tomli_w from pip._vendor.packaging.pylock import is_valid_pylock_path from pip._internal.cache import WheelCache from pip._internal.cli import cmdoptions from pip._internal.cli.req_command import ( RequirementCommand, with_cleanup, ) from pip._internal.cli.status_codes import SUCCESS from pip._internal.operations.build.build_tracker import get_build_tracker from pip._internal.utils.logging import getLogger from pip._internal.utils.misc import ( get_pip_version, ) from pip._internal.utils.pylock import pylock_from_install_requirements from pip._internal.utils.temp_dir import TempDirectory logger = getLogger(__name__) class LockCommand(RequirementCommand): """ EXPERIMENTAL - Lock packages and their dependencies from: - PyPI (and other indexes) using requirement specifiers. - VCS project urls. - Local project directories. - Local or remote source archives. pip also supports locking from "requirements files", which provide an easy way to specify a whole environment to be installed. The generated lock file is only guaranteed to be valid for the current python version and platform. """ usage = """ %prog [options] [-e] ... %prog [options] [package-index-options] ... %prog [options] -r [package-index-options] ... %prog [options] ...""" def add_options(self) -> None: self.cmd_opts.add_option( cmdoptions.PipOption( "--output", "-o", dest="output_file", metavar="path", type="path", default="pylock.toml", help="Lock file name (default=pylock.toml). Use - for stdout.", ) ) self.cmd_opts.add_option(cmdoptions.requirements()) self.cmd_opts.add_option(cmdoptions.requirements_from_scripts()) self.cmd_opts.add_option(cmdoptions.constraints()) self.cmd_opts.add_option(cmdoptions.build_constraints()) self.cmd_opts.add_option(cmdoptions.no_deps()) self.cmd_opts.add_option(cmdoptions.editable()) self.cmd_opts.add_option(cmdoptions.src()) self.cmd_opts.add_option(cmdoptions.ignore_requires_python()) self.cmd_opts.add_option(cmdoptions.no_build_isolation()) self.cmd_opts.add_option(cmdoptions.use_pep517()) self.cmd_opts.add_option(cmdoptions.check_build_deps()) self.cmd_opts.add_option(cmdoptions.config_settings()) self.cmd_opts.add_option(cmdoptions.require_hashes()) self.cmd_opts.add_option(cmdoptions.progress_bar()) index_opts = cmdoptions.make_option_group( cmdoptions.index_group, self.parser, ) selection_opts = cmdoptions.make_option_group( cmdoptions.package_selection_group, self.parser, ) self.parser.insert_option_group(0, index_opts) self.parser.insert_option_group(0, selection_opts) self.parser.insert_option_group(0, self.cmd_opts) @with_cleanup def run(self, options: Values, args: list[str]) -> int: logger.verbose("Using %s", get_pip_version()) logger.warning( "pip lock is currently an experimental command. " "It may be removed/changed in a future release " "without prior warning." ) cmdoptions.check_build_constraints(options) cmdoptions.check_release_control_exclusive(options) session = self.get_default_session(options) finder = self._build_package_finder( options=options, session=session, ignore_requires_python=options.ignore_requires_python, ) build_tracker = self.enter_context(get_build_tracker()) directory = TempDirectory( delete=not options.no_clean, kind="install", globally_managed=True, ) reqs = self.get_requirements(args, options, finder, session) wheel_cache = WheelCache(options.cache_dir) # Only when installing is it permitted to use PEP 660. # In other circumstances (pip wheel, pip download) we generate # regular (i.e. non editable) metadata and wheels. for req in reqs: req.permit_editable_wheels = True preparer = self.make_requirement_preparer( temp_build_dir=directory, options=options, build_tracker=build_tracker, session=session, finder=finder, use_user_site=False, verbosity=self.verbosity, ) resolver = self.make_resolver( preparer=preparer, finder=finder, options=options, wheel_cache=wheel_cache, use_user_site=False, ignore_installed=True, ignore_requires_python=options.ignore_requires_python, upgrade_strategy="to-satisfy-only", ) self.trace_basic_info(finder) requirement_set = resolver.resolve(reqs, check_supported_wheels=True) if options.output_file == "-": base_dir = Path.cwd() else: output_file_path = Path(options.output_file) if not is_valid_pylock_path(output_file_path): logger.warning( "%s is not a valid lock file name.", output_file_path, ) base_dir = output_file_path.parent pylock = pylock_from_install_requirements( requirement_set.requirements.values(), base_dir=base_dir ) pylock_toml = tomli_w.dumps(pylock.to_dict()) if options.output_file == "-": sys.stdout.write(pylock_toml) else: output_file_path.write_text(pylock_toml, encoding="utf-8") return SUCCESS ================================================ FILE: src/pip/_internal/commands/search.py ================================================ from __future__ import annotations import logging import shutil import sys import textwrap import xmlrpc.client from collections import OrderedDict from optparse import Values from typing import TypedDict from pip._vendor.packaging.version import parse as parse_version from pip._internal.cli.base_command import Command from pip._internal.cli.req_command import SessionCommandMixin from pip._internal.cli.status_codes import NO_MATCHES_FOUND, SUCCESS from pip._internal.exceptions import CommandError from pip._internal.metadata import get_default_environment from pip._internal.metadata.base import BaseDistribution from pip._internal.models.index import PyPI from pip._internal.network.xmlrpc import PipXmlrpcTransport from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import write_output class TransformedHit(TypedDict): name: str summary: str versions: list[str] logger = logging.getLogger(__name__) class SearchCommand(Command, SessionCommandMixin): """Search for PyPI packages whose name or summary contains .""" usage = """ %prog [options] """ ignore_require_venv = True def add_options(self) -> None: self.cmd_opts.add_option( "-i", "--index", dest="index", metavar="URL", default=PyPI.pypi_url, help="Base URL of Python Package Index (default %default)", ) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: list[str]) -> int: if not args: raise CommandError("Missing required argument (search query).") query = args pypi_hits = self.search(query, options) hits = transform_hits(pypi_hits) terminal_width = None if sys.stdout.isatty(): terminal_width = shutil.get_terminal_size()[0] print_results(hits, terminal_width=terminal_width) if pypi_hits: return SUCCESS return NO_MATCHES_FOUND def search(self, query: list[str], options: Values) -> list[dict[str, str]]: index_url = options.index session = self.get_default_session(options) transport = PipXmlrpcTransport(index_url, session) pypi = xmlrpc.client.ServerProxy(index_url, transport) try: hits = pypi.search({"name": query, "summary": query}, "or") except xmlrpc.client.Fault as fault: message = ( f"XMLRPC request failed [code: {fault.faultCode}]\n{fault.faultString}" ) raise CommandError(message) assert isinstance(hits, list) return hits def transform_hits(hits: list[dict[str, str]]) -> list[TransformedHit]: """ The list from pypi is really a list of versions. We want a list of packages with the list of versions stored inline. This converts the list from pypi into one we can use. """ packages: dict[str, TransformedHit] = OrderedDict() for hit in hits: name = hit["name"] summary = hit["summary"] version = hit["version"] if name not in packages.keys(): packages[name] = { "name": name, "summary": summary, "versions": [version], } else: packages[name]["versions"].append(version) # if this is the highest version, replace summary and score if version == highest_version(packages[name]["versions"]): packages[name]["summary"] = summary return list(packages.values()) def print_dist_installation_info(latest: str, dist: BaseDistribution | None) -> None: if dist is not None: with indent_log(): if dist.version == latest: write_output("INSTALLED: %s (latest)", dist.version) else: write_output("INSTALLED: %s", dist.version) if parse_version(latest).pre: write_output( "LATEST: %s (pre-release; install" " with `pip install --pre`)", latest, ) else: write_output("LATEST: %s", latest) def get_installed_distribution(name: str) -> BaseDistribution | None: env = get_default_environment() return env.get_distribution(name) def print_results( hits: list[TransformedHit], name_column_width: int | None = None, terminal_width: int | None = None, ) -> None: if not hits: return if name_column_width is None: name_column_width = ( max( [ len(hit["name"]) + len(highest_version(hit.get("versions", ["-"]))) for hit in hits ] ) + 4 ) for hit in hits: name = hit["name"] summary = hit["summary"] or "" latest = highest_version(hit.get("versions", ["-"])) if terminal_width is not None: target_width = terminal_width - name_column_width - 5 if target_width > 10: # wrap and indent summary to fit terminal summary_lines = textwrap.wrap(summary, target_width) summary = ("\n" + " " * (name_column_width + 3)).join(summary_lines) name_latest = f"{name} ({latest})" line = f"{name_latest:{name_column_width}} - {summary}" try: write_output(line) dist = get_installed_distribution(name) print_dist_installation_info(latest, dist) except UnicodeEncodeError: pass def highest_version(versions: list[str]) -> str: return max(versions, key=parse_version) ================================================ FILE: src/pip/_internal/commands/show.py ================================================ from __future__ import annotations import logging import string from collections.abc import Generator, Iterable, Iterator from optparse import Values from typing import NamedTuple from pip._vendor.packaging.requirements import InvalidRequirement from pip._vendor.packaging.utils import canonicalize_name from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.metadata import BaseDistribution, get_default_environment from pip._internal.utils.misc import write_output logger = logging.getLogger(__name__) def normalize_project_url_label(label: str) -> str: # This logic is from PEP 753 (Well-known Project URLs in Metadata). chars_to_remove = string.punctuation + string.whitespace removal_map = str.maketrans("", "", chars_to_remove) return label.translate(removal_map).lower() class ShowCommand(Command): """ Show information about one or more installed packages. The output is in RFC-compliant mail header format. """ usage = """ %prog [options] ...""" ignore_require_venv = True def add_options(self) -> None: self.cmd_opts.add_option( "-f", "--files", dest="files", action="store_true", default=False, help="Show the full list of installed files for each package.", ) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: list[str]) -> int: if not args: logger.warning("ERROR: Please provide a package name or names.") return ERROR query = args results = search_packages_info(query) if not print_results( results, list_files=options.files, verbose=options.verbose ): return ERROR return SUCCESS class _PackageInfo(NamedTuple): name: str version: str location: str editable_project_location: str | None requires: list[str] required_by: list[str] installer: str metadata_version: str classifiers: list[str] summary: str homepage: str project_urls: list[str] author: str author_email: str license: str license_expression: str entry_points: list[str] files: list[str] | None def search_packages_info(query: list[str]) -> Generator[_PackageInfo, None, None]: """ Gather details from installed distributions. Print distribution name, version, location, and installed files. Installed files requires a pip generated 'installed-files.txt' in the distributions '.egg-info' directory. """ env = get_default_environment() installed = {dist.canonical_name: dist for dist in env.iter_all_distributions()} query_names = [canonicalize_name(name) for name in query] missing = sorted( [name for name, pkg in zip(query, query_names) if pkg not in installed] ) if missing: logger.warning("Package(s) not found: %s", ", ".join(missing)) def _get_requiring_packages(current_dist: BaseDistribution) -> Iterator[str]: return ( dist.metadata["Name"] or "UNKNOWN" for dist in installed.values() if current_dist.canonical_name in {canonicalize_name(d.name) for d in dist.iter_dependencies()} ) for query_name in query_names: try: dist = installed[query_name] except KeyError: continue try: requires = sorted( # Avoid duplicates in requirements (e.g. due to environment markers). {req.name for req in dist.iter_dependencies()}, key=str.lower, ) except InvalidRequirement: requires = sorted(dist.iter_raw_dependencies(), key=str.lower) try: required_by = sorted(_get_requiring_packages(dist), key=str.lower) except InvalidRequirement: required_by = ["#N/A"] try: entry_points_text = dist.read_text("entry_points.txt") entry_points = entry_points_text.splitlines(keepends=False) except FileNotFoundError: entry_points = [] files_iter = dist.iter_declared_entries() if files_iter is None: files: list[str] | None = None else: files = sorted(files_iter) metadata = dist.metadata project_urls = metadata.get_all("Project-URL", []) homepage = metadata.get("Home-page", "") if not homepage: # It's common that there is a "homepage" Project-URL, but Home-page # remains unset (especially as PEP 621 doesn't surface the field). for url in project_urls: url_label, url = url.split(",", maxsplit=1) normalized_label = normalize_project_url_label(url_label) if normalized_label == "homepage": homepage = url.strip() break yield _PackageInfo( name=dist.raw_name, version=dist.raw_version, location=dist.location or "", editable_project_location=dist.editable_project_location, requires=requires, required_by=required_by, installer=dist.installer, metadata_version=dist.metadata_version or "", classifiers=metadata.get_all("Classifier", []), summary=metadata.get("Summary", ""), homepage=homepage, project_urls=project_urls, author=metadata.get("Author", ""), author_email=metadata.get("Author-email", ""), license=metadata.get("License", ""), license_expression=metadata.get("License-Expression", ""), entry_points=entry_points, files=files, ) def print_results( distributions: Iterable[_PackageInfo], list_files: bool, verbose: bool, ) -> bool: """ Print the information from installed distributions found. """ results_printed = False for i, dist in enumerate(distributions): results_printed = True if i > 0: write_output("---") metadata_version_tuple = tuple(map(int, dist.metadata_version.split("."))) write_output("Name: %s", dist.name) write_output("Version: %s", dist.version) write_output("Summary: %s", dist.summary) write_output("Home-page: %s", dist.homepage) write_output("Author: %s", dist.author) write_output("Author-email: %s", dist.author_email) if metadata_version_tuple >= (2, 4) and dist.license_expression: write_output("License-Expression: %s", dist.license_expression) else: write_output("License: %s", dist.license) write_output("Location: %s", dist.location) if dist.editable_project_location is not None: write_output( "Editable project location: %s", dist.editable_project_location ) write_output("Requires: %s", ", ".join(dist.requires)) write_output("Required-by: %s", ", ".join(dist.required_by)) if verbose: write_output("Metadata-Version: %s", dist.metadata_version) write_output("Installer: %s", dist.installer) write_output("Classifiers:") for classifier in dist.classifiers: write_output(" %s", classifier) write_output("Entry-points:") for entry in dist.entry_points: write_output(" %s", entry.strip()) write_output("Project-URLs:") for project_url in dist.project_urls: write_output(" %s", project_url) if list_files: write_output("Files:") if dist.files is None: write_output("Cannot locate RECORD or installed-files.txt") else: for line in dist.files: write_output(" %s", line.strip()) return results_printed ================================================ FILE: src/pip/_internal/commands/uninstall.py ================================================ import logging from optparse import Values from pip._vendor.packaging.utils import canonicalize_name from pip._internal.cli import cmdoptions from pip._internal.cli.base_command import Command from pip._internal.cli.index_command import SessionCommandMixin from pip._internal.cli.status_codes import SUCCESS from pip._internal.exceptions import InstallationError from pip._internal.req import parse_requirements from pip._internal.req.constructors import ( install_req_from_line, install_req_from_parsed_requirement, ) from pip._internal.utils.misc import ( check_externally_managed, protect_pip_from_modification_on_windows, warn_if_run_as_root, ) logger = logging.getLogger(__name__) class UninstallCommand(Command, SessionCommandMixin): """ Uninstall packages. pip is able to uninstall most installed packages. Known exceptions are: - Pure distutils packages installed with ``python setup.py install``, which leave behind no metadata to determine what files were installed. - Script wrappers installed by ``python setup.py develop``. """ usage = """ %prog [options] ... %prog [options] -r ...""" def add_options(self) -> None: self.cmd_opts.add_option( "-r", "--requirement", dest="requirements", action="append", default=[], metavar="file", help=( "Uninstall all the packages listed in the given requirements " "file. This option can be used multiple times." ), ) self.cmd_opts.add_option( "-y", "--yes", dest="yes", action="store_true", help="Don't ask for confirmation of uninstall deletions.", ) self.cmd_opts.add_option(cmdoptions.root_user_action()) self.cmd_opts.add_option(cmdoptions.override_externally_managed()) self.parser.insert_option_group(0, self.cmd_opts) def run(self, options: Values, args: list[str]) -> int: session = self.get_default_session(options) reqs_to_uninstall = {} for name in args: req = install_req_from_line( name, isolated=options.isolated_mode, ) if req.name: reqs_to_uninstall[canonicalize_name(req.name)] = req else: logger.warning( "Invalid requirement: %r ignored -" " the uninstall command expects named" " requirements.", name, ) for filename in options.requirements: for parsed_req in parse_requirements( filename, options=options, session=session ): req = install_req_from_parsed_requirement( parsed_req, isolated=options.isolated_mode ) if req.name: reqs_to_uninstall[canonicalize_name(req.name)] = req if not reqs_to_uninstall: raise InstallationError( f"You must give at least one requirement to {self.name} (see " f'"pip help {self.name}")' ) if not options.override_externally_managed: check_externally_managed() protect_pip_from_modification_on_windows( modifying_pip="pip" in reqs_to_uninstall ) for req in reqs_to_uninstall.values(): uninstall_pathset = req.uninstall( auto_confirm=options.yes, verbose=self.verbosity > 0, ) if uninstall_pathset: uninstall_pathset.commit() if options.root_user_action == "warn": warn_if_run_as_root() return SUCCESS ================================================ FILE: src/pip/_internal/commands/wheel.py ================================================ import logging import os import shutil from optparse import Values from pip._internal.cache import WheelCache from pip._internal.cli import cmdoptions from pip._internal.cli.req_command import RequirementCommand, with_cleanup from pip._internal.cli.status_codes import SUCCESS from pip._internal.exceptions import CommandError from pip._internal.operations.build.build_tracker import get_build_tracker from pip._internal.req.req_install import ( InstallRequirement, ) from pip._internal.utils.misc import ensure_dir, normalize_path from pip._internal.utils.temp_dir import TempDirectory from pip._internal.wheel_builder import build logger = logging.getLogger(__name__) class WheelCommand(RequirementCommand): """ Build Wheel archives for your requirements and dependencies. Wheel is a built-package format, and offers the advantage of not recompiling your software during every install. For more details, see the wheel docs: https://wheel.readthedocs.io/en/latest/ 'pip wheel' uses the build system interface as described here: https://pip.pypa.io/en/stable/reference/build-system/ """ usage = """ %prog [options] ... %prog [options] -r ... %prog [options] [-e] ... %prog [options] [-e] ... %prog [options] ...""" def add_options(self) -> None: self.cmd_opts.add_option( "-w", "--wheel-dir", dest="wheel_dir", metavar="dir", default=os.curdir, help=( "Build wheels into , where the default is the " "current working directory." ), ) self.cmd_opts.add_option(cmdoptions.no_build_isolation()) self.cmd_opts.add_option(cmdoptions.use_pep517()) self.cmd_opts.add_option(cmdoptions.check_build_deps()) self.cmd_opts.add_option(cmdoptions.constraints()) self.cmd_opts.add_option(cmdoptions.build_constraints()) self.cmd_opts.add_option(cmdoptions.editable()) self.cmd_opts.add_option(cmdoptions.requirements()) self.cmd_opts.add_option(cmdoptions.requirements_from_scripts()) self.cmd_opts.add_option(cmdoptions.src()) self.cmd_opts.add_option(cmdoptions.ignore_requires_python()) self.cmd_opts.add_option(cmdoptions.no_deps()) self.cmd_opts.add_option(cmdoptions.progress_bar()) self.cmd_opts.add_option( "--no-verify", dest="no_verify", action="store_true", default=False, help="Don't verify if built wheel is valid.", ) self.cmd_opts.add_option(cmdoptions.config_settings()) self.cmd_opts.add_option(cmdoptions.require_hashes()) index_opts = cmdoptions.make_option_group( cmdoptions.index_group, self.parser, ) selection_opts = cmdoptions.make_option_group( cmdoptions.package_selection_group, self.parser, ) self.parser.insert_option_group(0, index_opts) self.parser.insert_option_group(0, selection_opts) self.parser.insert_option_group(0, self.cmd_opts) @with_cleanup def run(self, options: Values, args: list[str]) -> int: cmdoptions.check_build_constraints(options) cmdoptions.check_release_control_exclusive(options) session = self.get_default_session(options) finder = self._build_package_finder(options, session) options.wheel_dir = normalize_path(options.wheel_dir) ensure_dir(options.wheel_dir) build_tracker = self.enter_context(get_build_tracker()) directory = TempDirectory( delete=not options.no_clean, kind="wheel", globally_managed=True, ) reqs = self.get_requirements(args, options, finder, session) wheel_cache = WheelCache(options.cache_dir) preparer = self.make_requirement_preparer( temp_build_dir=directory, options=options, build_tracker=build_tracker, session=session, finder=finder, download_dir=options.wheel_dir, use_user_site=False, verbosity=self.verbosity, ) resolver = self.make_resolver( preparer=preparer, finder=finder, options=options, wheel_cache=wheel_cache, ignore_requires_python=options.ignore_requires_python, ) self.trace_basic_info(finder) requirement_set = resolver.resolve(reqs, check_supported_wheels=True) preparer.prepare_linked_requirements_more(requirement_set.requirements.values()) reqs_to_build: list[InstallRequirement] = [] for req in requirement_set.requirements.values(): if req.is_wheel: preparer.save_linked_requirement(req) else: reqs_to_build.append(req) # build wheels build_successes, build_failures = build( reqs_to_build, wheel_cache=wheel_cache, verify=(not options.no_verify), ) for req in build_successes: assert req.link and req.link.is_wheel assert req.local_file_path # copy from cache to target directory try: shutil.copy(req.local_file_path, options.wheel_dir) except OSError as e: logger.warning( "Building wheel for %s failed: %s", req.name, e, ) build_failures.append(req) if len(build_failures) != 0: raise CommandError("Failed to build one or more wheels") return SUCCESS ================================================ FILE: src/pip/_internal/configuration.py ================================================ """Configuration management setup Some terminology: - name As written in config files. - value Value associated with a name - key Name combined with it's section (section.name) - variant A single word describing where the configuration key-value pair came from """ from __future__ import annotations import configparser import locale import os import sys from collections.abc import Iterable from typing import Any, NewType from pip._internal.exceptions import ( ConfigurationError, ConfigurationFileCouldNotBeLoaded, ) from pip._internal.utils import appdirs from pip._internal.utils.compat import WINDOWS from pip._internal.utils.logging import getLogger from pip._internal.utils.misc import ensure_dir, enum RawConfigParser = configparser.RawConfigParser # Shorthand Kind = NewType("Kind", str) CONFIG_BASENAME = "pip.ini" if WINDOWS else "pip.conf" ENV_NAMES_IGNORED = "version", "help" # The kinds of configurations there are. kinds = enum( USER="user", # User Specific GLOBAL="global", # System Wide SITE="site", # [Virtual] Environment Specific ENV="env", # from PIP_CONFIG_FILE ENV_VAR="env-var", # from Environment Variables ) OVERRIDE_ORDER = kinds.GLOBAL, kinds.USER, kinds.SITE, kinds.ENV, kinds.ENV_VAR VALID_LOAD_ONLY = kinds.USER, kinds.GLOBAL, kinds.SITE logger = getLogger(__name__) # NOTE: Maybe use the optionx attribute to normalize keynames. def _normalize_name(name: str) -> str: """Make a name consistent regardless of source (environment or file)""" name = name.lower().replace("_", "-") name = name.removeprefix("--") # only prefer long opts return name def _disassemble_key(name: str) -> list[str]: if "." not in name: error_message = ( "Key does not contain dot separated section and key. " f"Perhaps you wanted to use 'global.{name}' instead?" ) raise ConfigurationError(error_message) return name.split(".", 1) def get_configuration_files() -> dict[Kind, list[str]]: global_config_files = [ os.path.join(path, CONFIG_BASENAME) for path in appdirs.site_config_dirs("pip") ] site_config_file = os.path.join(sys.prefix, CONFIG_BASENAME) legacy_config_file = os.path.join( os.path.expanduser("~"), "pip" if WINDOWS else ".pip", CONFIG_BASENAME, ) new_config_file = os.path.join(appdirs.user_config_dir("pip"), CONFIG_BASENAME) return { kinds.GLOBAL: global_config_files, kinds.SITE: [site_config_file], kinds.USER: [legacy_config_file, new_config_file], } class Configuration: """Handles management of configuration. Provides an interface to accessing and managing configuration files. This class converts provides an API that takes "section.key-name" style keys and stores the value associated with it as "key-name" under the section "section". This allows for a clean interface wherein the both the section and the key-name are preserved in an easy to manage form in the configuration files and the data stored is also nice. """ def __init__(self, isolated: bool, load_only: Kind | None = None) -> None: super().__init__() if load_only is not None and load_only not in VALID_LOAD_ONLY: raise ConfigurationError( "Got invalid value for load_only - should be one of {}".format( ", ".join(map(repr, VALID_LOAD_ONLY)) ) ) self.isolated = isolated self.load_only = load_only # Because we keep track of where we got the data from self._parsers: dict[Kind, list[tuple[str, RawConfigParser]]] = { variant: [] for variant in OVERRIDE_ORDER } self._config: dict[Kind, dict[str, dict[str, Any]]] = { variant: {} for variant in OVERRIDE_ORDER } self._modified_parsers: list[tuple[str, RawConfigParser]] = [] def load(self) -> None: """Loads configuration from configuration files and environment""" self._load_config_files() if not self.isolated: self._load_environment_vars() def get_file_to_edit(self) -> str | None: """Returns the file with highest priority in configuration""" assert self.load_only is not None, "Need to be specified a file to be editing" try: return self._get_parser_to_modify()[0] except IndexError: return None def items(self) -> Iterable[tuple[str, Any]]: """Returns key-value pairs like dict.items() representing the loaded configuration """ return self._dictionary.items() def get_value(self, key: str) -> Any: """Get a value from the configuration.""" orig_key = key key = _normalize_name(key) try: clean_config: dict[str, Any] = {} for file_values in self._dictionary.values(): clean_config.update(file_values) return clean_config[key] except KeyError: # disassembling triggers a more useful error message than simply # "No such key" in the case that the key isn't in the form command.option _disassemble_key(key) raise ConfigurationError(f"No such key - {orig_key}") def set_value(self, key: str, value: Any) -> None: """Modify a value in the configuration.""" key = _normalize_name(key) self._ensure_have_load_only() assert self.load_only fname, parser = self._get_parser_to_modify() if parser is not None: section, name = _disassemble_key(key) # Modify the parser and the configuration if not parser.has_section(section): parser.add_section(section) parser.set(section, name, value) self._config[self.load_only].setdefault(fname, {}) self._config[self.load_only][fname][key] = value self._mark_as_modified(fname, parser) def unset_value(self, key: str) -> None: """Unset a value in the configuration.""" orig_key = key key = _normalize_name(key) self._ensure_have_load_only() assert self.load_only fname, parser = self._get_parser_to_modify() if ( key not in self._config[self.load_only][fname] and key not in self._config[self.load_only] ): raise ConfigurationError(f"No such key - {orig_key}") if parser is not None: section, name = _disassemble_key(key) if not ( parser.has_section(section) and parser.remove_option(section, name) ): # The option was not removed. raise ConfigurationError( "Fatal Internal error [id=1]. Please report as a bug." ) # The section may be empty after the option was removed. if not parser.items(section): parser.remove_section(section) self._mark_as_modified(fname, parser) try: del self._config[self.load_only][fname][key] except KeyError: del self._config[self.load_only][key] def save(self) -> None: """Save the current in-memory state.""" self._ensure_have_load_only() for fname, parser in self._modified_parsers: logger.info("Writing to %s", fname) # Ensure directory exists. ensure_dir(os.path.dirname(fname)) # Ensure directory's permission(need to be writeable) try: with open(fname, "w") as f: parser.write(f) except OSError as error: raise ConfigurationError( f"An error occurred while writing to the configuration file " f"{fname}: {error}" ) # # Private routines # def _ensure_have_load_only(self) -> None: if self.load_only is None: raise ConfigurationError("Needed a specific file to be modifying.") logger.debug("Will be working with %s variant only", self.load_only) @property def _dictionary(self) -> dict[str, dict[str, Any]]: """A dictionary representing the loaded configuration.""" # NOTE: Dictionaries are not populated if not loaded. So, conditionals # are not needed here. retval = {} for variant in OVERRIDE_ORDER: retval.update(self._config[variant]) return retval def _load_config_files(self) -> None: """Loads configuration from configuration files""" config_files = dict(self.iter_config_files()) if config_files[kinds.ENV][0:1] == [os.devnull]: logger.debug( "Skipping loading configuration files due to " "environment's PIP_CONFIG_FILE being os.devnull" ) return for variant, files in config_files.items(): for fname in files: # If there's specific variant set in `load_only`, load only # that variant, not the others. if self.load_only is not None and variant != self.load_only: logger.debug("Skipping file '%s' (variant: %s)", fname, variant) continue parser = self._load_file(variant, fname) # Keeping track of the parsers used self._parsers[variant].append((fname, parser)) def _load_file(self, variant: Kind, fname: str) -> RawConfigParser: logger.verbose("For variant '%s', will try loading '%s'", variant, fname) parser = self._construct_parser(fname) for section in parser.sections(): items = parser.items(section) self._config[variant].setdefault(fname, {}) self._config[variant][fname].update(self._normalized_keys(section, items)) return parser def _construct_parser(self, fname: str) -> RawConfigParser: parser = configparser.RawConfigParser() # If there is no such file, don't bother reading it but create the # parser anyway, to hold the data. # Doing this is useful when modifying and saving files, where we don't # need to construct a parser. if os.path.exists(fname): locale_encoding = locale.getpreferredencoding(False) try: parser.read(fname, encoding=locale_encoding) except UnicodeDecodeError: # See https://github.com/pypa/pip/issues/4963 raise ConfigurationFileCouldNotBeLoaded( reason=f"contains invalid {locale_encoding} characters", fname=fname, ) except configparser.Error as error: # See https://github.com/pypa/pip/issues/4893 raise ConfigurationFileCouldNotBeLoaded(error=error) return parser def _load_environment_vars(self) -> None: """Loads configuration from environment variables""" self._config[kinds.ENV_VAR].setdefault(":env:", {}) self._config[kinds.ENV_VAR][":env:"].update( self._normalized_keys(":env:", self.get_environ_vars()) ) def _normalized_keys( self, section: str, items: Iterable[tuple[str, Any]] ) -> dict[str, Any]: """Normalizes items to construct a dictionary with normalized keys. This routine is where the names become keys and are made the same regardless of source - configuration files or environment. """ normalized = {} for name, val in items: key = section + "." + _normalize_name(name) normalized[key] = val return normalized def get_environ_vars(self) -> Iterable[tuple[str, str]]: """Returns a generator with all environmental vars with prefix PIP_""" for key, val in os.environ.items(): if key.startswith("PIP_"): name = key[4:].lower() if name not in ENV_NAMES_IGNORED: yield name, val # XXX: This is patched in the tests. def iter_config_files(self) -> Iterable[tuple[Kind, list[str]]]: """Yields variant and configuration files associated with it. This should be treated like items of a dictionary. The order here doesn't affect what gets overridden. That is controlled by OVERRIDE_ORDER. However this does control the order they are displayed to the user. It's probably most ergonomic to display things in the same order as OVERRIDE_ORDER """ # SMELL: Move the conditions out of this function env_config_file = os.environ.get("PIP_CONFIG_FILE", None) config_files = get_configuration_files() yield kinds.GLOBAL, config_files[kinds.GLOBAL] # per-user config is not loaded when env_config_file exists should_load_user_config = not self.isolated and not ( env_config_file and os.path.exists(env_config_file) ) if should_load_user_config: # The legacy config file is overridden by the new config file yield kinds.USER, config_files[kinds.USER] # virtualenv config yield kinds.SITE, config_files[kinds.SITE] if env_config_file is not None: yield kinds.ENV, [env_config_file] else: yield kinds.ENV, [] def get_values_in_config(self, variant: Kind) -> dict[str, Any]: """Get values present in a config file""" return self._config[variant] def _get_parser_to_modify(self) -> tuple[str, RawConfigParser]: # Determine which parser to modify assert self.load_only parsers = self._parsers[self.load_only] if not parsers: # This should not happen if everything works correctly. raise ConfigurationError( "Fatal Internal error [id=2]. Please report as a bug." ) # Use the highest priority parser. return parsers[-1] # XXX: This is patched in the tests. def _mark_as_modified(self, fname: str, parser: RawConfigParser) -> None: file_parser_tuple = (fname, parser) if file_parser_tuple not in self._modified_parsers: self._modified_parsers.append(file_parser_tuple) def __repr__(self) -> str: return f"{self.__class__.__name__}({self._dictionary!r})" ================================================ FILE: src/pip/_internal/distributions/__init__.py ================================================ from pip._internal.distributions.base import AbstractDistribution from pip._internal.distributions.sdist import SourceDistribution from pip._internal.distributions.wheel import WheelDistribution from pip._internal.req.req_install import InstallRequirement def make_distribution_for_install_requirement( install_req: InstallRequirement, ) -> AbstractDistribution: """Returns a Distribution for the given InstallRequirement""" # Editable requirements will always be source distributions. They use the # legacy logic until we create a modern standard for them. if install_req.editable: return SourceDistribution(install_req) # If it's a wheel, it's a WheelDistribution if install_req.is_wheel: return WheelDistribution(install_req) # Otherwise, a SourceDistribution return SourceDistribution(install_req) ================================================ FILE: src/pip/_internal/distributions/base.py ================================================ from __future__ import annotations import abc from typing import TYPE_CHECKING from pip._internal.metadata.base import BaseDistribution from pip._internal.req import InstallRequirement if TYPE_CHECKING: from pip._internal.build_env import BuildEnvironmentInstaller class AbstractDistribution(metaclass=abc.ABCMeta): """A base class for handling installable artifacts. The requirements for anything installable are as follows: - we must be able to determine the requirement name (or we can't correctly handle the non-upgrade case). - for packages with setup requirements, we must also be able to determine their requirements without installing additional packages (for the same reason as run-time dependencies) - we must be able to create a Distribution object exposing the above metadata. - if we need to do work in the build tracker, we must be able to generate a unique string to identify the requirement in the build tracker. """ def __init__(self, req: InstallRequirement) -> None: super().__init__() self.req = req @abc.abstractproperty def build_tracker_id(self) -> str | None: """A string that uniquely identifies this requirement to the build tracker. If None, then this dist has no work to do in the build tracker, and ``.prepare_distribution_metadata()`` will not be called.""" raise NotImplementedError() @abc.abstractmethod def get_metadata_distribution(self) -> BaseDistribution: raise NotImplementedError() @abc.abstractmethod def prepare_distribution_metadata( self, build_env_installer: BuildEnvironmentInstaller, build_isolation: bool, check_build_deps: bool, ) -> None: raise NotImplementedError() ================================================ FILE: src/pip/_internal/distributions/installed.py ================================================ from __future__ import annotations from typing import TYPE_CHECKING from pip._internal.distributions.base import AbstractDistribution from pip._internal.metadata import BaseDistribution if TYPE_CHECKING: from pip._internal.build_env import BuildEnvironmentInstaller class InstalledDistribution(AbstractDistribution): """Represents an installed package. This does not need any preparation as the required information has already been computed. """ @property def build_tracker_id(self) -> str | None: return None def get_metadata_distribution(self) -> BaseDistribution: assert self.req.satisfied_by is not None, "not actually installed" return self.req.satisfied_by def prepare_distribution_metadata( self, build_env_installer: BuildEnvironmentInstaller, build_isolation: bool, check_build_deps: bool, ) -> None: pass ================================================ FILE: src/pip/_internal/distributions/sdist.py ================================================ from __future__ import annotations import logging from collections.abc import Iterable from typing import TYPE_CHECKING from pip._internal.build_env import BuildEnvironment from pip._internal.distributions.base import AbstractDistribution from pip._internal.exceptions import InstallationError from pip._internal.metadata import BaseDistribution from pip._internal.utils.subprocess import runner_with_spinner_message if TYPE_CHECKING: from pip._internal.build_env import BuildEnvironmentInstaller logger = logging.getLogger(__name__) class SourceDistribution(AbstractDistribution): """Represents a source distribution. The preparation step for these needs metadata for the packages to be generated. """ @property def build_tracker_id(self) -> str | None: """Identify this requirement uniquely by its link.""" assert self.req.link return self.req.link.url_without_fragment def get_metadata_distribution(self) -> BaseDistribution: return self.req.get_dist() def prepare_distribution_metadata( self, build_env_installer: BuildEnvironmentInstaller, build_isolation: bool, check_build_deps: bool, ) -> None: # Load pyproject.toml self.req.load_pyproject_toml() # Set up the build isolation, if this requirement should be isolated if build_isolation: # Setup an isolated environment and install the build backend static # requirements in it. self._prepare_build_backend(build_env_installer) # Check that the build backend supports PEP 660. This cannot be done # earlier because we need to setup the build backend to verify it # supports build_editable, nor can it be done later, because we want # to avoid installing build requirements needlessly. self.req.editable_sanity_check() # Install the dynamic build requirements. self._install_build_reqs(build_env_installer) else: # When not using build isolation, we still need to check that # the build backend supports PEP 660. self.req.editable_sanity_check() # Check if the current environment provides build dependencies if check_build_deps: pyproject_requires = self.req.pyproject_requires assert pyproject_requires is not None conflicting, missing = self.req.build_env.check_requirements( pyproject_requires ) if conflicting: self._raise_conflicts("the backend dependencies", conflicting) if missing: self._raise_missing_reqs(missing) self.req.prepare_metadata() def _prepare_build_backend( self, build_env_installer: BuildEnvironmentInstaller ) -> None: # Isolate in a BuildEnvironment and install the build-time # requirements. pyproject_requires = self.req.pyproject_requires assert pyproject_requires is not None self.req.build_env = BuildEnvironment(build_env_installer) self.req.build_env.install_requirements( pyproject_requires, "overlay", kind="build dependencies", for_req=self.req ) conflicting, missing = self.req.build_env.check_requirements( self.req.requirements_to_check ) if conflicting: self._raise_conflicts("PEP 517/518 supported requirements", conflicting) if missing: logger.warning( "Missing build requirements in pyproject.toml for %s.", self.req, ) logger.warning( "The project does not specify a build backend, and " "pip cannot fall back to setuptools without %s.", " and ".join(map(repr, sorted(missing))), ) def _get_build_requires_wheel(self) -> Iterable[str]: with self.req.build_env: runner = runner_with_spinner_message("Getting requirements to build wheel") backend = self.req.pep517_backend assert backend is not None with backend.subprocess_runner(runner): return backend.get_requires_for_build_wheel() def _get_build_requires_editable(self) -> Iterable[str]: with self.req.build_env: runner = runner_with_spinner_message( "Getting requirements to build editable" ) backend = self.req.pep517_backend assert backend is not None with backend.subprocess_runner(runner): return backend.get_requires_for_build_editable() def _install_build_reqs( self, build_env_installer: BuildEnvironmentInstaller ) -> None: # Install any extra build dependencies that the backend requests. # This must be done in a second pass, as the pyproject.toml # dependencies must be installed before we can call the backend. if ( self.req.editable and self.req.permit_editable_wheels and self.req.supports_pyproject_editable ): build_reqs = self._get_build_requires_editable() else: build_reqs = self._get_build_requires_wheel() conflicting, missing = self.req.build_env.check_requirements(build_reqs) if conflicting: self._raise_conflicts("the backend dependencies", conflicting) self.req.build_env.install_requirements( missing, "normal", kind="backend dependencies", for_req=self.req ) def _raise_conflicts( self, conflicting_with: str, conflicting_reqs: set[tuple[str, str]] ) -> None: format_string = ( "Some build dependencies for {requirement} " "conflict with {conflicting_with}: {description}." ) error_message = format_string.format( requirement=self.req, conflicting_with=conflicting_with, description=", ".join( f"{installed} is incompatible with {wanted}" for installed, wanted in sorted(conflicting_reqs) ), ) raise InstallationError(error_message) def _raise_missing_reqs(self, missing: set[str]) -> None: format_string = ( "Some build dependencies for {requirement} are missing: {missing}." ) error_message = format_string.format( requirement=self.req, missing=", ".join(map(repr, sorted(missing))) ) raise InstallationError(error_message) ================================================ FILE: src/pip/_internal/distributions/wheel.py ================================================ from __future__ import annotations from typing import TYPE_CHECKING from pip._vendor.packaging.utils import canonicalize_name from pip._internal.distributions.base import AbstractDistribution from pip._internal.metadata import ( BaseDistribution, FilesystemWheel, get_wheel_distribution, ) if TYPE_CHECKING: from pip._internal.build_env import BuildEnvironmentInstaller class WheelDistribution(AbstractDistribution): """Represents a wheel distribution. This does not need any preparation as wheels can be directly unpacked. """ @property def build_tracker_id(self) -> str | None: return None def get_metadata_distribution(self) -> BaseDistribution: """Loads the metadata from the wheel file into memory and returns a Distribution that uses it, not relying on the wheel file or requirement. """ assert self.req.local_file_path, "Set as part of preparation during download" assert self.req.name, "Wheels are never unnamed" wheel = FilesystemWheel(self.req.local_file_path) return get_wheel_distribution(wheel, canonicalize_name(self.req.name)) def prepare_distribution_metadata( self, build_env_installer: BuildEnvironmentInstaller, build_isolation: bool, check_build_deps: bool, ) -> None: pass ================================================ FILE: src/pip/_internal/exceptions.py ================================================ """Exceptions used throughout package. This module MUST NOT try to import from anything within `pip._internal` to operate. This is expected to be importable from any/all files within the subpackage and, thus, should not depend on them. """ from __future__ import annotations import configparser import contextlib import locale import logging import pathlib import re import sys import traceback from collections.abc import Iterable, Iterator from itertools import chain, groupby, repeat from typing import TYPE_CHECKING, Literal from pip._vendor.packaging.requirements import InvalidRequirement from pip._vendor.packaging.version import InvalidVersion from pip._vendor.rich.console import Console, ConsoleOptions, RenderResult from pip._vendor.rich.markup import escape from pip._vendor.rich.text import Text if TYPE_CHECKING: from hashlib import _Hash from pip._vendor.requests.models import PreparedRequest, Request, Response from pip._internal.metadata import BaseDistribution from pip._internal.models.link import Link from pip._internal.network.download import _FileDownload from pip._internal.req.req_install import InstallRequirement logger = logging.getLogger(__name__) # # Scaffolding # def _is_kebab_case(s: str) -> bool: return re.match(r"^[a-z]+(-[a-z]+)*$", s) is not None def _prefix_with_indent( s: Text | str, console: Console, *, prefix: str, indent: str, ) -> Text: if isinstance(s, Text): text = s else: text = console.render_str(s) return console.render_str(prefix, overflow="ignore") + console.render_str( f"\n{indent}", overflow="ignore" ).join(text.split(allow_blank=True)) class PipError(Exception): """The base pip error.""" class DiagnosticPipError(PipError): """An error, that presents diagnostic information to the user. This contains a bunch of logic, to enable pretty presentation of our error messages. Each error gets a unique reference. Each error can also include additional context, a hint and/or a note -- which are presented with the main error message in a consistent style. This is adapted from the error output styling in `sphinx-theme-builder`. """ reference: str def __init__( self, *, kind: Literal["error", "warning"] = "error", reference: str | None = None, message: str | Text, context: str | Text | None, hint_stmt: str | Text | None, note_stmt: str | Text | None = None, link: str | None = None, ) -> None: # Ensure a proper reference is provided. if reference is None: assert hasattr(self, "reference"), "error reference not provided!" reference = self.reference assert _is_kebab_case(reference), "error reference must be kebab-case!" self.kind = kind self.reference = reference self.message = message self.context = context self.note_stmt = note_stmt self.hint_stmt = hint_stmt self.link = link super().__init__(f"<{self.__class__.__name__}: {self.reference}>") def __repr__(self) -> str: return ( f"<{self.__class__.__name__}(" f"reference={self.reference!r}, " f"message={self.message!r}, " f"context={self.context!r}, " f"note_stmt={self.note_stmt!r}, " f"hint_stmt={self.hint_stmt!r}" ")>" ) def __rich_console__( self, console: Console, options: ConsoleOptions, ) -> RenderResult: colour = "red" if self.kind == "error" else "yellow" yield f"[{colour} bold]{self.kind}[/]: [bold]{self.reference}[/]" yield "" if not options.ascii_only: # Present the main message, with relevant context indented. if self.context is not None: yield _prefix_with_indent( self.message, console, prefix=f"[{colour}]×[/] ", indent=f"[{colour}]│[/] ", ) yield _prefix_with_indent( self.context, console, prefix=f"[{colour}]╰─>[/] ", indent=f"[{colour}] [/] ", ) else: yield _prefix_with_indent( self.message, console, prefix="[red]×[/] ", indent=" ", ) else: yield self.message if self.context is not None: yield "" yield self.context if self.note_stmt is not None or self.hint_stmt is not None: yield "" if self.note_stmt is not None: yield _prefix_with_indent( self.note_stmt, console, prefix="[magenta bold]note[/]: ", indent=" ", ) if self.hint_stmt is not None: yield _prefix_with_indent( self.hint_stmt, console, prefix="[cyan bold]hint[/]: ", indent=" ", ) if self.link is not None: yield "" yield f"Link: {self.link}" # # Actual Errors # class ConfigurationError(PipError): """General exception in configuration""" class InstallationError(PipError): """General exception during installation""" class FailedToPrepareCandidate(InstallationError): """Raised when we fail to prepare a candidate (i.e. fetch and generate metadata). This is intentionally not a diagnostic error, since the output will be presented above this error, when this occurs. This should instead present information to the user. """ def __init__( self, *, package_name: str, requirement_chain: str, failed_step: str ) -> None: super().__init__(f"Failed to build '{package_name}' when {failed_step.lower()}") self.package_name = package_name self.requirement_chain = requirement_chain self.failed_step = failed_step class MissingPyProjectBuildRequires(DiagnosticPipError): """Raised when pyproject.toml has `build-system`, but no `build-system.requires`.""" reference = "missing-pyproject-build-system-requires" def __init__(self, *, package: str) -> None: super().__init__( message=f"Can not process {escape(package)}", context=Text( "This package has an invalid pyproject.toml file.\n" "The [build-system] table is missing the mandatory `requires` key." ), note_stmt="This is an issue with the package mentioned above, not pip.", hint_stmt=Text("See PEP 518 for the detailed specification."), ) class InvalidPyProjectBuildRequires(DiagnosticPipError): """Raised when pyproject.toml an invalid `build-system.requires`.""" reference = "invalid-pyproject-build-system-requires" def __init__(self, *, package: str, reason: str) -> None: super().__init__( message=f"Can not process {escape(package)}", context=Text( "This package has an invalid `build-system.requires` key in " f"pyproject.toml.\n{reason}" ), note_stmt="This is an issue with the package mentioned above, not pip.", hint_stmt=Text("See PEP 518 for the detailed specification."), ) class NoneMetadataError(PipError): """Raised when accessing a Distribution's "METADATA" or "PKG-INFO". This signifies an inconsistency, when the Distribution claims to have the metadata file (if not, raise ``FileNotFoundError`` instead), but is not actually able to produce its content. This may be due to permission errors. """ def __init__( self, dist: BaseDistribution, metadata_name: str, ) -> None: """ :param dist: A Distribution object. :param metadata_name: The name of the metadata being accessed (can be "METADATA" or "PKG-INFO"). """ self.dist = dist self.metadata_name = metadata_name def __str__(self) -> str: # Use `dist` in the error message because its stringification # includes more information, like the version and location. return f"None {self.metadata_name} metadata found for distribution: {self.dist}" class UserInstallationInvalid(InstallationError): """A --user install is requested on an environment without user site.""" def __str__(self) -> str: return "User base directory is not specified" class InvalidSchemeCombination(InstallationError): def __str__(self) -> str: before = ", ".join(str(a) for a in self.args[:-1]) return f"Cannot set {before} and {self.args[-1]} together" class DistributionNotFound(InstallationError): """Raised when a distribution cannot be found to satisfy a requirement""" class RequirementsFileParseError(InstallationError): """Raised when a general error occurs parsing a requirements file line.""" class BestVersionAlreadyInstalled(PipError): """Raised when the most up-to-date version of a package is already installed.""" class BadCommand(PipError): """Raised when virtualenv or a command is not found""" class CommandError(PipError): """Raised when there is an error in command-line arguments""" class PreviousBuildDirError(PipError): """Raised when there's a previous conflicting build directory""" class NetworkConnectionError(PipError): """HTTP connection error""" def __init__( self, error_msg: str, response: Response | None = None, request: Request | PreparedRequest | None = None, ) -> None: """ Initialize NetworkConnectionError with `request` and `response` objects. """ self.response = response self.request = request self.error_msg = error_msg if ( self.response is not None and not self.request and hasattr(response, "request") ): self.request = self.response.request super().__init__(error_msg, response, request) def __str__(self) -> str: return str(self.error_msg) class InvalidWheelFilename(InstallationError): """Invalid wheel filename.""" class UnsupportedWheel(InstallationError): """Unsupported wheel.""" class InvalidWheel(InstallationError): """Invalid (e.g. corrupt) wheel.""" def __init__(self, location: str, name: str): self.location = location self.name = name def __str__(self) -> str: return f"Wheel '{self.name}' located at {self.location} is invalid." class MetadataInconsistent(InstallationError): """Built metadata contains inconsistent information. This is raised when the metadata contains values (e.g. name and version) that do not match the information previously obtained from sdist filename, user-supplied ``#egg=`` value, or an install requirement name. """ def __init__( self, ireq: InstallRequirement, field: str, f_val: str, m_val: str ) -> None: self.ireq = ireq self.field = field self.f_val = f_val self.m_val = m_val def __str__(self) -> str: return ( f"Requested {self.ireq} has inconsistent {self.field}: " f"expected {self.f_val!r}, but metadata has {self.m_val!r}" ) class MetadataInvalid(InstallationError): """Metadata is invalid.""" def __init__(self, ireq: InstallRequirement, error: str) -> None: self.ireq = ireq self.error = error def __str__(self) -> str: return f"Requested {self.ireq} has invalid metadata: {self.error}" class InstallationSubprocessError(DiagnosticPipError, InstallationError): """A subprocess call failed.""" reference = "subprocess-exited-with-error" def __init__( self, *, command_description: str, exit_code: int, output_lines: list[str] | None, ) -> None: if output_lines is None: output_prompt = Text("No available output.") else: output_prompt = ( Text.from_markup(f"[red][{len(output_lines)} lines of output][/]\n") + Text("".join(output_lines)) + Text.from_markup(R"[red]\[end of output][/]") ) super().__init__( message=( f"[green]{escape(command_description)}[/] did not run successfully.\n" f"exit code: {exit_code}" ), context=output_prompt, hint_stmt=None, note_stmt=( "This error originates from a subprocess, and is likely not a " "problem with pip." ), ) self.command_description = command_description self.exit_code = exit_code def __str__(self) -> str: return f"{self.command_description} exited with {self.exit_code}" class MetadataGenerationFailed(DiagnosticPipError, InstallationError): reference = "metadata-generation-failed" def __init__( self, *, package_details: str, ) -> None: super().__init__( message="Encountered error while generating package metadata.", context=escape(package_details), hint_stmt="See above for details.", note_stmt="This is an issue with the package mentioned above, not pip.", ) def __str__(self) -> str: return "metadata generation failed" class HashErrors(InstallationError): """Multiple HashError instances rolled into one for reporting""" def __init__(self) -> None: self.errors: list[HashError] = [] def append(self, error: HashError) -> None: self.errors.append(error) def __str__(self) -> str: lines = [] self.errors.sort(key=lambda e: e.order) for cls, errors_of_cls in groupby(self.errors, lambda e: e.__class__): lines.append(cls.head) lines.extend(e.body() for e in errors_of_cls) if lines: return "\n".join(lines) return "" def __bool__(self) -> bool: return bool(self.errors) class HashError(InstallationError): """ A failure to verify a package against known-good hashes :cvar order: An int sorting hash exception classes by difficulty of recovery (lower being harder), so the user doesn't bother fretting about unpinned packages when he has deeper issues, like VCS dependencies, to deal with. Also keeps error reports in a deterministic order. :cvar head: A section heading for display above potentially many exceptions of this kind :ivar req: The InstallRequirement that triggered this error. This is pasted on after the exception is instantiated, because it's not typically available earlier. """ req: InstallRequirement | None = None head = "" order: int = -1 def body(self) -> str: """Return a summary of me for display under the heading. This default implementation simply prints a description of the triggering requirement. :param req: The InstallRequirement that provoked this error, with its link already populated by the resolver's _populate_link(). """ return f" {self._requirement_name()}" def __str__(self) -> str: return f"{self.head}\n{self.body()}" def _requirement_name(self) -> str: """Return a description of the requirement that triggered me. This default implementation returns long description of the req, with line numbers """ return str(self.req) if self.req else "unknown package" class VcsHashUnsupported(HashError): """A hash was provided for a version-control-system-based requirement, but we don't have a method for hashing those.""" order = 0 head = ( "Can't verify hashes for these requirements because we don't " "have a way to hash version control repositories:" ) class DirectoryUrlHashUnsupported(HashError): """A hash was provided for a version-control-system-based requirement, but we don't have a method for hashing those.""" order = 1 head = ( "Can't verify hashes for these file:// requirements because they " "point to directories:" ) class HashMissing(HashError): """A hash was needed for a requirement but is absent.""" order = 2 head = ( "Hashes are required in --require-hashes mode, but they are " "missing from some requirements. Here is a list of those " "requirements along with the hashes their downloaded archives " "actually had. Add lines like these to your requirements files to " "prevent tampering. (If you did not enable --require-hashes " "manually, note that it turns on automatically when any package " "has a hash.)" ) def __init__(self, gotten_hash: str) -> None: """ :param gotten_hash: The hash of the (possibly malicious) archive we just downloaded """ self.gotten_hash = gotten_hash def body(self) -> str: # Dodge circular import. from pip._internal.utils.hashes import FAVORITE_HASH package = None if self.req: # In the case of URL-based requirements, display the original URL # seen in the requirements file rather than the package name, # so the output can be directly copied into the requirements file. package = ( self.req.original_link if self.req.is_direct # In case someone feeds something downright stupid # to InstallRequirement's constructor. else getattr(self.req, "req", None) ) return " {} --hash={}:{}".format( package or "unknown package", FAVORITE_HASH, self.gotten_hash ) class HashUnpinned(HashError): """A requirement had a hash specified but was not pinned to a specific version.""" order = 3 head = ( "In --require-hashes mode, all requirements must have their " "versions pinned with ==. These do not:" ) class HashMismatch(HashError): """ Distribution file hash values don't match. :ivar package_name: The name of the package that triggered the hash mismatch. Feel free to write to this after the exception is raise to improve its error message. """ order = 4 head = ( "THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS " "FILE. If you have updated the package versions, please update " "the hashes. Otherwise, examine the package contents carefully; " "someone may have tampered with them." ) def __init__(self, allowed: dict[str, list[str]], gots: dict[str, _Hash]) -> None: """ :param allowed: A dict of algorithm names pointing to lists of allowed hex digests :param gots: A dict of algorithm names pointing to hashes we actually got from the files under suspicion """ self.allowed = allowed self.gots = gots def body(self) -> str: return f" {self._requirement_name()}:\n{self._hash_comparison()}" def _hash_comparison(self) -> str: """ Return a comparison of actual and expected hash values. Example:: Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde or 123451234512345123451234512345123451234512345 Got bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef """ def hash_then_or(hash_name: str) -> chain[str]: # For now, all the decent hashes have 6-char names, so we can get # away with hard-coding space literals. return chain([hash_name], repeat(" or")) lines: list[str] = [] for hash_name, expecteds in self.allowed.items(): prefix = hash_then_or(hash_name) lines.extend((f" Expected {next(prefix)} {e}") for e in expecteds) lines.append( f" Got {self.gots[hash_name].hexdigest()}\n" ) return "\n".join(lines) class UnsupportedPythonVersion(InstallationError): """Unsupported python version according to Requires-Python package metadata.""" class ConfigurationFileCouldNotBeLoaded(ConfigurationError): """When there are errors while loading a configuration file""" def __init__( self, reason: str = "could not be loaded", fname: str | None = None, error: configparser.Error | None = None, ) -> None: super().__init__(error) self.reason = reason self.fname = fname self.error = error def __str__(self) -> str: if self.fname is not None: message_part = f" in {self.fname}." else: assert self.error is not None message_part = f".\n{self.error}\n" return f"Configuration file {self.reason}{message_part}" _DEFAULT_EXTERNALLY_MANAGED_ERROR = f"""\ The Python environment under {sys.prefix} is managed externally, and may not be manipulated by the user. Please use specific tooling from the distributor of the Python installation to interact with this environment instead. """ class ExternallyManagedEnvironment(DiagnosticPipError): """The current environment is externally managed. This is raised when the current environment is externally managed, as defined by `PEP 668`_. The ``EXTERNALLY-MANAGED`` configuration is checked and displayed when the error is bubbled up to the user. :param error: The error message read from ``EXTERNALLY-MANAGED``. """ reference = "externally-managed-environment" def __init__(self, error: str | None) -> None: if error is None: context = Text(_DEFAULT_EXTERNALLY_MANAGED_ERROR) else: context = Text(error) super().__init__( message="This environment is externally managed", context=context, note_stmt=( "If you believe this is a mistake, please contact your " "Python installation or OS distribution provider. " "You can override this, at the risk of breaking your Python " "installation or OS, by passing --break-system-packages." ), hint_stmt=Text("See PEP 668 for the detailed specification."), ) @staticmethod def _iter_externally_managed_error_keys() -> Iterator[str]: # LC_MESSAGES is in POSIX, but not the C standard. The most common # platform that does not implement this category is Windows, where # using other categories for console message localization is equally # unreliable, so we fall back to the locale-less vendor message. This # can always be re-evaluated when a vendor proposes a new alternative. try: category = locale.LC_MESSAGES except AttributeError: lang: str | None = None else: lang, _ = locale.getlocale(category) if lang is not None: yield f"Error-{lang}" for sep in ("-", "_"): before, found, _ = lang.partition(sep) if not found: continue yield f"Error-{before}" yield "Error" @classmethod def from_config( cls, config: pathlib.Path | str, ) -> ExternallyManagedEnvironment: parser = configparser.ConfigParser(interpolation=None) try: parser.read(config, encoding="utf-8") section = parser["externally-managed"] for key in cls._iter_externally_managed_error_keys(): with contextlib.suppress(KeyError): return cls(section[key]) except KeyError: pass except (OSError, UnicodeDecodeError, configparser.ParsingError): from pip._internal.utils._log import VERBOSE exc_info = logger.isEnabledFor(VERBOSE) logger.warning("Failed to read %s", config, exc_info=exc_info) return cls(None) class UninstallMissingRecord(DiagnosticPipError): reference = "uninstall-no-record-file" def __init__(self, *, distribution: BaseDistribution) -> None: installer = distribution.installer if not installer or installer == "pip": dep = f"{distribution.raw_name}=={distribution.version}" hint = Text.assemble( "You might be able to recover from this via: ", (f"pip install --force-reinstall --no-deps {dep}", "green"), ) else: hint = Text( f"The package was installed by {installer}. " "You should check if it can uninstall the package." ) super().__init__( message=Text(f"Cannot uninstall {distribution}"), context=( "The package's contents are unknown: " f"no RECORD file was found for {distribution.raw_name}." ), hint_stmt=hint, ) class LegacyDistutilsInstall(DiagnosticPipError): reference = "uninstall-distutils-installed-package" def __init__(self, *, distribution: BaseDistribution) -> None: super().__init__( message=Text(f"Cannot uninstall {distribution}"), context=( "It is a distutils installed project and thus we cannot accurately " "determine which files belong to it which would lead to only a partial " "uninstall." ), hint_stmt=None, ) class InvalidInstalledPackage(DiagnosticPipError): reference = "invalid-installed-package" def __init__( self, *, dist: BaseDistribution, invalid_exc: InvalidRequirement | InvalidVersion, ) -> None: installed_location = dist.installed_location if isinstance(invalid_exc, InvalidRequirement): invalid_type = "requirement" else: invalid_type = "version" super().__init__( message=Text( f"Cannot process installed package {dist} " + (f"in {installed_location!r} " if installed_location else "") + f"because it has an invalid {invalid_type}:\n{invalid_exc.args[0]}" ), context=( "Starting with pip 24.1, packages with invalid " f"{invalid_type}s can not be processed." ), hint_stmt="To proceed this package must be uninstalled.", ) class IncompleteDownloadError(DiagnosticPipError): """Raised when the downloader receives fewer bytes than advertised in the Content-Length header.""" reference = "incomplete-download" def __init__(self, download: _FileDownload) -> None: # Dodge circular import. from pip._internal.utils.misc import format_size assert download.size is not None download_status = ( f"{format_size(download.bytes_received)}/{format_size(download.size)}" ) if download.reattempts: retry_status = f"after {download.reattempts + 1} attempts " hint = "Use --resume-retries to configure resume attempt limit." else: # Download retrying is not enabled. retry_status = "" hint = "Consider using --resume-retries to enable download resumption." message = Text( f"Download failed {retry_status}because not enough bytes " f"were received ({download_status})" ) super().__init__( message=message, context=f"URL: {download.link.redacted_url}", hint_stmt=hint, note_stmt="This is an issue with network connectivity, not pip.", ) class ResolutionTooDeepError(DiagnosticPipError): """Raised when the dependency resolver exceeds the maximum recursion depth.""" reference = "resolution-too-deep" def __init__(self) -> None: super().__init__( message="Dependency resolution exceeded maximum depth", context=( "Pip cannot resolve the current dependencies as the dependency graph " "is too complex for pip to solve efficiently." ), hint_stmt=( "Try adding lower bounds to constrain your dependencies, " "for example: 'package>=2.0.0' instead of just 'package'. " ), link="https://pip.pypa.io/en/stable/topics/dependency-resolution/#handling-resolution-too-deep-errors", ) class InstallWheelBuildError(DiagnosticPipError): reference = "failed-wheel-build-for-install" def __init__(self, failed: list[InstallRequirement]) -> None: super().__init__( message=( "Failed to build installable wheels for some " "pyproject.toml based projects" ), context=", ".join(r.name for r in failed), # type: ignore hint_stmt=None, ) class InvalidEggFragment(DiagnosticPipError): reference = "invalid-egg-fragment" def __init__(self, link: Link, fragment: str) -> None: hint = "" if ">" in fragment or "=" in fragment or "<" in fragment: hint = ( "Version specifiers are silently ignored for URL references. " "Remove them. " ) if "[" in fragment and "]" in fragment: hint += "Try using the Direct URL requirement syntax: 'name[extra] @ URL'" if not hint: hint = "Egg fragments can only be a valid project name." super().__init__( message=f"The '{escape(fragment)}' egg fragment is invalid", context=f"from '{escape(str(link))}'", hint_stmt=escape(hint), ) class BuildDependencyInstallError(DiagnosticPipError): """Raised when build dependencies cannot be installed.""" reference = "failed-build-dependency-install" def __init__( self, req: InstallRequirement | None, build_reqs: Iterable[str], *, cause: Exception, log_lines: list[str] | None, ) -> None: if isinstance(cause, PipError): note = "This is likely not a problem with pip." else: note = ( "pip crashed unexpectedly. Please file an issue on pip's issue " "tracker: https://github.com/pypa/pip/issues/new" ) if log_lines is None: # No logs are available, they must have been printed earlier. context = Text("See above for more details.") else: if isinstance(cause, PipError): log_lines.append(f"ERROR: {cause}") else: # Split rendered error into real lines without trailing newlines. log_lines.extend( "".join(traceback.format_exception(cause)).splitlines() ) context = Text.assemble( f"Installing {' '.join(build_reqs)}\n", (f"[{len(log_lines)} lines of output]\n", "red"), "\n".join(log_lines), ("\n[end of output]", "red"), ) message = Text("Cannot install build dependencies", "green") if req: message += Text(f" for {req}") super().__init__( message=message, context=context, hint_stmt=None, note_stmt=note ) ================================================ FILE: src/pip/_internal/index/__init__.py ================================================ """Index interaction code""" ================================================ FILE: src/pip/_internal/index/collector.py ================================================ """ The main purpose of this module is to expose LinkCollector.collect_sources(). """ from __future__ import annotations import collections import email.message import functools import itertools import json import logging import os import urllib.parse from collections.abc import Iterable, MutableMapping, Sequence from dataclasses import dataclass from html.parser import HTMLParser from optparse import Values from typing import ( Callable, NamedTuple, Protocol, ) from pip._vendor import requests from pip._vendor.requests import Response from pip._vendor.requests.exceptions import RetryError, SSLError from pip._internal.exceptions import NetworkConnectionError from pip._internal.models.link import Link from pip._internal.models.search_scope import SearchScope from pip._internal.network.session import PipSession from pip._internal.network.utils import raise_for_status from pip._internal.utils.filetypes import is_archive_file from pip._internal.utils.misc import redact_auth_from_url from pip._internal.utils.urls import url_to_path from pip._internal.vcs import vcs from .sources import CandidatesFromPage, LinkSource, build_source logger = logging.getLogger(__name__) ResponseHeaders = MutableMapping[str, str] def _match_vcs_scheme(url: str) -> str | None: """Look for VCS schemes in the URL. Returns the matched VCS scheme, or None if there's no match. """ for scheme in vcs.schemes: if url.lower().startswith(scheme) and url[len(scheme)] in "+:": return scheme return None class _NotAPIContent(Exception): def __init__(self, content_type: str, request_desc: str) -> None: super().__init__(content_type, request_desc) self.content_type = content_type self.request_desc = request_desc def _ensure_api_header(response: Response) -> None: """ Check the Content-Type header to ensure the response contains a Simple API Response. Raises `_NotAPIContent` if the content type is not a valid content-type. """ content_type = response.headers.get("Content-Type", "Unknown") content_type_l = content_type.lower() if content_type_l.startswith( ( "text/html", "application/vnd.pypi.simple.v1+html", "application/vnd.pypi.simple.v1+json", ) ): return raise _NotAPIContent(content_type, response.request.method) class _NotHTTP(Exception): pass def _ensure_api_response(url: str, session: PipSession) -> None: """ Send a HEAD request to the URL, and ensure the response contains a simple API Response. Raises `_NotHTTP` if the URL is not available for a HEAD request, or `_NotAPIContent` if the content type is not a valid content type. """ scheme, netloc, path, query, fragment = urllib.parse.urlsplit(url) if scheme not in {"http", "https"}: raise _NotHTTP() resp = session.head(url, allow_redirects=True) raise_for_status(resp) _ensure_api_header(resp) def _get_simple_response(url: str, session: PipSession) -> Response: """Access an Simple API response with GET, and return the response. This consists of three parts: 1. If the URL looks suspiciously like an archive, send a HEAD first to check the Content-Type is HTML or Simple API, to avoid downloading a large file. Raise `_NotHTTP` if the content type cannot be determined, or `_NotAPIContent` if it is not HTML or a Simple API. 2. Actually perform the request. Raise HTTP exceptions on network failures. 3. Check the Content-Type header to make sure we got a Simple API response, and raise `_NotAPIContent` otherwise. """ if is_archive_file(Link(url).filename): _ensure_api_response(url, session=session) logger.debug("Getting page %s", redact_auth_from_url(url)) resp = session.get( url, headers={ "Accept": ", ".join( [ "application/vnd.pypi.simple.v1+json", "application/vnd.pypi.simple.v1+html; q=0.1", "text/html; q=0.01", ] ), # We don't want to blindly returned cached data for # /simple/, because authors generally expecting that # twine upload && pip install will function, but if # they've done a pip install in the last ~10 minutes # it won't. Thus by setting this to zero we will not # blindly use any cached data, however the benefit of # using max-age=0 instead of no-cache, is that we will # still support conditional requests, so we will still # minimize traffic sent in cases where the page hasn't # changed at all, we will just always incur the round # trip for the conditional GET now instead of only # once per 10 minutes. # For more information, please see pypa/pip#5670. "Cache-Control": "max-age=0", }, ) raise_for_status(resp) # The check for archives above only works if the url ends with # something that looks like an archive. However that is not a # requirement of an url. Unless we issue a HEAD request on every # url we cannot know ahead of time for sure if something is a # Simple API response or not. However we can check after we've # downloaded it. _ensure_api_header(resp) logger.debug( "Fetched page %s as %s", redact_auth_from_url(url), resp.headers.get("Content-Type", "Unknown"), ) return resp def _get_encoding_from_headers(headers: ResponseHeaders) -> str | None: """Determine if we have any encoding information in our headers.""" if headers and "Content-Type" in headers: m = email.message.Message() m["content-type"] = headers["Content-Type"] charset = m.get_param("charset") if charset: return str(charset) return None class CacheablePageContent: def __init__(self, page: IndexContent) -> None: assert page.cache_link_parsing self.page = page def __eq__(self, other: object) -> bool: return isinstance(other, type(self)) and self.page.url == other.page.url def __hash__(self) -> int: return hash(self.page.url) class ParseLinks(Protocol): def __call__(self, page: IndexContent) -> Iterable[Link]: ... def with_cached_index_content(fn: ParseLinks) -> ParseLinks: """ Given a function that parses an Iterable[Link] from an IndexContent, cache the function's result (keyed by CacheablePageContent), unless the IndexContent `page` has `page.cache_link_parsing == False`. """ @functools.cache def wrapper(cacheable_page: CacheablePageContent) -> list[Link]: return list(fn(cacheable_page.page)) @functools.wraps(fn) def wrapper_wrapper(page: IndexContent) -> list[Link]: if page.cache_link_parsing: return wrapper(CacheablePageContent(page)) return list(fn(page)) return wrapper_wrapper @with_cached_index_content def parse_links(page: IndexContent) -> Iterable[Link]: """ Parse a Simple API's Index Content, and yield its anchor elements as Link objects. """ content_type_l = page.content_type.lower() if content_type_l.startswith("application/vnd.pypi.simple.v1+json"): data = json.loads(page.content) for file in data.get("files", []): link = Link.from_json(file, page.url) if link is None: continue yield link return parser = HTMLLinkParser(page.url) encoding = page.encoding or "utf-8" parser.feed(page.content.decode(encoding)) url = page.url base_url = parser.base_url or url for anchor in parser.anchors: link = Link.from_element(anchor, page_url=url, base_url=base_url) if link is None: continue yield link @dataclass(frozen=True) class IndexContent: """Represents one response (or page), along with its URL. :param encoding: the encoding to decode the given content. :param url: the URL from which the HTML was downloaded. :param cache_link_parsing: whether links parsed from this page's url should be cached. PyPI index urls should have this set to False, for example. """ content: bytes content_type: str encoding: str | None url: str cache_link_parsing: bool = True def __str__(self) -> str: return redact_auth_from_url(self.url) class HTMLLinkParser(HTMLParser): """ HTMLParser that keeps the first base HREF and a list of all anchor elements' attributes. """ def __init__(self, url: str) -> None: super().__init__(convert_charrefs=True) self.url: str = url self.base_url: str | None = None self.anchors: list[dict[str, str | None]] = [] def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None: if tag == "base" and self.base_url is None: href = self.get_href(attrs) if href is not None: self.base_url = href elif tag == "a": self.anchors.append(dict(attrs)) def get_href(self, attrs: list[tuple[str, str | None]]) -> str | None: for name, value in attrs: if name == "href": return value return None def _handle_get_simple_fail( link: Link, reason: str | Exception, meth: Callable[..., None] | None = None, ) -> None: if meth is None: meth = logger.debug meth("Could not fetch URL %s: %s - skipping", link, reason) def _make_index_content( response: Response, cache_link_parsing: bool = True ) -> IndexContent: encoding = _get_encoding_from_headers(response.headers) return IndexContent( response.content, response.headers["Content-Type"], encoding=encoding, url=response.url, cache_link_parsing=cache_link_parsing, ) def _get_index_content(link: Link, *, session: PipSession) -> IndexContent | None: url = link.url.split("#", 1)[0] # Check for VCS schemes that do not support lookup as web pages. vcs_scheme = _match_vcs_scheme(url) if vcs_scheme: logger.warning( "Cannot look at %s URL %s because it does not support lookup as web pages.", vcs_scheme, link, ) return None # Tack index.html onto file:// URLs that point to directories if url.startswith("file:") and os.path.isdir(url_to_path(url)): # add trailing slash if not present so urljoin doesn't trim # final segment if not url.endswith("/"): url += "/" # TODO: In the future, it would be nice if pip supported PEP 691 # style responses in the file:// URLs, however there's no # standard file extension for application/vnd.pypi.simple.v1+json # so we'll need to come up with something on our own. url = urllib.parse.urljoin(url, "index.html") logger.debug(" file: URL is directory, getting %s", url) try: resp = _get_simple_response(url, session=session) except _NotHTTP: logger.warning( "Skipping page %s because it looks like an archive, and cannot " "be checked by a HTTP HEAD request.", link, ) except _NotAPIContent as exc: logger.warning( "Skipping page %s because the %s request got Content-Type: %s. " "The only supported Content-Types are application/vnd.pypi.simple.v1+json, " "application/vnd.pypi.simple.v1+html, and text/html", link, exc.request_desc, exc.content_type, ) except NetworkConnectionError as exc: _handle_get_simple_fail(link, exc) except RetryError as exc: _handle_get_simple_fail(link, exc) except SSLError as exc: reason = "There was a problem confirming the ssl certificate: " reason += str(exc) _handle_get_simple_fail(link, reason, meth=logger.info) except requests.ConnectionError as exc: _handle_get_simple_fail(link, f"connection error: {exc}") except requests.Timeout: _handle_get_simple_fail(link, "timed out") else: return _make_index_content(resp, cache_link_parsing=link.cache_link_parsing) return None class CollectedSources(NamedTuple): find_links: Sequence[LinkSource | None] index_urls: Sequence[LinkSource | None] class LinkCollector: """ Responsible for collecting Link objects from all configured locations, making network requests as needed. The class's main method is its collect_sources() method. """ def __init__( self, session: PipSession, search_scope: SearchScope, ) -> None: self.search_scope = search_scope self.session = session @classmethod def create( cls, session: PipSession, options: Values, suppress_no_index: bool = False, ) -> LinkCollector: """ :param session: The Session to use to make requests. :param suppress_no_index: Whether to ignore the --no-index option when constructing the SearchScope object. """ index_urls = [options.index_url] + options.extra_index_urls if options.no_index and not suppress_no_index: logger.debug( "Ignoring indexes: %s", ",".join(redact_auth_from_url(url) for url in index_urls), ) index_urls = [] # Make sure find_links is a list before passing to create(). find_links = options.find_links or [] search_scope = SearchScope.create( find_links=find_links, index_urls=index_urls, no_index=options.no_index, ) link_collector = LinkCollector( session=session, search_scope=search_scope, ) return link_collector @property def find_links(self) -> list[str]: return self.search_scope.find_links def fetch_response(self, location: Link) -> IndexContent | None: """ Fetch an HTML page containing package links. """ return _get_index_content(location, session=self.session) def collect_sources( self, project_name: str, candidates_from_page: CandidatesFromPage, ) -> CollectedSources: # The OrderedDict calls deduplicate sources by URL. index_url_sources = collections.OrderedDict( build_source( loc, candidates_from_page=candidates_from_page, page_validator=self.session.is_secure_origin, expand_dir=False, cache_link_parsing=False, project_name=project_name, ) for loc in self.search_scope.get_index_urls_locations(project_name) ).values() find_links_sources = collections.OrderedDict( build_source( loc, candidates_from_page=candidates_from_page, page_validator=self.session.is_secure_origin, expand_dir=True, cache_link_parsing=True, project_name=project_name, ) for loc in self.find_links ).values() if logger.isEnabledFor(logging.DEBUG): lines = [ f"* {s.link}" for s in itertools.chain(find_links_sources, index_url_sources) if s is not None and s.link is not None ] lines = [ f"{len(lines)} location(s) to search " f"for versions of {project_name}:" ] + lines logger.debug("\n".join(lines)) return CollectedSources( find_links=list(find_links_sources), index_urls=list(index_url_sources), ) ================================================ FILE: src/pip/_internal/index/package_finder.py ================================================ """Routines related to PyPI, indexes""" from __future__ import annotations import datetime import enum import functools import itertools import logging import re from collections.abc import Iterable from dataclasses import dataclass from typing import ( TYPE_CHECKING, Optional, Union, ) from pip._vendor.packaging import specifiers from pip._vendor.packaging.tags import Tag from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.packaging.version import InvalidVersion, Version, _BaseVersion from pip._vendor.packaging.version import parse as parse_version from pip._internal.exceptions import ( BestVersionAlreadyInstalled, DistributionNotFound, InstallationError, InvalidWheelFilename, UnsupportedWheel, ) from pip._internal.index.collector import LinkCollector, parse_links from pip._internal.metadata import select_backend from pip._internal.models.candidate import InstallationCandidate from pip._internal.models.format_control import FormatControl from pip._internal.models.link import Link from pip._internal.models.release_control import ReleaseControl from pip._internal.models.search_scope import SearchScope from pip._internal.models.selection_prefs import SelectionPreferences from pip._internal.models.target_python import TargetPython from pip._internal.models.wheel import Wheel from pip._internal.req import InstallRequirement from pip._internal.utils._log import getLogger from pip._internal.utils.filetypes import WHEEL_EXTENSION from pip._internal.utils.hashes import Hashes from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import build_netloc from pip._internal.utils.packaging import check_requires_python from pip._internal.utils.unpacking import SUPPORTED_EXTENSIONS if TYPE_CHECKING: from typing_extensions import TypeGuard __all__ = ["FormatControl", "BestCandidateResult", "PackageFinder"] logger = getLogger(__name__) BuildTag = Union[tuple[()], tuple[int, str]] CandidateSortingKey = tuple[int, int, int, _BaseVersion, Optional[int], BuildTag] def _check_link_requires_python( link: Link, version_info: tuple[int, int, int], ignore_requires_python: bool = False, ) -> bool: """ Return whether the given Python version is compatible with a link's "Requires-Python" value. :param version_info: A 3-tuple of ints representing the Python major-minor-micro version to check. :param ignore_requires_python: Whether to ignore the "Requires-Python" value if the given Python version isn't compatible. """ try: is_compatible = check_requires_python( link.requires_python, version_info=version_info, ) except specifiers.InvalidSpecifier: logger.debug( "Ignoring invalid Requires-Python (%r) for link: %s", link.requires_python, link, ) else: if not is_compatible: version = ".".join(map(str, version_info)) if not ignore_requires_python: logger.verbose( "Link requires a different Python (%s not in: %r): %s", version, link.requires_python, link, ) return False logger.debug( "Ignoring failed Requires-Python check (%s not in: %r) for link: %s", version, link.requires_python, link, ) return True class LinkType(enum.Enum): candidate = enum.auto() different_project = enum.auto() yanked = enum.auto() format_unsupported = enum.auto() format_invalid = enum.auto() platform_mismatch = enum.auto() requires_python_mismatch = enum.auto() upload_too_late = enum.auto() upload_time_missing = enum.auto() class LinkEvaluator: """ Responsible for evaluating links for a particular project. """ _py_version_re = re.compile(r"-py([123]\.?[0-9]?)$") # Don't include an allow_yanked default value to make sure each call # site considers whether yanked releases are allowed. This also causes # that decision to be made explicit in the calling code, which helps # people when reading the code. def __init__( self, project_name: str, canonical_name: NormalizedName, formats: frozenset[str], target_python: TargetPython, allow_yanked: bool, ignore_requires_python: bool | None = None, uploaded_prior_to: datetime.datetime | None = None, ) -> None: """ :param project_name: The user supplied package name. :param canonical_name: The canonical package name. :param formats: The formats allowed for this package. Should be a set with 'binary' or 'source' or both in it. :param target_python: The target Python interpreter to use when evaluating link compatibility. This is used, for example, to check wheel compatibility, as well as when checking the Python version, e.g. the Python version embedded in a link filename (or egg fragment) and against an HTML link's optional PEP 503 "data-requires-python" attribute. :param allow_yanked: Whether files marked as yanked (in the sense of PEP 592) are permitted to be candidates for install. :param ignore_requires_python: Whether to ignore incompatible PEP 503 "data-requires-python" values in HTML links. Defaults to False. :param uploaded_prior_to: If set, only allow links uploaded prior to the given datetime. """ if ignore_requires_python is None: ignore_requires_python = False self._allow_yanked = allow_yanked self._canonical_name = canonical_name self._ignore_requires_python = ignore_requires_python self._formats = formats self._target_python = target_python self._uploaded_prior_to = uploaded_prior_to self.project_name = project_name def evaluate_link(self, link: Link) -> tuple[LinkType, str]: """ Determine whether a link is a candidate for installation. :return: A tuple (result, detail), where *result* is an enum representing whether the evaluation found a candidate, or the reason why one is not found. If a candidate is found, *detail* will be the candidate's version string; if one is not found, it contains the reason the link fails to qualify. """ version = None if link.is_yanked and not self._allow_yanked: reason = link.yanked_reason or "" return (LinkType.yanked, f"yanked for reason: {reason}") if link.egg_fragment: egg_info = link.egg_fragment ext = link.ext else: egg_info, ext = link.splitext() if not ext: return (LinkType.format_unsupported, "not a file") if ext not in SUPPORTED_EXTENSIONS: return ( LinkType.format_unsupported, f"unsupported archive format: {ext}", ) if "binary" not in self._formats and ext == WHEEL_EXTENSION: reason = f"No binaries permitted for {self.project_name}" return (LinkType.format_unsupported, reason) if "macosx10" in link.path and ext == ".zip": return (LinkType.format_unsupported, "macosx10 one") if ext == WHEEL_EXTENSION: try: wheel = Wheel(link.filename) except InvalidWheelFilename: return ( LinkType.format_invalid, "invalid wheel filename", ) if wheel.name != self._canonical_name: reason = f"wrong project name (not {self.project_name})" return (LinkType.different_project, reason) supported_tags = self._target_python.get_unsorted_tags() if not wheel.supported(supported_tags): # Include the wheel's tags in the reason string to # simplify troubleshooting compatibility issues. file_tags = ", ".join(wheel.get_formatted_file_tags()) reason = ( f"none of the wheel's tags ({file_tags}) are compatible " f"(run pip debug --verbose to show compatible tags)" ) return (LinkType.platform_mismatch, reason) version = wheel.version # Check upload-time filter after verifying the link is a package file. # Skip this check for local files, as --uploaded-prior-to only applies # to packages from indexes. if self._uploaded_prior_to is not None and not link.is_file: if link.upload_time is None: if link.comes_from: index_info = f"Index {link.comes_from}" else: index_info = "Index" return ( LinkType.upload_time_missing, f"{index_info} does not provide upload-time metadata.", ) elif link.upload_time >= self._uploaded_prior_to: return ( LinkType.upload_too_late, f"Upload time {link.upload_time} not " f"prior to {self._uploaded_prior_to}", ) # This should be up by the self.ok_binary check, but see issue 2700. if "source" not in self._formats and ext != WHEEL_EXTENSION: reason = f"No sources permitted for {self.project_name}" return (LinkType.format_unsupported, reason) if not version: version = _extract_version_from_fragment( egg_info, self._canonical_name, ) if not version: reason = f"Missing project version for {self.project_name}" return (LinkType.format_invalid, reason) match = self._py_version_re.search(version) if match: version = version[: match.start()] py_version = match.group(1) if py_version != self._target_python.py_version: return ( LinkType.platform_mismatch, "Python version is incorrect", ) supports_python = _check_link_requires_python( link, version_info=self._target_python.py_version_info, ignore_requires_python=self._ignore_requires_python, ) if not supports_python: requires_python = link.requires_python if requires_python: def get_version_sort_key(v: str) -> tuple[int, ...]: return tuple(int(s) for s in v.split(".") if s.isdigit()) requires_python = ",".join( sorted( (str(s) for s in specifiers.SpecifierSet(requires_python)), key=get_version_sort_key, ) ) reason = f"{version} Requires-Python {requires_python}" return (LinkType.requires_python_mismatch, reason) logger.debug("Found link %s, version: %s", link, version) return (LinkType.candidate, version) def filter_unallowed_hashes( candidates: list[InstallationCandidate], hashes: Hashes | None, project_name: str, ) -> list[InstallationCandidate]: """ Filter out candidates whose hashes aren't allowed, and return a new list of candidates. If at least one candidate has an allowed hash, then all candidates with either an allowed hash or no hash specified are returned. Otherwise, the given candidates are returned. Including the candidates with no hash specified when there is a match allows a warning to be logged if there is a more preferred candidate with no hash specified. Returning all candidates in the case of no matches lets pip report the hash of the candidate that would otherwise have been installed (e.g. permitting the user to more easily update their requirements file with the desired hash). """ if not hashes: logger.debug( "Given no hashes to check %s links for project %r: " "discarding no candidates", len(candidates), project_name, ) # Make sure we're not returning back the given value. return list(candidates) matches_or_no_digest = [] # Collect the non-matches for logging purposes. non_matches = [] match_count = 0 for candidate in candidates: link = candidate.link if not link.has_hash: pass elif link.is_hash_allowed(hashes=hashes): match_count += 1 else: non_matches.append(candidate) continue matches_or_no_digest.append(candidate) if match_count: filtered = matches_or_no_digest else: # Make sure we're not returning back the given value. filtered = list(candidates) if len(filtered) == len(candidates): discard_message = "discarding no candidates" else: discard_message = "discarding {} non-matches:\n {}".format( len(non_matches), "\n ".join(str(candidate.link) for candidate in non_matches), ) logger.debug( "Checked %s links for project %r against %s hashes " "(%s matches, %s no digest): %s", len(candidates), project_name, hashes.digest_count, match_count, len(matches_or_no_digest) - match_count, discard_message, ) return filtered @dataclass class CandidatePreferences: """ Encapsulates some of the preferences for filtering and sorting InstallationCandidate objects. """ prefer_binary: bool = False release_control: ReleaseControl | None = None @dataclass(frozen=True) class BestCandidateResult: """A collection of candidates, returned by `PackageFinder.find_best_candidate`. This class is only intended to be instantiated by CandidateEvaluator's `compute_best_candidate()` method. :param all_candidates: A sequence of all available candidates found. :param applicable_candidates: The applicable candidates. :param best_candidate: The most preferred candidate found, or None if no applicable candidates were found. """ all_candidates: list[InstallationCandidate] applicable_candidates: list[InstallationCandidate] best_candidate: InstallationCandidate | None def __post_init__(self) -> None: assert set(self.applicable_candidates) <= set(self.all_candidates) if self.best_candidate is None: assert not self.applicable_candidates else: assert self.best_candidate in self.applicable_candidates class CandidateEvaluator: """ Responsible for filtering and sorting candidates for installation based on what tags are valid. """ @classmethod def create( cls, project_name: str, target_python: TargetPython | None = None, prefer_binary: bool = False, release_control: ReleaseControl | None = None, specifier: specifiers.BaseSpecifier | None = None, hashes: Hashes | None = None, ) -> CandidateEvaluator: """Create a CandidateEvaluator object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :param hashes: An optional collection of allowed hashes. """ if target_python is None: target_python = TargetPython() if specifier is None: specifier = specifiers.SpecifierSet() supported_tags = target_python.get_sorted_tags() return cls( project_name=project_name, supported_tags=supported_tags, specifier=specifier, prefer_binary=prefer_binary, release_control=release_control, hashes=hashes, ) def __init__( self, project_name: str, supported_tags: list[Tag], specifier: specifiers.BaseSpecifier, prefer_binary: bool = False, release_control: ReleaseControl | None = None, hashes: Hashes | None = None, ) -> None: """ :param supported_tags: The PEP 425 tags supported by the target Python in order of preference (most preferred first). """ self._release_control = release_control self._hashes = hashes self._prefer_binary = prefer_binary self._project_name = project_name self._specifier = specifier self._supported_tags = supported_tags # Since the index of the tag in the _supported_tags list is used # as a priority, precompute a map from tag to index/priority to be # used in wheel.find_most_preferred_tag. self._wheel_tag_preferences = { tag: idx for idx, tag in enumerate(supported_tags) } def get_applicable_candidates( self, candidates: list[InstallationCandidate], ) -> list[InstallationCandidate]: """ Return the applicable candidates from a list of candidates. """ # Using None infers from the specifier instead. if self._release_control is not None: allow_prereleases = self._release_control.allows_prereleases( canonicalize_name(self._project_name) ) else: allow_prereleases = None specifier = self._specifier # When using the pkg_resources backend we turn the version object into # a str here because otherwise when we're debundled but setuptools isn't, # Python will see packaging.version.Version and # pkg_resources._vendor.packaging.version.Version as different # types. This way we'll use a str as a common data interchange # format. If we stop using the pkg_resources provided specifier # and start using our own, we can drop the cast to str(). if select_backend().NAME == "pkg_resources": candidates_and_versions: list[ tuple[InstallationCandidate, str | Version] ] = [(c, str(c.version)) for c in candidates] else: candidates_and_versions = [(c, c.version) for c in candidates] versions = set( specifier.filter( (v for _, v in candidates_and_versions), prereleases=allow_prereleases, ) ) applicable_candidates = [c for c, v in candidates_and_versions if v in versions] filtered_applicable_candidates = filter_unallowed_hashes( candidates=applicable_candidates, hashes=self._hashes, project_name=self._project_name, ) return sorted(filtered_applicable_candidates, key=self._sort_key) def _sort_key(self, candidate: InstallationCandidate) -> CandidateSortingKey: """ Function to pass as the `key` argument to a call to sorted() to sort InstallationCandidates by preference. Returns a tuple such that tuples sorting as greater using Python's default comparison operator are more preferred. The preference is as follows: First and foremost, candidates with allowed (matching) hashes are always preferred over candidates without matching hashes. This is because e.g. if the only candidate with an allowed hash is yanked, we still want to use that candidate. Second, excepting hash considerations, candidates that have been yanked (in the sense of PEP 592) are always less preferred than candidates that haven't been yanked. Then: If not finding wheels, they are sorted by version only. If finding wheels, then the sort order is by version, then: 1. existing installs 2. wheels ordered via Wheel.support_index_min(self._supported_tags) 3. source archives If prefer_binary was set, then all wheels are sorted above sources. Note: it was considered to embed this logic into the Link comparison operators, but then different sdist links with the same version, would have to be considered equal """ valid_tags = self._supported_tags support_num = len(valid_tags) build_tag: BuildTag = () binary_preference = 0 link = candidate.link if link.is_wheel: # can raise InvalidWheelFilename wheel = Wheel(link.filename) try: pri = -( wheel.find_most_preferred_tag( valid_tags, self._wheel_tag_preferences ) ) except ValueError: raise UnsupportedWheel( f"{wheel.filename} is not a supported wheel for this platform. It " "can't be sorted." ) if self._prefer_binary: binary_preference = 1 build_tag = wheel.build_tag else: # sdist pri = -(support_num) has_allowed_hash = int(link.is_hash_allowed(self._hashes)) yank_value = -1 * int(link.is_yanked) # -1 for yanked. return ( has_allowed_hash, yank_value, binary_preference, candidate.version, pri, build_tag, ) def sort_best_candidate( self, candidates: list[InstallationCandidate], ) -> InstallationCandidate | None: """ Return the best candidate per the instance's sort order, or None if no candidate is acceptable. """ if not candidates: return None best_candidate = max(candidates, key=self._sort_key) return best_candidate def compute_best_candidate( self, candidates: list[InstallationCandidate], ) -> BestCandidateResult: """ Compute and return a `BestCandidateResult` instance. """ applicable_candidates = self.get_applicable_candidates(candidates) best_candidate = self.sort_best_candidate(applicable_candidates) return BestCandidateResult( candidates, applicable_candidates=applicable_candidates, best_candidate=best_candidate, ) class PackageFinder: """This finds packages. This is meant to match easy_install's technique for looking for packages, by reading pages and looking for appropriate links. """ def __init__( self, link_collector: LinkCollector, target_python: TargetPython, allow_yanked: bool, format_control: FormatControl | None = None, candidate_prefs: CandidatePreferences | None = None, ignore_requires_python: bool | None = None, uploaded_prior_to: datetime.datetime | None = None, ) -> None: """ This constructor is primarily meant to be used by the create() class method and from tests. :param format_control: A FormatControl object, used to control the selection of source packages / binary packages when consulting the index and links. :param candidate_prefs: Options to use when creating a CandidateEvaluator object. """ if candidate_prefs is None: candidate_prefs = CandidatePreferences() format_control = format_control or FormatControl(set(), set()) self._allow_yanked = allow_yanked self._candidate_prefs = candidate_prefs self._ignore_requires_python = ignore_requires_python self._link_collector = link_collector self._target_python = target_python self._uploaded_prior_to = uploaded_prior_to self.format_control = format_control # These are boring links that have already been logged somehow. self._logged_links: set[tuple[Link, LinkType, str]] = set() # Cache of the result of finding candidates self._all_candidates: dict[str, list[InstallationCandidate]] = {} self._best_candidates: dict[ tuple[str, specifiers.BaseSpecifier | None, Hashes | None], BestCandidateResult, ] = {} # Don't include an allow_yanked default value to make sure each call # site considers whether yanked releases are allowed. This also causes # that decision to be made explicit in the calling code, which helps # people when reading the code. @classmethod def create( cls, link_collector: LinkCollector, selection_prefs: SelectionPreferences, target_python: TargetPython | None = None, uploaded_prior_to: datetime.datetime | None = None, ) -> PackageFinder: """Create a PackageFinder. :param selection_prefs: The candidate selection preferences, as a SelectionPreferences object. :param target_python: The target Python interpreter to use when checking compatibility. If None (the default), a TargetPython object will be constructed from the running Python. :param uploaded_prior_to: If set, only find links uploaded prior to the given datetime. """ if target_python is None: target_python = TargetPython() candidate_prefs = CandidatePreferences( prefer_binary=selection_prefs.prefer_binary, release_control=selection_prefs.release_control, ) return cls( candidate_prefs=candidate_prefs, link_collector=link_collector, target_python=target_python, allow_yanked=selection_prefs.allow_yanked, format_control=selection_prefs.format_control, ignore_requires_python=selection_prefs.ignore_requires_python, uploaded_prior_to=uploaded_prior_to, ) @property def target_python(self) -> TargetPython: return self._target_python @property def search_scope(self) -> SearchScope: return self._link_collector.search_scope @search_scope.setter def search_scope(self, search_scope: SearchScope) -> None: self._link_collector.search_scope = search_scope @property def find_links(self) -> list[str]: return self._link_collector.find_links @property def index_urls(self) -> list[str]: return self.search_scope.index_urls @property def proxy(self) -> str | None: return self._link_collector.session.pip_proxy @property def trusted_hosts(self) -> Iterable[str]: for host_port in self._link_collector.session.pip_trusted_origins: yield build_netloc(*host_port) @property def custom_cert(self) -> str | None: # session.verify is either a boolean (use default bundle/no SSL # verification) or a string path to a custom CA bundle to use. We only # care about the latter. verify = self._link_collector.session.verify return verify if isinstance(verify, str) else None @property def client_cert(self) -> str | None: cert = self._link_collector.session.cert assert not isinstance(cert, tuple), "pip only supports PEM client certs" return cert @property def release_control(self) -> ReleaseControl | None: return self._candidate_prefs.release_control def set_release_control(self, release_control: ReleaseControl) -> None: self._candidate_prefs.release_control = release_control @property def prefer_binary(self) -> bool: return self._candidate_prefs.prefer_binary def set_prefer_binary(self) -> None: self._candidate_prefs.prefer_binary = True @property def uploaded_prior_to(self) -> datetime.datetime | None: return self._uploaded_prior_to def requires_python_skipped_reasons(self) -> list[str]: reasons = { detail for _, result, detail in self._logged_links if result == LinkType.requires_python_mismatch } return sorted(reasons) def make_link_evaluator(self, project_name: str) -> LinkEvaluator: canonical_name = canonicalize_name(project_name) formats = self.format_control.get_allowed_formats(canonical_name) return LinkEvaluator( project_name=project_name, canonical_name=canonical_name, formats=formats, target_python=self._target_python, allow_yanked=self._allow_yanked, ignore_requires_python=self._ignore_requires_python, uploaded_prior_to=self._uploaded_prior_to, ) def _sort_links(self, links: Iterable[Link]) -> list[Link]: """ Returns elements of links in order, non-egg links first, egg links second, while eliminating duplicates """ eggs, no_eggs = [], [] seen: set[Link] = set() for link in links: if link not in seen: seen.add(link) if link.egg_fragment: eggs.append(link) else: no_eggs.append(link) return no_eggs + eggs def _log_skipped_link(self, link: Link, result: LinkType, detail: str) -> None: entry = (link, result, detail) if entry not in self._logged_links: # Put the link at the end so the reason is more visible and because # the link string is usually very long. logger.debug("Skipping link: %s: %s", detail, link) self._logged_links.add(entry) def get_install_candidate( self, link_evaluator: LinkEvaluator, link: Link ) -> InstallationCandidate | None: """ If the link is a candidate for install, convert it to an InstallationCandidate and return it. Otherwise, return None. """ result, detail = link_evaluator.evaluate_link(link) if result == LinkType.upload_time_missing: # Fail immediately if the index doesn't provide upload-time # when --uploaded-prior-to is specified raise InstallationError(detail) if result != LinkType.candidate: self._log_skipped_link(link, result, detail) return None try: return InstallationCandidate( name=link_evaluator.project_name, link=link, version=detail, ) except InvalidVersion: return None def evaluate_links( self, link_evaluator: LinkEvaluator, links: Iterable[Link] ) -> list[InstallationCandidate]: """ Convert links that are candidates to InstallationCandidate objects. """ candidates = [] for link in self._sort_links(links): candidate = self.get_install_candidate(link_evaluator, link) if candidate is not None: candidates.append(candidate) return candidates def process_project_url( self, project_url: Link, link_evaluator: LinkEvaluator ) -> list[InstallationCandidate]: logger.debug( "Fetching project page and analyzing links: %s", project_url, ) index_response = self._link_collector.fetch_response(project_url) if index_response is None: return [] page_links = list(parse_links(index_response)) with indent_log(): package_links = self.evaluate_links( link_evaluator, links=page_links, ) return package_links def find_all_candidates(self, project_name: str) -> list[InstallationCandidate]: """Find all available InstallationCandidate for project_name This checks index_urls and find_links. All versions found are returned as an InstallationCandidate list. See LinkEvaluator.evaluate_link() for details on which files are accepted. """ if project_name in self._all_candidates: return self._all_candidates[project_name] link_evaluator = self.make_link_evaluator(project_name) collected_sources = self._link_collector.collect_sources( project_name=project_name, candidates_from_page=functools.partial( self.process_project_url, link_evaluator=link_evaluator, ), ) page_candidates_it = itertools.chain.from_iterable( source.page_candidates() for sources in collected_sources for source in sources if source is not None ) page_candidates = list(page_candidates_it) file_links_it = itertools.chain.from_iterable( source.file_links() for sources in collected_sources for source in sources if source is not None ) file_candidates = self.evaluate_links( link_evaluator, sorted(file_links_it, reverse=True), ) if logger.isEnabledFor(logging.DEBUG) and file_candidates: paths = [] for candidate in file_candidates: assert candidate.link.url # we need to have a URL try: paths.append(candidate.link.file_path) except Exception: paths.append(candidate.link.url) # it's not a local file logger.debug("Local files found: %s", ", ".join(paths)) # This is an intentional priority ordering self._all_candidates[project_name] = file_candidates + page_candidates return self._all_candidates[project_name] def make_candidate_evaluator( self, project_name: str, specifier: specifiers.BaseSpecifier | None = None, hashes: Hashes | None = None, ) -> CandidateEvaluator: """Create a CandidateEvaluator object to use.""" candidate_prefs = self._candidate_prefs return CandidateEvaluator.create( project_name=project_name, target_python=self._target_python, prefer_binary=candidate_prefs.prefer_binary, release_control=candidate_prefs.release_control, specifier=specifier, hashes=hashes, ) def find_best_candidate( self, project_name: str, specifier: specifiers.BaseSpecifier | None = None, hashes: Hashes | None = None, ) -> BestCandidateResult: """Find matches for the given project and specifier. :param specifier: An optional object implementing `filter` (e.g. `packaging.specifiers.SpecifierSet`) to filter applicable versions. :return: A `BestCandidateResult` instance. """ if (project_name, specifier, hashes) in self._best_candidates: return self._best_candidates[project_name, specifier, hashes] candidates = self.find_all_candidates(project_name) candidate_evaluator = self.make_candidate_evaluator( project_name=project_name, specifier=specifier, hashes=hashes, ) self._best_candidates[project_name, specifier, hashes] = ( candidate_evaluator.compute_best_candidate(candidates) ) return self._best_candidates[project_name, specifier, hashes] def find_requirement( self, req: InstallRequirement, upgrade: bool ) -> InstallationCandidate | None: """Try to find a Link matching req Expects req, an InstallRequirement and upgrade, a boolean Returns a InstallationCandidate if found, Raises DistributionNotFound or BestVersionAlreadyInstalled otherwise """ name = req.name assert name is not None, "find_requirement() called with no name" hashes = req.hashes(trust_internet=False) best_candidate_result = self.find_best_candidate( name, specifier=req.specifier, hashes=hashes, ) best_candidate = best_candidate_result.best_candidate installed_version: _BaseVersion | None = None if req.satisfied_by is not None: installed_version = req.satisfied_by.version def _format_versions(cand_iter: Iterable[InstallationCandidate]) -> str: # This repeated parse_version and str() conversion is needed to # handle different vendoring sources from pip and pkg_resources. # If we stop using the pkg_resources provided specifier and start # using our own, we can drop the cast to str(). return ( ", ".join( sorted( {str(c.version) for c in cand_iter}, key=parse_version, ) ) or "none" ) if installed_version is None and best_candidate is None: # Check if only final releases are allowed for this package version_type = "version" if self.release_control is not None: allows_pre = self.release_control.allows_prereleases( canonicalize_name(name) ) if allows_pre is False: version_type = "final version" logger.critical( "Could not find a %s that satisfies the requirement %s " "(from versions: %s)", version_type, req, _format_versions(best_candidate_result.all_candidates), ) raise DistributionNotFound(f"No matching distribution found for {req}") def _should_install_candidate( candidate: InstallationCandidate | None, ) -> TypeGuard[InstallationCandidate]: if installed_version is None: return True if best_candidate is None: return False return best_candidate.version > installed_version if not upgrade and installed_version is not None: if _should_install_candidate(best_candidate): logger.debug( "Existing installed version (%s) satisfies requirement " "(most up-to-date version is %s)", installed_version, best_candidate.version, ) else: logger.debug( "Existing installed version (%s) is most up-to-date and " "satisfies requirement", installed_version, ) return None if _should_install_candidate(best_candidate): logger.debug( "Using version %s (newest of versions: %s)", best_candidate.version, _format_versions(best_candidate_result.applicable_candidates), ) return best_candidate # We have an existing version, and its the best version logger.debug( "Installed version (%s) is most up-to-date (past versions: %s)", installed_version, _format_versions(best_candidate_result.applicable_candidates), ) raise BestVersionAlreadyInstalled def _find_name_version_sep(fragment: str, canonical_name: str) -> int: """Find the separator's index based on the package's canonical name. :param fragment: A + filename "fragment" (stem) or egg fragment. :param canonical_name: The package's canonical name. This function is needed since the canonicalized name does not necessarily have the same length as the egg info's name part. An example:: >>> fragment = 'foo__bar-1.0' >>> canonical_name = 'foo-bar' >>> _find_name_version_sep(fragment, canonical_name) 8 """ # Project name and version must be separated by one single dash. Find all # occurrences of dashes; if the string in front of it matches the canonical # name, this is the one separating the name and version parts. for i, c in enumerate(fragment): if c != "-": continue if canonicalize_name(fragment[:i]) == canonical_name: return i raise ValueError(f"{fragment} does not match {canonical_name}") def _extract_version_from_fragment(fragment: str, canonical_name: str) -> str | None: """Parse the version string from a + filename "fragment" (stem) or egg fragment. :param fragment: The string to parse. E.g. foo-2.1 :param canonical_name: The canonicalized name of the package this belongs to. """ try: version_start = _find_name_version_sep(fragment, canonical_name) + 1 except ValueError: return None version = fragment[version_start:] if not version: return None return version ================================================ FILE: src/pip/_internal/index/sources.py ================================================ from __future__ import annotations import logging import mimetypes import os from collections import defaultdict from collections.abc import Iterable from typing import Callable from pip._vendor.packaging.utils import ( InvalidSdistFilename, InvalidWheelFilename, canonicalize_name, parse_sdist_filename, parse_wheel_filename, ) from pip._internal.models.candidate import InstallationCandidate from pip._internal.models.link import Link from pip._internal.utils.urls import path_to_url, url_to_path from pip._internal.vcs import is_url logger = logging.getLogger(__name__) FoundCandidates = Iterable[InstallationCandidate] FoundLinks = Iterable[Link] CandidatesFromPage = Callable[[Link], Iterable[InstallationCandidate]] PageValidator = Callable[[Link], bool] class LinkSource: @property def link(self) -> Link | None: """Returns the underlying link, if there's one.""" raise NotImplementedError() def page_candidates(self) -> FoundCandidates: """Candidates found by parsing an archive listing HTML file.""" raise NotImplementedError() def file_links(self) -> FoundLinks: """Links found by specifying archives directly.""" raise NotImplementedError() def _is_html_file(file_url: str) -> bool: return mimetypes.guess_type(file_url, strict=False)[0] == "text/html" class _FlatDirectoryToUrls: """Scans directory and caches results""" def __init__(self, path: str) -> None: self._path = path self._page_candidates: list[str] = [] self._project_name_to_urls: dict[str, list[str]] = defaultdict(list) self._scanned_directory = False def _scan_directory(self) -> None: """Scans directory once and populates both page_candidates and project_name_to_urls at the same time """ for entry in os.scandir(self._path): url = path_to_url(entry.path) if _is_html_file(url): self._page_candidates.append(url) continue # File must have a valid wheel or sdist name, # otherwise not worth considering as a package try: project_filename = parse_wheel_filename(entry.name)[0] except InvalidWheelFilename: try: project_filename = parse_sdist_filename(entry.name)[0] except InvalidSdistFilename: continue self._project_name_to_urls[project_filename].append(url) self._scanned_directory = True @property def page_candidates(self) -> list[str]: if not self._scanned_directory: self._scan_directory() return self._page_candidates @property def project_name_to_urls(self) -> dict[str, list[str]]: if not self._scanned_directory: self._scan_directory() return self._project_name_to_urls class _FlatDirectorySource(LinkSource): """Link source specified by ``--find-links=``. This looks the content of the directory, and returns: * ``page_candidates``: Links listed on each HTML file in the directory. * ``file_candidates``: Archives in the directory. """ _paths_to_urls: dict[str, _FlatDirectoryToUrls] = {} def __init__( self, candidates_from_page: CandidatesFromPage, path: str, project_name: str, ) -> None: self._candidates_from_page = candidates_from_page self._project_name = canonicalize_name(project_name) # Get existing instance of _FlatDirectoryToUrls if it exists if path in self._paths_to_urls: self._path_to_urls = self._paths_to_urls[path] else: self._path_to_urls = _FlatDirectoryToUrls(path=path) self._paths_to_urls[path] = self._path_to_urls @property def link(self) -> Link | None: return None def page_candidates(self) -> FoundCandidates: for url in self._path_to_urls.page_candidates: yield from self._candidates_from_page(Link(url)) def file_links(self) -> FoundLinks: for url in self._path_to_urls.project_name_to_urls[self._project_name]: yield Link(url) class _LocalFileSource(LinkSource): """``--find-links=`` or ``--[extra-]index-url=``. If a URL is supplied, it must be a ``file:`` URL. If a path is supplied to the option, it is converted to a URL first. This returns: * ``page_candidates``: Links listed on an HTML file. * ``file_candidates``: The non-HTML file. """ def __init__( self, candidates_from_page: CandidatesFromPage, link: Link, ) -> None: self._candidates_from_page = candidates_from_page self._link = link @property def link(self) -> Link | None: return self._link def page_candidates(self) -> FoundCandidates: if not _is_html_file(self._link.url): return yield from self._candidates_from_page(self._link) def file_links(self) -> FoundLinks: if _is_html_file(self._link.url): return yield self._link class _RemoteFileSource(LinkSource): """``--find-links=`` or ``--[extra-]index-url=``. This returns: * ``page_candidates``: Links listed on an HTML file. * ``file_candidates``: The non-HTML file. """ def __init__( self, candidates_from_page: CandidatesFromPage, page_validator: PageValidator, link: Link, ) -> None: self._candidates_from_page = candidates_from_page self._page_validator = page_validator self._link = link @property def link(self) -> Link | None: return self._link def page_candidates(self) -> FoundCandidates: if not self._page_validator(self._link): return yield from self._candidates_from_page(self._link) def file_links(self) -> FoundLinks: yield self._link class _IndexDirectorySource(LinkSource): """``--[extra-]index-url=``. This is treated like a remote URL; ``candidates_from_page`` contains logic for this by appending ``index.html`` to the link. """ def __init__( self, candidates_from_page: CandidatesFromPage, link: Link, ) -> None: self._candidates_from_page = candidates_from_page self._link = link @property def link(self) -> Link | None: return self._link def page_candidates(self) -> FoundCandidates: yield from self._candidates_from_page(self._link) def file_links(self) -> FoundLinks: return () def build_source( location: str, *, candidates_from_page: CandidatesFromPage, page_validator: PageValidator, expand_dir: bool, cache_link_parsing: bool, project_name: str, ) -> tuple[str | None, LinkSource | None]: path: str | None = None url: str | None = None if os.path.exists(location): # Is a local path. url = path_to_url(location) path = location elif location.startswith("file:"): # A file: URL. url = location path = url_to_path(location) elif is_url(location): url = location if url is None: msg = ( "Location '%s' is ignored: " "it is either a non-existing path or lacks a specific scheme." ) logger.warning(msg, location) return (None, None) if path is None: source: LinkSource = _RemoteFileSource( candidates_from_page=candidates_from_page, page_validator=page_validator, link=Link(url, cache_link_parsing=cache_link_parsing), ) return (url, source) if os.path.isdir(path): if expand_dir: source = _FlatDirectorySource( candidates_from_page=candidates_from_page, path=path, project_name=project_name, ) else: source = _IndexDirectorySource( candidates_from_page=candidates_from_page, link=Link(url, cache_link_parsing=cache_link_parsing), ) return (url, source) elif os.path.isfile(path): source = _LocalFileSource( candidates_from_page=candidates_from_page, link=Link(url, cache_link_parsing=cache_link_parsing), ) return (url, source) logger.warning( "Location '%s' is ignored: it is neither a file nor a directory.", location, ) return (url, None) ================================================ FILE: src/pip/_internal/locations/__init__.py ================================================ from __future__ import annotations import functools import logging import os import pathlib import sys import sysconfig from pip._internal.models.scheme import SCHEME_KEYS, Scheme from pip._internal.utils.compat import WINDOWS from pip._internal.utils.deprecation import deprecated from pip._internal.utils.virtualenv import running_under_virtualenv from . import _sysconfig from .base import ( USER_CACHE_DIR, get_major_minor_version, get_src_prefix, is_osx_framework, site_packages, user_site, ) __all__ = [ "USER_CACHE_DIR", "get_bin_prefix", "get_bin_user", "get_major_minor_version", "get_platlib", "get_purelib", "get_scheme", "get_src_prefix", "site_packages", "user_site", ] logger = logging.getLogger(__name__) _PLATLIBDIR: str = getattr(sys, "platlibdir", "lib") _USE_SYSCONFIG_DEFAULT = sys.version_info >= (3, 10) def _should_use_sysconfig() -> bool: """This function determines the value of _USE_SYSCONFIG. By default, pip uses sysconfig on Python 3.10+. But Python distributors can override this decision by setting: sysconfig._PIP_USE_SYSCONFIG = True / False Rationale in https://github.com/pypa/pip/issues/10647 This is a function for testability, but should be constant during any one run. """ return bool(getattr(sysconfig, "_PIP_USE_SYSCONFIG", _USE_SYSCONFIG_DEFAULT)) _USE_SYSCONFIG = _should_use_sysconfig() if not _USE_SYSCONFIG: # Import distutils lazily to avoid deprecation warnings, # but import it soon enough that it is in memory and available during # a pip reinstall. from . import _distutils # Be noisy about incompatibilities if this platforms "should" be using # sysconfig, but is explicitly opting out and using distutils instead. if _USE_SYSCONFIG_DEFAULT and not _USE_SYSCONFIG: _MISMATCH_LEVEL = logging.WARNING else: _MISMATCH_LEVEL = logging.DEBUG def _looks_like_bpo_44860() -> bool: """The resolution to bpo-44860 will change this incorrect platlib. See . """ from distutils.command.install import INSTALL_SCHEMES try: unix_user_platlib = INSTALL_SCHEMES["unix_user"]["platlib"] except KeyError: return False return unix_user_platlib == "$usersite" def _looks_like_red_hat_patched_platlib_purelib(scheme: dict[str, str]) -> bool: platlib = scheme["platlib"] if "/$platlibdir/" in platlib: platlib = platlib.replace("/$platlibdir/", f"/{_PLATLIBDIR}/") if "/lib64/" not in platlib: return False unpatched = platlib.replace("/lib64/", "/lib/") return unpatched.replace("$platbase/", "$base/") == scheme["purelib"] @functools.cache def _looks_like_red_hat_lib() -> bool: """Red Hat patches platlib in unix_prefix and unix_home, but not purelib. This is the only way I can see to tell a Red Hat-patched Python. """ from distutils.command.install import INSTALL_SCHEMES return all( k in INSTALL_SCHEMES and _looks_like_red_hat_patched_platlib_purelib(INSTALL_SCHEMES[k]) for k in ("unix_prefix", "unix_home") ) @functools.cache def _looks_like_debian_scheme() -> bool: """Debian adds two additional schemes.""" from distutils.command.install import INSTALL_SCHEMES return "deb_system" in INSTALL_SCHEMES and "unix_local" in INSTALL_SCHEMES @functools.cache def _looks_like_red_hat_scheme() -> bool: """Red Hat patches ``sys.prefix`` and ``sys.exec_prefix``. Red Hat's ``00251-change-user-install-location.patch`` changes the install command's ``prefix`` and ``exec_prefix`` to append ``"/local"``. This is (fortunately?) done quite unconditionally, so we create a default command object without any configuration to detect this. """ from distutils.command.install import install from distutils.dist import Distribution cmd = install(Distribution()) cmd.finalize_options() return ( cmd.exec_prefix == f"{os.path.normpath(sys.exec_prefix)}/local" and cmd.prefix == f"{os.path.normpath(sys.prefix)}/local" ) @functools.cache def _looks_like_slackware_scheme() -> bool: """Slackware patches sysconfig but fails to patch distutils and site. Slackware changes sysconfig's user scheme to use ``"lib64"`` for the lib path, but does not do the same to the site module. """ if user_site is None: # User-site not available. return False try: paths = sysconfig.get_paths(scheme="posix_user", expand=False) except KeyError: # User-site not available. return False return "/lib64/" in paths["purelib"] and "/lib64/" not in user_site @functools.cache def _looks_like_msys2_mingw_scheme() -> bool: """MSYS2 patches distutils and sysconfig to use a UNIX-like scheme. However, MSYS2 incorrectly patches sysconfig ``nt`` scheme. The fix is likely going to be included in their 3.10 release, so we ignore the warning. See msys2/MINGW-packages#9319. MSYS2 MINGW's patch uses lowercase ``"lib"`` instead of the usual uppercase, and is missing the final ``"site-packages"``. """ paths = sysconfig.get_paths("nt", expand=False) return all( "Lib" not in p and "lib" in p and not p.endswith("site-packages") for p in (paths[key] for key in ("platlib", "purelib")) ) @functools.cache def _warn_mismatched(old: pathlib.Path, new: pathlib.Path, *, key: str) -> None: issue_url = "https://github.com/pypa/pip/issues/10151" message = ( "Value for %s does not match. Please report this to <%s>" "\ndistutils: %s" "\nsysconfig: %s" ) logger.log(_MISMATCH_LEVEL, message, key, issue_url, old, new) def _warn_if_mismatch(old: pathlib.Path, new: pathlib.Path, *, key: str) -> bool: if old == new: return False _warn_mismatched(old, new, key=key) return True @functools.cache def _log_context( *, user: bool = False, home: str | None = None, root: str | None = None, prefix: str | None = None, ) -> None: parts = [ "Additional context:", "user = %r", "home = %r", "root = %r", "prefix = %r", ] logger.log(_MISMATCH_LEVEL, "\n".join(parts), user, home, root, prefix) def get_scheme( dist_name: str, user: bool = False, home: str | None = None, root: str | None = None, isolated: bool = False, prefix: str | None = None, ) -> Scheme: new = _sysconfig.get_scheme( dist_name, user=user, home=home, root=root, isolated=isolated, prefix=prefix, ) if _USE_SYSCONFIG: return new old = _distutils.get_scheme( dist_name, user=user, home=home, root=root, isolated=isolated, prefix=prefix, ) warning_contexts = [] for k in SCHEME_KEYS: old_v = pathlib.Path(getattr(old, k)) new_v = pathlib.Path(getattr(new, k)) if old_v == new_v: continue # distutils incorrectly put PyPy packages under ``site-packages/python`` # in the ``posix_home`` scheme, but PyPy devs said they expect the # directory name to be ``pypy`` instead. So we treat this as a bug fix # and not warn about it. See bpo-43307 and python/cpython#24628. skip_pypy_special_case = ( sys.implementation.name == "pypy" and home is not None and k in ("platlib", "purelib") and old_v.parent == new_v.parent and old_v.name.startswith("python") and new_v.name.startswith("pypy") ) if skip_pypy_special_case: continue # sysconfig's ``osx_framework_user`` does not include ``pythonX.Y`` in # the ``include`` value, but distutils's ``headers`` does. We'll let # CPython decide whether this is a bug or feature. See bpo-43948. skip_osx_framework_user_special_case = ( user and is_osx_framework() and k == "headers" and old_v.parent.parent == new_v.parent and old_v.parent.name.startswith("python") ) if skip_osx_framework_user_special_case: continue # On Red Hat and derived Linux distributions, distutils is patched to # use "lib64" instead of "lib" for platlib. if k == "platlib" and _looks_like_red_hat_lib(): continue # On Python 3.9+, sysconfig's posix_user scheme sets platlib against # sys.platlibdir, but distutils's unix_user incorrectly continues # using the same $usersite for both platlib and purelib. This creates a # mismatch when sys.platlibdir is not "lib". skip_bpo_44860 = ( user and k == "platlib" and not WINDOWS and _PLATLIBDIR != "lib" and _looks_like_bpo_44860() ) if skip_bpo_44860: continue # Slackware incorrectly patches posix_user to use lib64 instead of lib, # but not usersite to match the location. skip_slackware_user_scheme = ( user and k in ("platlib", "purelib") and not WINDOWS and _looks_like_slackware_scheme() ) if skip_slackware_user_scheme: continue # Both Debian and Red Hat patch Python to place the system site under # /usr/local instead of /usr. Debian also places lib in dist-packages # instead of site-packages, but the /usr/local check should cover it. skip_linux_system_special_case = ( not (user or home or prefix or running_under_virtualenv()) and old_v.parts[1:3] == ("usr", "local") and len(new_v.parts) > 1 and new_v.parts[1] == "usr" and (len(new_v.parts) < 3 or new_v.parts[2] != "local") and (_looks_like_red_hat_scheme() or _looks_like_debian_scheme()) ) if skip_linux_system_special_case: continue # MSYS2 MINGW's sysconfig patch does not include the "site-packages" # part of the path. This is incorrect and will be fixed in MSYS. skip_msys2_mingw_bug = ( WINDOWS and k in ("platlib", "purelib") and _looks_like_msys2_mingw_scheme() ) if skip_msys2_mingw_bug: continue # CPython's POSIX install script invokes pip (via ensurepip) against the # interpreter located in the source tree, not the install site. This # triggers special logic in sysconfig that's not present in distutils. # https://github.com/python/cpython/blob/8c21941ddaf/Lib/sysconfig.py#L178-L194 skip_cpython_build = ( sysconfig.is_python_build(check_home=True) and not WINDOWS and k in ("headers", "include", "platinclude") ) if skip_cpython_build: continue warning_contexts.append((old_v, new_v, f"scheme.{k}")) if not warning_contexts: return old # Check if this path mismatch is caused by distutils config files. Those # files will no longer work once we switch to sysconfig, so this raises a # deprecation message for them. default_old = _distutils.distutils_scheme( dist_name, user, home, root, isolated, prefix, ignore_config_files=True, ) if any(default_old[k] != getattr(old, k) for k in SCHEME_KEYS): deprecated( reason=( "Configuring installation scheme with distutils config files " "is deprecated and will no longer work in the near future. If you " "are using a Homebrew or Linuxbrew Python, please see discussion " "at https://github.com/Homebrew/homebrew-core/issues/76621" ), replacement=None, gone_in=None, ) return old # Post warnings about this mismatch so user can report them back. for old_v, new_v, key in warning_contexts: _warn_mismatched(old_v, new_v, key=key) _log_context(user=user, home=home, root=root, prefix=prefix) return old def get_bin_prefix() -> str: new = _sysconfig.get_bin_prefix() if _USE_SYSCONFIG: return new old = _distutils.get_bin_prefix() if _warn_if_mismatch(pathlib.Path(old), pathlib.Path(new), key="bin_prefix"): _log_context() return old def get_bin_user() -> str: return _sysconfig.get_scheme("", user=True).scripts def _looks_like_deb_system_dist_packages(value: str) -> bool: """Check if the value is Debian's APT-controlled dist-packages. Debian's ``distutils.sysconfig.get_python_lib()`` implementation returns the default package path controlled by APT, but does not patch ``sysconfig`` to do the same. This is similar to the bug worked around in ``get_scheme()``, but here the default is ``deb_system`` instead of ``unix_local``. Ultimately we can't do anything about this Debian bug, and this detection allows us to skip the warning when needed. """ if not _looks_like_debian_scheme(): return False if value == "/usr/lib/python3/dist-packages": return True return False def get_purelib() -> str: """Return the default pure-Python lib location.""" new = _sysconfig.get_purelib() if _USE_SYSCONFIG: return new old = _distutils.get_purelib() if _looks_like_deb_system_dist_packages(old): return old if _warn_if_mismatch(pathlib.Path(old), pathlib.Path(new), key="purelib"): _log_context() return old def get_platlib() -> str: """Return the default platform-shared lib location.""" new = _sysconfig.get_platlib() if _USE_SYSCONFIG: return new from . import _distutils old = _distutils.get_platlib() if _looks_like_deb_system_dist_packages(old): return old if _warn_if_mismatch(pathlib.Path(old), pathlib.Path(new), key="platlib"): _log_context() return old ================================================ FILE: src/pip/_internal/locations/_distutils.py ================================================ """Locations where we look for configs, install stuff, etc""" # The following comment should be removed at some point in the future. # mypy: strict-optional=False # If pip's going to use distutils, it should not be using the copy that setuptools # might have injected into the environment. This is done by removing the injected # shim, if it's injected. # # See https://github.com/pypa/pip/issues/8761 for the original discussion and # rationale for why this is done within pip. from __future__ import annotations try: __import__("_distutils_hack").remove_shim() except (ImportError, AttributeError): pass import logging import os import sys from distutils.cmd import Command as DistutilsCommand from distutils.command.install import SCHEME_KEYS from distutils.command.install import install as distutils_install_command from distutils.sysconfig import get_python_lib from pip._internal.models.scheme import Scheme from pip._internal.utils.compat import WINDOWS from pip._internal.utils.virtualenv import running_under_virtualenv from .base import get_major_minor_version logger = logging.getLogger(__name__) def distutils_scheme( dist_name: str, user: bool = False, home: str | None = None, root: str | None = None, isolated: bool = False, prefix: str | None = None, *, ignore_config_files: bool = False, ) -> dict[str, str]: """ Return a distutils install scheme """ from distutils.dist import Distribution dist_args: dict[str, str | list[str]] = {"name": dist_name} if isolated: dist_args["script_args"] = ["--no-user-cfg"] d = Distribution(dist_args) if not ignore_config_files: try: d.parse_config_files() except UnicodeDecodeError: paths = d.find_config_files() logger.warning( "Ignore distutils configs in %s due to encoding errors.", ", ".join(os.path.basename(p) for p in paths), ) obj: DistutilsCommand | None = None obj = d.get_command_obj("install", create=True) assert obj is not None i: distutils_install_command = obj # NOTE: setting user or home has the side-effect of creating the home dir # or user base for installations during finalize_options() # ideally, we'd prefer a scheme class that has no side-effects. assert not (user and prefix), f"user={user} prefix={prefix}" assert not (home and prefix), f"home={home} prefix={prefix}" i.user = user or i.user if user or home: i.prefix = "" i.prefix = prefix or i.prefix i.home = home or i.home i.root = root or i.root i.finalize_options() scheme: dict[str, str] = {} for key in SCHEME_KEYS: scheme[key] = getattr(i, "install_" + key) # install_lib specified in setup.cfg should install *everything* # into there (i.e. it takes precedence over both purelib and # platlib). Note, i.install_lib is *always* set after # finalize_options(); we only want to override here if the user # has explicitly requested it hence going back to the config if "install_lib" in d.get_option_dict("install"): scheme.update({"purelib": i.install_lib, "platlib": i.install_lib}) if running_under_virtualenv(): if home: prefix = home elif user: prefix = i.install_userbase else: prefix = i.prefix scheme["headers"] = os.path.join( prefix, "include", "site", f"python{get_major_minor_version()}", dist_name, ) if root is not None: path_no_drive = os.path.splitdrive(os.path.abspath(scheme["headers"]))[1] scheme["headers"] = os.path.join(root, path_no_drive[1:]) return scheme def get_scheme( dist_name: str, user: bool = False, home: str | None = None, root: str | None = None, isolated: bool = False, prefix: str | None = None, ) -> Scheme: """ Get the "scheme" corresponding to the input parameters. The distutils documentation provides the context for the available schemes: https://docs.python.org/3/install/index.html#alternate-installation :param dist_name: the name of the package to retrieve the scheme for, used in the headers scheme path :param user: indicates to use the "user" scheme :param home: indicates to use the "home" scheme and provides the base directory for the same :param root: root under which other directories are re-based :param isolated: equivalent to --no-user-cfg, i.e. do not consider ~/.pydistutils.cfg (posix) or ~/pydistutils.cfg (non-posix) for scheme paths :param prefix: indicates to use the "prefix" scheme and provides the base directory for the same """ scheme = distutils_scheme(dist_name, user, home, root, isolated, prefix) return Scheme( platlib=scheme["platlib"], purelib=scheme["purelib"], headers=scheme["headers"], scripts=scheme["scripts"], data=scheme["data"], ) def get_bin_prefix() -> str: # XXX: In old virtualenv versions, sys.prefix can contain '..' components, # so we need to call normpath to eliminate them. prefix = os.path.normpath(sys.prefix) if WINDOWS: bin_py = os.path.join(prefix, "Scripts") # buildout uses 'bin' on Windows too? if not os.path.exists(bin_py): bin_py = os.path.join(prefix, "bin") return bin_py # Forcing to use /usr/local/bin for standard macOS framework installs # Also log to ~/Library/Logs/ for use with the Console.app log viewer if sys.platform[:6] == "darwin" and prefix[:16] == "/System/Library/": return "/usr/local/bin" return os.path.join(prefix, "bin") def get_purelib() -> str: return get_python_lib(plat_specific=False) def get_platlib() -> str: return get_python_lib(plat_specific=True) ================================================ FILE: src/pip/_internal/locations/_sysconfig.py ================================================ from __future__ import annotations import logging import os import sys import sysconfig from typing import Callable from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid from pip._internal.models.scheme import SCHEME_KEYS, Scheme from pip._internal.utils.virtualenv import running_under_virtualenv from .base import change_root, get_major_minor_version, is_osx_framework logger = logging.getLogger(__name__) # Notes on _infer_* functions. # Unfortunately ``get_default_scheme()`` didn't exist before 3.10, so there's no # way to ask things like "what is the '_prefix' scheme on this platform". These # functions try to answer that with some heuristics while accounting for ad-hoc # platforms not covered by CPython's default sysconfig implementation. If the # ad-hoc implementation does not fully implement sysconfig, we'll fall back to # a POSIX scheme. _AVAILABLE_SCHEMES = set(sysconfig.get_scheme_names()) _PREFERRED_SCHEME_API: Callable[[str], str] | None = getattr( sysconfig, "get_preferred_scheme", None ) def _should_use_osx_framework_prefix() -> bool: """Check for Apple's ``osx_framework_library`` scheme. Python distributed by Apple's Command Line Tools has this special scheme that's used when: * This is a framework build. * We are installing into the system prefix. This does not account for ``pip install --prefix`` (also means we're not installing to the system prefix), which should use ``posix_prefix``, but logic here means ``_infer_prefix()`` outputs ``osx_framework_library``. But since ``prefix`` is not available for ``sysconfig.get_default_scheme()``, which is the stdlib replacement for ``_infer_prefix()``, presumably Apple wouldn't be able to magically switch between ``osx_framework_library`` and ``posix_prefix``. ``_infer_prefix()`` returning ``osx_framework_library`` means its behavior is consistent whether we use the stdlib implementation or our own, and we deal with this special case in ``get_scheme()`` instead. """ return ( "osx_framework_library" in _AVAILABLE_SCHEMES and not running_under_virtualenv() and is_osx_framework() ) def _infer_prefix() -> str: """Try to find a prefix scheme for the current platform. This tries: * A special ``osx_framework_library`` for Python distributed by Apple's Command Line Tools, when not running in a virtual environment. * Implementation + OS, used by PyPy on Windows (``pypy_nt``). * Implementation without OS, used by PyPy on POSIX (``pypy``). * OS + "prefix", used by CPython on POSIX (``posix_prefix``). * Just the OS name, used by CPython on Windows (``nt``). If none of the above works, fall back to ``posix_prefix``. """ if _PREFERRED_SCHEME_API: return _PREFERRED_SCHEME_API("prefix") if _should_use_osx_framework_prefix(): return "osx_framework_library" implementation_suffixed = f"{sys.implementation.name}_{os.name}" if implementation_suffixed in _AVAILABLE_SCHEMES: return implementation_suffixed if sys.implementation.name in _AVAILABLE_SCHEMES: return sys.implementation.name suffixed = f"{os.name}_prefix" if suffixed in _AVAILABLE_SCHEMES: return suffixed if os.name in _AVAILABLE_SCHEMES: # On Windows, prefx is just called "nt". return os.name return "posix_prefix" def _infer_user() -> str: """Try to find a user scheme for the current platform.""" if _PREFERRED_SCHEME_API: return _PREFERRED_SCHEME_API("user") if is_osx_framework() and not running_under_virtualenv(): suffixed = "osx_framework_user" else: suffixed = f"{os.name}_user" if suffixed in _AVAILABLE_SCHEMES: return suffixed if "posix_user" not in _AVAILABLE_SCHEMES: # User scheme unavailable. raise UserInstallationInvalid() return "posix_user" def _infer_home() -> str: """Try to find a home for the current platform.""" if _PREFERRED_SCHEME_API: return _PREFERRED_SCHEME_API("home") suffixed = f"{os.name}_home" if suffixed in _AVAILABLE_SCHEMES: return suffixed return "posix_home" # Update these keys if the user sets a custom home. _HOME_KEYS = [ "installed_base", "base", "installed_platbase", "platbase", "prefix", "exec_prefix", ] if sysconfig.get_config_var("userbase") is not None: _HOME_KEYS.append("userbase") def get_scheme( dist_name: str, user: bool = False, home: str | None = None, root: str | None = None, isolated: bool = False, prefix: str | None = None, ) -> Scheme: """ Get the "scheme" corresponding to the input parameters. :param dist_name: the name of the package to retrieve the scheme for, used in the headers scheme path :param user: indicates to use the "user" scheme :param home: indicates to use the "home" scheme :param root: root under which other directories are re-based :param isolated: ignored, but kept for distutils compatibility (where this controls whether the user-site pydistutils.cfg is honored) :param prefix: indicates to use the "prefix" scheme and provides the base directory for the same """ if user and prefix: raise InvalidSchemeCombination("--user", "--prefix") if home and prefix: raise InvalidSchemeCombination("--home", "--prefix") if home is not None: scheme_name = _infer_home() elif user: scheme_name = _infer_user() else: scheme_name = _infer_prefix() # Special case: When installing into a custom prefix, use posix_prefix # instead of osx_framework_library. See _should_use_osx_framework_prefix() # docstring for details. if prefix is not None and scheme_name == "osx_framework_library": scheme_name = "posix_prefix" if home is not None: variables = {k: home for k in _HOME_KEYS} elif prefix is not None: variables = {k: prefix for k in _HOME_KEYS} else: variables = {} paths = sysconfig.get_paths(scheme=scheme_name, vars=variables) # Logic here is very arbitrary, we're doing it for compatibility, don't ask. # 1. Pip historically uses a special header path in virtual environments. # 2. If the distribution name is not known, distutils uses 'UNKNOWN'. We # only do the same when not running in a virtual environment because # pip's historical header path logic (see point 1) did not do this. if running_under_virtualenv(): if user: base = variables.get("userbase", sys.prefix) else: base = variables.get("base", sys.prefix) python_xy = f"python{get_major_minor_version()}" paths["include"] = os.path.join(base, "include", "site", python_xy) elif not dist_name: dist_name = "UNKNOWN" scheme = Scheme( platlib=paths["platlib"], purelib=paths["purelib"], headers=os.path.join(paths["include"], dist_name), scripts=paths["scripts"], data=paths["data"], ) if root is not None: converted_keys = {} for key in SCHEME_KEYS: converted_keys[key] = change_root(root, getattr(scheme, key)) scheme = Scheme(**converted_keys) return scheme def get_bin_prefix() -> str: # Forcing to use /usr/local/bin for standard macOS framework installs. if sys.platform[:6] == "darwin" and sys.prefix[:16] == "/System/Library/": return "/usr/local/bin" return sysconfig.get_paths()["scripts"] def get_purelib() -> str: return sysconfig.get_paths()["purelib"] def get_platlib() -> str: return sysconfig.get_paths()["platlib"] ================================================ FILE: src/pip/_internal/locations/base.py ================================================ from __future__ import annotations import functools import os import site import sys import sysconfig from pip._internal.exceptions import InstallationError from pip._internal.utils import appdirs from pip._internal.utils.virtualenv import running_under_virtualenv # Application Directories USER_CACHE_DIR = appdirs.user_cache_dir("pip") # FIXME doesn't account for venv linked to global site-packages site_packages: str = sysconfig.get_path("purelib") def get_major_minor_version() -> str: """ Return the major-minor version of the current Python as a string, e.g. "3.7" or "3.10". """ return "{}.{}".format(*sys.version_info) def change_root(new_root: str, pathname: str) -> str: """Return 'pathname' with 'new_root' prepended. If 'pathname' is relative, this is equivalent to os.path.join(new_root, pathname). Otherwise, it requires making 'pathname' relative and then joining the two, which is tricky on DOS/Windows and Mac OS. This is borrowed from Python's standard library's distutils module. """ if os.name == "posix": if not os.path.isabs(pathname): return os.path.join(new_root, pathname) else: return os.path.join(new_root, pathname[1:]) elif os.name == "nt": (drive, path) = os.path.splitdrive(pathname) if path[0] == "\\": path = path[1:] return os.path.join(new_root, path) else: raise InstallationError( f"Unknown platform: {os.name}\n" "Can not change root path prefix on unknown platform." ) def get_src_prefix() -> str: if running_under_virtualenv(): src_prefix = os.path.join(sys.prefix, "src") else: # FIXME: keep src in cwd for now (it is not a temporary folder) try: src_prefix = os.path.join(os.getcwd(), "src") except OSError: # In case the current working directory has been renamed or deleted sys.exit("The folder you are executing pip from can no longer be found.") # under macOS + virtualenv sys.prefix is not properly resolved # it is something like /path/to/python/bin/.. return os.path.abspath(src_prefix) try: # Use getusersitepackages if this is present, as it ensures that the # value is initialised properly. user_site: str | None = site.getusersitepackages() except AttributeError: user_site = site.USER_SITE @functools.cache def is_osx_framework() -> bool: return bool(sysconfig.get_config_var("PYTHONFRAMEWORK")) ================================================ FILE: src/pip/_internal/main.py ================================================ from __future__ import annotations def main(args: list[str] | None = None) -> int: """This is preserved for old console scripts that may still be referencing it. For additional details, see https://github.com/pypa/pip/issues/7498. """ from pip._internal.utils.entrypoints import _wrapper return _wrapper(args) ================================================ FILE: src/pip/_internal/metadata/__init__.py ================================================ from __future__ import annotations import contextlib import functools import os import sys from typing import TYPE_CHECKING, Literal, Protocol, cast from pip._internal.utils.deprecation import deprecated from pip._internal.utils.misc import strtobool from .base import BaseDistribution, BaseEnvironment, FilesystemWheel, MemoryWheel, Wheel if TYPE_CHECKING: from pip._vendor.packaging.utils import NormalizedName __all__ = [ "BaseDistribution", "BaseEnvironment", "FilesystemWheel", "MemoryWheel", "Wheel", "get_default_environment", "get_environment", "get_wheel_distribution", "select_backend", ] def _should_use_importlib_metadata() -> bool: """Whether to use the ``importlib.metadata`` or ``pkg_resources`` backend. By default, pip uses ``importlib.metadata`` on Python 3.11+, and ``pkg_resources`` otherwise. Up to Python 3.13, This can be overridden by a couple of ways: * If environment variable ``_PIP_USE_IMPORTLIB_METADATA`` is set, it dictates whether ``importlib.metadata`` is used, for Python <3.14. * On Python 3.11, 3.12 and 3.13, Python distributors can patch ``importlib.metadata`` to add a global constant ``_PIP_USE_IMPORTLIB_METADATA = False``. This makes pip use ``pkg_resources`` (unless the user set the aforementioned environment variable to *True*). On Python 3.14+, the ``pkg_resources`` backend cannot be used. """ if sys.version_info >= (3, 14): # On Python >=3.14 we only support importlib.metadata. return True with contextlib.suppress(KeyError, ValueError): # On Python <3.14, if the environment variable is set, we obey what it says. return bool(strtobool(os.environ["_PIP_USE_IMPORTLIB_METADATA"])) if sys.version_info < (3, 11): # On Python <3.11, we always use pkg_resources, unless the environment # variable was set. return False # On Python 3.11, 3.12 and 3.13, we check if the global constant is set. import importlib.metadata return bool(getattr(importlib.metadata, "_PIP_USE_IMPORTLIB_METADATA", True)) def _emit_pkg_resources_deprecation_if_needed() -> None: if sys.version_info < (3, 11): # All pip versions supporting Python<=3.11 will support pkg_resources, # and pkg_resources is the default for these, so let's not bother users. return import importlib.metadata if hasattr(importlib.metadata, "_PIP_USE_IMPORTLIB_METADATA"): # The Python distributor has set the global constant, so we don't # warn, since it is not a user decision. return # The user has decided to use pkg_resources, so we warn. deprecated( reason="Using the pkg_resources metadata backend is deprecated.", replacement=( "to use the default importlib.metadata backend, " "by unsetting the _PIP_USE_IMPORTLIB_METADATA environment variable" ), gone_in="26.3", issue=13317, ) class Backend(Protocol): NAME: Literal["importlib", "pkg_resources"] Distribution: type[BaseDistribution] Environment: type[BaseEnvironment] @functools.cache def select_backend() -> Backend: if _should_use_importlib_metadata(): from . import importlib return cast(Backend, importlib) _emit_pkg_resources_deprecation_if_needed() from . import pkg_resources return cast(Backend, pkg_resources) def get_default_environment() -> BaseEnvironment: """Get the default representation for the current environment. This returns an Environment instance from the chosen backend. The default Environment instance should be built from ``sys.path`` and may use caching to share instance state across calls. """ return select_backend().Environment.default() def get_environment(paths: list[str] | None) -> BaseEnvironment: """Get a representation of the environment specified by ``paths``. This returns an Environment instance from the chosen backend based on the given import paths. The backend must build a fresh instance representing the state of installed distributions when this function is called. """ return select_backend().Environment.from_paths(paths) def get_directory_distribution(directory: str) -> BaseDistribution: """Get the distribution metadata representation in the specified directory. This returns a Distribution instance from the chosen backend based on the given on-disk ``.dist-info`` directory. """ return select_backend().Distribution.from_directory(directory) def get_wheel_distribution( wheel: Wheel, canonical_name: NormalizedName ) -> BaseDistribution: """Get the representation of the specified wheel's distribution metadata. This returns a Distribution instance from the chosen backend based on the given wheel's ``.dist-info`` directory. :param canonical_name: Normalized project name of the given wheel. """ return select_backend().Distribution.from_wheel(wheel, canonical_name) def get_metadata_distribution( metadata_contents: bytes, filename: str, canonical_name: str, ) -> BaseDistribution: """Get the dist representation of the specified METADATA file contents. This returns a Distribution instance from the chosen backend sourced from the data in `metadata_contents`. :param metadata_contents: Contents of a METADATA file within a dist, or one served via PEP 658. :param filename: Filename for the dist this metadata represents. :param canonical_name: Normalized project name of the given dist. """ return select_backend().Distribution.from_metadata_file_contents( metadata_contents, filename, canonical_name, ) ================================================ FILE: src/pip/_internal/metadata/_json.py ================================================ # Extracted from https://github.com/pfmoore/pkg_metadata from __future__ import annotations from email.header import Header, decode_header, make_header from email.message import Message from typing import Any, cast METADATA_FIELDS = [ # Name, Multiple-Use ("Metadata-Version", False), ("Name", False), ("Version", False), ("Dynamic", True), ("Platform", True), ("Supported-Platform", True), ("Summary", False), ("Description", False), ("Description-Content-Type", False), ("Keywords", False), ("Home-page", False), ("Download-URL", False), ("Author", False), ("Author-email", False), ("Maintainer", False), ("Maintainer-email", False), ("License", False), ("License-Expression", False), ("License-File", True), ("Classifier", True), ("Requires-Dist", True), ("Requires-Python", False), ("Requires-External", True), ("Project-URL", True), ("Provides-Extra", True), ("Provides-Dist", True), ("Obsoletes-Dist", True), ] def json_name(field: str) -> str: return field.lower().replace("-", "_") def msg_to_json(msg: Message) -> dict[str, Any]: """Convert a Message object into a JSON-compatible dictionary.""" def sanitise_header(h: Header | str) -> str: if isinstance(h, Header): chunks = [] for bytes, encoding in decode_header(h): if encoding == "unknown-8bit": try: # See if UTF-8 works bytes.decode("utf-8") encoding = "utf-8" except UnicodeDecodeError: # If not, latin1 at least won't fail encoding = "latin1" chunks.append((bytes, encoding)) return str(make_header(chunks)) return str(h) result = {} for field, multi in METADATA_FIELDS: if field not in msg: continue key = json_name(field) if multi: value: str | list[str] = [ sanitise_header(v) for v in msg.get_all(field) # type: ignore ] else: value = sanitise_header(msg.get(field)) # type: ignore if key == "keywords": # Accept both comma-separated and space-separated # forms, for better compatibility with old data. if "," in value: value = [v.strip() for v in value.split(",")] else: value = value.split() result[key] = value payload = cast(str, msg.get_payload()) if payload: result["description"] = payload return result ================================================ FILE: src/pip/_internal/metadata/base.py ================================================ from __future__ import annotations import csv import email.message import functools import json import logging import pathlib import re import zipfile from collections.abc import Collection, Container, Iterable, Iterator from typing import ( IO, Any, NamedTuple, Protocol, Union, ) from pip._vendor.packaging.requirements import Requirement from pip._vendor.packaging.specifiers import InvalidSpecifier, SpecifierSet from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.packaging.version import Version from pip._internal.exceptions import NoneMetadataError from pip._internal.locations import site_packages, user_site from pip._internal.models.direct_url import ( DIRECT_URL_METADATA_NAME, DirectUrl, DirectUrlValidationError, ) from pip._internal.utils.compat import stdlib_pkgs # TODO: Move definition here. from pip._internal.utils.egg_link import egg_link_path_from_sys_path from pip._internal.utils.misc import is_local, normalize_path from pip._internal.utils.urls import url_to_path from ._json import msg_to_json InfoPath = Union[str, pathlib.PurePath] logger = logging.getLogger(__name__) class BaseEntryPoint(Protocol): @property def name(self) -> str: raise NotImplementedError() @property def value(self) -> str: raise NotImplementedError() @property def group(self) -> str: raise NotImplementedError() def _convert_installed_files_path( entry: tuple[str, ...], info: tuple[str, ...], ) -> str: """Convert a legacy installed-files.txt path into modern RECORD path. The legacy format stores paths relative to the info directory, while the modern format stores paths relative to the package root, e.g. the site-packages directory. :param entry: Path parts of the installed-files.txt entry. :param info: Path parts of the egg-info directory relative to package root. :returns: The converted entry. For best compatibility with symlinks, this does not use ``abspath()`` or ``Path.resolve()``, but tries to work with path parts: 1. While ``entry`` starts with ``..``, remove the equal amounts of parts from ``info``; if ``info`` is empty, start appending ``..`` instead. 2. Join the two directly. """ while entry and entry[0] == "..": if not info or info[-1] == "..": info += ("..",) else: info = info[:-1] entry = entry[1:] return str(pathlib.Path(*info, *entry)) class RequiresEntry(NamedTuple): requirement: str extra: str marker: str class BaseDistribution(Protocol): @classmethod def from_directory(cls, directory: str) -> BaseDistribution: """Load the distribution from a metadata directory. :param directory: Path to a metadata directory, e.g. ``.dist-info``. """ raise NotImplementedError() @classmethod def from_metadata_file_contents( cls, metadata_contents: bytes, filename: str, project_name: str, ) -> BaseDistribution: """Load the distribution from the contents of a METADATA file. This is used to implement PEP 658 by generating a "shallow" dist object that can be used for resolution without downloading or building the actual dist yet. :param metadata_contents: The contents of a METADATA file. :param filename: File name for the dist with this metadata. :param project_name: Name of the project this dist represents. """ raise NotImplementedError() @classmethod def from_wheel(cls, wheel: Wheel, name: str) -> BaseDistribution: """Load the distribution from a given wheel. :param wheel: A concrete wheel definition. :param name: File name of the wheel. :raises InvalidWheel: Whenever loading of the wheel causes a :py:exc:`zipfile.BadZipFile` exception to be thrown. :raises UnsupportedWheel: If the wheel is a valid zip, but malformed internally. """ raise NotImplementedError() def __repr__(self) -> str: return f"{self.raw_name} {self.raw_version} ({self.location})" def __str__(self) -> str: return f"{self.raw_name} {self.raw_version}" @property def location(self) -> str | None: """Where the distribution is loaded from. A string value is not necessarily a filesystem path, since distributions can be loaded from other sources, e.g. arbitrary zip archives. ``None`` means the distribution is created in-memory. Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If this is a symbolic link, we want to preserve the relative path between it and files in the distribution. """ raise NotImplementedError() @property def editable_project_location(self) -> str | None: """The project location for editable distributions. This is the directory where pyproject.toml or setup.py is located. None if the distribution is not installed in editable mode. """ # TODO: this property is relatively costly to compute, memoize it ? direct_url = self.direct_url if direct_url: if direct_url.is_local_editable(): return url_to_path(direct_url.url) else: # Search for an .egg-link file by walking sys.path, as it was # done before by dist_is_editable(). egg_link_path = egg_link_path_from_sys_path(self.raw_name) if egg_link_path: # TODO: get project location from second line of egg_link file # (https://github.com/pypa/pip/issues/10243) return self.location return None @property def installed_location(self) -> str | None: """The distribution's "installed" location. This should generally be a ``site-packages`` directory. This is usually ``dist.location``, except for legacy develop-installed packages, where ``dist.location`` is the source code location, and this is where the ``.egg-link`` file is. The returned location is normalized (in particular, with symlinks removed). """ raise NotImplementedError() @property def info_location(self) -> str | None: """Location of the .[egg|dist]-info directory or file. Similarly to ``location``, a string value is not necessarily a filesystem path. ``None`` means the distribution is created in-memory. For a modern .dist-info installation on disk, this should be something like ``{location}/{raw_name}-{version}.dist-info``. Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If this is a symbolic link, we want to preserve the relative path between it and other files in the distribution. """ raise NotImplementedError() @property def installed_by_distutils(self) -> bool: """Whether this distribution is installed with legacy distutils format. A distribution installed with "raw" distutils not patched by setuptools uses one single file at ``info_location`` to store metadata. We need to treat this specially on uninstallation. """ info_location = self.info_location if not info_location: return False return pathlib.Path(info_location).is_file() @property def installed_as_egg(self) -> bool: """Whether this distribution is installed as an egg. This usually indicates the distribution was installed by (older versions of) easy_install. """ location = self.location if not location: return False # XXX if the distribution is a zipped egg, location has a trailing / # so we resort to pathlib.Path to check the suffix in a reliable way. return pathlib.Path(location).suffix == ".egg" @property def installed_with_setuptools_egg_info(self) -> bool: """Whether this distribution is installed with the ``.egg-info`` format. This usually indicates the distribution was installed with setuptools with an old pip version or with ``single-version-externally-managed``. Note that this ensure the metadata store is a directory. distutils can also installs an ``.egg-info``, but as a file, not a directory. This property is *False* for that case. Also see ``installed_by_distutils``. """ info_location = self.info_location if not info_location: return False if not info_location.endswith(".egg-info"): return False return pathlib.Path(info_location).is_dir() @property def installed_with_dist_info(self) -> bool: """Whether this distribution is installed with the "modern format". This indicates a "modern" installation, e.g. storing metadata in the ``.dist-info`` directory. This applies to installations made by setuptools (but through pip, not directly), or anything using the standardized build backend interface (PEP 517). """ info_location = self.info_location if not info_location: return False if not info_location.endswith(".dist-info"): return False return pathlib.Path(info_location).is_dir() @property def canonical_name(self) -> NormalizedName: raise NotImplementedError() @property def version(self) -> Version: raise NotImplementedError() @property def raw_version(self) -> str: raise NotImplementedError() @property def setuptools_filename(self) -> str: """Convert a project name to its setuptools-compatible filename. This is a copy of ``pkg_resources.to_filename()`` for compatibility. """ return self.raw_name.replace("-", "_") @property def direct_url(self) -> DirectUrl | None: """Obtain a DirectUrl from this distribution. Returns None if the distribution has no `direct_url.json` metadata, or if `direct_url.json` is invalid. """ try: content = self.read_text(DIRECT_URL_METADATA_NAME) except FileNotFoundError: return None try: return DirectUrl.from_json(content) except ( UnicodeDecodeError, json.JSONDecodeError, DirectUrlValidationError, ) as e: logger.warning( "Error parsing %s for %s: %s", DIRECT_URL_METADATA_NAME, self.canonical_name, e, ) return None @property def installer(self) -> str: try: installer_text = self.read_text("INSTALLER") except (OSError, ValueError, NoneMetadataError): return "" # Fail silently if the installer file cannot be read. for line in installer_text.splitlines(): cleaned_line = line.strip() if cleaned_line: return cleaned_line return "" @property def requested(self) -> bool: return self.is_file("REQUESTED") @property def editable(self) -> bool: return bool(self.editable_project_location) @property def local(self) -> bool: """If distribution is installed in the current virtual environment. Always True if we're not in a virtualenv. """ if self.installed_location is None: return False return is_local(self.installed_location) @property def in_usersite(self) -> bool: if self.installed_location is None or user_site is None: return False return self.installed_location.startswith(normalize_path(user_site)) @property def in_site_packages(self) -> bool: if self.installed_location is None or site_packages is None: return False return self.installed_location.startswith(normalize_path(site_packages)) def is_file(self, path: InfoPath) -> bool: """Check whether an entry in the info directory is a file.""" raise NotImplementedError() def iter_distutils_script_names(self) -> Iterator[str]: """Find distutils 'scripts' entries metadata. If 'scripts' is supplied in ``setup.py``, distutils records those in the installed distribution's ``scripts`` directory, a file for each script. """ raise NotImplementedError() def read_text(self, path: InfoPath) -> str: """Read a file in the info directory. :raise FileNotFoundError: If ``path`` does not exist in the directory. :raise NoneMetadataError: If ``path`` exists in the info directory, but cannot be read. """ raise NotImplementedError() def iter_entry_points(self) -> Iterable[BaseEntryPoint]: raise NotImplementedError() def _metadata_impl(self) -> email.message.Message: raise NotImplementedError() @functools.cached_property def metadata(self) -> email.message.Message: """Metadata of distribution parsed from e.g. METADATA or PKG-INFO. This should return an empty message if the metadata file is unavailable. :raises NoneMetadataError: If the metadata file is available, but does not contain valid metadata. """ metadata = self._metadata_impl() self._add_egg_info_requires(metadata) return metadata @property def metadata_dict(self) -> dict[str, Any]: """PEP 566 compliant JSON-serializable representation of METADATA or PKG-INFO. This should return an empty dict if the metadata file is unavailable. :raises NoneMetadataError: If the metadata file is available, but does not contain valid metadata. """ return msg_to_json(self.metadata) @property def metadata_version(self) -> str | None: """Value of "Metadata-Version:" in distribution metadata, if available.""" return self.metadata.get("Metadata-Version") @property def raw_name(self) -> str: """Value of "Name:" in distribution metadata.""" # The metadata should NEVER be missing the Name: key, but if it somehow # does, fall back to the known canonical name. return self.metadata.get("Name", self.canonical_name) @property def requires_python(self) -> SpecifierSet: """Value of "Requires-Python:" in distribution metadata. If the key does not exist or contains an invalid value, an empty SpecifierSet should be returned. """ value = self.metadata.get("Requires-Python") if value is None: return SpecifierSet() try: # Convert to str to satisfy the type checker; this can be a Header object. spec = SpecifierSet(str(value)) except InvalidSpecifier as e: message = "Package %r has an invalid Requires-Python: %s" logger.warning(message, self.raw_name, e) return SpecifierSet() return spec def iter_dependencies(self, extras: Collection[str] = ()) -> Iterable[Requirement]: """Dependencies of this distribution. For modern .dist-info distributions, this is the collection of "Requires-Dist:" entries in distribution metadata. """ raise NotImplementedError() def iter_raw_dependencies(self) -> Iterable[str]: """Raw Requires-Dist metadata.""" return self.metadata.get_all("Requires-Dist", []) def iter_provided_extras(self) -> Iterable[NormalizedName]: """Extras provided by this distribution. For modern .dist-info distributions, this is the collection of "Provides-Extra:" entries in distribution metadata. The return value of this function is expected to be normalised names, per PEP 685, with the returned value being handled appropriately by `iter_dependencies`. """ raise NotImplementedError() def _iter_declared_entries_from_record(self) -> Iterator[str] | None: try: text = self.read_text("RECORD") except FileNotFoundError: return None # This extra Path-str cast normalizes entries. return (str(pathlib.Path(row[0])) for row in csv.reader(text.splitlines())) def _iter_declared_entries_from_legacy(self) -> Iterator[str] | None: try: text = self.read_text("installed-files.txt") except FileNotFoundError: return None paths = (p for p in text.splitlines(keepends=False) if p) root = self.location info = self.info_location if root is None or info is None: return paths try: info_rel = pathlib.Path(info).relative_to(root) except ValueError: # info is not relative to root. return paths if not info_rel.parts: # info *is* root. return paths return ( _convert_installed_files_path(pathlib.Path(p).parts, info_rel.parts) for p in paths ) def iter_declared_entries(self) -> Iterator[str] | None: """Iterate through file entries declared in this distribution. For modern .dist-info distributions, this is the files listed in the ``RECORD`` metadata file. For legacy setuptools distributions, this comes from ``installed-files.txt``, with entries normalized to be compatible with the format used by ``RECORD``. :return: An iterator for listed entries, or None if the distribution contains neither ``RECORD`` nor ``installed-files.txt``. """ return ( self._iter_declared_entries_from_record() or self._iter_declared_entries_from_legacy() ) def _iter_requires_txt_entries(self) -> Iterator[RequiresEntry]: """Parse a ``requires.txt`` in an egg-info directory. This is an INI-ish format where an egg-info stores dependencies. A section name describes extra other environment markers, while each entry is an arbitrary string (not a key-value pair) representing a dependency as a requirement string (no markers). There is a construct in ``importlib.metadata`` called ``Sectioned`` that does mostly the same, but the format is currently considered private. """ try: content = self.read_text("requires.txt") except FileNotFoundError: return extra = marker = "" # Section-less entries don't have markers. for line in content.splitlines(): line = line.strip() if not line or line.startswith("#"): # Comment; ignored. continue if line.startswith("[") and line.endswith("]"): # A section header. extra, _, marker = line.strip("[]").partition(":") continue yield RequiresEntry(requirement=line, extra=extra, marker=marker) def _iter_egg_info_extras(self) -> Iterable[str]: """Get extras from the egg-info directory.""" known_extras = {""} for entry in self._iter_requires_txt_entries(): extra = canonicalize_name(entry.extra) if extra in known_extras: continue known_extras.add(extra) yield extra def _iter_egg_info_dependencies(self) -> Iterable[str]: """Get distribution dependencies from the egg-info directory. To ease parsing, this converts a legacy dependency entry into a PEP 508 requirement string. Like ``_iter_requires_txt_entries()``, there is code in ``importlib.metadata`` that does mostly the same, but not do exactly what we need. Namely, ``importlib.metadata`` does not normalize the extra name before putting it into the requirement string, which causes marker comparison to fail because the dist-info format do normalize. This is consistent in all currently available PEP 517 backends, although not standardized. """ for entry in self._iter_requires_txt_entries(): extra = canonicalize_name(entry.extra) if extra and entry.marker: marker = f'({entry.marker}) and extra == "{extra}"' elif extra: marker = f'extra == "{extra}"' elif entry.marker: marker = entry.marker else: marker = "" if marker: yield f"{entry.requirement} ; {marker}" else: yield entry.requirement def _add_egg_info_requires(self, metadata: email.message.Message) -> None: """Add egg-info requires.txt information to the metadata.""" if not metadata.get_all("Requires-Dist"): for dep in self._iter_egg_info_dependencies(): metadata["Requires-Dist"] = dep if not metadata.get_all("Provides-Extra"): for extra in self._iter_egg_info_extras(): metadata["Provides-Extra"] = extra class BaseEnvironment: """An environment containing distributions to introspect.""" @classmethod def default(cls) -> BaseEnvironment: raise NotImplementedError() @classmethod def from_paths(cls, paths: list[str] | None) -> BaseEnvironment: raise NotImplementedError() def get_distribution(self, name: str) -> BaseDistribution | None: """Given a requirement name, return the installed distributions. The name may not be normalized. The implementation must canonicalize it for lookup. """ raise NotImplementedError() def _iter_distributions(self) -> Iterator[BaseDistribution]: """Iterate through installed distributions. This function should be implemented by subclass, but never called directly. Use the public ``iter_distribution()`` instead, which implements additional logic to make sure the distributions are valid. """ raise NotImplementedError() def iter_all_distributions(self) -> Iterator[BaseDistribution]: """Iterate through all installed distributions without any filtering.""" for dist in self._iter_distributions(): # Make sure the distribution actually comes from a valid Python # packaging distribution. Pip's AdjacentTempDirectory leaves folders # e.g. ``~atplotlib.dist-info`` if cleanup was interrupted. The # valid project name pattern is taken from PEP 508. project_name_valid = re.match( r"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$", dist.canonical_name, flags=re.IGNORECASE, ) if not project_name_valid: logger.warning( "Ignoring invalid distribution %s (%s)", dist.canonical_name, dist.location, ) continue yield dist def iter_installed_distributions( self, local_only: bool = True, skip: Container[str] = stdlib_pkgs, include_editables: bool = True, editables_only: bool = False, user_only: bool = False, ) -> Iterator[BaseDistribution]: """Return a list of installed distributions. This is based on ``iter_all_distributions()`` with additional filtering options. Note that ``iter_installed_distributions()`` without arguments is *not* equal to ``iter_all_distributions()``, since some of the configurations exclude packages by default. :param local_only: If True (default), only return installations local to the current virtualenv, if in a virtualenv. :param skip: An iterable of canonicalized project names to ignore; defaults to ``stdlib_pkgs``. :param include_editables: If False, don't report editables. :param editables_only: If True, only report editables. :param user_only: If True, only report installations in the user site directory. """ it = self.iter_all_distributions() if local_only: it = (d for d in it if d.local) if not include_editables: it = (d for d in it if not d.editable) if editables_only: it = (d for d in it if d.editable) if user_only: it = (d for d in it if d.in_usersite) return (d for d in it if d.canonical_name not in skip) class Wheel(Protocol): location: str def as_zipfile(self) -> zipfile.ZipFile: raise NotImplementedError() class FilesystemWheel(Wheel): def __init__(self, location: str) -> None: self.location = location def as_zipfile(self) -> zipfile.ZipFile: return zipfile.ZipFile(self.location, allowZip64=True) class MemoryWheel(Wheel): def __init__(self, location: str, stream: IO[bytes]) -> None: self.location = location self.stream = stream def as_zipfile(self) -> zipfile.ZipFile: return zipfile.ZipFile(self.stream, allowZip64=True) ================================================ FILE: src/pip/_internal/metadata/importlib/__init__.py ================================================ from ._dists import Distribution from ._envs import Environment __all__ = ["NAME", "Distribution", "Environment"] NAME = "importlib" ================================================ FILE: src/pip/_internal/metadata/importlib/_compat.py ================================================ from __future__ import annotations import importlib.metadata import os from typing import Any, Protocol, cast from pip._vendor.packaging.utils import NormalizedName, canonicalize_name class BadMetadata(ValueError): def __init__(self, dist: importlib.metadata.Distribution, *, reason: str) -> None: self.dist = dist self.reason = reason def __str__(self) -> str: return f"Bad metadata in {self.dist} ({self.reason})" class BasePath(Protocol): """A protocol that various path objects conform. This exists because importlib.metadata uses both ``pathlib.Path`` and ``zipfile.Path``, and we need a common base for type hints (Union does not work well since ``zipfile.Path`` is too new for our linter setup). This does not mean to be exhaustive, but only contains things that present in both classes *that we need*. """ @property def name(self) -> str: raise NotImplementedError() @property def parent(self) -> BasePath: raise NotImplementedError() def get_info_location(d: importlib.metadata.Distribution) -> BasePath | None: """Find the path to the distribution's metadata directory. HACK: This relies on importlib.metadata's private ``_path`` attribute. Not all distributions exist on disk, so importlib.metadata is correct to not expose the attribute as public. But pip's code base is old and not as clean, so we do this to avoid having to rewrite too many things. Hopefully we can eliminate this some day. """ return getattr(d, "_path", None) def parse_name_and_version_from_info_directory( dist: importlib.metadata.Distribution, ) -> tuple[str | None, str | None]: """Get a name and version from the metadata directory name. This is much faster than reading distribution metadata. """ info_location = get_info_location(dist) if info_location is None: return None, None stem, suffix = os.path.splitext(info_location.name) if suffix == ".dist-info": name, sep, version = stem.partition("-") if sep: return name, version if suffix == ".egg-info": name = stem.split("-", 1)[0] return name, None return None, None def get_dist_canonical_name(dist: importlib.metadata.Distribution) -> NormalizedName: """Get the distribution's normalized name. The ``name`` attribute is only available in Python 3.10 or later. We are targeting exactly that, but Mypy does not know this. """ if name := parse_name_and_version_from_info_directory(dist)[0]: return canonicalize_name(name) name = cast(Any, dist).name if not isinstance(name, str): raise BadMetadata(dist, reason="invalid metadata entry 'name'") return canonicalize_name(name) ================================================ FILE: src/pip/_internal/metadata/importlib/_dists.py ================================================ from __future__ import annotations import email.message import importlib.metadata import pathlib import zipfile from collections.abc import Collection, Iterable, Iterator, Mapping, Sequence from os import PathLike from typing import ( cast, ) from pip._vendor.packaging.requirements import Requirement from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.packaging.version import Version from pip._vendor.packaging.version import parse as parse_version from pip._internal.exceptions import InvalidWheel, UnsupportedWheel from pip._internal.metadata.base import ( BaseDistribution, BaseEntryPoint, InfoPath, Wheel, ) from pip._internal.utils.misc import normalize_path from pip._internal.utils.packaging import get_requirement from pip._internal.utils.temp_dir import TempDirectory from pip._internal.utils.wheel import parse_wheel, read_wheel_metadata_file from ._compat import ( BadMetadata, BasePath, get_dist_canonical_name, parse_name_and_version_from_info_directory, ) class WheelDistribution(importlib.metadata.Distribution): """An ``importlib.metadata.Distribution`` read from a wheel. Although ``importlib.metadata.PathDistribution`` accepts ``zipfile.Path``, its implementation is too "lazy" for pip's needs (we can't keep the ZipFile handle open for the entire lifetime of the distribution object). This implementation eagerly reads the entire metadata directory into the memory instead, and operates from that. """ def __init__( self, files: Mapping[pathlib.PurePosixPath, bytes], info_location: pathlib.PurePosixPath, ) -> None: self._files = files self.info_location = info_location @classmethod def from_zipfile( cls, zf: zipfile.ZipFile, name: str, location: str, ) -> WheelDistribution: info_dir, _ = parse_wheel(zf, name) paths = ( (name, pathlib.PurePosixPath(name.split("/", 1)[-1])) for name in zf.namelist() if name.startswith(f"{info_dir}/") ) files = { relpath: read_wheel_metadata_file(zf, fullpath) for fullpath, relpath in paths } info_location = pathlib.PurePosixPath(location, info_dir) return cls(files, info_location) def iterdir(self, path: InfoPath) -> Iterator[pathlib.PurePosixPath]: # Only allow iterating through the metadata directory. if pathlib.PurePosixPath(str(path)) in self._files: return iter(self._files) raise FileNotFoundError(path) def read_text(self, filename: str) -> str | None: try: data = self._files[pathlib.PurePosixPath(filename)] except KeyError: return None try: text = data.decode("utf-8") except UnicodeDecodeError as e: wheel = self.info_location.parent error = f"Error decoding metadata for {wheel}: {e} in {filename} file" raise UnsupportedWheel(error) return text def locate_file(self, path: str | PathLike[str]) -> pathlib.Path: # This method doesn't make sense for our in-memory wheel, but the API # requires us to define it. raise NotImplementedError class Distribution(BaseDistribution): def __init__( self, dist: importlib.metadata.Distribution, info_location: BasePath | None, installed_location: BasePath | None, ) -> None: self._dist = dist self._info_location = info_location self._installed_location = installed_location @classmethod def from_directory(cls, directory: str) -> BaseDistribution: info_location = pathlib.Path(directory) dist = importlib.metadata.Distribution.at(info_location) return cls(dist, info_location, info_location.parent) @classmethod def from_metadata_file_contents( cls, metadata_contents: bytes, filename: str, project_name: str, ) -> BaseDistribution: # Generate temp dir to contain the metadata file, and write the file contents. temp_dir = pathlib.Path( TempDirectory(kind="metadata", globally_managed=True).path ) metadata_path = temp_dir / "METADATA" metadata_path.write_bytes(metadata_contents) # Construct dist pointing to the newly created directory. dist = importlib.metadata.Distribution.at(metadata_path.parent) return cls(dist, metadata_path.parent, None) @classmethod def from_wheel(cls, wheel: Wheel, name: str) -> BaseDistribution: try: with wheel.as_zipfile() as zf: dist = WheelDistribution.from_zipfile(zf, name, wheel.location) except zipfile.BadZipFile as e: raise InvalidWheel(wheel.location, name) from e return cls(dist, dist.info_location, pathlib.PurePosixPath(wheel.location)) @property def location(self) -> str | None: if self._info_location is None: return None return str(self._info_location.parent) @property def info_location(self) -> str | None: if self._info_location is None: return None return str(self._info_location) @property def installed_location(self) -> str | None: if self._installed_location is None: return None return normalize_path(str(self._installed_location)) @property def canonical_name(self) -> NormalizedName: return get_dist_canonical_name(self._dist) @property def version(self) -> Version: try: version = ( parse_name_and_version_from_info_directory(self._dist)[1] or self._dist.version ) return parse_version(version) except TypeError: raise BadMetadata(self._dist, reason="invalid metadata entry `version`") @property def raw_version(self) -> str: return self._dist.version def is_file(self, path: InfoPath) -> bool: return self._dist.read_text(str(path)) is not None def iter_distutils_script_names(self) -> Iterator[str]: # A distutils installation is always "flat" (not in e.g. egg form), so # if this distribution's info location is NOT a pathlib.Path (but e.g. # zipfile.Path), it can never contain any distutils scripts. if not isinstance(self._info_location, pathlib.Path): return for child in self._info_location.joinpath("scripts").iterdir(): yield child.name def read_text(self, path: InfoPath) -> str: content = self._dist.read_text(str(path)) if content is None: raise FileNotFoundError(path) return content def iter_entry_points(self) -> Iterable[BaseEntryPoint]: # importlib.metadata's EntryPoint structure satisfies BaseEntryPoint. return self._dist.entry_points def _metadata_impl(self) -> email.message.Message: # From Python 3.10+, importlib.metadata declares PackageMetadata as the # return type. This protocol is unfortunately a disaster now and misses # a ton of fields that we need, including get() and get_payload(). We # rely on the implementation that the object is actually a Message now, # until upstream can improve the protocol. (python/cpython#94952) metadata = self._dist.metadata # From Python 3.15+, importlib.metadata may return None when no # metadata file (METADATA or PKG-INFO) exists in the distribution # directory. (python/cpython#132947) if metadata is None: return email.message.Message() return cast(email.message.Message, metadata) def iter_provided_extras(self) -> Iterable[NormalizedName]: return [ canonicalize_name(extra) for extra in self.metadata.get_all("Provides-Extra", []) ] def iter_dependencies(self, extras: Collection[str] = ()) -> Iterable[Requirement]: contexts: Sequence[dict[str, str]] = [{"extra": e} for e in extras] for req_string in self.metadata.get_all("Requires-Dist", []): # strip() because email.message.Message.get_all() may return a leading \n # in case a long header was wrapped. req = get_requirement(req_string.strip()) if not req.marker: yield req elif not extras and req.marker.evaluate({"extra": ""}): yield req elif any(req.marker.evaluate(context) for context in contexts): yield req ================================================ FILE: src/pip/_internal/metadata/importlib/_envs.py ================================================ from __future__ import annotations import importlib.metadata import logging import os import pathlib import sys import zipfile from collections.abc import Iterator, Sequence from typing import Optional from pip._vendor.packaging.utils import ( InvalidWheelFilename, NormalizedName, canonicalize_name, parse_wheel_filename, ) from pip._internal.metadata.base import BaseDistribution, BaseEnvironment from pip._internal.utils.filetypes import WHEEL_EXTENSION from ._compat import BadMetadata, BasePath, get_dist_canonical_name, get_info_location from ._dists import Distribution logger = logging.getLogger(__name__) def _looks_like_wheel(location: str) -> bool: if not location.endswith(WHEEL_EXTENSION): return False if not os.path.isfile(location): return False try: parse_wheel_filename(os.path.basename(location)) except InvalidWheelFilename: return False return zipfile.is_zipfile(location) class _DistributionFinder: """Finder to locate distributions. The main purpose of this class is to memoize found distributions' names, so only one distribution is returned for each package name. At lot of pip code assumes this (because it is setuptools's behavior), and not doing the same can potentially cause a distribution in lower precedence path to override a higher precedence one if the caller is not careful. Eventually we probably want to make it possible to see lower precedence installations as well. It's useful feature, after all. """ FoundResult = tuple[importlib.metadata.Distribution, Optional[BasePath]] def __init__(self) -> None: self._found_names: set[NormalizedName] = set() def _find_impl(self, location: str) -> Iterator[FoundResult]: """Find distributions in a location.""" # Skip looking inside a wheel. Since a package inside a wheel is not # always valid (due to .data directories etc.), its .dist-info entry # should not be considered an installed distribution. if _looks_like_wheel(location): return # To know exactly where we find a distribution, we have to feed in the # paths one by one, instead of dumping the list to importlib.metadata. for dist in importlib.metadata.distributions(path=[location]): info_location = get_info_location(dist) try: name = get_dist_canonical_name(dist) except BadMetadata as e: logger.warning("Skipping %s due to %s", info_location, e.reason) continue if name in self._found_names: continue self._found_names.add(name) yield dist, info_location def find(self, location: str) -> Iterator[BaseDistribution]: """Find distributions in a location. The path can be either a directory, or a ZIP archive. """ for dist, info_location in self._find_impl(location): if info_location is None: installed_location: BasePath | None = None else: installed_location = info_location.parent yield Distribution(dist, info_location, installed_location) def find_legacy_editables(self, location: str) -> Iterator[BaseDistribution]: """Read location in egg-link files and return distributions in there. The path should be a directory; otherwise this returns nothing. This follows how setuptools does this for compatibility. The first non-empty line in the egg-link is read as a path (resolved against the egg-link's containing directory if relative). Distributions found at that linked location are returned. """ path = pathlib.Path(location) if not path.is_dir(): return for child in path.iterdir(): if child.suffix != ".egg-link": continue with child.open() as f: lines = (line.strip() for line in f) target_rel = next((line for line in lines if line), "") if not target_rel: continue target_location = str(path.joinpath(target_rel)) for dist, info_location in self._find_impl(target_location): yield Distribution(dist, info_location, path) class Environment(BaseEnvironment): def __init__(self, paths: Sequence[str]) -> None: self._paths = paths @classmethod def default(cls) -> BaseEnvironment: return cls(sys.path) @classmethod def from_paths(cls, paths: list[str] | None) -> BaseEnvironment: if paths is None: return cls(sys.path) return cls(paths) def _iter_distributions(self) -> Iterator[BaseDistribution]: finder = _DistributionFinder() for location in self._paths: yield from finder.find(location) yield from finder.find_legacy_editables(location) def get_distribution(self, name: str) -> BaseDistribution | None: canonical_name = canonicalize_name(name) matches = ( distribution for distribution in self.iter_all_distributions() if distribution.canonical_name == canonical_name ) return next(matches, None) ================================================ FILE: src/pip/_internal/metadata/pkg_resources.py ================================================ from __future__ import annotations import email.message import email.parser import logging import os import zipfile from collections.abc import Collection, Iterable, Iterator, Mapping from typing import ( NamedTuple, ) from pip._vendor import pkg_resources from pip._vendor.packaging.requirements import Requirement from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.packaging.version import Version from pip._vendor.packaging.version import parse as parse_version from pip._internal.exceptions import InvalidWheel, NoneMetadataError, UnsupportedWheel from pip._internal.utils.egg_link import egg_link_path_from_location from pip._internal.utils.misc import display_path, normalize_path from pip._internal.utils.wheel import parse_wheel, read_wheel_metadata_file from .base import ( BaseDistribution, BaseEntryPoint, BaseEnvironment, InfoPath, Wheel, ) __all__ = ["NAME", "Distribution", "Environment"] logger = logging.getLogger(__name__) NAME = "pkg_resources" class EntryPoint(NamedTuple): name: str value: str group: str class InMemoryMetadata: """IMetadataProvider that reads metadata files from a dictionary. This also maps metadata decoding exceptions to our internal exception type. """ def __init__(self, metadata: Mapping[str, bytes], wheel_name: str) -> None: self._metadata = metadata self._wheel_name = wheel_name def has_metadata(self, name: str) -> bool: return name in self._metadata def get_metadata(self, name: str) -> str: try: return self._metadata[name].decode() except UnicodeDecodeError as e: # Augment the default error with the origin of the file. raise UnsupportedWheel( f"Error decoding metadata for {self._wheel_name}: {e} in {name} file" ) def get_metadata_lines(self, name: str) -> Iterable[str]: return pkg_resources.yield_lines(self.get_metadata(name)) def metadata_isdir(self, name: str) -> bool: return False def metadata_listdir(self, name: str) -> list[str]: return [] def run_script(self, script_name: str, namespace: str) -> None: pass class Distribution(BaseDistribution): def __init__(self, dist: pkg_resources.Distribution) -> None: self._dist = dist # This is populated lazily, to avoid loading metadata for all possible # distributions eagerly. self.__extra_mapping: Mapping[NormalizedName, str] | None = None @property def _extra_mapping(self) -> Mapping[NormalizedName, str]: if self.__extra_mapping is None: self.__extra_mapping = { canonicalize_name(extra): extra for extra in self._dist.extras } return self.__extra_mapping @classmethod def from_directory(cls, directory: str) -> BaseDistribution: dist_dir = directory.rstrip(os.sep) # Build a PathMetadata object, from path to metadata. :wink: base_dir, dist_dir_name = os.path.split(dist_dir) metadata = pkg_resources.PathMetadata(base_dir, dist_dir) # Determine the correct Distribution object type. if dist_dir.endswith(".egg-info"): dist_cls = pkg_resources.Distribution dist_name = os.path.splitext(dist_dir_name)[0] else: assert dist_dir.endswith(".dist-info") dist_cls = pkg_resources.DistInfoDistribution dist_name = os.path.splitext(dist_dir_name)[0].split("-")[0] dist = dist_cls(base_dir, project_name=dist_name, metadata=metadata) return cls(dist) @classmethod def from_metadata_file_contents( cls, metadata_contents: bytes, filename: str, project_name: str, ) -> BaseDistribution: metadata_dict = { "METADATA": metadata_contents, } dist = pkg_resources.DistInfoDistribution( location=filename, metadata=InMemoryMetadata(metadata_dict, filename), project_name=project_name, ) return cls(dist) @classmethod def from_wheel(cls, wheel: Wheel, name: str) -> BaseDistribution: try: with wheel.as_zipfile() as zf: info_dir, _ = parse_wheel(zf, name) metadata_dict = { path.split("/", 1)[-1]: read_wheel_metadata_file(zf, path) for path in zf.namelist() if path.startswith(f"{info_dir}/") } except zipfile.BadZipFile as e: raise InvalidWheel(wheel.location, name) from e except UnsupportedWheel as e: raise UnsupportedWheel(f"{name} has an invalid wheel, {e}") dist = pkg_resources.DistInfoDistribution( location=wheel.location, metadata=InMemoryMetadata(metadata_dict, wheel.location), project_name=name, ) return cls(dist) @property def location(self) -> str | None: return self._dist.location @property def installed_location(self) -> str | None: egg_link = egg_link_path_from_location(self.raw_name) if egg_link: location = egg_link elif self.location: location = self.location else: return None return normalize_path(location) @property def info_location(self) -> str | None: return self._dist.egg_info @property def installed_by_distutils(self) -> bool: # A distutils-installed distribution is provided by FileMetadata. This # provider has a "path" attribute not present anywhere else. Not the # best introspection logic, but pip has been doing this for a long time. try: return bool(self._dist._provider.path) except AttributeError: return False @property def canonical_name(self) -> NormalizedName: return canonicalize_name(self._dist.project_name) @property def version(self) -> Version: return parse_version(self._dist.version) @property def raw_version(self) -> str: return self._dist.version def is_file(self, path: InfoPath) -> bool: return self._dist.has_metadata(str(path)) def iter_distutils_script_names(self) -> Iterator[str]: yield from self._dist.metadata_listdir("scripts") def read_text(self, path: InfoPath) -> str: name = str(path) if not self._dist.has_metadata(name): raise FileNotFoundError(name) content = self._dist.get_metadata(name) if content is None: raise NoneMetadataError(self, name) return content def iter_entry_points(self) -> Iterable[BaseEntryPoint]: for group, entries in self._dist.get_entry_map().items(): for name, entry_point in entries.items(): name, _, value = str(entry_point).partition("=") yield EntryPoint(name=name.strip(), value=value.strip(), group=group) def _metadata_impl(self) -> email.message.Message: """ :raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None. """ if isinstance(self._dist, pkg_resources.DistInfoDistribution): metadata_name = "METADATA" else: metadata_name = "PKG-INFO" try: metadata = self.read_text(metadata_name) except FileNotFoundError: if self.location: displaying_path = display_path(self.location) else: displaying_path = repr(self.location) logger.warning("No metadata found in %s", displaying_path) metadata = "" feed_parser = email.parser.FeedParser() feed_parser.feed(metadata) return feed_parser.close() def iter_dependencies(self, extras: Collection[str] = ()) -> Iterable[Requirement]: if extras: relevant_extras = set(self._extra_mapping) & set( map(canonicalize_name, extras) ) extras = [self._extra_mapping[extra] for extra in relevant_extras] return self._dist.requires(extras) def iter_provided_extras(self) -> Iterable[NormalizedName]: return self._extra_mapping.keys() class Environment(BaseEnvironment): def __init__(self, ws: pkg_resources.WorkingSet) -> None: self._ws = ws @classmethod def default(cls) -> BaseEnvironment: return cls(pkg_resources.working_set) @classmethod def from_paths(cls, paths: list[str] | None) -> BaseEnvironment: return cls(pkg_resources.WorkingSet(paths)) def _iter_distributions(self) -> Iterator[BaseDistribution]: for dist in self._ws: yield Distribution(dist) def _search_distribution(self, name: str) -> BaseDistribution | None: """Find a distribution matching the ``name`` in the environment. This searches from *all* distributions available in the environment, to match the behavior of ``pkg_resources.get_distribution()``. """ canonical_name = canonicalize_name(name) for dist in self.iter_all_distributions(): if dist.canonical_name == canonical_name: return dist return None def get_distribution(self, name: str) -> BaseDistribution | None: # Search the distribution by looking through the working set. dist = self._search_distribution(name) if dist: return dist # If distribution could not be found, call working_set.require to # update the working set, and try to find the distribution again. # This might happen for e.g. when you install a package twice, once # using setup.py develop and again using setup.py install. Now when # running pip uninstall twice, the package gets removed from the # working set in the first uninstall, so we have to populate the # working set again so that pip knows about it and the packages gets # picked up and is successfully uninstalled the second time too. try: # We didn't pass in any version specifiers, so this can never # raise pkg_resources.VersionConflict. self._ws.require(name) except pkg_resources.DistributionNotFound: return None return self._search_distribution(name) ================================================ FILE: src/pip/_internal/models/__init__.py ================================================ """A package that contains models that represent entities.""" ================================================ FILE: src/pip/_internal/models/candidate.py ================================================ from dataclasses import dataclass from pip._vendor.packaging.version import Version from pip._vendor.packaging.version import parse as parse_version from pip._internal.models.link import Link @dataclass(frozen=True) class InstallationCandidate: """Represents a potential "candidate" for installation.""" __slots__ = ["name", "version", "link"] name: str version: Version link: Link def __init__(self, name: str, version: str, link: Link) -> None: object.__setattr__(self, "name", name) object.__setattr__(self, "version", parse_version(version)) object.__setattr__(self, "link", link) def __str__(self) -> str: return f"{self.name!r} candidate (version {self.version} at {self.link})" ================================================ FILE: src/pip/_internal/models/direct_url.py ================================================ """PEP 610""" from __future__ import annotations import json import re import urllib.parse from collections.abc import Iterable from dataclasses import dataclass from typing import Any, ClassVar, TypeVar, Union __all__ = [ "DirectUrl", "DirectUrlValidationError", "DirInfo", "ArchiveInfo", "VcsInfo", ] T = TypeVar("T") DIRECT_URL_METADATA_NAME = "direct_url.json" ENV_VAR_RE = re.compile(r"^\$\{[A-Za-z0-9-_]+\}(:\$\{[A-Za-z0-9-_]+\})?$") class DirectUrlValidationError(Exception): pass def _get( d: dict[str, Any], expected_type: type[T], key: str, default: T | None = None ) -> T | None: """Get value from dictionary and verify expected type.""" if key not in d: return default value = d[key] if not isinstance(value, expected_type): raise DirectUrlValidationError( f"{value!r} has unexpected type for {key} (expected {expected_type})" ) return value def _get_required( d: dict[str, Any], expected_type: type[T], key: str, default: T | None = None ) -> T: value = _get(d, expected_type, key, default) if value is None: raise DirectUrlValidationError(f"{key} must have a value") return value def _exactly_one_of(infos: Iterable[InfoType | None]) -> InfoType: infos = [info for info in infos if info is not None] if not infos: raise DirectUrlValidationError( "missing one of archive_info, dir_info, vcs_info" ) if len(infos) > 1: raise DirectUrlValidationError( "more than one of archive_info, dir_info, vcs_info" ) assert infos[0] is not None return infos[0] def _filter_none(**kwargs: Any) -> dict[str, Any]: """Make dict excluding None values.""" return {k: v for k, v in kwargs.items() if v is not None} @dataclass class VcsInfo: name: ClassVar = "vcs_info" vcs: str commit_id: str requested_revision: str | None = None @classmethod def _from_dict(cls, d: dict[str, Any] | None) -> VcsInfo | None: if d is None: return None return cls( vcs=_get_required(d, str, "vcs"), commit_id=_get_required(d, str, "commit_id"), requested_revision=_get(d, str, "requested_revision"), ) def _to_dict(self) -> dict[str, Any]: return _filter_none( vcs=self.vcs, requested_revision=self.requested_revision, commit_id=self.commit_id, ) class ArchiveInfo: name = "archive_info" def __init__( self, hash: str | None = None, hashes: dict[str, str] | None = None, ) -> None: # set hashes before hash, since the hash setter will further populate hashes self.hashes = hashes self.hash = hash @property def hash(self) -> str | None: return self._hash @hash.setter def hash(self, value: str | None) -> None: if value is not None: # Auto-populate the hashes key to upgrade to the new format automatically. # We don't back-populate the legacy hash key from hashes. try: hash_name, hash_value = value.split("=", 1) except ValueError: raise DirectUrlValidationError( f"invalid archive_info.hash format: {value!r}" ) if self.hashes is None: self.hashes = {hash_name: hash_value} elif hash_name not in self.hashes: self.hashes = self.hashes.copy() self.hashes[hash_name] = hash_value self._hash = value @classmethod def _from_dict(cls, d: dict[str, Any] | None) -> ArchiveInfo | None: if d is None: return None return cls(hash=_get(d, str, "hash"), hashes=_get(d, dict, "hashes")) def _to_dict(self) -> dict[str, Any]: return _filter_none(hash=self.hash, hashes=self.hashes) @dataclass class DirInfo: name: ClassVar = "dir_info" editable: bool = False @classmethod def _from_dict(cls, d: dict[str, Any] | None) -> DirInfo | None: if d is None: return None return cls(editable=_get_required(d, bool, "editable", default=False)) def _to_dict(self) -> dict[str, Any]: return _filter_none(editable=self.editable or None) InfoType = Union[ArchiveInfo, DirInfo, VcsInfo] @dataclass class DirectUrl: url: str info: InfoType subdirectory: str | None = None def _remove_auth_from_netloc(self, netloc: str) -> str: if "@" not in netloc: return netloc user_pass, netloc_no_user_pass = netloc.split("@", 1) if ( isinstance(self.info, VcsInfo) and self.info.vcs == "git" and user_pass == "git" ): return netloc if ENV_VAR_RE.match(user_pass): return netloc return netloc_no_user_pass @property def redacted_url(self) -> str: """url with user:password part removed unless it is formed with environment variables as specified in PEP 610, or it is ``git`` in the case of a git URL. """ purl = urllib.parse.urlsplit(self.url) netloc = self._remove_auth_from_netloc(purl.netloc) surl = urllib.parse.urlunsplit( (purl.scheme, netloc, purl.path, purl.query, purl.fragment) ) return surl def validate(self) -> None: self.from_dict(self.to_dict()) @classmethod def from_dict(cls, d: dict[str, Any]) -> DirectUrl: return DirectUrl( url=_get_required(d, str, "url"), subdirectory=_get(d, str, "subdirectory"), info=_exactly_one_of( [ ArchiveInfo._from_dict(_get(d, dict, "archive_info")), DirInfo._from_dict(_get(d, dict, "dir_info")), VcsInfo._from_dict(_get(d, dict, "vcs_info")), ] ), ) def to_dict(self) -> dict[str, Any]: res = _filter_none( url=self.redacted_url, subdirectory=self.subdirectory, ) res[self.info.name] = self.info._to_dict() return res @classmethod def from_json(cls, s: str) -> DirectUrl: return cls.from_dict(json.loads(s)) def to_json(self) -> str: return json.dumps(self.to_dict(), sort_keys=True) def is_local_editable(self) -> bool: return isinstance(self.info, DirInfo) and self.info.editable ================================================ FILE: src/pip/_internal/models/format_control.py ================================================ from __future__ import annotations from pip._vendor.packaging.utils import canonicalize_name from pip._internal.exceptions import CommandError class FormatControl: """Helper for managing formats from which a package can be installed.""" __slots__ = ["no_binary", "only_binary"] def __init__( self, no_binary: set[str] | None = None, only_binary: set[str] | None = None, ) -> None: if no_binary is None: no_binary = set() if only_binary is None: only_binary = set() self.no_binary = no_binary self.only_binary = only_binary def __eq__(self, other: object) -> bool: if not isinstance(other, self.__class__): return NotImplemented if self.__slots__ != other.__slots__: return False return all(getattr(self, k) == getattr(other, k) for k in self.__slots__) def __repr__(self) -> str: return f"{self.__class__.__name__}({self.no_binary}, {self.only_binary})" @staticmethod def handle_mutual_excludes(value: str, target: set[str], other: set[str]) -> None: if value.startswith("-"): raise CommandError( "--no-binary / --only-binary option requires 1 argument." ) new = value.split(",") while ":all:" in new: other.clear() target.clear() target.add(":all:") del new[: new.index(":all:") + 1] # Without a none, we want to discard everything as :all: covers it if ":none:" not in new: return for name in new: if name == ":none:": target.clear() continue name = canonicalize_name(name) other.discard(name) target.add(name) def get_allowed_formats(self, canonical_name: str) -> frozenset[str]: result = {"binary", "source"} if canonical_name in self.only_binary: result.discard("source") elif canonical_name in self.no_binary: result.discard("binary") elif ":all:" in self.only_binary: result.discard("source") elif ":all:" in self.no_binary: result.discard("binary") return frozenset(result) def disallow_binaries(self) -> None: self.handle_mutual_excludes( ":all:", self.no_binary, self.only_binary, ) ================================================ FILE: src/pip/_internal/models/index.py ================================================ import urllib.parse class PackageIndex: """Represents a Package Index and provides easier access to endpoints""" __slots__ = ["url", "netloc", "simple_url", "pypi_url", "file_storage_domain"] def __init__(self, url: str, file_storage_domain: str) -> None: super().__init__() self.url = url self.netloc = urllib.parse.urlsplit(url).netloc self.simple_url = self._url_for_path("simple") self.pypi_url = self._url_for_path("pypi") # This is part of a temporary hack used to block installs of PyPI # packages which depend on external urls only necessary until PyPI can # block such packages themselves self.file_storage_domain = file_storage_domain def _url_for_path(self, path: str) -> str: return urllib.parse.urljoin(self.url, path) PyPI = PackageIndex("https://pypi.org/", file_storage_domain="files.pythonhosted.org") TestPyPI = PackageIndex( "https://test.pypi.org/", file_storage_domain="test-files.pythonhosted.org" ) ================================================ FILE: src/pip/_internal/models/installation_report.py ================================================ from collections.abc import Sequence from typing import Any from pip._vendor.packaging.markers import default_environment from pip import __version__ from pip._internal.req.req_install import InstallRequirement class InstallationReport: def __init__(self, install_requirements: Sequence[InstallRequirement]): self._install_requirements = install_requirements @classmethod def _install_req_to_dict(cls, ireq: InstallRequirement) -> dict[str, Any]: assert ireq.download_info, f"No download_info for {ireq}" res = { # PEP 610 json for the download URL. download_info.archive_info.hashes may # be absent when the requirement was installed from the wheel cache # and the cache entry was populated by an older pip version that did not # record origin.json. "download_info": ireq.download_info.to_dict(), # is_direct is true if the requirement was a direct URL reference (which # includes editable requirements), and false if the requirement was # downloaded from a PEP 503 index or --find-links. "is_direct": ireq.is_direct, # is_yanked is true if the requirement was yanked from the index, but # was still selected by pip to conform to PEP 592. "is_yanked": ireq.link.is_yanked if ireq.link else False, # requested is true if the requirement was specified by the user (aka # top level requirement), and false if it was installed as a dependency of a # requirement. https://peps.python.org/pep-0376/#requested "requested": ireq.user_supplied, # PEP 566 json encoding for metadata # https://www.python.org/dev/peps/pep-0566/#json-compatible-metadata "metadata": ireq.get_dist().metadata_dict, } if ireq.user_supplied and ireq.extras: # For top level requirements, the list of requested extras, if any. res["requested_extras"] = sorted(ireq.extras) return res def to_dict(self) -> dict[str, Any]: return { "version": "1", "pip_version": __version__, "install": [ self._install_req_to_dict(ireq) for ireq in self._install_requirements ], # https://peps.python.org/pep-0508/#environment-markers # TODO: currently, the resolver uses the default environment to evaluate # environment markers, so that is what we report here. In the future, it # should also take into account options such as --python-version or # --platform, perhaps under the form of an environment_override field? # https://github.com/pypa/pip/issues/11198 "environment": default_environment(), } ================================================ FILE: src/pip/_internal/models/link.py ================================================ from __future__ import annotations import datetime import functools import itertools import logging import os import posixpath import re import urllib.parse import urllib.request from collections.abc import Mapping from dataclasses import dataclass from typing import ( Any, NamedTuple, ) from pip._internal.exceptions import InvalidEggFragment from pip._internal.utils.datetime import parse_iso_datetime from pip._internal.utils.filetypes import WHEEL_EXTENSION from pip._internal.utils.hashes import Hashes from pip._internal.utils.misc import ( pairwise, redact_auth_from_url, split_auth_from_netloc, splitext, ) from pip._internal.utils.urls import path_to_url, url_to_path logger = logging.getLogger(__name__) # Order matters, earlier hashes have a precedence over later hashes for what # we will pick to use. _SUPPORTED_HASHES = ("sha512", "sha384", "sha256", "sha224", "sha1", "md5") @dataclass(frozen=True) class LinkHash: """Links to content may have embedded hash values. This class parses those. `name` must be any member of `_SUPPORTED_HASHES`. This class can be converted to and from `ArchiveInfo`. While ArchiveInfo intends to be JSON-serializable to conform to PEP 610, this class contains the logic for parsing a hash name and value for correctness, and then checking whether that hash conforms to a schema with `.is_hash_allowed()`.""" name: str value: str _hash_url_fragment_re = re.compile( # NB: we do not validate that the second group (.*) is a valid hex # digest. Instead, we simply keep that string in this class, and then check it # against Hashes when hash-checking is needed. This is easier to debug than # proactively discarding an invalid hex digest, as we handle incorrect hashes # and malformed hashes in the same place. r"[#&]({choices})=([^&]*)".format( choices="|".join(re.escape(hash_name) for hash_name in _SUPPORTED_HASHES) ), ) def __post_init__(self) -> None: assert self.name in _SUPPORTED_HASHES @classmethod @functools.cache def find_hash_url_fragment(cls, url: str) -> LinkHash | None: """Search a string for a checksum algorithm name and encoded output value.""" match = cls._hash_url_fragment_re.search(url) if match is None: return None name, value = match.groups() return cls(name=name, value=value) def as_dict(self) -> dict[str, str]: return {self.name: self.value} def as_hashes(self) -> Hashes: """Return a Hashes instance which checks only for the current hash.""" return Hashes({self.name: [self.value]}) def is_hash_allowed(self, hashes: Hashes | None) -> bool: """ Return True if the current hash is allowed by `hashes`. """ if hashes is None: return False return hashes.is_hash_allowed(self.name, hex_digest=self.value) @dataclass(frozen=True) class MetadataFile: """Information about a core metadata file associated with a distribution.""" hashes: dict[str, str] | None def __post_init__(self) -> None: if self.hashes is not None: assert all(name in _SUPPORTED_HASHES for name in self.hashes) def supported_hashes(hashes: dict[str, str] | None) -> dict[str, str] | None: # Remove any unsupported hash types from the mapping. If this leaves no # supported hashes, return None if hashes is None: return None hashes = {n: v for n, v in hashes.items() if n in _SUPPORTED_HASHES} if not hashes: return None return hashes def _clean_url_path_part(part: str) -> str: """ Clean a "part" of a URL path (i.e. after splitting on "@" characters). """ # We unquote prior to quoting to make sure nothing is double quoted. return urllib.parse.quote(urllib.parse.unquote(part)) def _clean_file_url_path(part: str) -> str: """ Clean the first part of a URL path that corresponds to a local filesystem path (i.e. the first part after splitting on "@" characters). """ # We unquote prior to quoting to make sure nothing is double quoted. # Also, on Windows the path part might contain a drive letter which # should not be quoted. On Linux where drive letters do not # exist, the colon should be quoted. We rely on urllib.request # to do the right thing here. ret = urllib.request.pathname2url(urllib.request.url2pathname(part)) if ret.startswith("///"): # Remove any URL authority section, leaving only the URL path. ret = ret.removeprefix("//") return ret # percent-encoded: / _reserved_chars_re = re.compile("(@|%2F)", re.IGNORECASE) def _clean_url_path(path: str, is_local_path: bool) -> str: """ Clean the path portion of a URL. """ if is_local_path: clean_func = _clean_file_url_path else: clean_func = _clean_url_path_part # Split on the reserved characters prior to cleaning so that # revision strings in VCS URLs are properly preserved. parts = _reserved_chars_re.split(path) cleaned_parts = [] for to_clean, reserved in pairwise(itertools.chain(parts, [""])): cleaned_parts.append(clean_func(to_clean)) # Normalize %xx escapes (e.g. %2f -> %2F) cleaned_parts.append(reserved.upper()) return "".join(cleaned_parts) def _ensure_quoted_url(url: str) -> str: """ Make sure a link is fully quoted. For example, if ' ' occurs in the URL, it will be replaced with "%20", and without double-quoting other characters. """ # Split the URL into parts according to the general structure # `scheme://netloc/path?query#fragment`. result = urllib.parse.urlsplit(url) # If the netloc is empty, then the URL refers to a local filesystem path. is_local_path = not result.netloc path = _clean_url_path(result.path, is_local_path=is_local_path) # Temporarily replace scheme with file to ensure the URL generated by # urlunsplit() contains an empty netloc (file://) as per RFC 1738. ret = urllib.parse.urlunsplit(result._replace(scheme="file", path=path)) ret = result.scheme + ret[4:] # Restore original scheme. return ret def _absolute_link_url(base_url: str, url: str) -> str: """ A faster implementation of urllib.parse.urljoin with a shortcut for absolute http/https URLs. """ if url.startswith(("https://", "http://")): return url else: return urllib.parse.urljoin(base_url, url) @functools.total_ordering class Link: """Represents a parsed link from a Package Index's simple URL""" __slots__ = [ "_parsed_url", "_url", "_path", "_hashes", "comes_from", "requires_python", "yanked_reason", "metadata_file_data", "upload_time", "cache_link_parsing", "egg_fragment", ] def __init__( self, url: str, comes_from: str | None = None, requires_python: str | None = None, yanked_reason: str | None = None, metadata_file_data: MetadataFile | None = None, upload_time: datetime.datetime | None = None, cache_link_parsing: bool = True, hashes: Mapping[str, str] | None = None, ) -> None: """ :param url: url of the resource pointed to (href of the link) :param comes_from: URL or string indicating where the link was found. :param requires_python: String containing the `Requires-Python` metadata field, specified in PEP 345. This may be specified by a data-requires-python attribute in the HTML link tag, as described in PEP 503. :param yanked_reason: the reason the file has been yanked, if the file has been yanked, or None if the file hasn't been yanked. This is the value of the "data-yanked" attribute, if present, in a simple repository HTML link. If the file has been yanked but no reason was provided, this should be the empty string. See PEP 592 for more information and the specification. :param metadata_file_data: the metadata attached to the file, or None if no such metadata is provided. This argument, if not None, indicates that a separate metadata file exists, and also optionally supplies hashes for that file. :param upload_time: upload time of the file, or None if the information is not available from the server. :param cache_link_parsing: A flag that is used elsewhere to determine whether resources retrieved from this link should be cached. PyPI URLs should generally have this set to False, for example. :param hashes: A mapping of hash names to digests to allow us to determine the validity of a download. """ # The comes_from, requires_python, and metadata_file_data arguments are # only used by classmethods of this class, and are not used in client # code directly. # url can be a UNC windows share if url.startswith("\\\\"): url = path_to_url(url) self._parsed_url = urllib.parse.urlsplit(url) # Store the url as a private attribute to prevent accidentally # trying to set a new value. self._url = url # The .path property is hot, so calculate its value ahead of time. self._path = urllib.parse.unquote(self._parsed_url.path) link_hash = LinkHash.find_hash_url_fragment(url) hashes_from_link = {} if link_hash is None else link_hash.as_dict() if hashes is None: self._hashes = hashes_from_link else: self._hashes = {**hashes, **hashes_from_link} self.comes_from = comes_from self.requires_python = requires_python if requires_python else None self.yanked_reason = yanked_reason self.metadata_file_data = metadata_file_data self.upload_time = upload_time self.cache_link_parsing = cache_link_parsing self.egg_fragment = self._egg_fragment() @classmethod def from_json( cls, file_data: dict[str, Any], page_url: str, ) -> Link | None: """ Convert an pypi json document from a simple repository page into a Link. """ file_url = file_data.get("url") if file_url is None: return None url = _ensure_quoted_url(_absolute_link_url(page_url, file_url)) pyrequire = file_data.get("requires-python") yanked_reason = file_data.get("yanked") hashes = file_data.get("hashes", {}) # PEP 714: Indexes must use the name core-metadata, but # clients should support the old name as a fallback for compatibility. metadata_info = file_data.get("core-metadata") if metadata_info is None: metadata_info = file_data.get("dist-info-metadata") if upload_time_data := file_data.get("upload-time"): upload_time = parse_iso_datetime(upload_time_data) else: upload_time = None # The metadata info value may be a boolean, or a dict of hashes. if isinstance(metadata_info, dict): # The file exists, and hashes have been supplied metadata_file_data = MetadataFile(supported_hashes(metadata_info)) elif metadata_info: # The file exists, but there are no hashes metadata_file_data = MetadataFile(None) else: # False or not present: the file does not exist metadata_file_data = None # The Link.yanked_reason expects an empty string instead of a boolean. if yanked_reason and not isinstance(yanked_reason, str): yanked_reason = "" # The Link.yanked_reason expects None instead of False. elif not yanked_reason: yanked_reason = None return cls( url, comes_from=page_url, requires_python=pyrequire, yanked_reason=yanked_reason, hashes=hashes, metadata_file_data=metadata_file_data, upload_time=upload_time, ) @classmethod def from_element( cls, anchor_attribs: dict[str, str | None], page_url: str, base_url: str, ) -> Link | None: """ Convert an anchor element's attributes in a simple repository page to a Link. """ href = anchor_attribs.get("href") if not href: return None url = _ensure_quoted_url(_absolute_link_url(base_url, href)) pyrequire = anchor_attribs.get("data-requires-python") yanked_reason = anchor_attribs.get("data-yanked") # PEP 714: Indexes must use the name data-core-metadata, but # clients should support the old name as a fallback for compatibility. metadata_info = anchor_attribs.get("data-core-metadata") if metadata_info is None: metadata_info = anchor_attribs.get("data-dist-info-metadata") # The metadata info value may be the string "true", or a string of # the form "hashname=hashval" if metadata_info == "true": # The file exists, but there are no hashes metadata_file_data = MetadataFile(None) elif metadata_info is None: # The file does not exist metadata_file_data = None else: # The file exists, and hashes have been supplied hashname, sep, hashval = metadata_info.partition("=") if sep == "=": metadata_file_data = MetadataFile(supported_hashes({hashname: hashval})) else: # Error - data is wrong. Treat as no hashes supplied. logger.debug( "Index returned invalid data-dist-info-metadata value: %s", metadata_info, ) metadata_file_data = MetadataFile(None) return cls( url, comes_from=page_url, requires_python=pyrequire, yanked_reason=yanked_reason, metadata_file_data=metadata_file_data, ) def __str__(self) -> str: if self.requires_python: rp = f" (requires-python:{self.requires_python})" else: rp = "" if self.comes_from: return f"{self.redacted_url} (from {self.comes_from}){rp}" else: return self.redacted_url def __repr__(self) -> str: return f"" def __hash__(self) -> int: return hash(self.url) def __eq__(self, other: Any) -> bool: if not isinstance(other, Link): return NotImplemented return self.url == other.url def __lt__(self, other: Any) -> bool: if not isinstance(other, Link): return NotImplemented return self.url < other.url @property def url(self) -> str: return self._url @property def redacted_url(self) -> str: return redact_auth_from_url(self.url) @property def filename(self) -> str: path = self.path.rstrip("/") name = posixpath.basename(path) if not name: # Make sure we don't leak auth information if the netloc # includes a username and password. netloc, user_pass = split_auth_from_netloc(self.netloc) return netloc name = urllib.parse.unquote(name) assert name, f"URL {self._url!r} produced no filename" return name @property def file_path(self) -> str: return url_to_path(self.url) @property def scheme(self) -> str: return self._parsed_url.scheme @property def netloc(self) -> str: """ This can contain auth information. """ return self._parsed_url.netloc @property def path(self) -> str: return self._path def splitext(self) -> tuple[str, str]: return splitext(posixpath.basename(self.path.rstrip("/"))) @property def ext(self) -> str: return self.splitext()[1] @property def url_without_fragment(self) -> str: scheme, netloc, path, query, fragment = self._parsed_url return urllib.parse.urlunsplit((scheme, netloc, path, query, "")) _egg_fragment_re = re.compile(r"[#&]egg=([^&]*)") # Per PEP 508. _project_name_re = re.compile( r"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$", re.IGNORECASE ) def _egg_fragment(self) -> str | None: match = self._egg_fragment_re.search(self._url) if not match: return None # An egg fragment looks like a PEP 508 project name, along with # an optional extras specifier. Anything else is invalid. project_name = match.group(1) if not self._project_name_re.match(project_name): raise InvalidEggFragment(self, project_name) return project_name _subdirectory_fragment_re = re.compile(r"[#&]subdirectory=([^&]*)") @property def subdirectory_fragment(self) -> str | None: match = self._subdirectory_fragment_re.search(self._url) if not match: return None return match.group(1) def metadata_link(self) -> Link | None: """Return a link to the associated core metadata file (if any).""" if self.metadata_file_data is None: return None metadata_url = f"{self.url_without_fragment}.metadata" if self.metadata_file_data.hashes is None: return Link(metadata_url) return Link(metadata_url, hashes=self.metadata_file_data.hashes) def as_hashes(self) -> Hashes: return Hashes({k: [v] for k, v in self._hashes.items()}) @property def hash(self) -> str | None: return next(iter(self._hashes.values()), None) @property def hash_name(self) -> str | None: return next(iter(self._hashes), None) @property def show_url(self) -> str: return posixpath.basename(self._url.split("#", 1)[0].split("?", 1)[0]) @property def is_file(self) -> bool: return self.scheme == "file" def is_existing_dir(self) -> bool: return self.is_file and os.path.isdir(self.file_path) @property def is_wheel(self) -> bool: return self.ext == WHEEL_EXTENSION @property def is_vcs(self) -> bool: from pip._internal.vcs import vcs return self.scheme in vcs.all_schemes @property def is_yanked(self) -> bool: return self.yanked_reason is not None @property def has_hash(self) -> bool: return bool(self._hashes) def is_hash_allowed(self, hashes: Hashes | None) -> bool: """ Return True if the link has a hash and it is allowed by `hashes`. """ if hashes is None: return False return any(hashes.is_hash_allowed(k, v) for k, v in self._hashes.items()) class _CleanResult(NamedTuple): """Convert link for equivalency check. This is used in the resolver to check whether two URL-specified requirements likely point to the same distribution and can be considered equivalent. This equivalency logic avoids comparing URLs literally, which can be too strict (e.g. "a=1&b=2" vs "b=2&a=1") and produce conflicts unexpecting to users. Currently this does three things: 1. Drop the basic auth part. This is technically wrong since a server can serve different content based on auth, but if it does that, it is even impossible to guarantee two URLs without auth are equivalent, since the user can input different auth information when prompted. So the practical solution is to assume the auth doesn't affect the response. 2. Parse the query to avoid the ordering issue. Note that ordering under the same key in the query are NOT cleaned; i.e. "a=1&a=2" and "a=2&a=1" are still considered different. 3. Explicitly drop most of the fragment part, except ``subdirectory=`` and hash values, since it should have no impact the downloaded content. Note that this drops the "egg=" part historically used to denote the requested project (and extras), which is wrong in the strictest sense, but too many people are supplying it inconsistently to cause superfluous resolution conflicts, so we choose to also ignore them. """ parsed: urllib.parse.SplitResult query: dict[str, list[str]] subdirectory: str hashes: dict[str, str] def _clean_link(link: Link) -> _CleanResult: parsed = link._parsed_url netloc = parsed.netloc.rsplit("@", 1)[-1] # According to RFC 8089, an empty host in file: means localhost. if parsed.scheme == "file" and not netloc: netloc = "localhost" fragment = urllib.parse.parse_qs(parsed.fragment) if "egg" in fragment: logger.debug("Ignoring egg= fragment in %s", link) try: # If there are multiple subdirectory values, use the first one. # This matches the behavior of Link.subdirectory_fragment. subdirectory = fragment["subdirectory"][0] except (IndexError, KeyError): subdirectory = "" # If there are multiple hash values under the same algorithm, use the # first one. This matches the behavior of Link.hash_value. hashes = {k: fragment[k][0] for k in _SUPPORTED_HASHES if k in fragment} return _CleanResult( parsed=parsed._replace(netloc=netloc, query="", fragment=""), query=urllib.parse.parse_qs(parsed.query), subdirectory=subdirectory, hashes=hashes, ) @functools.cache def links_equivalent(link1: Link, link2: Link) -> bool: return _clean_link(link1) == _clean_link(link2) ================================================ FILE: src/pip/_internal/models/release_control.py ================================================ from __future__ import annotations from dataclasses import dataclass, field from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._internal.exceptions import CommandError # TODO: add slots=True when Python 3.9 is dropped @dataclass class ReleaseControl: """Helper for managing which release types can be installed.""" all_releases: set[str] = field(default_factory=set) only_final: set[str] = field(default_factory=set) _order: list[tuple[str, str]] = field( init=False, default_factory=list, compare=False, repr=False ) def handle_mutual_excludes( self, value: str, target: set[str], other: set[str], attr_name: str ) -> None: """Parse and apply release control option value. Processes comma-separated package names or special values `:all:` and `:none:`. When adding packages to target, they're removed from other to maintain mutual exclusivity between all_releases and only_final. All operations are tracked in order so that the original command-line argument sequence can be reconstructed when passing options to build subprocesses. """ if value.startswith("-"): raise CommandError( "--all-releases / --only-final option requires 1 argument." ) new = value.split(",") while ":all:" in new: other.clear() target.clear() target.add(":all:") # Track :all: in order self._order.append((attr_name, ":all:")) del new[: new.index(":all:") + 1] # Without a none, we want to discard everything as :all: covers it if ":none:" not in new: return for name in new: if name == ":none:": target.clear() # Track :none: in order self._order.append((attr_name, ":none:")) continue name = canonicalize_name(name) other.discard(name) target.add(name) # Track package-specific setting in order self._order.append((attr_name, name)) def get_ordered_args(self) -> list[tuple[str, str]]: """ Get ordered list of (flag_name, value) tuples for reconstructing CLI args. Returns: List of tuples where each tuple is (attribute_name, value). The attribute_name is either 'all_releases' or 'only_final'. Example: [("all_releases", ":all:"), ("only_final", "simple")] would be reconstructed as: ["--all-releases", ":all:", "--only-final", "simple"] """ return self._order[:] def allows_prereleases(self, canonical_name: NormalizedName) -> bool | None: """ Determine if pre-releases are allowed for a package. Returns: True: Pre-releases are allowed (package in all_releases) False: Only final releases allowed (package in only_final) None: No specific setting, use default behavior """ if canonical_name in self.all_releases: return True elif canonical_name in self.only_final: return False elif ":all:" in self.all_releases: return True elif ":all:" in self.only_final: return False return None ================================================ FILE: src/pip/_internal/models/scheme.py ================================================ """ For types associated with installation schemes. For a general overview of available schemes and their context, see https://docs.python.org/3/install/index.html#alternate-installation. """ from dataclasses import dataclass SCHEME_KEYS = ["platlib", "purelib", "headers", "scripts", "data"] @dataclass(frozen=True) class Scheme: """A Scheme holds paths which are used as the base directories for artifacts associated with a Python package. """ __slots__ = SCHEME_KEYS platlib: str purelib: str headers: str scripts: str data: str ================================================ FILE: src/pip/_internal/models/search_scope.py ================================================ import itertools import logging import os import posixpath import urllib.parse from dataclasses import dataclass from pip._vendor.packaging.utils import canonicalize_name from pip._internal.models.index import PyPI from pip._internal.utils.compat import has_tls from pip._internal.utils.misc import normalize_path, redact_auth_from_url logger = logging.getLogger(__name__) @dataclass(frozen=True) class SearchScope: """ Encapsulates the locations that pip is configured to search. """ __slots__ = ["find_links", "index_urls", "no_index"] find_links: list[str] index_urls: list[str] no_index: bool @classmethod def create( cls, find_links: list[str], index_urls: list[str], no_index: bool, ) -> "SearchScope": """ Create a SearchScope object after normalizing the `find_links`. """ # Build find_links. If an argument starts with ~, it may be # a local file relative to a home directory. So try normalizing # it and if it exists, use the normalized version. # This is deliberately conservative - it might be fine just to # blindly normalize anything starting with a ~... built_find_links: list[str] = [] for link in find_links: if link.startswith("~"): new_link = normalize_path(link) if os.path.exists(new_link): link = new_link built_find_links.append(link) # If we don't have TLS enabled, then WARN if anyplace we're looking # relies on TLS. if not has_tls(): for link in itertools.chain(index_urls, built_find_links): parsed = urllib.parse.urlparse(link) if parsed.scheme == "https": logger.warning( "pip is configured with locations that require " "TLS/SSL, however the ssl module in Python is not " "available." ) break return cls( find_links=built_find_links, index_urls=index_urls, no_index=no_index, ) def get_formatted_locations(self) -> str: lines = [] redacted_index_urls = [] if self.index_urls and self.index_urls != [PyPI.simple_url]: for url in self.index_urls: redacted_index_url = redact_auth_from_url(url) # Parse the URL purl = urllib.parse.urlsplit(redacted_index_url) # URL is generally invalid if scheme and netloc is missing # there are issues with Python and URL parsing, so this test # is a bit crude. See bpo-20271, bpo-23505. Python doesn't # always parse invalid URLs correctly - it should raise # exceptions for malformed URLs if not purl.scheme and not purl.netloc: logger.warning( 'The index url "%s" seems invalid, please provide a scheme.', redacted_index_url, ) redacted_index_urls.append(redacted_index_url) lines.append( "Looking in indexes: {}".format(", ".join(redacted_index_urls)) ) if self.find_links: lines.append( "Looking in links: {}".format( ", ".join(redact_auth_from_url(url) for url in self.find_links) ) ) return "\n".join(lines) def get_index_urls_locations(self, project_name: str) -> list[str]: """Returns the locations found via self.index_urls Checks the url_name on the main (first in the list) index and use this url_name to produce all locations """ def mkurl_pypi_url(url: str) -> str: loc = posixpath.join( url, urllib.parse.quote(canonicalize_name(project_name)) ) # For maximum compatibility with easy_install, ensure the path # ends in a trailing slash. Although this isn't in the spec # (and PyPI can handle it without the slash) some other index # implementations might break if they relied on easy_install's # behavior. if not loc.endswith("/"): loc = loc + "/" return loc return [mkurl_pypi_url(url) for url in self.index_urls] ================================================ FILE: src/pip/_internal/models/selection_prefs.py ================================================ from __future__ import annotations from pip._internal.models.format_control import FormatControl from pip._internal.models.release_control import ReleaseControl # TODO: This needs Python 3.10's improved slots support for dataclasses # to be converted into a dataclass. class SelectionPreferences: """ Encapsulates the candidate selection preferences for downloading and installing files. """ __slots__ = [ "allow_yanked", "release_control", "format_control", "prefer_binary", "ignore_requires_python", ] # Don't include an allow_yanked default value to make sure each call # site considers whether yanked releases are allowed. This also causes # that decision to be made explicit in the calling code, which helps # people when reading the code. def __init__( self, allow_yanked: bool, release_control: ReleaseControl | None = None, format_control: FormatControl | None = None, prefer_binary: bool = False, ignore_requires_python: bool | None = None, ) -> None: """Create a SelectionPreferences object. :param allow_yanked: Whether files marked as yanked (in the sense of PEP 592) are permitted to be candidates for install. :param release_control: A ReleaseControl object or None. Used to control whether pre-releases are allowed for specific packages. :param format_control: A FormatControl object or None. Used to control the selection of source packages / binary packages when consulting the index and links. :param prefer_binary: Whether to prefer an old, but valid, binary dist over a new source dist. :param ignore_requires_python: Whether to ignore incompatible "Requires-Python" values in links. Defaults to False. """ if ignore_requires_python is None: ignore_requires_python = False self.allow_yanked = allow_yanked self.release_control = release_control self.format_control = format_control self.prefer_binary = prefer_binary self.ignore_requires_python = ignore_requires_python ================================================ FILE: src/pip/_internal/models/target_python.py ================================================ from __future__ import annotations import sys from pip._vendor.packaging.tags import Tag from pip._internal.utils.compatibility_tags import get_supported, version_info_to_nodot from pip._internal.utils.misc import normalize_version_info class TargetPython: """ Encapsulates the properties of a Python interpreter one is targeting for a package install, download, etc. """ __slots__ = [ "_given_py_version_info", "abis", "implementation", "platforms", "py_version", "py_version_info", "_valid_tags", "_valid_tags_set", ] def __init__( self, platforms: list[str] | None = None, py_version_info: tuple[int, ...] | None = None, abis: list[str] | None = None, implementation: str | None = None, ) -> None: """ :param platforms: A list of strings or None. If None, searches for packages that are supported by the current system. Otherwise, will find packages that can be built on the platforms passed in. These packages will only be downloaded for distribution: they will not be built locally. :param py_version_info: An optional tuple of ints representing the Python version information to use (e.g. `sys.version_info[:3]`). This can have length 1, 2, or 3 when provided. :param abis: A list of strings or None. This is passed to compatibility_tags.py's get_supported() function as is. :param implementation: A string or None. This is passed to compatibility_tags.py's get_supported() function as is. """ # Store the given py_version_info for when we call get_supported(). self._given_py_version_info = py_version_info if py_version_info is None: py_version_info = sys.version_info[:3] else: py_version_info = normalize_version_info(py_version_info) py_version = ".".join(map(str, py_version_info[:2])) self.abis = abis self.implementation = implementation self.platforms = platforms self.py_version = py_version self.py_version_info = py_version_info # This is used to cache the return value of get_(un)sorted_tags. self._valid_tags: list[Tag] | None = None self._valid_tags_set: set[Tag] | None = None def format_given(self) -> str: """ Format the given, non-None attributes for display. """ display_version = None if self._given_py_version_info is not None: display_version = ".".join( str(part) for part in self._given_py_version_info ) key_values = [ ("platforms", self.platforms), ("version_info", display_version), ("abis", self.abis), ("implementation", self.implementation), ] return " ".join( f"{key}={value!r}" for key, value in key_values if value is not None ) def get_sorted_tags(self) -> list[Tag]: """ Return the supported PEP 425 tags to check wheel candidates against. The tags are returned in order of preference (most preferred first). """ if self._valid_tags is None: # Pass versions=None if no py_version_info was given since # versions=None uses special default logic. py_version_info = self._given_py_version_info if py_version_info is None: version = None else: version = version_info_to_nodot(py_version_info) tags = get_supported( version=version, platforms=self.platforms, abis=self.abis, impl=self.implementation, ) self._valid_tags = tags return self._valid_tags def get_unsorted_tags(self) -> set[Tag]: """Exactly the same as get_sorted_tags, but returns a set. This is important for performance. """ if self._valid_tags_set is None: self._valid_tags_set = set(self.get_sorted_tags()) return self._valid_tags_set ================================================ FILE: src/pip/_internal/models/wheel.py ================================================ """Represents a wheel file and provides access to the various parts of the name that have meaning. """ from __future__ import annotations from collections.abc import Iterable from pip._vendor.packaging.tags import Tag from pip._vendor.packaging.utils import ( InvalidWheelFilename as _PackagingInvalidWheelFilename, ) from pip._vendor.packaging.utils import parse_wheel_filename from pip._internal.exceptions import InvalidWheelFilename class Wheel: """A wheel file""" def __init__(self, filename: str) -> None: self.filename = filename try: wheel_info = parse_wheel_filename(filename) except _PackagingInvalidWheelFilename as e: raise InvalidWheelFilename(e.args[0]) from None self.name, _version, self.build_tag, self.file_tags = wheel_info self.version = str(_version) def get_formatted_file_tags(self) -> list[str]: """Return the wheel's tags as a sorted list of strings.""" return sorted(str(tag) for tag in self.file_tags) def support_index_min(self, tags: list[Tag]) -> int: """Return the lowest index that one of the wheel's file_tag combinations achieves in the given list of supported tags. For example, if there are 8 supported tags and one of the file tags is first in the list, then return 0. :param tags: the PEP 425 tags to check the wheel against, in order with most preferred first. :raises ValueError: If none of the wheel's file tags match one of the supported tags. """ try: return next(i for i, t in enumerate(tags) if t in self.file_tags) except StopIteration: raise ValueError() def find_most_preferred_tag( self, tags: list[Tag], tag_to_priority: dict[Tag, int] ) -> int: """Return the priority of the most preferred tag that one of the wheel's file tag combinations achieves in the given list of supported tags using the given tag_to_priority mapping, where lower priorities are more-preferred. This is used in place of support_index_min in some cases in order to avoid an expensive linear scan of a large list of tags. :param tags: the PEP 425 tags to check the wheel against. :param tag_to_priority: a mapping from tag to priority of that tag, where lower is more preferred. :raises ValueError: If none of the wheel's file tags match one of the supported tags. """ return min( tag_to_priority[tag] for tag in self.file_tags if tag in tag_to_priority ) def supported(self, tags: Iterable[Tag]) -> bool: """Return whether the wheel is compatible with one of the given tags. :param tags: the PEP 425 tags to check the wheel against. """ return not self.file_tags.isdisjoint(tags) ================================================ FILE: src/pip/_internal/network/__init__.py ================================================ """Contains purely network-related utilities.""" ================================================ FILE: src/pip/_internal/network/auth.py ================================================ """Network Authentication Helpers Contains interface (MultiDomainBasicAuth) and associated glue code for providing credentials in the context of network requests. """ from __future__ import annotations import logging import os import shutil import subprocess import sysconfig import typing import urllib.parse from abc import ABC, abstractmethod from functools import cache from os.path import commonprefix from pathlib import Path from typing import Any, NamedTuple from pip._vendor.requests.auth import AuthBase, HTTPBasicAuth from pip._vendor.requests.utils import get_netrc_auth from pip._internal.utils.logging import getLogger from pip._internal.utils.misc import ( ask, ask_input, ask_password, remove_auth_from_url, split_auth_netloc_from_url, ) from pip._internal.vcs.versioncontrol import AuthInfo if typing.TYPE_CHECKING: from pip._vendor.requests import PreparedRequest from pip._vendor.requests.models import Response logger = getLogger(__name__) KEYRING_DISABLED = False class Credentials(NamedTuple): url: str username: str password: str class KeyRingBaseProvider(ABC): """Keyring base provider interface""" has_keyring: bool @abstractmethod def get_auth_info(self, url: str, username: str | None) -> AuthInfo | None: ... @abstractmethod def save_auth_info(self, url: str, username: str, password: str) -> None: ... class KeyRingNullProvider(KeyRingBaseProvider): """Keyring null provider""" has_keyring = False def get_auth_info(self, url: str, username: str | None) -> AuthInfo | None: return None def save_auth_info(self, url: str, username: str, password: str) -> None: return None class KeyRingPythonProvider(KeyRingBaseProvider): """Keyring interface which uses locally imported `keyring`""" has_keyring = True def __init__(self) -> None: import keyring self.keyring = keyring def get_auth_info(self, url: str, username: str | None) -> AuthInfo | None: # Support keyring's get_credential interface which supports getting # credentials without a username. This is only available for # keyring>=15.2.0. if hasattr(self.keyring, "get_credential"): logger.debug("Getting credentials from keyring for %s", url) cred = self.keyring.get_credential(url, username) if cred is not None: return cred.username, cred.password return None if username is not None: logger.debug("Getting password from keyring for %s", url) password = self.keyring.get_password(url, username) if password: return username, password return None def save_auth_info(self, url: str, username: str, password: str) -> None: self.keyring.set_password(url, username, password) class KeyRingCliProvider(KeyRingBaseProvider): """Provider which uses `keyring` cli Instead of calling the keyring package installed alongside pip we call keyring on the command line which will enable pip to use which ever installation of keyring is available first in PATH. """ has_keyring = True def __init__(self, cmd: str) -> None: self.keyring = cmd def get_auth_info(self, url: str, username: str | None) -> AuthInfo | None: # This is the default implementation of keyring.get_credential # https://github.com/jaraco/keyring/blob/97689324abcf01bd1793d49063e7ca01e03d7d07/keyring/backend.py#L134-L139 if username is not None: password = self._get_password(url, username) if password is not None: return username, password return None def save_auth_info(self, url: str, username: str, password: str) -> None: return self._set_password(url, username, password) def _get_password(self, service_name: str, username: str) -> str | None: """Mirror the implementation of keyring.get_password using cli""" if self.keyring is None: return None cmd = [self.keyring, "get", service_name, username] env = os.environ.copy() env["PYTHONIOENCODING"] = "utf-8" res = subprocess.run( cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, env=env, ) if res.returncode: return None return res.stdout.decode("utf-8").strip(os.linesep) def _set_password(self, service_name: str, username: str, password: str) -> None: """Mirror the implementation of keyring.set_password using cli""" if self.keyring is None: return None env = os.environ.copy() env["PYTHONIOENCODING"] = "utf-8" subprocess.run( [self.keyring, "set", service_name, username], input=f"{password}{os.linesep}".encode(), env=env, check=True, ) return None @cache def get_keyring_provider(provider: str) -> KeyRingBaseProvider: logger.verbose("Keyring provider requested: %s", provider) # keyring has previously failed and been disabled if KEYRING_DISABLED: provider = "disabled" if provider in ["import", "auto"]: try: impl = KeyRingPythonProvider() logger.verbose("Keyring provider set: import") return impl except ImportError: pass except Exception as exc: # In the event of an unexpected exception # we should warn the user msg = "Installed copy of keyring fails with exception %s" if provider == "auto": msg = msg + ", trying to find a keyring executable as a fallback" logger.warning(msg, exc, exc_info=logger.isEnabledFor(logging.DEBUG)) if provider in ["subprocess", "auto"]: cli = shutil.which("keyring") if cli and cli.startswith(sysconfig.get_path("scripts")): # all code within this function is stolen from shutil.which implementation @typing.no_type_check def PATH_as_shutil_which_determines_it() -> str: path = os.environ.get("PATH", None) if path is None: try: path = os.confstr("CS_PATH") except (AttributeError, ValueError): # os.confstr() or CS_PATH is not available path = os.defpath # bpo-35755: Don't use os.defpath if the PATH environment variable is # set to an empty string return path scripts = Path(sysconfig.get_path("scripts")) paths = [] for path in PATH_as_shutil_which_determines_it().split(os.pathsep): p = Path(path) try: if not p.samefile(scripts): paths.append(path) except FileNotFoundError: pass path = os.pathsep.join(paths) cli = shutil.which("keyring", path=path) if cli: logger.verbose("Keyring provider set: subprocess with executable %s", cli) return KeyRingCliProvider(cli) logger.verbose("Keyring provider set: disabled") return KeyRingNullProvider() class MultiDomainBasicAuth(AuthBase): def __init__( self, prompting: bool = True, index_urls: list[str] | None = None, keyring_provider: str = "auto", ) -> None: self.prompting = prompting self.index_urls = index_urls self.keyring_provider = keyring_provider self.passwords: dict[str, AuthInfo] = {} # When the user is prompted to enter credentials and keyring is # available, we will offer to save them. If the user accepts, # this value is set to the credentials they entered. After the # request authenticates, the caller should call # ``save_credentials`` to save these. self._credentials_to_save: Credentials | None = None @property def keyring_provider(self) -> KeyRingBaseProvider: return get_keyring_provider(self._keyring_provider) @keyring_provider.setter def keyring_provider(self, provider: str) -> None: # The free function get_keyring_provider has been decorated with # functools.cache. If an exception occurs in get_keyring_auth that # cache will be cleared and keyring disabled, take that into account # if you want to remove this indirection. self._keyring_provider = provider @property def use_keyring(self) -> bool: # We won't use keyring when --no-input is passed unless # a specific provider is requested because it might require # user interaction return self.prompting or self._keyring_provider not in ["auto", "disabled"] def _get_keyring_auth( self, url: str | None, username: str | None, ) -> AuthInfo | None: """Return the tuple auth for a given url from keyring.""" # Do nothing if no url was provided if not url: return None try: return self.keyring_provider.get_auth_info(url, username) except Exception as exc: # Log the full exception (with stacktrace) at debug, so it'll only # show up when running in verbose mode. logger.debug("Keyring is skipped due to an exception", exc_info=True) # Always log a shortened version of the exception. logger.warning( "Keyring is skipped due to an exception: %s", str(exc), ) global KEYRING_DISABLED KEYRING_DISABLED = True get_keyring_provider.cache_clear() return None def _get_index_url(self, url: str) -> str | None: """Return the original index URL matching the requested URL. Cached or dynamically generated credentials may work against the original index URL rather than just the netloc. The provided url should have had its username and password removed already. If the original index url had credentials then they will be included in the return value. Returns None if no matching index was found, or if --no-index was specified by the user. """ if not url or not self.index_urls: return None url = remove_auth_from_url(url).rstrip("/") + "/" parsed_url = urllib.parse.urlsplit(url) candidates = [] for index in self.index_urls: index = index.rstrip("/") + "/" parsed_index = urllib.parse.urlsplit(remove_auth_from_url(index)) if parsed_url == parsed_index: return index if parsed_url.netloc != parsed_index.netloc: continue candidate = urllib.parse.urlsplit(index) candidates.append(candidate) if not candidates: return None candidates.sort( reverse=True, key=lambda candidate: commonprefix( [ parsed_url.path, candidate.path, ] ).rfind("/"), ) return urllib.parse.urlunsplit(candidates[0]) def _get_new_credentials( self, original_url: str, *, allow_netrc: bool = True, allow_keyring: bool = False, ) -> AuthInfo: """Find and return credentials for the specified URL.""" # Split the credentials and netloc from the url. url, netloc, url_user_password = split_auth_netloc_from_url( original_url, ) # Start with the credentials embedded in the url username, password = url_user_password if username is not None and password is not None: logger.debug("Found credentials in url for %s", netloc) return url_user_password # Find a matching index url for this request index_url = self._get_index_url(url) if index_url: # Split the credentials from the url. index_info = split_auth_netloc_from_url(index_url) if index_info: index_url, _, index_url_user_password = index_info logger.debug("Found index url %s", index_url) # If an index URL was found, try its embedded credentials if index_url and index_url_user_password[0] is not None: username, password = index_url_user_password if username is not None and password is not None: logger.debug("Found credentials in index url for %s", netloc) return index_url_user_password # Get creds from netrc if we still don't have them if allow_netrc: netrc_auth = get_netrc_auth(original_url) if netrc_auth: logger.debug("Found credentials in netrc for %s", netloc) return netrc_auth # If we don't have a password and keyring is available, use it. if allow_keyring: # The index url is more specific than the netloc, so try it first # fmt: off kr_auth = ( self._get_keyring_auth(index_url, username) or self._get_keyring_auth(netloc, username) ) # fmt: on if kr_auth: logger.debug("Found credentials in keyring for %s", netloc) return kr_auth return username, password def _get_url_and_credentials( self, original_url: str ) -> tuple[str, str | None, str | None]: """Return the credentials to use for the provided URL. If allowed, netrc and keyring may be used to obtain the correct credentials. Returns (url_without_credentials, username, password). Note that even if the original URL contains credentials, this function may return a different username and password. """ url, netloc, _ = split_auth_netloc_from_url(original_url) # Try to get credentials from original url username, password = self._get_new_credentials(original_url) # If credentials not found, use any stored credentials for this netloc. # Do this if either the username or the password is missing. # This accounts for the situation in which the user has specified # the username in the index url, but the password comes from keyring. if (username is None or password is None) and netloc in self.passwords: un, pw = self.passwords[netloc] # It is possible that the cached credentials are for a different username, # in which case the cache should be ignored. if username is None or username == un: username, password = un, pw if username is not None or password is not None: # Convert the username and password if they're None, so that # this netloc will show up as "cached" in the conditional above. # Further, HTTPBasicAuth doesn't accept None, so it makes sense to # cache the value that is going to be used. username = username or "" password = password or "" # Store any acquired credentials. self.passwords[netloc] = (username, password) assert ( # Credentials were found (username is not None and password is not None) # Credentials were not found or (username is None and password is None) ), f"Could not load credentials from url: {original_url}" return url, username, password def __call__(self, req: PreparedRequest) -> PreparedRequest: # Get credentials for this request assert req.url is not None url, username, password = self._get_url_and_credentials(req.url) # Set the url of the request to the url without any credentials req.url = url if username is not None and password is not None: # Send the basic auth with this request req = HTTPBasicAuth(username, password)(req) # Attach a hook to handle 401 responses req.register_hook("response", self.handle_401) return req # Factored out to allow for easy patching in tests def _prompt_for_password(self, netloc: str) -> tuple[str | None, str | None, bool]: username = ask_input(f"User for {netloc}: ") if self.prompting else None if not username: return None, None, False if self.use_keyring: auth = self._get_keyring_auth(netloc, username) if auth and auth[0] is not None and auth[1] is not None: return auth[0], auth[1], False password = ask_password("Password: ") return username, password, True # Factored out to allow for easy patching in tests def _should_save_password_to_keyring(self) -> bool: if ( not self.prompting or not self.use_keyring or not self.keyring_provider.has_keyring ): return False return ask("Save credentials to keyring [y/N]: ", ["y", "n"]) == "y" def handle_401(self, resp: Response, **kwargs: Any) -> Response: # We only care about 401 responses, anything else we want to just # pass through the actual response if resp.status_code != 401: return resp username, password = None, None # Query the keyring for credentials: if self.use_keyring: username, password = self._get_new_credentials( resp.url, allow_netrc=False, allow_keyring=True, ) # We are not able to prompt the user so simply return the response if not self.prompting and not username and not password: return resp parsed = urllib.parse.urlparse(resp.url) # Prompt the user for a new username and password save = False if not username and not password: username, password, save = self._prompt_for_password(parsed.netloc) # Store the new username and password to use for future requests self._credentials_to_save = None if username is not None and password is not None: self.passwords[parsed.netloc] = (username, password) # Prompt to save the password to keyring if save and self._should_save_password_to_keyring(): self._credentials_to_save = Credentials( url=parsed.netloc, username=username, password=password, ) # Consume content and release the original connection to allow our new # request to reuse the same one. # The result of the assignment isn't used, it's just needed to consume # the content. _ = resp.content resp.raw.release_conn() # Add our new username and password to the request req = HTTPBasicAuth(username or "", password or "")(resp.request) req.register_hook("response", self.warn_on_401) # On successful request, save the credentials that were used to # keyring. (Note that if the user responded "no" above, this member # is not set and nothing will be saved.) if self._credentials_to_save: req.register_hook("response", self.save_credentials) # Send our new request new_resp = resp.connection.send(req, **kwargs) new_resp.history.append(resp) return new_resp def warn_on_401(self, resp: Response, **kwargs: Any) -> None: """Response callback to warn about incorrect credentials.""" if resp.status_code == 401: logger.warning( "401 Error, Credentials not correct for %s", resp.request.url, ) def save_credentials(self, resp: Response, **kwargs: Any) -> None: """Response callback to save credentials on success.""" assert ( self.keyring_provider.has_keyring ), "should never reach here without keyring" creds = self._credentials_to_save self._credentials_to_save = None if creds and resp.status_code < 400: try: logger.info("Saving credentials to keyring") self.keyring_provider.save_auth_info( creds.url, creds.username, creds.password ) except Exception: logger.exception("Failed to save credentials") ================================================ FILE: src/pip/_internal/network/cache.py ================================================ """HTTP cache implementation.""" from __future__ import annotations import os import shutil from collections.abc import Generator from contextlib import contextmanager from datetime import datetime from typing import Any, BinaryIO, Callable from pip._vendor.cachecontrol.cache import SeparateBodyBaseCache from pip._vendor.cachecontrol.caches import SeparateBodyFileCache from pip._vendor.requests.models import Response from pip._internal.utils.filesystem import ( adjacent_tmp_file, copy_directory_permissions, replace, ) from pip._internal.utils.misc import ensure_dir def is_from_cache(response: Response) -> bool: return getattr(response, "from_cache", False) @contextmanager def suppressed_cache_errors() -> Generator[None, None, None]: """If we can't access the cache then we can just skip caching and process requests as if caching wasn't enabled. """ try: yield except OSError: pass class SafeFileCache(SeparateBodyBaseCache): """ A file based cache which is safe to use even when the target directory may not be accessible or writable. There is a race condition when two processes try to write and/or read the same entry at the same time, since each entry consists of two separate files (https://github.com/psf/cachecontrol/issues/324). We therefore have additional logic that makes sure that both files to be present before returning an entry; this fixes the read side of the race condition. For the write side, we assume that the server will only ever return the same data for the same URL, which ought to be the case for files pip is downloading. PyPI does not have a mechanism to swap out a wheel for another wheel, for example. If this assumption is not true, the CacheControl issue will need to be fixed. """ def __init__(self, directory: str) -> None: assert directory is not None, "Cache directory must not be None." super().__init__() self.directory = directory def _get_cache_path(self, name: str) -> str: # From cachecontrol.caches.file_cache.FileCache._fn, brought into our # class for backwards-compatibility and to avoid using a non-public # method. hashed = SeparateBodyFileCache.encode(name) parts = list(hashed[:5]) + [hashed] return os.path.join(self.directory, *parts) def get(self, key: str) -> bytes | None: # The cache entry is only valid if both metadata and body exist. metadata_path = self._get_cache_path(key) body_path = metadata_path + ".body" if not (os.path.exists(metadata_path) and os.path.exists(body_path)): return None with suppressed_cache_errors(): with open(metadata_path, "rb") as f: return f.read() def _write_to_file(self, path: str, writer_func: Callable[[BinaryIO], Any]) -> None: """Common file writing logic with proper permissions and atomic replacement.""" with suppressed_cache_errors(): ensure_dir(os.path.dirname(path)) with adjacent_tmp_file(path) as f: writer_func(f) # Inherit the read/write permissions of the cache directory # to enable multi-user cache use-cases. copy_directory_permissions(self.directory, f) replace(f.name, path) def _write(self, path: str, data: bytes) -> None: self._write_to_file(path, lambda f: f.write(data)) def _write_from_io(self, path: str, source_file: BinaryIO) -> None: self._write_to_file(path, lambda f: shutil.copyfileobj(source_file, f)) def set( self, key: str, value: bytes, expires: int | datetime | None = None ) -> None: path = self._get_cache_path(key) self._write(path, value) def delete(self, key: str) -> None: path = self._get_cache_path(key) with suppressed_cache_errors(): os.remove(path) with suppressed_cache_errors(): os.remove(path + ".body") def get_body(self, key: str) -> BinaryIO | None: # The cache entry is only valid if both metadata and body exist. metadata_path = self._get_cache_path(key) body_path = metadata_path + ".body" if not (os.path.exists(metadata_path) and os.path.exists(body_path)): return None with suppressed_cache_errors(): return open(body_path, "rb") def set_body(self, key: str, body: bytes) -> None: path = self._get_cache_path(key) + ".body" self._write(path, body) def set_body_from_io(self, key: str, body_file: BinaryIO) -> None: """Set the body of the cache entry from a file object.""" path = self._get_cache_path(key) + ".body" self._write_from_io(path, body_file) ================================================ FILE: src/pip/_internal/network/download.py ================================================ """Download files with progress indicators.""" from __future__ import annotations import email.message import logging import mimetypes import os from collections.abc import Iterable, Mapping from dataclasses import dataclass from http import HTTPStatus from typing import BinaryIO from pip._vendor.requests import PreparedRequest from pip._vendor.requests.models import Response from pip._vendor.urllib3 import HTTPResponse as URLlib3Response from pip._vendor.urllib3._collections import HTTPHeaderDict from pip._vendor.urllib3.exceptions import ReadTimeoutError from pip._internal.cli.progress_bars import BarType, get_download_progress_renderer from pip._internal.exceptions import IncompleteDownloadError, NetworkConnectionError from pip._internal.models.index import PyPI from pip._internal.models.link import Link from pip._internal.network.cache import SafeFileCache, is_from_cache from pip._internal.network.session import CacheControlAdapter, PipSession from pip._internal.network.utils import HEADERS, raise_for_status, response_chunks from pip._internal.utils.misc import format_size, redact_auth_from_url, splitext logger = logging.getLogger(__name__) def _get_http_response_size(resp: Response) -> int | None: try: return int(resp.headers["content-length"]) except (ValueError, KeyError, TypeError): return None def _get_http_response_etag_or_last_modified(resp: Response) -> str | None: """ Return either the ETag or Last-Modified header (or None if neither exists). The return value can be used in an If-Range header. """ return resp.headers.get("etag", resp.headers.get("last-modified")) def _log_download( resp: Response, link: Link, progress_bar: BarType, total_length: int | None, range_start: int | None = 0, ) -> Iterable[bytes]: if link.netloc == PyPI.file_storage_domain: url = link.show_url else: url = link.url_without_fragment logged_url = redact_auth_from_url(url) if total_length: if range_start: logged_url = ( f"{logged_url} ({format_size(range_start)}/{format_size(total_length)})" ) else: logged_url = f"{logged_url} ({format_size(total_length)})" if is_from_cache(resp): logger.info("Using cached %s", logged_url) elif range_start: logger.info("Resuming download %s", logged_url) else: logger.info("Downloading %s", logged_url) if logger.getEffectiveLevel() > logging.INFO: show_progress = False elif is_from_cache(resp): show_progress = False elif not total_length: show_progress = True elif total_length > (512 * 1024): show_progress = True else: show_progress = False chunks = response_chunks(resp) if not show_progress: return chunks renderer = get_download_progress_renderer( bar_type=progress_bar, size=total_length, initial_progress=range_start ) return renderer(chunks) def sanitize_content_filename(filename: str) -> str: """ Sanitize the "filename" value from a Content-Disposition header. """ return os.path.basename(filename) def parse_content_disposition(content_disposition: str, default_filename: str) -> str: """ Parse the "filename" value from a Content-Disposition header, and return the default filename if the result is empty. """ m = email.message.Message() m["content-type"] = content_disposition filename = m.get_param("filename") if filename: # We need to sanitize the filename to prevent directory traversal # in case the filename contains ".." path parts. filename = sanitize_content_filename(str(filename)) return filename or default_filename def _get_http_response_filename(resp: Response, link: Link) -> str: """Get an ideal filename from the given HTTP response, falling back to the link filename if not provided. """ filename = link.filename # fallback # Have a look at the Content-Disposition header for a better guess content_disposition = resp.headers.get("content-disposition") if content_disposition: filename = parse_content_disposition(content_disposition, filename) ext: str | None = splitext(filename)[1] if not ext: ext = mimetypes.guess_extension(resp.headers.get("content-type", "")) if ext: filename += ext if not ext and link.url != resp.url: ext = os.path.splitext(resp.url)[1] if ext: filename += ext return filename @dataclass class _FileDownload: """Stores the state of a single link download.""" link: Link output_file: BinaryIO size: int | None bytes_received: int = 0 reattempts: int = 0 def is_incomplete(self) -> bool: return bool(self.size is not None and self.bytes_received < self.size) def write_chunk(self, data: bytes) -> None: self.bytes_received += len(data) self.output_file.write(data) def reset_file(self) -> None: """Delete any saved data and reset progress to zero.""" self.output_file.seek(0) self.output_file.truncate() self.bytes_received = 0 class Downloader: def __init__( self, session: PipSession, progress_bar: BarType, ) -> None: self._session = session self._progress_bar = progress_bar self._resume_retries = session.resume_retries assert ( self._resume_retries >= 0 ), "Number of max resume retries must be bigger or equal to zero" def batch( self, links: Iterable[Link], location: str ) -> Iterable[tuple[Link, tuple[str, str]]]: """Convenience method to download multiple links.""" for link in links: filepath, content_type = self(link, location) yield link, (filepath, content_type) def __call__(self, link: Link, location: str) -> tuple[str, str]: """Download a link and save it under location.""" resp = self._http_get(link) download_size = _get_http_response_size(resp) filepath = os.path.join(location, _get_http_response_filename(resp, link)) with open(filepath, "wb") as content_file: download = _FileDownload(link, content_file, download_size) self._process_response(download, resp) if download.is_incomplete(): self._attempt_resumes_or_redownloads(download, resp) content_type = resp.headers.get("Content-Type", "") return filepath, content_type def _process_response(self, download: _FileDownload, resp: Response) -> None: """Download and save chunks from a response.""" chunks = _log_download( resp, download.link, self._progress_bar, download.size, range_start=download.bytes_received, ) try: for chunk in chunks: download.write_chunk(chunk) except ReadTimeoutError as e: # If the download size is not known, then give up downloading the file. if download.size is None: raise e logger.warning("Connection timed out while downloading.") def _attempt_resumes_or_redownloads( self, download: _FileDownload, first_resp: Response ) -> None: """Attempt to resume/restart the download if connection was dropped.""" while download.reattempts < self._resume_retries and download.is_incomplete(): assert download.size is not None download.reattempts += 1 logger.warning( "Attempting to resume incomplete download (%s/%s, attempt %d)", format_size(download.bytes_received), format_size(download.size), download.reattempts, ) try: resume_resp = self._http_get_resume(download, should_match=first_resp) # Fallback: if the server responded with 200 (i.e., the file has # since been modified or range requests are unsupported) or any # other unexpected status, restart the download from the beginning. must_restart = resume_resp.status_code != HTTPStatus.PARTIAL_CONTENT if must_restart: download.reset_file() download.size = _get_http_response_size(resume_resp) first_resp = resume_resp self._process_response(download, resume_resp) except (ConnectionError, ReadTimeoutError, OSError): continue # No more resume attempts. Raise an error if the download is still incomplete. if download.is_incomplete(): os.remove(download.output_file.name) raise IncompleteDownloadError(download) # If we successfully completed the download via resume, manually cache it # as a complete response to enable future caching if download.reattempts > 0: self._cache_resumed_download(download, first_resp) def _cache_resumed_download( self, download: _FileDownload, original_response: Response ) -> None: """ Manually cache a file that was successfully downloaded via resume retries. cachecontrol doesn't cache 206 (Partial Content) responses, since they are not complete files. This method manually adds the final file to the cache as though it was downloaded in a single request, so that future requests can use the cache. """ url = download.link.url_without_fragment adapter = self._session.get_adapter(url) # Check if the adapter is the CacheControlAdapter (i.e. caching is enabled) if not isinstance(adapter, CacheControlAdapter): logger.debug( "Skipping resume download caching: no cache controller for %s", url ) return # Check SafeFileCache is being used assert isinstance( adapter.cache, SafeFileCache ), "separate body cache not in use!" synthetic_request = PreparedRequest() synthetic_request.prepare(method="GET", url=url, headers={}) synthetic_response_headers = HTTPHeaderDict() for key, value in original_response.headers.items(): if key.lower() not in ["content-range", "content-length"]: synthetic_response_headers[key] = value synthetic_response_headers["content-length"] = str(download.size) synthetic_response = URLlib3Response( body="", headers=synthetic_response_headers, status=200, preload_content=False, ) # Save metadata and then stream the file contents to cache. cache_url = adapter.controller.cache_url(url) metadata_blob = adapter.controller.serializer.dumps( synthetic_request, synthetic_response, b"" ) adapter.cache.set(cache_url, metadata_blob) download.output_file.flush() with open(download.output_file.name, "rb") as f: adapter.cache.set_body_from_io(cache_url, f) logger.debug( "Cached resumed download as complete response for future use: %s", url ) def _http_get_resume( self, download: _FileDownload, should_match: Response ) -> Response: """Issue a HTTP range request to resume the download.""" # To better understand the download resumption logic, see the mdn web docs: # https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Range_requests headers = HEADERS.copy() headers["Range"] = f"bytes={download.bytes_received}-" # If possible, use a conditional range request to avoid corrupted # downloads caused by the remote file changing in-between. if identifier := _get_http_response_etag_or_last_modified(should_match): headers["If-Range"] = identifier return self._http_get(download.link, headers) def _http_get(self, link: Link, headers: Mapping[str, str] = HEADERS) -> Response: target_url = link.url_without_fragment try: resp = self._session.get(target_url, headers=headers, stream=True) raise_for_status(resp) except NetworkConnectionError as e: assert e.response is not None logger.critical( "HTTP error %s while getting %s", e.response.status_code, link ) raise return resp ================================================ FILE: src/pip/_internal/network/lazy_wheel.py ================================================ """Lazy ZIP over HTTP""" from __future__ import annotations __all__ = ["HTTPRangeRequestUnsupported", "dist_from_wheel_url"] from bisect import bisect_left, bisect_right from collections.abc import Generator from contextlib import contextmanager from tempfile import NamedTemporaryFile from typing import Any from zipfile import BadZipFile, ZipFile from pip._vendor.packaging.utils import NormalizedName from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response from pip._internal.metadata import BaseDistribution, MemoryWheel, get_wheel_distribution from pip._internal.network.session import PipSession from pip._internal.network.utils import HEADERS, raise_for_status, response_chunks class HTTPRangeRequestUnsupported(Exception): pass def dist_from_wheel_url( name: NormalizedName, url: str, session: PipSession ) -> BaseDistribution: """Return a distribution object from the given wheel URL. This uses HTTP range requests to only fetch the portion of the wheel containing metadata, just enough for the object to be constructed. If such requests are not supported, HTTPRangeRequestUnsupported is raised. """ with LazyZipOverHTTP(url, session) as zf: # For read-only ZIP files, ZipFile only needs methods read, # seek, seekable and tell, not the whole IO protocol. wheel = MemoryWheel(zf.name, zf) # type: ignore # After context manager exit, wheel.name # is an invalid file by intention. return get_wheel_distribution(wheel, name) class LazyZipOverHTTP: """File-like object mapped to a ZIP file over HTTP. This uses HTTP range requests to lazily fetch the file's content, which is supposed to be fed to ZipFile. If such requests are not supported by the server, raise HTTPRangeRequestUnsupported during initialization. """ def __init__( self, url: str, session: PipSession, chunk_size: int = CONTENT_CHUNK_SIZE ) -> None: head = session.head(url, headers=HEADERS) raise_for_status(head) assert head.status_code == 200 self._session, self._url, self._chunk_size = session, url, chunk_size self._length = int(head.headers["Content-Length"]) self._file = NamedTemporaryFile() self.truncate(self._length) self._left: list[int] = [] self._right: list[int] = [] if "bytes" not in head.headers.get("Accept-Ranges", "none"): raise HTTPRangeRequestUnsupported("range request is not supported") self._check_zip() @property def mode(self) -> str: """Opening mode, which is always rb.""" return "rb" @property def name(self) -> str: """Path to the underlying file.""" return self._file.name def seekable(self) -> bool: """Return whether random access is supported, which is True.""" return True def close(self) -> None: """Close the file.""" self._file.close() @property def closed(self) -> bool: """Whether the file is closed.""" return self._file.closed def read(self, size: int = -1) -> bytes: """Read up to size bytes from the object and return them. As a convenience, if size is unspecified or -1, all bytes until EOF are returned. Fewer than size bytes may be returned if EOF is reached. """ download_size = max(size, self._chunk_size) start, length = self.tell(), self._length stop = length if size < 0 else min(start + download_size, length) start = max(0, stop - download_size) self._download(start, stop - 1) return self._file.read(size) def readable(self) -> bool: """Return whether the file is readable, which is True.""" return True def seek(self, offset: int, whence: int = 0) -> int: """Change stream position and return the new absolute position. Seek to offset relative position indicated by whence: * 0: Start of stream (the default). pos should be >= 0; * 1: Current position - pos may be negative; * 2: End of stream - pos usually negative. """ return self._file.seek(offset, whence) def tell(self) -> int: """Return the current position.""" return self._file.tell() def truncate(self, size: int | None = None) -> int: """Resize the stream to the given size in bytes. If size is unspecified resize to the current position. The current stream position isn't changed. Return the new file size. """ return self._file.truncate(size) def writable(self) -> bool: """Return False.""" return False def __enter__(self) -> LazyZipOverHTTP: self._file.__enter__() return self def __exit__(self, *exc: Any) -> None: self._file.__exit__(*exc) @contextmanager def _stay(self) -> Generator[None, None, None]: """Return a context manager keeping the position. At the end of the block, seek back to original position. """ pos = self.tell() try: yield finally: self.seek(pos) def _check_zip(self) -> None: """Check and download until the file is a valid ZIP.""" end = self._length - 1 for start in reversed(range(0, end, self._chunk_size)): self._download(start, end) with self._stay(): try: # For read-only ZIP files, ZipFile only needs # methods read, seek, seekable and tell. ZipFile(self) except BadZipFile: pass else: break def _stream_response( self, start: int, end: int, base_headers: dict[str, str] = HEADERS ) -> Response: """Return HTTP response to a range request from start to end.""" headers = base_headers.copy() headers["Range"] = f"bytes={start}-{end}" # TODO: Get range requests to be correctly cached headers["Cache-Control"] = "no-cache" return self._session.get(self._url, headers=headers, stream=True) def _merge( self, start: int, end: int, left: int, right: int ) -> Generator[tuple[int, int], None, None]: """Return a generator of intervals to be fetched. Args: start (int): Start of needed interval end (int): End of needed interval left (int): Index of first overlapping downloaded data right (int): Index after last overlapping downloaded data """ lslice, rslice = self._left[left:right], self._right[left:right] i = start = min([start] + lslice[:1]) end = max([end] + rslice[-1:]) for j, k in zip(lslice, rslice): if j > i: yield i, j - 1 i = k + 1 if i <= end: yield i, end self._left[left:right], self._right[left:right] = [start], [end] def _download(self, start: int, end: int) -> None: """Download bytes from start to end inclusively.""" with self._stay(): left = bisect_left(self._right, start) right = bisect_right(self._left, end) for start, end in self._merge(start, end, left, right): response = self._stream_response(start, end) response.raise_for_status() self.seek(start) for chunk in response_chunks(response, self._chunk_size): self._file.write(chunk) ================================================ FILE: src/pip/_internal/network/session.py ================================================ """PipSession and supporting code, containing all pip-specific network request configuration and behavior. """ from __future__ import annotations import email.utils import functools import io import ipaddress import json import logging import mimetypes import os import platform import shutil import subprocess import sys import urllib.parse import warnings from collections.abc import Generator, Mapping, Sequence from typing import ( TYPE_CHECKING, Any, Optional, Union, ) from pip._vendor import requests, urllib3 from pip._vendor.cachecontrol import CacheControlAdapter as _BaseCacheControlAdapter from pip._vendor.requests.adapters import DEFAULT_POOLBLOCK, BaseAdapter from pip._vendor.requests.adapters import HTTPAdapter as _BaseHTTPAdapter from pip._vendor.requests.models import PreparedRequest, Response from pip._vendor.requests.structures import CaseInsensitiveDict from pip._vendor.urllib3.connectionpool import ConnectionPool from pip._vendor.urllib3.exceptions import InsecureRequestWarning from pip import __version__ from pip._internal.metadata import get_default_environment from pip._internal.models.link import Link from pip._internal.network.auth import MultiDomainBasicAuth from pip._internal.network.cache import SafeFileCache # Import ssl from compat so the initial import occurs in only one place. from pip._internal.utils.compat import has_tls from pip._internal.utils.glibc import libc_ver from pip._internal.utils.misc import build_url_from_netloc, parse_netloc from pip._internal.utils.urls import url_to_path if TYPE_CHECKING: from ssl import SSLContext from pip._vendor.urllib3 import ProxyManager from pip._vendor.urllib3.poolmanager import PoolManager logger = logging.getLogger(__name__) SecureOrigin = tuple[str, str, Optional[Union[int, str]]] # Ignore warning raised when using --trusted-host. warnings.filterwarnings("ignore", category=InsecureRequestWarning) SECURE_ORIGINS: list[SecureOrigin] = [ # protocol, hostname, port # Taken from Chrome's list of secure origins (See: http://bit.ly/1qrySKC) ("https", "*", "*"), ("*", "localhost", "*"), ("*", "127.0.0.0/8", "*"), ("*", "::1/128", "*"), ("file", "*", None), # ssh is always secure. ("ssh", "*", "*"), ] # These are environment variables present when running under various # CI systems. For each variable, some CI systems that use the variable # are indicated. The collection was chosen so that for each of a number # of popular systems, at least one of the environment variables is used. # This list is used to provide some indication of and lower bound for # CI traffic to PyPI. Thus, it is okay if the list is not comprehensive. # For more background, see: https://github.com/pypa/pip/issues/5499 CI_ENVIRONMENT_VARIABLES = ( # Azure Pipelines "BUILD_BUILDID", # Jenkins "BUILD_ID", # AppVeyor, CircleCI, Codeship, Gitlab CI, Shippable, Travis CI "CI", # Explicit environment variable. "PIP_IS_CI", ) def looks_like_ci() -> bool: """ Return whether it looks like pip is running under CI. """ # We don't use the method of checking for a tty (e.g. using isatty()) # because some CI systems mimic a tty (e.g. Travis CI). Thus that # method doesn't provide definitive information in either direction. return any(name in os.environ for name in CI_ENVIRONMENT_VARIABLES) @functools.lru_cache(maxsize=1) def user_agent() -> str: """ Return a string representing the user agent. """ data: dict[str, Any] = { "installer": {"name": "pip", "version": __version__}, "python": platform.python_version(), "implementation": { "name": platform.python_implementation(), }, } if data["implementation"]["name"] == "CPython": data["implementation"]["version"] = platform.python_version() elif data["implementation"]["name"] == "PyPy": pypy_version_info = sys.pypy_version_info # type: ignore if pypy_version_info.releaselevel == "final": pypy_version_info = pypy_version_info[:3] data["implementation"]["version"] = ".".join( [str(x) for x in pypy_version_info] ) elif data["implementation"]["name"] == "Jython": # Complete Guess data["implementation"]["version"] = platform.python_version() elif data["implementation"]["name"] == "IronPython": # Complete Guess data["implementation"]["version"] = platform.python_version() if sys.platform.startswith("linux"): from pip._vendor import distro linux_distribution = distro.name(), distro.version(), distro.codename() distro_infos: dict[str, Any] = dict( filter( lambda x: x[1], zip(["name", "version", "id"], linux_distribution), ) ) libc = dict( filter( lambda x: x[1], zip(["lib", "version"], libc_ver()), ) ) if libc: distro_infos["libc"] = libc if distro_infos: data["distro"] = distro_infos if sys.platform.startswith("darwin") and platform.mac_ver()[0]: data["distro"] = {"name": "macOS", "version": platform.mac_ver()[0]} if platform.system(): data.setdefault("system", {})["name"] = platform.system() if platform.release(): data.setdefault("system", {})["release"] = platform.release() if platform.machine(): data["cpu"] = platform.machine() if has_tls(): import _ssl as ssl data["openssl_version"] = ssl.OPENSSL_VERSION setuptools_dist = get_default_environment().get_distribution("setuptools") if setuptools_dist is not None: data["setuptools_version"] = str(setuptools_dist.version) if shutil.which("rustc") is not None: # If for any reason `rustc --version` fails, silently ignore it try: rustc_output = subprocess.check_output( ["rustc", "--version"], stderr=subprocess.STDOUT, timeout=0.5 ) except Exception: pass else: if rustc_output.startswith(b"rustc "): # The format of `rustc --version` is: # `b'rustc 1.52.1 (9bc8c42bb 2021-05-09)\n'` # We extract just the middle (1.52.1) part data["rustc_version"] = rustc_output.split(b" ")[1].decode() # Use None rather than False so as not to give the impression that # pip knows it is not being run under CI. Rather, it is a null or # inconclusive result. Also, we include some value rather than no # value to make it easier to know that the check has been run. data["ci"] = True if looks_like_ci() else None user_data = os.environ.get("PIP_USER_AGENT_USER_DATA") if user_data is not None: data["user_data"] = user_data return "{data[installer][name]}/{data[installer][version]} {json}".format( data=data, json=json.dumps(data, separators=(",", ":"), sort_keys=True), ) class LocalFSAdapter(BaseAdapter): def send( self, request: PreparedRequest, stream: bool = False, timeout: float | tuple[float, float] | tuple[float, None] | None = None, verify: bool | str = True, cert: bytes | str | tuple[bytes | str, bytes | str] | None = None, proxies: Mapping[str, str] | None = None, ) -> Response: assert request.url is not None pathname = url_to_path(request.url) resp = Response() resp.status_code = 200 resp.url = request.url try: stats = os.stat(pathname) except OSError as exc: # format the exception raised as a io.BytesIO object, # to return a better error message: resp.status_code = 404 resp.reason = type(exc).__name__ resp.raw = io.BytesIO(f"{resp.reason}: {exc}".encode()) else: modified = email.utils.formatdate(stats.st_mtime, usegmt=True) content_type = mimetypes.guess_type(pathname)[0] or "text/plain" resp.headers = CaseInsensitiveDict( { "Content-Type": content_type, "Content-Length": str(stats.st_size), "Last-Modified": modified, } ) resp.raw = open(pathname, "rb") resp.close = resp.raw.close # type: ignore[method-assign] return resp def close(self) -> None: pass class _SSLContextAdapterMixin: """Mixin to add the ``ssl_context`` constructor argument to HTTP adapters. The additional argument is forwarded directly to the pool manager. This allows us to dynamically decide what SSL store to use at runtime, which is used to implement the optional ``truststore`` backend. """ def __init__( self, *, ssl_context: SSLContext | None = None, **kwargs: Any, ) -> None: self._ssl_context = ssl_context super().__init__(**kwargs) def init_poolmanager( self, connections: int, maxsize: int, block: bool = DEFAULT_POOLBLOCK, **pool_kwargs: Any, ) -> PoolManager: if self._ssl_context is not None: pool_kwargs.setdefault("ssl_context", self._ssl_context) return super().init_poolmanager( # type: ignore[misc, no-any-return] connections=connections, maxsize=maxsize, block=block, **pool_kwargs, ) def proxy_manager_for(self, proxy: str, **proxy_kwargs: Any) -> ProxyManager: # Proxy manager replaces the pool manager, so inject our SSL # context here too. https://github.com/pypa/pip/issues/13288 if self._ssl_context is not None: proxy_kwargs.setdefault("ssl_context", self._ssl_context) return super().proxy_manager_for(proxy, **proxy_kwargs) # type: ignore[misc, no-any-return] class HTTPAdapter(_SSLContextAdapterMixin, _BaseHTTPAdapter): pass class CacheControlAdapter(_SSLContextAdapterMixin, _BaseCacheControlAdapter): pass class InsecureHTTPAdapter(HTTPAdapter): def cert_verify( self, conn: ConnectionPool, url: str, verify: bool | str, cert: str | tuple[str, str] | None, ) -> None: super().cert_verify(conn=conn, url=url, verify=False, cert=cert) class InsecureCacheControlAdapter(CacheControlAdapter): def cert_verify( self, conn: ConnectionPool, url: str, verify: bool | str, cert: str | tuple[str, str] | None, ) -> None: super().cert_verify(conn=conn, url=url, verify=False, cert=cert) class PipSession(requests.Session): timeout: int | None = None def __init__( self, *args: Any, retries: int = 0, resume_retries: int = 0, cache: str | None = None, trusted_hosts: Sequence[str] = (), index_urls: list[str] | None = None, ssl_context: SSLContext | None = None, **kwargs: Any, ) -> None: """ :param trusted_hosts: Domains not to emit warnings for when not using HTTPS. """ super().__init__(*args, **kwargs) # Namespace the attribute with "pip_" just in case to prevent # possible conflicts with the base class. self.pip_trusted_origins: list[tuple[str, int | None]] = [] self.pip_proxy = None # Attach our User Agent to the request self.headers["User-Agent"] = user_agent() # Attach our Authentication handler to the session self.auth: MultiDomainBasicAuth = MultiDomainBasicAuth(index_urls=index_urls) # Create our urllib3.Retry instance which will allow us to customize # how we handle retries. retries = urllib3.Retry( # Set the total number of retries that a particular request can # have. total=retries, # A 503 error from PyPI typically means that the Fastly -> Origin # connection got interrupted in some way. A 503 error in general # is typically considered a transient error so we'll go ahead and # retry it. # A 500 may indicate transient error in Amazon S3 # A 502 may be a transient error from a CDN like CloudFlare or CloudFront # A 520 or 527 - may indicate transient error in CloudFlare status_forcelist=[500, 502, 503, 520, 527], # Add a small amount of back off between failed requests in # order to prevent hammering the service. backoff_factor=0.25, ) # type: ignore self.resume_retries = resume_retries # Our Insecure HTTPAdapter disables HTTPS validation. It does not # support caching so we'll use it for all http:// URLs. # If caching is disabled, we will also use it for # https:// hosts that we've marked as ignoring # TLS errors for (trusted-hosts). insecure_adapter = InsecureHTTPAdapter(max_retries=retries) # We want to _only_ cache responses on securely fetched origins or when # the host is specified as trusted. We do this because # we can't validate the response of an insecurely/untrusted fetched # origin, and we don't want someone to be able to poison the cache and # require manual eviction from the cache to fix it. self._trusted_host_adapter: InsecureCacheControlAdapter | InsecureHTTPAdapter if cache: secure_adapter: _BaseHTTPAdapter = CacheControlAdapter( cache=SafeFileCache(cache), max_retries=retries, ssl_context=ssl_context, ) self._trusted_host_adapter = InsecureCacheControlAdapter( cache=SafeFileCache(cache), max_retries=retries, ) else: secure_adapter = HTTPAdapter(max_retries=retries, ssl_context=ssl_context) self._trusted_host_adapter = insecure_adapter self.mount("https://", secure_adapter) self.mount("http://", insecure_adapter) # Enable file:// urls self.mount("file://", LocalFSAdapter()) for host in trusted_hosts: self.add_trusted_host(host, suppress_logging=True) def update_index_urls(self, new_index_urls: list[str]) -> None: """ :param new_index_urls: New index urls to update the authentication handler with. """ self.auth.index_urls = new_index_urls def add_trusted_host( self, host: str, source: str | None = None, suppress_logging: bool = False ) -> None: """ :param host: It is okay to provide a host that has previously been added. :param source: An optional source string, for logging where the host string came from. """ if not suppress_logging: msg = f"adding trusted host: {host!r}" if source is not None: msg += f" (from {source})" logger.info(msg) parsed_host, parsed_port = parse_netloc(host) if parsed_host is None: raise ValueError(f"Trusted host URL must include a host part: {host!r}") if (parsed_host, parsed_port) not in self.pip_trusted_origins: self.pip_trusted_origins.append((parsed_host, parsed_port)) self.mount( build_url_from_netloc(host, scheme="http") + "/", self._trusted_host_adapter ) self.mount(build_url_from_netloc(host) + "/", self._trusted_host_adapter) if not parsed_port: self.mount( build_url_from_netloc(host, scheme="http") + ":", self._trusted_host_adapter, ) # Mount wildcard ports for the same host. self.mount(build_url_from_netloc(host) + ":", self._trusted_host_adapter) def iter_secure_origins(self) -> Generator[SecureOrigin, None, None]: yield from SECURE_ORIGINS for host, port in self.pip_trusted_origins: yield ("*", host, "*" if port is None else port) def is_secure_origin(self, location: Link) -> bool: # Determine if this url used a secure transport mechanism parsed = urllib.parse.urlparse(str(location)) origin_protocol, origin_host, origin_port = ( parsed.scheme, parsed.hostname, parsed.port, ) # The protocol to use to see if the protocol matches. # Don't count the repository type as part of the protocol: in # cases such as "git+ssh", only use "ssh". (I.e., Only verify against # the last scheme.) origin_protocol = origin_protocol.rsplit("+", 1)[-1] # Determine if our origin is a secure origin by looking through our # hardcoded list of secure origins, as well as any additional ones # configured on this PackageFinder instance. for secure_origin in self.iter_secure_origins(): secure_protocol, secure_host, secure_port = secure_origin if origin_protocol != secure_protocol and secure_protocol != "*": continue try: addr = ipaddress.ip_address(origin_host or "") network = ipaddress.ip_network(secure_host) except ValueError: # We don't have both a valid address or a valid network, so # we'll check this origin against hostnames. if ( origin_host and origin_host.lower() != secure_host.lower() and secure_host != "*" ): continue else: # We have a valid address and network, so see if the address # is contained within the network. if addr not in network: continue # Check to see if the port matches. if ( origin_port != secure_port and secure_port != "*" and secure_port is not None ): continue # If we've gotten here, then this origin matches the current # secure origin and we should return True return True # If we've gotten to this point, then the origin isn't secure and we # will not accept it as a valid location to search. We will however # log a warning that we are ignoring it. logger.warning( "The repository located at %s is not a trusted or secure host and " "is being ignored. If this repository is available via HTTPS we " "recommend you use HTTPS instead, otherwise you may silence " "this warning and allow it anyway with '--trusted-host %s'.", origin_host, origin_host, ) return False def request(self, method: str, url: str, *args: Any, **kwargs: Any) -> Response: # type: ignore[override] # Allow setting a default timeout on a session kwargs.setdefault("timeout", self.timeout) # Allow setting a default proxies on a session kwargs.setdefault("proxies", self.proxies) # Dispatch the actual request return super().request(method, url, *args, **kwargs) ================================================ FILE: src/pip/_internal/network/utils.py ================================================ from collections.abc import Generator from pip._vendor.requests.models import Response from pip._internal.exceptions import NetworkConnectionError # The following comments and HTTP headers were originally added by # Donald Stufft in git commit 22c562429a61bb77172039e480873fb239dd8c03. # # We use Accept-Encoding: identity here because requests defaults to # accepting compressed responses. This breaks in a variety of ways # depending on how the server is configured. # - Some servers will notice that the file isn't a compressible file # and will leave the file alone and with an empty Content-Encoding # - Some servers will notice that the file is already compressed and # will leave the file alone, adding a Content-Encoding: gzip header # - Some servers won't notice anything at all and will take a file # that's already been compressed and compress it again, and set # the Content-Encoding: gzip header # By setting this to request only the identity encoding we're hoping # to eliminate the third case. Hopefully there does not exist a server # which when given a file will notice it is already compressed and that # you're not asking for a compressed file and will then decompress it # before sending because if that's the case I don't think it'll ever be # possible to make this work. HEADERS: dict[str, str] = {"Accept-Encoding": "identity"} DOWNLOAD_CHUNK_SIZE = 256 * 1024 def raise_for_status(resp: Response) -> None: http_error_msg = "" if isinstance(resp.reason, bytes): # We attempt to decode utf-8 first because some servers # choose to localize their reason strings. If the string # isn't utf-8, we fall back to iso-8859-1 for all other # encodings. try: reason = resp.reason.decode("utf-8") except UnicodeDecodeError: reason = resp.reason.decode("iso-8859-1") else: reason = resp.reason if 400 <= resp.status_code < 500: http_error_msg = ( f"{resp.status_code} Client Error: {reason} for url: {resp.url}" ) elif 500 <= resp.status_code < 600: http_error_msg = ( f"{resp.status_code} Server Error: {reason} for url: {resp.url}" ) if http_error_msg: raise NetworkConnectionError(http_error_msg, response=resp) def response_chunks( response: Response, chunk_size: int = DOWNLOAD_CHUNK_SIZE ) -> Generator[bytes, None, None]: """Given a requests Response, provide the data chunks.""" try: # Special case for urllib3. for chunk in response.raw.stream( chunk_size, # We use decode_content=False here because we don't # want urllib3 to mess with the raw bytes we get # from the server. If we decompress inside of # urllib3 then we cannot verify the checksum # because the checksum will be of the compressed # file. This breakage will only occur if the # server adds a Content-Encoding header, which # depends on how the server was configured: # - Some servers will notice that the file isn't a # compressible file and will leave the file alone # and with an empty Content-Encoding # - Some servers will notice that the file is # already compressed and will leave the file # alone and will add a Content-Encoding: gzip # header # - Some servers won't notice anything at all and # will take a file that's already been compressed # and compress it again and set the # Content-Encoding: gzip header # # By setting this not to decode automatically we # hope to eliminate problems with the second case. decode_content=False, ): yield chunk except AttributeError: # Standard file-like object. while True: chunk = response.raw.read(chunk_size) if not chunk: break yield chunk ================================================ FILE: src/pip/_internal/network/xmlrpc.py ================================================ """xmlrpclib.Transport implementation""" import logging import urllib.parse import xmlrpc.client from typing import TYPE_CHECKING from pip._internal.exceptions import NetworkConnectionError from pip._internal.network.session import PipSession from pip._internal.network.utils import raise_for_status if TYPE_CHECKING: from xmlrpc.client import _HostType, _Marshallable from _typeshed import SizedBuffer logger = logging.getLogger(__name__) class PipXmlrpcTransport(xmlrpc.client.Transport): """Provide a `xmlrpclib.Transport` implementation via a `PipSession` object. """ def __init__( self, index_url: str, session: PipSession, use_datetime: bool = False ) -> None: super().__init__(use_datetime) index_parts = urllib.parse.urlparse(index_url) self._scheme = index_parts.scheme self._session = session def request( self, host: "_HostType", handler: str, request_body: "SizedBuffer", verbose: bool = False, ) -> tuple["_Marshallable", ...]: assert isinstance(host, str) parts = (self._scheme, host, handler, None, None, None) url = urllib.parse.urlunparse(parts) try: headers = {"Content-Type": "text/xml"} response = self._session.post( url, data=request_body, headers=headers, stream=True, ) raise_for_status(response) self.verbose = verbose return self.parse_response(response.raw) except NetworkConnectionError as exc: assert exc.response logger.critical( "HTTP error %s while getting %s", exc.response.status_code, url, ) raise ================================================ FILE: src/pip/_internal/operations/__init__.py ================================================ ================================================ FILE: src/pip/_internal/operations/build/__init__.py ================================================ ================================================ FILE: src/pip/_internal/operations/build/build_tracker.py ================================================ from __future__ import annotations import contextlib import hashlib import logging import os from collections.abc import Generator from types import TracebackType from pip._internal.req.req_install import InstallRequirement from pip._internal.utils.temp_dir import TempDirectory logger = logging.getLogger(__name__) @contextlib.contextmanager def update_env_context_manager(**changes: str) -> Generator[None, None, None]: target = os.environ # Save values from the target and change them. non_existent_marker = object() saved_values: dict[str, object | str] = {} for name, new_value in changes.items(): try: saved_values[name] = target[name] except KeyError: saved_values[name] = non_existent_marker target[name] = new_value try: yield finally: # Restore original values in the target. for name, original_value in saved_values.items(): if original_value is non_existent_marker: del target[name] else: assert isinstance(original_value, str) # for mypy target[name] = original_value @contextlib.contextmanager def get_build_tracker() -> Generator[BuildTracker, None, None]: root = os.environ.get("PIP_BUILD_TRACKER") with contextlib.ExitStack() as ctx: if root is None: root = ctx.enter_context(TempDirectory(kind="build-tracker")).path ctx.enter_context(update_env_context_manager(PIP_BUILD_TRACKER=root)) logger.debug("Initialized build tracking at %s", root) with BuildTracker(root) as tracker: yield tracker class TrackerId(str): """Uniquely identifying string provided to the build tracker.""" class BuildTracker: """Ensure that an sdist cannot request itself as a setup requirement. When an sdist is prepared, it identifies its setup requirements in the context of ``BuildTracker.track()``. If a requirement shows up recursively, this raises an exception. This stops fork bombs embedded in malicious packages.""" def __init__(self, root: str) -> None: self._root = root self._entries: dict[TrackerId, InstallRequirement] = {} logger.debug("Created build tracker: %s", self._root) def __enter__(self) -> BuildTracker: logger.debug("Entered build tracker: %s", self._root) return self def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None, ) -> None: self.cleanup() def _entry_path(self, key: TrackerId) -> str: hashed = hashlib.sha224(key.encode()).hexdigest() return os.path.join(self._root, hashed) def add(self, req: InstallRequirement, key: TrackerId) -> None: """Add an InstallRequirement to build tracking.""" # Get the file to write information about this requirement. entry_path = self._entry_path(key) # Try reading from the file. If it exists and can be read from, a build # is already in progress, so a LookupError is raised. try: with open(entry_path) as fp: contents = fp.read() except FileNotFoundError: pass else: message = f"{req.link} is already being built: {contents}" raise LookupError(message) # If we're here, req should really not be building already. assert key not in self._entries # Start tracking this requirement. with open(entry_path, "w", encoding="utf-8") as fp: fp.write(str(req)) self._entries[key] = req logger.debug("Added %s to build tracker %r", req, self._root) def remove(self, req: InstallRequirement, key: TrackerId) -> None: """Remove an InstallRequirement from build tracking.""" # Delete the created file and the corresponding entry. os.unlink(self._entry_path(key)) del self._entries[key] logger.debug("Removed %s from build tracker %r", req, self._root) def cleanup(self) -> None: for key, req in list(self._entries.items()): self.remove(req, key) logger.debug("Removed build tracker: %r", self._root) @contextlib.contextmanager def track(self, req: InstallRequirement, key: str) -> Generator[None, None, None]: """Ensure that `key` cannot install itself as a setup requirement. :raises LookupError: If `key` was already provided in a parent invocation of the context introduced by this method.""" tracker_id = TrackerId(key) self.add(req, tracker_id) yield self.remove(req, tracker_id) ================================================ FILE: src/pip/_internal/operations/build/metadata.py ================================================ """Metadata generation logic for source distributions.""" import os from pip._vendor.pyproject_hooks import BuildBackendHookCaller from pip._internal.build_env import BuildEnvironment from pip._internal.exceptions import ( InstallationSubprocessError, MetadataGenerationFailed, ) from pip._internal.utils.subprocess import runner_with_spinner_message from pip._internal.utils.temp_dir import TempDirectory def generate_metadata( build_env: BuildEnvironment, backend: BuildBackendHookCaller, details: str ) -> str: """Generate metadata using mechanisms described in PEP 517. Returns the generated metadata directory. """ metadata_tmpdir = TempDirectory(kind="modern-metadata", globally_managed=True) metadata_dir = metadata_tmpdir.path with build_env: # Note that BuildBackendHookCaller implements a fallback for # prepare_metadata_for_build_wheel, so we don't have to # consider the possibility that this hook doesn't exist. runner = runner_with_spinner_message("Preparing metadata (pyproject.toml)") with backend.subprocess_runner(runner): try: distinfo_dir = backend.prepare_metadata_for_build_wheel(metadata_dir) except InstallationSubprocessError as error: raise MetadataGenerationFailed(package_details=details) from error return os.path.join(metadata_dir, distinfo_dir) ================================================ FILE: src/pip/_internal/operations/build/metadata_editable.py ================================================ """Metadata generation logic for source distributions.""" import os from pip._vendor.pyproject_hooks import BuildBackendHookCaller from pip._internal.build_env import BuildEnvironment from pip._internal.exceptions import ( InstallationSubprocessError, MetadataGenerationFailed, ) from pip._internal.utils.subprocess import runner_with_spinner_message from pip._internal.utils.temp_dir import TempDirectory def generate_editable_metadata( build_env: BuildEnvironment, backend: BuildBackendHookCaller, details: str ) -> str: """Generate metadata using mechanisms described in PEP 660. Returns the generated metadata directory. """ metadata_tmpdir = TempDirectory(kind="modern-metadata", globally_managed=True) metadata_dir = metadata_tmpdir.path with build_env: # Note that BuildBackendHookCaller implements a fallback for # prepare_metadata_for_build_wheel/editable, so we don't have to # consider the possibility that this hook doesn't exist. runner = runner_with_spinner_message( "Preparing editable metadata (pyproject.toml)" ) with backend.subprocess_runner(runner): try: distinfo_dir = backend.prepare_metadata_for_build_editable(metadata_dir) except InstallationSubprocessError as error: raise MetadataGenerationFailed(package_details=details) from error assert distinfo_dir is not None return os.path.join(metadata_dir, distinfo_dir) ================================================ FILE: src/pip/_internal/operations/build/wheel.py ================================================ from __future__ import annotations import logging import os from pip._vendor.pyproject_hooks import BuildBackendHookCaller from pip._internal.utils.subprocess import runner_with_spinner_message logger = logging.getLogger(__name__) def build_wheel_pep517( name: str, backend: BuildBackendHookCaller, metadata_directory: str, wheel_directory: str, ) -> str | None: """Build one InstallRequirement using the PEP 517 build process. Returns path to wheel if successfully built. Otherwise, returns None. """ assert metadata_directory is not None try: logger.debug("Destination directory: %s", wheel_directory) runner = runner_with_spinner_message( f"Building wheel for {name} (pyproject.toml)" ) with backend.subprocess_runner(runner): wheel_name = backend.build_wheel( wheel_directory=wheel_directory, metadata_directory=metadata_directory, ) except Exception: logger.error("Failed building wheel for %s", name) return None return os.path.join(wheel_directory, wheel_name) ================================================ FILE: src/pip/_internal/operations/build/wheel_editable.py ================================================ from __future__ import annotations import logging import os from pip._vendor.pyproject_hooks import BuildBackendHookCaller, HookMissing from pip._internal.utils.subprocess import runner_with_spinner_message logger = logging.getLogger(__name__) def build_wheel_editable( name: str, backend: BuildBackendHookCaller, metadata_directory: str, wheel_directory: str, ) -> str | None: """Build one InstallRequirement using the PEP 660 build process. Returns path to wheel if successfully built. Otherwise, returns None. """ assert metadata_directory is not None try: logger.debug("Destination directory: %s", wheel_directory) runner = runner_with_spinner_message( f"Building editable for {name} (pyproject.toml)" ) with backend.subprocess_runner(runner): try: wheel_name = backend.build_editable( wheel_directory=wheel_directory, metadata_directory=metadata_directory, ) except HookMissing as e: logger.error( "Cannot build editable %s because the build " "backend does not have the %s hook", name, e, ) return None except Exception: logger.error("Failed building editable for %s", name) return None return os.path.join(wheel_directory, wheel_name) ================================================ FILE: src/pip/_internal/operations/check.py ================================================ """Validation of dependencies of packages""" from __future__ import annotations import logging from collections.abc import Generator, Iterable from contextlib import suppress from email.parser import Parser from functools import reduce from typing import ( Callable, NamedTuple, ) from pip._vendor.packaging.requirements import Requirement from pip._vendor.packaging.tags import Tag, parse_tag from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.packaging.version import Version from pip._internal.distributions import make_distribution_for_install_requirement from pip._internal.metadata import get_default_environment from pip._internal.metadata.base import BaseDistribution from pip._internal.req.req_install import InstallRequirement logger = logging.getLogger(__name__) class PackageDetails(NamedTuple): version: Version dependencies: list[Requirement] # Shorthands PackageSet = dict[NormalizedName, PackageDetails] Missing = tuple[NormalizedName, Requirement] Conflicting = tuple[NormalizedName, Version, Requirement] MissingDict = dict[NormalizedName, list[Missing]] ConflictingDict = dict[NormalizedName, list[Conflicting]] CheckResult = tuple[MissingDict, ConflictingDict] ConflictDetails = tuple[PackageSet, CheckResult] def create_package_set_from_installed() -> tuple[PackageSet, bool]: """Converts a list of distributions into a PackageSet.""" package_set = {} problems = False env = get_default_environment() for dist in env.iter_installed_distributions(local_only=False, skip=()): name = dist.canonical_name try: dependencies = list(dist.iter_dependencies()) package_set[name] = PackageDetails(dist.version, dependencies) except (OSError, ValueError) as e: # Don't crash on unreadable or broken metadata. logger.warning("Error parsing dependencies of %s: %s", name, e) problems = True return package_set, problems def check_package_set( package_set: PackageSet, should_ignore: Callable[[str], bool] | None = None ) -> CheckResult: """Check if a package set is consistent If should_ignore is passed, it should be a callable that takes a package name and returns a boolean. """ missing = {} conflicting = {} for package_name, package_detail in package_set.items(): # Info about dependencies of package_name missing_deps: set[Missing] = set() conflicting_deps: set[Conflicting] = set() if should_ignore and should_ignore(package_name): continue for req in package_detail.dependencies: name = canonicalize_name(req.name) # Check if it's missing if name not in package_set: missed = True if req.marker is not None: missed = req.marker.evaluate({"extra": ""}) if missed: missing_deps.add((name, req)) continue # Check if there's a conflict version = package_set[name].version if not req.specifier.contains(version, prereleases=True): conflicting_deps.add((name, version, req)) if missing_deps: missing[package_name] = sorted(missing_deps, key=str) if conflicting_deps: conflicting[package_name] = sorted(conflicting_deps, key=str) return missing, conflicting def check_install_conflicts(to_install: list[InstallRequirement]) -> ConflictDetails: """For checking if the dependency graph would be consistent after \ installing given requirements """ # Start from the current state package_set, _ = create_package_set_from_installed() # Install packages would_be_installed = _simulate_installation_of(to_install, package_set) # Only warn about directly-dependent packages; create a whitelist of them whitelist = _create_whitelist(would_be_installed, package_set) return ( package_set, check_package_set( package_set, should_ignore=lambda name: name not in whitelist ), ) def check_unsupported( packages: Iterable[BaseDistribution], supported_tags: Iterable[Tag], ) -> Generator[BaseDistribution, None, None]: for p in packages: with suppress(FileNotFoundError): wheel_file = p.read_text("WHEEL") wheel_tags: frozenset[Tag] = reduce( frozenset.union, map(parse_tag, Parser().parsestr(wheel_file).get_all("Tag", [])), frozenset(), ) if wheel_tags.isdisjoint(supported_tags): yield p def _simulate_installation_of( to_install: list[InstallRequirement], package_set: PackageSet ) -> set[NormalizedName]: """Computes the version of packages after installing to_install.""" # Keep track of packages that were installed installed = set() # Modify it as installing requirement_set would (assuming no errors) for inst_req in to_install: abstract_dist = make_distribution_for_install_requirement(inst_req) dist = abstract_dist.get_metadata_distribution() name = dist.canonical_name package_set[name] = PackageDetails(dist.version, list(dist.iter_dependencies())) installed.add(name) return installed def _create_whitelist( would_be_installed: set[NormalizedName], package_set: PackageSet ) -> set[NormalizedName]: packages_affected = set(would_be_installed) for package_name in package_set: if package_name in packages_affected: continue for req in package_set[package_name].dependencies: if canonicalize_name(req.name) in packages_affected: packages_affected.add(package_name) break return packages_affected ================================================ FILE: src/pip/_internal/operations/freeze.py ================================================ from __future__ import annotations import collections import logging import os from collections.abc import Container, Generator, Iterable from dataclasses import dataclass, field from typing import NamedTuple from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.packaging.version import InvalidVersion from pip._internal.exceptions import BadCommand, InstallationError from pip._internal.metadata import BaseDistribution, get_environment from pip._internal.req.constructors import ( install_req_from_editable, install_req_from_line, ) from pip._internal.req.req_file import COMMENT_RE from pip._internal.utils.direct_url_helpers import direct_url_as_pep440_direct_reference logger = logging.getLogger(__name__) class _EditableInfo(NamedTuple): requirement: str comments: list[str] def freeze( requirement: list[str] | None = None, local_only: bool = False, user_only: bool = False, paths: list[str] | None = None, isolated: bool = False, exclude_editable: bool = False, skip: Container[str] = (), ) -> Generator[str, None, None]: installations: dict[str, FrozenRequirement] = {} dists = get_environment(paths).iter_installed_distributions( local_only=local_only, skip=(), user_only=user_only, ) for dist in dists: req = FrozenRequirement.from_dist(dist) if exclude_editable and req.editable: continue installations[req.canonical_name] = req if requirement: # the options that don't get turned into an InstallRequirement # should only be emitted once, even if the same option is in multiple # requirements files, so we need to keep track of what has been emitted # so that we don't emit it again if it's seen again emitted_options: set[str] = set() # keep track of which files a requirement is in so that we can # give an accurate warning if a requirement appears multiple times. req_files: dict[str, list[str]] = collections.defaultdict(list) for req_file_path in requirement: with open(req_file_path) as req_file: for line in req_file: if ( not line.strip() or line.strip().startswith("#") or line.startswith( ( "-r", "--requirement", "-f", "--find-links", "-i", "--index-url", "--pre", "--trusted-host", "--process-dependency-links", "--extra-index-url", "--use-feature", ) ) ): line = line.rstrip() if line not in emitted_options: emitted_options.add(line) yield line continue if line.startswith(("-e", "--editable")): if line.startswith("-e"): line = line[2:].strip() else: line = line[len("--editable") :].strip().lstrip("=") line_req = install_req_from_editable( line, isolated=isolated, ) else: line_req = install_req_from_line( COMMENT_RE.sub("", line).strip(), isolated=isolated, ) if not line_req.name: logger.info( "Skipping line in requirement file [%s] because " "it's not clear what it would install: %s", req_file_path, line.strip(), ) logger.info( " (add #egg=PackageName to the URL to avoid" " this warning)" ) else: line_req_canonical_name = canonicalize_name(line_req.name) if line_req_canonical_name not in installations: # either it's not installed, or it is installed # but has been processed already if not req_files[line_req.name]: logger.warning( "Requirement file [%s] contains %s, but " "package %r is not installed", req_file_path, COMMENT_RE.sub("", line).strip(), line_req.name, ) else: req_files[line_req.name].append(req_file_path) else: yield str(installations[line_req_canonical_name]).rstrip() del installations[line_req_canonical_name] req_files[line_req.name].append(req_file_path) # Warn about requirements that were included multiple times (in a # single requirements file or in different requirements files). for name, files in req_files.items(): if len(files) > 1: logger.warning( "Requirement %s included multiple times [%s]", name, ", ".join(sorted(set(files))), ) yield ("## The following requirements were added by pip freeze:") for installation in sorted(installations.values(), key=lambda x: x.name.lower()): if installation.canonical_name not in skip: yield str(installation).rstrip() def _format_as_name_version(dist: BaseDistribution) -> str: try: dist_version = dist.version except InvalidVersion: # legacy version return f"{dist.raw_name}==={dist.raw_version}" else: return f"{dist.raw_name}=={dist_version}" def _get_editable_info(dist: BaseDistribution) -> _EditableInfo: """ Compute and return values (req, comments) for use in FrozenRequirement.from_dist(). """ editable_project_location = dist.editable_project_location assert editable_project_location location = os.path.normcase(os.path.abspath(editable_project_location)) from pip._internal.vcs import RemoteNotFoundError, RemoteNotValidError, vcs vcs_backend = vcs.get_backend_for_dir(location) if vcs_backend is None: display = _format_as_name_version(dist) logger.debug( 'No VCS found for editable requirement "%s" in: %r', display, location, ) return _EditableInfo( requirement=location, comments=[f"# Editable install with no version control ({display})"], ) vcs_name = type(vcs_backend).__name__ try: req = vcs_backend.get_src_requirement(location, dist.raw_name) except RemoteNotFoundError: display = _format_as_name_version(dist) return _EditableInfo( requirement=location, comments=[f"# Editable {vcs_name} install with no remote ({display})"], ) except RemoteNotValidError as ex: display = _format_as_name_version(dist) return _EditableInfo( requirement=location, comments=[ f"# Editable {vcs_name} install ({display}) with either a deleted " f"local remote or invalid URI:", f"# '{ex.url}'", ], ) except BadCommand: logger.warning( "cannot determine version of editable source in %s " "(%s command not found in path)", location, vcs_backend.name, ) return _EditableInfo(requirement=location, comments=[]) except InstallationError as exc: logger.warning("Error when trying to get requirement for VCS system %s", exc) else: return _EditableInfo(requirement=req, comments=[]) logger.warning("Could not determine repository location of %s", location) return _EditableInfo( requirement=location, comments=["## !! Could not determine repository location"], ) @dataclass(frozen=True) class FrozenRequirement: name: str req: str editable: bool comments: Iterable[str] = field(default_factory=tuple) @property def canonical_name(self) -> NormalizedName: return canonicalize_name(self.name) @classmethod def from_dist(cls, dist: BaseDistribution) -> FrozenRequirement: editable = dist.editable if editable: req, comments = _get_editable_info(dist) else: comments = [] direct_url = dist.direct_url if direct_url: # if PEP 610 metadata is present, use it req = direct_url_as_pep440_direct_reference(direct_url, dist.raw_name) else: # name==version requirement req = _format_as_name_version(dist) return cls(dist.raw_name, req, editable, comments=comments) def __str__(self) -> str: req = self.req if self.editable: req = f"-e {req}" return "\n".join(list(self.comments) + [str(req)]) + "\n" ================================================ FILE: src/pip/_internal/operations/install/__init__.py ================================================ """For modules related to installing packages.""" ================================================ FILE: src/pip/_internal/operations/install/wheel.py ================================================ """Support for installing and building the "wheel" binary package format.""" from __future__ import annotations import collections import compileall import contextlib import csv import importlib import logging import os.path import re import shutil import sys import textwrap import warnings from base64 import urlsafe_b64encode from collections.abc import Generator, Iterable, Iterator, Sequence from email.message import Message from itertools import chain, filterfalse, starmap from typing import ( IO, Any, BinaryIO, Callable, NewType, Protocol, Union, cast, ) from zipfile import ZipFile, ZipInfo from pip._vendor.distlib.scripts import ScriptMaker from pip._vendor.distlib.util import get_export_entry from pip._vendor.packaging.utils import canonicalize_name from pip._internal.exceptions import InstallationError from pip._internal.locations import get_major_minor_version from pip._internal.metadata import ( BaseDistribution, FilesystemWheel, get_wheel_distribution, ) from pip._internal.models.direct_url import DIRECT_URL_METADATA_NAME, DirectUrl from pip._internal.models.scheme import SCHEME_KEYS, Scheme from pip._internal.utils.filesystem import adjacent_tmp_file, replace from pip._internal.utils.misc import StreamWrapper, ensure_dir, hash_file, partition from pip._internal.utils.unpacking import ( current_umask, is_within_directory, set_extracted_file_to_default_mode_plus_executable, zip_item_is_executable, ) from pip._internal.utils.wheel import parse_wheel class File(Protocol): src_record_path: RecordPath dest_path: str changed: bool def save(self) -> None: pass logger = logging.getLogger(__name__) RecordPath = NewType("RecordPath", str) InstalledCSVRow = tuple[RecordPath, str, Union[int, str]] def rehash(path: str, blocksize: int = 1 << 20) -> tuple[str, str]: """Return (encoded_digest, length) for path using hashlib.sha256()""" h, length = hash_file(path, blocksize) digest = "sha256=" + urlsafe_b64encode(h.digest()).decode("latin1").rstrip("=") return (digest, str(length)) def csv_io_kwargs(mode: str) -> dict[str, Any]: """Return keyword arguments to properly open a CSV file in the given mode. """ return {"mode": mode, "newline": "", "encoding": "utf-8"} def fix_script(path: str) -> bool: """Replace #!python with #!/path/to/python Return True if file was changed. """ # XXX RECORD hashes will need to be updated assert os.path.isfile(path) with open(path, "rb") as script: firstline = script.readline() if not firstline.startswith(b"#!python"): return False exename = sys.executable.encode(sys.getfilesystemencoding()) firstline = b"#!" + exename + os.linesep.encode("ascii") rest = script.read() with open(path, "wb") as script: script.write(firstline) script.write(rest) return True def wheel_root_is_purelib(metadata: Message) -> bool: return metadata.get("Root-Is-Purelib", "").lower() == "true" def get_entrypoints(dist: BaseDistribution) -> tuple[dict[str, str], dict[str, str]]: console_scripts = {} gui_scripts = {} for entry_point in dist.iter_entry_points(): if entry_point.group == "console_scripts": console_scripts[entry_point.name] = entry_point.value elif entry_point.group == "gui_scripts": gui_scripts[entry_point.name] = entry_point.value return console_scripts, gui_scripts def message_about_scripts_not_on_PATH(scripts: Sequence[str]) -> str | None: """Determine if any scripts are not on PATH and format a warning. Returns a warning message if one or more scripts are not on PATH, otherwise None. """ if not scripts: return None # Group scripts by the path they were installed in grouped_by_dir: dict[str, set[str]] = collections.defaultdict(set) for destfile in scripts: parent_dir = os.path.dirname(destfile) script_name = os.path.basename(destfile) grouped_by_dir[parent_dir].add(script_name) # We don't want to warn for directories that are on PATH. not_warn_dirs = [ os.path.normcase(os.path.normpath(i)).rstrip(os.sep) for i in os.environ.get("PATH", "").split(os.pathsep) ] # If an executable sits with sys.executable, we don't warn for it. # This covers the case of venv invocations without activating the venv. not_warn_dirs.append( os.path.normcase(os.path.normpath(os.path.dirname(sys.executable))) ) warn_for: dict[str, set[str]] = { parent_dir: scripts for parent_dir, scripts in grouped_by_dir.items() if os.path.normcase(os.path.normpath(parent_dir)) not in not_warn_dirs } if not warn_for: return None # Format a message msg_lines = [] for parent_dir, dir_scripts in warn_for.items(): sorted_scripts: list[str] = sorted(dir_scripts) if len(sorted_scripts) == 1: start_text = f"script {sorted_scripts[0]} is" else: start_text = "scripts {} are".format( ", ".join(sorted_scripts[:-1]) + " and " + sorted_scripts[-1] ) msg_lines.append( f"The {start_text} installed in '{parent_dir}' which is not on PATH." ) last_line_fmt = ( "Consider adding {} to PATH or, if you prefer " "to suppress this warning, use --no-warn-script-location." ) if len(msg_lines) == 1: msg_lines.append(last_line_fmt.format("this directory")) else: msg_lines.append(last_line_fmt.format("these directories")) # Add a note if any directory starts with ~ warn_for_tilde = any( i[0] == "~" for i in os.environ.get("PATH", "").split(os.pathsep) if i ) if warn_for_tilde: tilde_warning_msg = ( "NOTE: The current PATH contains path(s) starting with `~`, " "which may not be expanded by all applications." ) msg_lines.append(tilde_warning_msg) # Returns the formatted multiline message return "\n".join(msg_lines) def _normalized_outrows( outrows: Iterable[InstalledCSVRow], ) -> list[tuple[str, str, str]]: """Normalize the given rows of a RECORD file. Items in each row are converted into str. Rows are then sorted to make the value more predictable for tests. Each row is a 3-tuple (path, hash, size) and corresponds to a record of a RECORD file (see PEP 376 and PEP 427 for details). For the rows passed to this function, the size can be an integer as an int or string, or the empty string. """ # Normally, there should only be one row per path, in which case the # second and third elements don't come into play when sorting. # However, in cases in the wild where a path might happen to occur twice, # we don't want the sort operation to trigger an error (but still want # determinism). Since the third element can be an int or string, we # coerce each element to a string to avoid a TypeError in this case. # For additional background, see-- # https://github.com/pypa/pip/issues/5868 return sorted( (record_path, hash_, str(size)) for record_path, hash_, size in outrows ) def _record_to_fs_path(record_path: RecordPath, lib_dir: str) -> str: return os.path.join(lib_dir, record_path) def _fs_to_record_path(path: str, lib_dir: str) -> RecordPath: # On Windows, do not handle relative paths if they belong to different # logical disks if os.path.splitdrive(path)[0].lower() == os.path.splitdrive(lib_dir)[0].lower(): path = os.path.relpath(path, lib_dir) path = path.replace(os.path.sep, "/") return cast("RecordPath", path) def get_csv_rows_for_installed( old_csv_rows: list[list[str]], installed: dict[RecordPath, RecordPath], changed: set[RecordPath], generated: list[str], lib_dir: str, ) -> list[InstalledCSVRow]: """ :param installed: A map from archive RECORD path to installation RECORD path. """ installed_rows: list[InstalledCSVRow] = [] for row in old_csv_rows: if len(row) > 3: logger.warning("RECORD line has more than three elements: %s", row) old_record_path = cast("RecordPath", row[0]) new_record_path = installed.pop(old_record_path, old_record_path) if new_record_path in changed: digest, length = rehash(_record_to_fs_path(new_record_path, lib_dir)) else: digest = row[1] if len(row) > 1 else "" length = row[2] if len(row) > 2 else "" installed_rows.append((new_record_path, digest, length)) for f in generated: path = _fs_to_record_path(f, lib_dir) digest, length = rehash(f) installed_rows.append((path, digest, length)) return installed_rows + [ (installed_record_path, "", "") for installed_record_path in installed.values() ] def get_console_script_specs(console: dict[str, str]) -> list[str]: """ Given the mapping from entrypoint name to callable, return the relevant console script specs. """ # Don't mutate caller's version console = console.copy() scripts_to_generate = [] # Special case pip and setuptools to generate versioned wrappers # # The issue is that some projects (specifically, pip and setuptools) use # code in setup.py to create "versioned" entry points - pip2.7 on Python # 2.7, pip3.3 on Python 3.3, etc. But these entry points are baked into # the wheel metadata at build time, and so if the wheel is installed with # a *different* version of Python the entry points will be wrong. The # correct fix for this is to enhance the metadata to be able to describe # such versioned entry points. # Currently, projects using versioned entry points will either have # incorrect versioned entry points, or they will not be able to distribute # "universal" wheels (i.e., they will need a wheel per Python version). # # Because setuptools and pip are bundled with _ensurepip and virtualenv, # we need to use universal wheels. As a workaround, we # override the versioned entry points in the wheel and generate the # correct ones. # # To add the level of hack in this section of code, in order to support # ensurepip this code will look for an ``ENSUREPIP_OPTIONS`` environment # variable which will control which version scripts get installed. # # ENSUREPIP_OPTIONS=altinstall # - Only pipX.Y and easy_install-X.Y will be generated and installed # ENSUREPIP_OPTIONS=install # - pipX.Y, pipX, easy_install-X.Y will be generated and installed. Note # that this option is technically if ENSUREPIP_OPTIONS is set and is # not altinstall # DEFAULT # - The default behavior is to install pip, pipX, pipX.Y, easy_install # and easy_install-X.Y. pip_script = console.pop("pip", None) if pip_script: if "ENSUREPIP_OPTIONS" not in os.environ: scripts_to_generate.append("pip = " + pip_script) if os.environ.get("ENSUREPIP_OPTIONS", "") != "altinstall": scripts_to_generate.append(f"pip{sys.version_info[0]} = {pip_script}") scripts_to_generate.append(f"pip{get_major_minor_version()} = {pip_script}") # Delete any other versioned pip entry points pip_ep = [k for k in console if re.match(r"pip(\d+(\.\d+)?)?$", k)] for k in pip_ep: del console[k] easy_install_script = console.pop("easy_install", None) if easy_install_script: if "ENSUREPIP_OPTIONS" not in os.environ: scripts_to_generate.append("easy_install = " + easy_install_script) scripts_to_generate.append( f"easy_install-{get_major_minor_version()} = {easy_install_script}" ) # Delete any other versioned easy_install entry points easy_install_ep = [ k for k in console if re.match(r"easy_install(-\d+\.\d+)?$", k) ] for k in easy_install_ep: del console[k] # Generate the console entry points specified in the wheel scripts_to_generate.extend(starmap("{} = {}".format, console.items())) return scripts_to_generate class ZipBackedFile: def __init__( self, src_record_path: RecordPath, dest_path: str, zip_file: ZipFile ) -> None: self.src_record_path = src_record_path self.dest_path = dest_path self._zip_file = zip_file self.changed = False def _getinfo(self) -> ZipInfo: return self._zip_file.getinfo(self.src_record_path) def save(self) -> None: # When we open the output file below, any existing file is truncated # before we start writing the new contents. This is fine in most # cases, but can cause a segfault if pip has loaded a shared # object (e.g. from pyopenssl through its vendored urllib3) # Since the shared object is mmap'd an attempt to call a # symbol in it will then cause a segfault. Unlinking the file # allows writing of new contents while allowing the process to # continue to use the old copy. if os.path.exists(self.dest_path): os.unlink(self.dest_path) zipinfo = self._getinfo() # optimization: the file is created by open(), # skip the decompression when there is 0 bytes to decompress. with open(self.dest_path, "wb") as dest: if zipinfo.file_size > 0: with self._zip_file.open(zipinfo) as f: blocksize = min(zipinfo.file_size, 1024 * 1024) shutil.copyfileobj(f, dest, blocksize) if zip_item_is_executable(zipinfo): set_extracted_file_to_default_mode_plus_executable(self.dest_path) class ScriptFile: def __init__(self, file: File) -> None: self._file = file self.src_record_path = self._file.src_record_path self.dest_path = self._file.dest_path self.changed = False def save(self) -> None: self._file.save() self.changed = fix_script(self.dest_path) class MissingCallableSuffix(InstallationError): def __init__(self, entry_point: str) -> None: super().__init__( f"Invalid script entry point: {entry_point} - A callable " "suffix is required. See https://packaging.python.org/" "specifications/entry-points/#use-for-scripts for more " "information." ) def _raise_for_invalid_entrypoint(specification: str) -> None: entry = get_export_entry(specification) if entry is not None and entry.suffix is None: raise MissingCallableSuffix(str(entry)) class PipScriptMaker(ScriptMaker): # Override distlib's default script template with one that # doesn't import `re` module, allowing scripts to load faster. script_template = textwrap.dedent( """\ import sys from %(module)s import %(import_name)s if __name__ == '__main__': sys.argv[0] = sys.argv[0].removesuffix('.exe') sys.exit(%(func)s()) """ ) def make( self, specification: str, options: dict[str, Any] | None = None ) -> list[str]: _raise_for_invalid_entrypoint(specification) return super().make(specification, options) def _install_wheel( # noqa: C901, PLR0915 function is too long name: str, wheel_zip: ZipFile, wheel_path: str, scheme: Scheme, pycompile: bool = True, warn_script_location: bool = True, direct_url: DirectUrl | None = None, requested: bool = False, ) -> None: """Install a wheel. :param name: Name of the project to install :param wheel_zip: open ZipFile for wheel being installed :param scheme: Distutils scheme dictating the install directories :param req_description: String used in place of the requirement, for logging :param pycompile: Whether to byte-compile installed Python files :param warn_script_location: Whether to check that scripts are installed into a directory on PATH :raises UnsupportedWheel: * when the directory holds an unpacked wheel with incompatible Wheel-Version * when the .dist-info dir does not match the wheel """ info_dir, metadata = parse_wheel(wheel_zip, name) if wheel_root_is_purelib(metadata): lib_dir = scheme.purelib else: lib_dir = scheme.platlib # Record details of the files moved # installed = files copied from the wheel to the destination # changed = files changed while installing (scripts #! line typically) # generated = files newly generated during the install (script wrappers) installed: dict[RecordPath, RecordPath] = {} changed: set[RecordPath] = set() generated: list[str] = [] def record_installed( srcfile: RecordPath, destfile: str, modified: bool = False ) -> None: """Map archive RECORD paths to installation RECORD paths.""" newpath = _fs_to_record_path(destfile, lib_dir) installed[srcfile] = newpath if modified: changed.add(newpath) def is_dir_path(path: RecordPath) -> bool: return path.endswith("/") def assert_no_path_traversal(dest_dir_path: str, target_path: str) -> None: if not is_within_directory(dest_dir_path, target_path): message = ( "The wheel {!r} has a file {!r} trying to install" " outside the target directory {!r}" ) raise InstallationError( message.format(wheel_path, target_path, dest_dir_path) ) def root_scheme_file_maker( zip_file: ZipFile, dest: str ) -> Callable[[RecordPath], File]: def make_root_scheme_file(record_path: RecordPath) -> File: normed_path = os.path.normpath(record_path) dest_path = os.path.join(dest, normed_path) assert_no_path_traversal(dest, dest_path) return ZipBackedFile(record_path, dest_path, zip_file) return make_root_scheme_file def data_scheme_file_maker( zip_file: ZipFile, scheme: Scheme ) -> Callable[[RecordPath], File]: scheme_paths = {key: getattr(scheme, key) for key in SCHEME_KEYS} def make_data_scheme_file(record_path: RecordPath) -> File: normed_path = os.path.normpath(record_path) try: _, scheme_key, dest_subpath = normed_path.split(os.path.sep, 2) except ValueError: message = ( f"Unexpected file in {wheel_path}: {record_path!r}. .data directory" " contents should be named like: '/'." ) raise InstallationError(message) try: scheme_path = scheme_paths[scheme_key] except KeyError: valid_scheme_keys = ", ".join(sorted(scheme_paths)) message = ( f"Unknown scheme key used in {wheel_path}: {scheme_key} " f"(for file {record_path!r}). .data directory contents " f"should be in subdirectories named with a valid scheme " f"key ({valid_scheme_keys})" ) raise InstallationError(message) dest_path = os.path.join(scheme_path, dest_subpath) assert_no_path_traversal(scheme_path, dest_path) return ZipBackedFile(record_path, dest_path, zip_file) return make_data_scheme_file def is_data_scheme_path(path: RecordPath) -> bool: return path.split("/", 1)[0].endswith(".data") paths = cast(list[RecordPath], wheel_zip.namelist()) file_paths = filterfalse(is_dir_path, paths) root_scheme_paths, data_scheme_paths = partition(is_data_scheme_path, file_paths) make_root_scheme_file = root_scheme_file_maker(wheel_zip, lib_dir) files: Iterator[File] = map(make_root_scheme_file, root_scheme_paths) def is_script_scheme_path(path: RecordPath) -> bool: parts = path.split("/", 2) return len(parts) > 2 and parts[0].endswith(".data") and parts[1] == "scripts" other_scheme_paths, script_scheme_paths = partition( is_script_scheme_path, data_scheme_paths ) make_data_scheme_file = data_scheme_file_maker(wheel_zip, scheme) other_scheme_files = map(make_data_scheme_file, other_scheme_paths) files = chain(files, other_scheme_files) # Get the defined entry points distribution = get_wheel_distribution( FilesystemWheel(wheel_path), canonicalize_name(name), ) console, gui = get_entrypoints(distribution) def is_entrypoint_wrapper(file: File) -> bool: # EP, EP.exe and EP-script.py are scripts generated for # entry point EP by setuptools path = file.dest_path name = os.path.basename(path) if name.lower().endswith(".exe"): matchname = name[:-4] elif name.lower().endswith("-script.py"): matchname = name[:-10] elif name.lower().endswith(".pya"): matchname = name[:-4] else: matchname = name # Ignore setuptools-generated scripts return matchname in console or matchname in gui script_scheme_files: Iterator[File] = map( make_data_scheme_file, script_scheme_paths ) script_scheme_files = filterfalse(is_entrypoint_wrapper, script_scheme_files) script_scheme_files = map(ScriptFile, script_scheme_files) files = chain(files, script_scheme_files) existing_parents = set() for file in files: # directory creation is lazy and after file filtering # to ensure we don't install empty dirs; empty dirs can't be # uninstalled. parent_dir = os.path.dirname(file.dest_path) if parent_dir not in existing_parents: ensure_dir(parent_dir) existing_parents.add(parent_dir) file.save() record_installed(file.src_record_path, file.dest_path, file.changed) def pyc_source_file_paths() -> Generator[str, None, None]: # We de-duplicate installation paths, since there can be overlap (e.g. # file in .data maps to same location as file in wheel root). # Sorting installation paths makes it easier to reproduce and debug # issues related to permissions on existing files. for installed_path in sorted(set(installed.values())): full_installed_path = os.path.join(lib_dir, installed_path) if not os.path.isfile(full_installed_path): continue if not full_installed_path.endswith(".py"): continue yield full_installed_path def pyc_output_path(path: str) -> str: """Return the path the pyc file would have been written to.""" return importlib.util.cache_from_source(path) # Compile all of the pyc files for the installed files if pycompile: with contextlib.redirect_stdout( StreamWrapper.from_stream(sys.stdout) ) as stdout: with warnings.catch_warnings(): warnings.filterwarnings("ignore") for path in pyc_source_file_paths(): success = compileall.compile_file(path, force=True, quiet=True) if success: pyc_path = pyc_output_path(path) assert os.path.exists(pyc_path) pyc_record_path = cast( "RecordPath", pyc_path.replace(os.path.sep, "/") ) record_installed(pyc_record_path, pyc_path) logger.debug(stdout.getvalue()) maker = PipScriptMaker(None, scheme.scripts) # Ensure old scripts are overwritten. # See https://github.com/pypa/pip/issues/1800 maker.clobber = True # Ensure we don't generate any variants for scripts because this is almost # never what somebody wants. # See https://bitbucket.org/pypa/distlib/issue/35/ maker.variants = {""} # This is required because otherwise distlib creates scripts that are not # executable. # See https://bitbucket.org/pypa/distlib/issue/32/ maker.set_mode = True # Generate the console and GUI entry points specified in the wheel scripts_to_generate = get_console_script_specs(console) gui_scripts_to_generate = list(starmap("{} = {}".format, gui.items())) generated_console_scripts = maker.make_multiple(scripts_to_generate) generated.extend(generated_console_scripts) generated.extend(maker.make_multiple(gui_scripts_to_generate, {"gui": True})) if warn_script_location: msg = message_about_scripts_not_on_PATH(generated_console_scripts) if msg is not None: logger.warning(msg) generated_file_mode = 0o666 & ~current_umask() @contextlib.contextmanager def _generate_file(path: str, **kwargs: Any) -> Generator[BinaryIO, None, None]: with adjacent_tmp_file(path, **kwargs) as f: yield f os.chmod(f.name, generated_file_mode) replace(f.name, path) dest_info_dir = os.path.join(lib_dir, info_dir) # Record pip as the installer installer_path = os.path.join(dest_info_dir, "INSTALLER") with _generate_file(installer_path) as installer_file: installer_file.write(b"pip\n") generated.append(installer_path) # Record the PEP 610 direct URL reference if direct_url is not None: direct_url_path = os.path.join(dest_info_dir, DIRECT_URL_METADATA_NAME) with _generate_file(direct_url_path) as direct_url_file: direct_url_file.write(direct_url.to_json().encode("utf-8")) generated.append(direct_url_path) # Record the REQUESTED file if requested: requested_path = os.path.join(dest_info_dir, "REQUESTED") with open(requested_path, "wb"): pass generated.append(requested_path) record_text = distribution.read_text("RECORD") record_rows = list(csv.reader(record_text.splitlines())) rows = get_csv_rows_for_installed( record_rows, installed=installed, changed=changed, generated=generated, lib_dir=lib_dir, ) # Record details of all files installed record_path = os.path.join(dest_info_dir, "RECORD") with _generate_file(record_path, **csv_io_kwargs("w")) as record_file: # Explicitly cast to typing.IO[str] as a workaround for the mypy error: # "writer" has incompatible type "BinaryIO"; expected "_Writer" writer = csv.writer(cast("IO[str]", record_file)) writer.writerows(_normalized_outrows(rows)) @contextlib.contextmanager def req_error_context(req_description: str) -> Generator[None, None, None]: try: yield except InstallationError as e: message = f"For req: {req_description}. {e.args[0]}" raise InstallationError(message) from e def install_wheel( name: str, wheel_path: str, scheme: Scheme, req_description: str, pycompile: bool = True, warn_script_location: bool = True, direct_url: DirectUrl | None = None, requested: bool = False, ) -> None: with ZipFile(wheel_path, allowZip64=True) as z: with req_error_context(req_description): _install_wheel( name=name, wheel_zip=z, wheel_path=wheel_path, scheme=scheme, pycompile=pycompile, warn_script_location=warn_script_location, direct_url=direct_url, requested=requested, ) ================================================ FILE: src/pip/_internal/operations/prepare.py ================================================ """Prepares a distribution for installation""" # The following comment should be removed at some point in the future. # mypy: strict-optional=False from __future__ import annotations import mimetypes import os import shutil from collections.abc import Iterable from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING from pip._vendor.packaging.utils import canonicalize_name from pip._internal.build_env import BuildEnvironmentInstaller from pip._internal.distributions import make_distribution_for_install_requirement from pip._internal.distributions.installed import InstalledDistribution from pip._internal.exceptions import ( DirectoryUrlHashUnsupported, HashMismatch, HashUnpinned, InstallationError, MetadataInconsistent, NetworkConnectionError, VcsHashUnsupported, ) from pip._internal.index.package_finder import PackageFinder from pip._internal.metadata import BaseDistribution, get_metadata_distribution from pip._internal.models.direct_url import ArchiveInfo from pip._internal.models.link import Link from pip._internal.models.wheel import Wheel from pip._internal.network.download import Downloader from pip._internal.network.lazy_wheel import ( HTTPRangeRequestUnsupported, dist_from_wheel_url, ) from pip._internal.network.session import PipSession from pip._internal.operations.build.build_tracker import BuildTracker from pip._internal.req.req_install import InstallRequirement from pip._internal.utils._log import getLogger from pip._internal.utils.direct_url_helpers import ( direct_url_for_editable, direct_url_from_link, ) from pip._internal.utils.hashes import Hashes, MissingHashes from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import ( display_path, hash_file, hide_url, redact_auth_from_requirement, ) from pip._internal.utils.temp_dir import TempDirectory from pip._internal.utils.unpacking import unpack_file from pip._internal.vcs import vcs if TYPE_CHECKING: from pip._internal.cli.progress_bars import BarType logger = getLogger(__name__) def _get_prepared_distribution( req: InstallRequirement, build_tracker: BuildTracker, build_env_installer: BuildEnvironmentInstaller, build_isolation: bool, check_build_deps: bool, ) -> BaseDistribution: """Prepare a distribution for installation.""" abstract_dist = make_distribution_for_install_requirement(req) tracker_id = abstract_dist.build_tracker_id if tracker_id is not None: with build_tracker.track(req, tracker_id): abstract_dist.prepare_distribution_metadata( build_env_installer, build_isolation, check_build_deps ) return abstract_dist.get_metadata_distribution() def unpack_vcs_link(link: Link, location: str, verbosity: int) -> None: vcs_backend = vcs.get_backend_for_scheme(link.scheme) assert vcs_backend is not None vcs_backend.unpack(location, url=hide_url(link.url), verbosity=verbosity) @dataclass class File: path: str content_type: str | None = None def __post_init__(self) -> None: if self.content_type is None: # Try to guess the file's MIME type. If the system MIME tables # can't be loaded, give up. try: self.content_type = mimetypes.guess_type(self.path)[0] except OSError: pass def get_http_url( link: Link, download: Downloader, download_dir: str | None = None, hashes: Hashes | None = None, ) -> File: temp_dir = TempDirectory(kind="unpack", globally_managed=True) # If a download dir is specified, is the file already downloaded there? already_downloaded_path = None if download_dir: already_downloaded_path = _check_download_dir(link, download_dir, hashes) if already_downloaded_path: from_path = already_downloaded_path content_type = None else: # let's download to a tmp dir from_path, content_type = download(link, temp_dir.path) if hashes: hashes.check_against_path(from_path) return File(from_path, content_type) def get_file_url( link: Link, download_dir: str | None = None, hashes: Hashes | None = None ) -> File: """Get file and optionally check its hash.""" # If a download dir is specified, is the file already there and valid? already_downloaded_path = None if download_dir: already_downloaded_path = _check_download_dir(link, download_dir, hashes) if already_downloaded_path: from_path = already_downloaded_path else: from_path = link.file_path # If --require-hashes is off, `hashes` is either empty, the # link's embedded hash, or MissingHashes; it is required to # match. If --require-hashes is on, we are satisfied by any # hash in `hashes` matching: a URL-based or an option-based # one; no internet-sourced hash will be in `hashes`. if hashes: hashes.check_against_path(from_path) return File(from_path, None) def unpack_url( link: Link, location: str, download: Downloader, verbosity: int, download_dir: str | None = None, hashes: Hashes | None = None, ) -> File | None: """Unpack link into location, downloading if required. :param hashes: A Hashes object, one of whose embedded hashes must match, or HashMismatch will be raised. If the Hashes is empty, no matches are required, and unhashable types of requirements (like VCS ones, which would ordinarily raise HashUnsupported) are allowed. """ # non-editable vcs urls if link.is_vcs: unpack_vcs_link(link, location, verbosity=verbosity) return None assert not link.is_existing_dir() # file urls if link.is_file: file = get_file_url(link, download_dir, hashes=hashes) # http urls else: file = get_http_url( link, download, download_dir, hashes=hashes, ) # unpack the archive to the build dir location. even when only downloading # archives, they have to be unpacked to parse dependencies, except wheels if not link.is_wheel: unpack_file(file.path, location, file.content_type) return file def _check_download_dir( link: Link, download_dir: str, hashes: Hashes | None, warn_on_hash_mismatch: bool = True, ) -> str | None: """Check download_dir for previously downloaded file with correct hash If a correct file is found return its path else None """ download_path = os.path.join(download_dir, link.filename) if not os.path.exists(download_path): return None # If already downloaded, does its hash match? logger.info("File was already downloaded %s", download_path) if hashes: try: hashes.check_against_path(download_path) except HashMismatch: if warn_on_hash_mismatch: logger.warning( "Previously-downloaded file %s has bad hash. Re-downloading.", download_path, ) os.unlink(download_path) return None return download_path class RequirementPreparer: """Prepares a Requirement""" def __init__( self, *, build_dir: str, download_dir: str | None, src_dir: str, build_isolation: bool, build_isolation_installer: BuildEnvironmentInstaller, check_build_deps: bool, build_tracker: BuildTracker, session: PipSession, progress_bar: BarType, finder: PackageFinder, require_hashes: bool, use_user_site: bool, lazy_wheel: bool, verbosity: int, legacy_resolver: bool, ) -> None: super().__init__() self.src_dir = src_dir self.build_dir = build_dir self.build_tracker = build_tracker self._session = session self._download = Downloader(session, progress_bar) self.finder = finder # Where still-packed archives should be written to. If None, they are # not saved, and are deleted immediately after unpacking. self.download_dir = download_dir # Is build isolation allowed? self.build_isolation = build_isolation self.build_env_installer = build_isolation_installer # Should check build dependencies? self.check_build_deps = check_build_deps # Should hash-checking be required? self.require_hashes = require_hashes # Should install in user site-packages? self.use_user_site = use_user_site # Should wheels be downloaded lazily? self.use_lazy_wheel = lazy_wheel # How verbose should underlying tooling be? self.verbosity = verbosity # Are we using the legacy resolver? self.legacy_resolver = legacy_resolver # Memoized downloaded files, as mapping of url: path. self._downloaded: dict[str, str] = {} # Previous "header" printed for a link-based InstallRequirement self._previous_requirement_header = ("", "") def _log_preparing_link(self, req: InstallRequirement) -> None: """Provide context for the requirement being prepared.""" if req.link.is_file and not req.is_wheel_from_cache: message = "Processing %s" information = str(display_path(req.link.file_path)) else: message = "Collecting %s" information = redact_auth_from_requirement(req.req) if req.req else str(req) # If we used req.req, inject requirement source if available (this # would already be included if we used req directly) if req.req and req.comes_from: if isinstance(req.comes_from, str): comes_from: str | None = req.comes_from else: comes_from = req.comes_from.from_path() if comes_from: information += f" (from {comes_from})" if (message, information) != self._previous_requirement_header: self._previous_requirement_header = (message, information) logger.info(message, information) if req.is_wheel_from_cache: with indent_log(): logger.info("Using cached %s", req.link.filename) def _ensure_link_req_src_dir( self, req: InstallRequirement, parallel_builds: bool ) -> None: """Ensure source_dir of a linked InstallRequirement.""" # Since source_dir is only set for editable requirements. if req.link.is_wheel: # We don't need to unpack wheels, so no need for a source # directory. return assert req.source_dir is None if req.link.is_existing_dir(): # build local directories in-tree req.source_dir = req.link.file_path return # We always delete unpacked sdists after pip runs. req.ensure_has_source_dir( self.build_dir, autodelete=True, parallel_builds=parallel_builds, ) req.ensure_pristine_source_checkout() def _get_linked_req_hashes(self, req: InstallRequirement) -> Hashes: # By the time this is called, the requirement's link should have # been checked so we can tell what kind of requirements req is # and raise some more informative errors than otherwise. # (For example, we can raise VcsHashUnsupported for a VCS URL # rather than HashMissing.) if not self.require_hashes: return req.hashes(trust_internet=True) # We could check these first 2 conditions inside unpack_url # and save repetition of conditions, but then we would # report less-useful error messages for unhashable # requirements, complaining that there's no hash provided. if req.link.is_vcs: raise VcsHashUnsupported() if req.link.is_existing_dir(): raise DirectoryUrlHashUnsupported() # Unpinned packages are asking for trouble when a new version # is uploaded. This isn't a security check, but it saves users # a surprising hash mismatch in the future. # file:/// URLs aren't pinnable, so don't complain about them # not being pinned. if not req.is_direct and not req.is_pinned: raise HashUnpinned() # If known-good hashes are missing for this requirement, # shim it with a facade object that will provoke hash # computation and then raise a HashMissing exception # showing the user what the hash should be. return req.hashes(trust_internet=False) or MissingHashes() def _fetch_metadata_only( self, req: InstallRequirement, ) -> BaseDistribution | None: if self.legacy_resolver: logger.debug( "Metadata-only fetching is not used in the legacy resolver", ) return None if self.require_hashes: logger.debug( "Metadata-only fetching is not used as hash checking is required", ) return None # Try PEP 658 metadata first, then fall back to lazy wheel if unavailable. return self._fetch_metadata_using_link_data_attr( req ) or self._fetch_metadata_using_lazy_wheel(req.link) def _fetch_metadata_using_link_data_attr( self, req: InstallRequirement, ) -> BaseDistribution | None: """Fetch metadata from the data-dist-info-metadata attribute, if possible.""" # (1) Get the link to the metadata file, if provided by the backend. metadata_link = req.link.metadata_link() if metadata_link is None: return None assert req.req is not None logger.verbose( "Obtaining dependency information for %s from %s", req.req, metadata_link, ) # (2) Download the contents of the METADATA file, separate from the dist itself. metadata_file = get_http_url( metadata_link, self._download, hashes=metadata_link.as_hashes(), ) with open(metadata_file.path, "rb") as f: metadata_contents = f.read() # (3) Generate a dist just from those file contents. metadata_dist = get_metadata_distribution( metadata_contents, req.link.filename, req.req.name, ) # (4) Ensure the Name: field from the METADATA file matches the name from the # install requirement. # # NB: raw_name will fall back to the name from the install requirement if # the Name: field is not present, but it's noted in the raw_name docstring # that that should NEVER happen anyway. if canonicalize_name(metadata_dist.raw_name) != canonicalize_name(req.req.name): raise MetadataInconsistent( req, "Name", req.req.name, metadata_dist.raw_name ) return metadata_dist def _fetch_metadata_using_lazy_wheel( self, link: Link, ) -> BaseDistribution | None: """Fetch metadata using lazy wheel, if possible.""" # --use-feature=fast-deps must be provided. if not self.use_lazy_wheel: return None if link.is_file or not link.is_wheel: logger.debug( "Lazy wheel is not used as %r does not point to a remote wheel", link, ) return None wheel = Wheel(link.filename) name = wheel.name logger.info( "Obtaining dependency information from %s %s", name, wheel.version, ) url = link.url.split("#", 1)[0] try: return dist_from_wheel_url(name, url, self._session) except HTTPRangeRequestUnsupported: logger.debug("%s does not support range requests", url) return None def _complete_partial_requirements( self, partially_downloaded_reqs: Iterable[InstallRequirement], parallel_builds: bool = False, ) -> None: """Download any requirements which were only fetched by metadata.""" # Download to a temporary directory. These will be copied over as # needed for downstream 'download', 'wheel', and 'install' commands. temp_dir = TempDirectory(kind="unpack", globally_managed=True).path # Map each link to the requirement that owns it. This allows us to set # `req.local_file_path` on the appropriate requirement after passing # all the links at once into BatchDownloader. links_to_fully_download: dict[Link, InstallRequirement] = {} for req in partially_downloaded_reqs: assert req.link links_to_fully_download[req.link] = req batch_download = self._download.batch(links_to_fully_download.keys(), temp_dir) for link, (filepath, _) in batch_download: logger.debug("Downloading link %s to %s", link, filepath) req = links_to_fully_download[link] # Record the downloaded file path so wheel reqs can extract a Distribution # in .get_dist(). req.local_file_path = filepath # Record that the file is downloaded so we don't do it again in # _prepare_linked_requirement(). self._downloaded[req.link.url] = filepath # If this is an sdist, we need to unpack it after downloading, but the # .source_dir won't be set up until we are in _prepare_linked_requirement(). # Add the downloaded archive to the install requirement to unpack after # preparing the source dir. if not req.is_wheel: req.needs_unpacked_archive(Path(filepath)) # This step is necessary to ensure all lazy wheels are processed # successfully by the 'download', 'wheel', and 'install' commands. for req in partially_downloaded_reqs: self._prepare_linked_requirement(req, parallel_builds) def prepare_linked_requirement( self, req: InstallRequirement, parallel_builds: bool = False ) -> BaseDistribution: """Prepare a requirement to be obtained from req.link.""" assert req.link self._log_preparing_link(req) with indent_log(): # Check if the relevant file is already available # in the download directory file_path = None if self.download_dir is not None and req.link.is_wheel: hashes = self._get_linked_req_hashes(req) file_path = _check_download_dir( req.link, self.download_dir, hashes, # When a locally built wheel has been found in cache, we don't warn # about re-downloading when the already downloaded wheel hash does # not match. This is because the hash must be checked against the # original link, not the cached link. It that case the already # downloaded file will be removed and re-fetched from cache (which # implies a hash check against the cache entry's origin.json). warn_on_hash_mismatch=not req.is_wheel_from_cache, ) if file_path is not None: # The file is already available, so mark it as downloaded self._downloaded[req.link.url] = file_path else: # The file is not available, attempt to fetch only metadata metadata_dist = self._fetch_metadata_only(req) if metadata_dist is not None: req.needs_more_preparation = True req.set_dist(metadata_dist) # Ensure download_info is available even in dry-run mode if req.download_info is None: req.download_info = direct_url_from_link( req.link, req.source_dir ) return metadata_dist # None of the optimizations worked, fully prepare the requirement return self._prepare_linked_requirement(req, parallel_builds) def prepare_linked_requirements_more( self, reqs: Iterable[InstallRequirement], parallel_builds: bool = False ) -> None: """Prepare linked requirements more, if needed.""" reqs = [req for req in reqs if req.needs_more_preparation] for req in reqs: # Determine if any of these requirements were already downloaded. if self.download_dir is not None and req.link.is_wheel: hashes = self._get_linked_req_hashes(req) file_path = _check_download_dir(req.link, self.download_dir, hashes) if file_path is not None: self._downloaded[req.link.url] = file_path req.needs_more_preparation = False # Prepare requirements we found were already downloaded for some # reason. The other downloads will be completed separately. partially_downloaded_reqs: list[InstallRequirement] = [] for req in reqs: if req.needs_more_preparation: partially_downloaded_reqs.append(req) else: self._prepare_linked_requirement(req, parallel_builds) # TODO: separate this part out from RequirementPreparer when the v1 # resolver can be removed! self._complete_partial_requirements( partially_downloaded_reqs, parallel_builds=parallel_builds, ) def _prepare_linked_requirement( self, req: InstallRequirement, parallel_builds: bool ) -> BaseDistribution: assert req.link link = req.link hashes = self._get_linked_req_hashes(req) if hashes and req.is_wheel_from_cache: assert req.download_info is not None assert link.is_wheel assert link.is_file # We need to verify hashes, and we have found the requirement in the cache # of locally built wheels. if ( isinstance(req.download_info.info, ArchiveInfo) and req.download_info.info.hashes and hashes.has_one_of(req.download_info.info.hashes) ): # At this point we know the requirement was built from a hashable source # artifact, and we verified that the cache entry's hash of the original # artifact matches one of the hashes we expect. We don't verify hashes # against the cached wheel, because the wheel is not the original. hashes = None else: logger.warning( "The hashes of the source archive found in cache entry " "don't match, ignoring cached built wheel " "and re-downloading source." ) req.link = req.cached_wheel_source_link link = req.link self._ensure_link_req_src_dir(req, parallel_builds) if link.is_existing_dir(): local_file = None elif link.url not in self._downloaded: try: local_file = unpack_url( link, req.source_dir, self._download, self.verbosity, self.download_dir, hashes, ) except NetworkConnectionError as exc: raise InstallationError( f"Could not install requirement {req} because of HTTP " f"error {exc} for URL {link}" ) else: file_path = self._downloaded[link.url] if hashes: hashes.check_against_path(file_path) local_file = File(file_path, content_type=None) # If download_info is set, we got it from the wheel cache. if req.download_info is None: # Editables don't go through this function (see # prepare_editable_requirement). assert not req.editable req.download_info = direct_url_from_link(link, req.source_dir) # Make sure we have a hash in download_info. If we got it as part of the # URL, it will have been verified and we can rely on it. Otherwise we # compute it from the downloaded file. # FIXME: https://github.com/pypa/pip/issues/11943 if ( isinstance(req.download_info.info, ArchiveInfo) and not req.download_info.info.hashes and local_file ): hash = hash_file(local_file.path)[0].hexdigest() # We populate info.hash for backward compatibility. # This will automatically populate info.hashes. req.download_info.info.hash = f"sha256={hash}" # For use in later processing, # preserve the file path on the requirement. if local_file: req.local_file_path = local_file.path dist = _get_prepared_distribution( req, self.build_tracker, self.build_env_installer, self.build_isolation, self.check_build_deps, ) return dist def save_linked_requirement(self, req: InstallRequirement) -> None: assert self.download_dir is not None assert req.link is not None link = req.link if link.is_vcs or (link.is_existing_dir() and req.editable): # Make a .zip of the source_dir we already created. req.archive(self.download_dir) return if link.is_existing_dir(): logger.debug( "Not copying link to destination directory " "since it is a directory: %s", link, ) return if req.local_file_path is None: # No distribution was downloaded for this requirement. return download_location = os.path.join(self.download_dir, link.filename) if not os.path.exists(download_location): shutil.copy(req.local_file_path, download_location) download_path = display_path(download_location) logger.info("Saved %s", download_path) def prepare_editable_requirement( self, req: InstallRequirement, ) -> BaseDistribution: """Prepare an editable requirement.""" assert req.editable, "cannot prepare a non-editable req as editable" logger.info("Obtaining %s", req) with indent_log(): if self.require_hashes: raise InstallationError( f"The editable requirement {req} cannot be installed when " "requiring hashes, because there is no single file to " "hash." ) req.ensure_has_source_dir(self.src_dir) req.update_editable() assert req.source_dir req.download_info = direct_url_for_editable(req.unpacked_source_directory) dist = _get_prepared_distribution( req, self.build_tracker, self.build_env_installer, self.build_isolation, self.check_build_deps, ) req.check_if_exists(self.use_user_site) return dist def prepare_installed_requirement( self, req: InstallRequirement, skip_reason: str, ) -> BaseDistribution: """Prepare an already-installed requirement.""" assert req.satisfied_by, "req should have been satisfied but isn't" assert skip_reason is not None, ( "did not get skip reason skipped but req.satisfied_by " f"is set to {req.satisfied_by}" ) logger.info( "Requirement %s: %s (%s)", skip_reason, req, req.satisfied_by.version ) with indent_log(): if self.require_hashes: logger.debug( "Since it is already installed, we are trusting this " "package without checking its hash. To ensure a " "completely repeatable environment, install into an " "empty virtualenv." ) return InstalledDistribution(req).get_metadata_distribution() ================================================ FILE: src/pip/_internal/pyproject.py ================================================ from __future__ import annotations import os from collections import namedtuple from typing import Any from pip._vendor.packaging.requirements import InvalidRequirement from pip._internal.exceptions import ( InstallationError, InvalidPyProjectBuildRequires, MissingPyProjectBuildRequires, ) from pip._internal.utils.compat import tomllib from pip._internal.utils.packaging import get_requirement def _is_list_of_str(obj: Any) -> bool: return isinstance(obj, list) and all(isinstance(item, str) for item in obj) def make_pyproject_path(unpacked_source_directory: str) -> str: return os.path.join(unpacked_source_directory, "pyproject.toml") BuildSystemDetails = namedtuple( "BuildSystemDetails", ["requires", "backend", "check", "backend_path"] ) def load_pyproject_toml( pyproject_toml: str, setup_py: str, req_name: str ) -> BuildSystemDetails: """Load the pyproject.toml file. Parameters: pyproject_toml - Location of the project's pyproject.toml file setup_py - Location of the project's setup.py file req_name - The name of the requirement we're processing (for error reporting) Returns: None if we should use the legacy code path, otherwise a tuple ( requirements from pyproject.toml, name of PEP 517 backend, requirements we should check are installed after setting up the build environment directory paths to import the backend from (backend-path), relative to the project root. ) """ has_pyproject = os.path.isfile(pyproject_toml) has_setup = os.path.isfile(setup_py) if not has_pyproject and not has_setup: raise InstallationError( f"{req_name} does not appear to be a Python project: " f"neither 'setup.py' nor 'pyproject.toml' found." ) if has_pyproject: with open(pyproject_toml, encoding="utf-8") as f: pp_toml = tomllib.loads(f.read()) build_system = pp_toml.get("build-system") else: build_system = None if build_system is None: # In the absence of any explicit backend specification, we # assume the setuptools backend that most closely emulates the # traditional direct setup.py execution, and require wheel and # a version of setuptools that supports that backend. build_system = { "requires": ["setuptools>=40.8.0"], "build-backend": "setuptools.build_meta:__legacy__", } # Ensure that the build-system section in pyproject.toml conforms # to PEP 518. # Specifying the build-system table but not the requires key is invalid if "requires" not in build_system: raise MissingPyProjectBuildRequires(package=req_name) # Error out if requires is not a list of strings requires = build_system["requires"] if not _is_list_of_str(requires): raise InvalidPyProjectBuildRequires( package=req_name, reason="It is not a list of strings.", ) # Each requirement must be valid as per PEP 508 for requirement in requires: try: get_requirement(requirement) except InvalidRequirement as error: raise InvalidPyProjectBuildRequires( package=req_name, reason=f"It contains an invalid requirement: {requirement!r}", ) from error backend = build_system.get("build-backend") backend_path = build_system.get("backend-path", []) check: list[str] = [] if backend is None: # If the user didn't specify a backend, we assume they want to use # the setuptools backend. But we can't be sure they have included # a version of setuptools which supplies the backend. So we # make a note to check that this requirement is present once # we have set up the environment. # This is quite a lot of work to check for a very specific case. But # the problem is, that case is potentially quite common - projects that # adopted PEP 518 early for the ability to specify requirements to # execute setup.py, but never considered needing to mention the build # tools themselves. The original PEP 518 code had a similar check (but # implemented in a different way). backend = "setuptools.build_meta:__legacy__" check = ["setuptools>=40.8.0"] return BuildSystemDetails(requires, backend, check, backend_path) ================================================ FILE: src/pip/_internal/req/__init__.py ================================================ from __future__ import annotations import collections import logging from collections.abc import Generator from dataclasses import dataclass from pip._internal.cli.progress_bars import BarType, get_install_progress_renderer from pip._internal.utils.logging import indent_log from .req_file import parse_requirements from .req_install import InstallRequirement from .req_set import RequirementSet __all__ = [ "RequirementSet", "InstallRequirement", "parse_requirements", "install_given_reqs", ] logger = logging.getLogger(__name__) @dataclass(frozen=True) class InstallationResult: name: str def _validate_requirements( requirements: list[InstallRequirement], ) -> Generator[tuple[str, InstallRequirement], None, None]: for req in requirements: assert req.name, f"invalid to-be-installed requirement: {req}" yield req.name, req def install_given_reqs( requirements: list[InstallRequirement], root: str | None, home: str | None, prefix: str | None, warn_script_location: bool, use_user_site: bool, pycompile: bool, progress_bar: BarType, ) -> list[InstallationResult]: """ Install everything in the given list. (to be called after having downloaded and unpacked the packages) """ to_install = collections.OrderedDict(_validate_requirements(requirements)) if to_install: logger.info( "Installing collected packages: %s", ", ".join(to_install.keys()), ) installed = [] show_progress = logger.isEnabledFor(logging.INFO) and len(to_install) > 1 items = iter(to_install.values()) if show_progress: renderer = get_install_progress_renderer( bar_type=progress_bar, total=len(to_install) ) items = renderer(items) with indent_log(): for requirement in items: req_name = requirement.name assert req_name is not None if requirement.should_reinstall: logger.info("Attempting uninstall: %s", req_name) with indent_log(): uninstalled_pathset = requirement.uninstall(auto_confirm=True) else: uninstalled_pathset = None try: requirement.install( root=root, home=home, prefix=prefix, warn_script_location=warn_script_location, use_user_site=use_user_site, pycompile=pycompile, ) except Exception: # if install did not succeed, rollback previous uninstall if uninstalled_pathset and not requirement.install_succeeded: uninstalled_pathset.rollback() raise else: if uninstalled_pathset and requirement.install_succeeded: uninstalled_pathset.commit() installed.append(InstallationResult(req_name)) return installed ================================================ FILE: src/pip/_internal/req/constructors.py ================================================ """Backing implementation for InstallRequirement's various constructors The idea here is that these formed a major chunk of InstallRequirement's size so, moving them and support code dedicated to them outside of that class helps creates for better understandability for the rest of the code. These are meant to be used elsewhere within pip to create instances of InstallRequirement. """ from __future__ import annotations import copy import logging import os import re from collections.abc import Collection from dataclasses import dataclass from pip._vendor.packaging.markers import Marker from pip._vendor.packaging.requirements import InvalidRequirement, Requirement from pip._internal.exceptions import InstallationError from pip._internal.models.index import PyPI, TestPyPI from pip._internal.models.link import Link from pip._internal.models.wheel import Wheel from pip._internal.req.req_file import ParsedRequirement from pip._internal.req.req_install import InstallRequirement from pip._internal.utils.filetypes import is_archive_file from pip._internal.utils.misc import is_installable_dir from pip._internal.utils.packaging import get_requirement from pip._internal.utils.urls import path_to_url from pip._internal.vcs import is_url, vcs __all__ = [ "install_req_from_editable", "install_req_from_line", "parse_editable", ] logger = logging.getLogger(__name__) # All standard version specifier operators # https://packaging.python.org/en/latest/specifications/version-specifiers/#id5 operators = ("~=", "==", "!=", "<=", ">=", "<", ">", "===") def _strip_extras(path: str) -> tuple[str, str | None]: m = re.match(r"^(.+)(\[[^\]]+\])$", path) extras = None if m: path_no_extras = m.group(1).rstrip() extras = m.group(2) else: path_no_extras = path return path_no_extras, extras def convert_extras(extras: str | None) -> set[str]: if not extras: return set() return get_requirement("placeholder" + extras.lower()).extras def _set_requirement_extras(req: Requirement, new_extras: set[str]) -> Requirement: """ Returns a new requirement based on the given one, with the supplied extras. If the given requirement already has extras those are replaced (or dropped if no new extras are given). """ match: re.Match[str] | None = re.fullmatch( # see https://peps.python.org/pep-0508/#complete-grammar r"([\w\t .-]+)(\[[^\]]*\])?(.*)", str(req), flags=re.ASCII, ) # ireq.req is a valid requirement so the regex should always match assert ( match is not None ), f"regex match on requirement {req} failed, this should never happen" pre: str | None = match.group(1) post: str | None = match.group(3) assert ( pre is not None and post is not None ), f"regex group selection for requirement {req} failed, this should never happen" extras: str = "[{}]".format(",".join(sorted(new_extras)) if new_extras else "") return get_requirement(f"{pre}{extras}{post}") def _parse_direct_url_editable(editable_req: str) -> tuple[str | None, str, set[str]]: try: req = Requirement(editable_req) except InvalidRequirement: pass else: if req.url: # Join the marker back into the name part. This will be parsed out # later into a Requirement again. if req.marker: name = f"{req.name} ; {req.marker}" else: name = req.name return (name, req.url, req.extras) raise ValueError def _parse_pip_syntax_editable(editable_req: str) -> tuple[str | None, str, set[str]]: url = editable_req # If a file path is specified with extras, strip off the extras. url_no_extras, extras = _strip_extras(url) if os.path.isdir(url_no_extras): # Treating it as code that has already been checked out url_no_extras = path_to_url(url_no_extras) if url_no_extras.lower().startswith("file:"): package_name = Link(url_no_extras).egg_fragment if extras: return ( package_name, url_no_extras, get_requirement("placeholder" + extras.lower()).extras, ) else: return package_name, url_no_extras, set() for version_control in vcs: if url.lower().startswith(f"{version_control}:"): url = f"{version_control}+{url}" break return Link(url).egg_fragment, url, set() def parse_editable(editable_req: str) -> tuple[str | None, str, set[str]]: """Parses an editable requirement into: - a requirement name with environment markers - an URL - extras Accepted requirements: - svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir - local_path[some_extra] - Foobar[extra] @ svn+http://blahblah@rev#subdirectory=subdir ; markers """ try: package_name, url, extras = _parse_direct_url_editable(editable_req) except ValueError: package_name, url, extras = _parse_pip_syntax_editable(editable_req) link = Link(url) if not link.is_vcs and not link.url.startswith("file:"): backends = ", ".join(vcs.all_schemes) raise InstallationError( f"{editable_req} is not a valid editable requirement. " f"It should either be a path to a local project or a VCS URL " f"(beginning with {backends})." ) # The project name can be inferred from local file URIs easily. if not package_name and not link.url.startswith("file:"): raise InstallationError( f"Could not detect requirement name for '{editable_req}', " "please specify one with your_package_name @ URL" ) return package_name, url, extras def check_first_requirement_in_file(filename: str) -> None: """Check if file is parsable as a requirements file. This is heavily based on ``pkg_resources.parse_requirements``, but simplified to just check the first meaningful line. :raises InvalidRequirement: If the first meaningful line cannot be parsed as an requirement. """ with open(filename, encoding="utf-8", errors="ignore") as f: # Create a steppable iterator, so we can handle \-continuations. lines = ( line for line in (line.strip() for line in f) if line and not line.startswith("#") # Skip blank lines/comments. ) for line in lines: # Drop comments -- a hash without a space may be in a URL. if " #" in line: line = line[: line.find(" #")] # If there is a line continuation, drop it, and append the next line. if line.endswith("\\"): line = line[:-2].strip() + next(lines, "") get_requirement(line) return def deduce_helpful_msg(req: str) -> str: """Returns helpful msg in case requirements file does not exist, or cannot be parsed. :params req: Requirements file path """ if not os.path.exists(req): return f" File '{req}' does not exist." msg = " The path does exist. " # Try to parse and check if it is a requirements file. try: check_first_requirement_in_file(req) except InvalidRequirement: logger.debug("Cannot parse '%s' as requirements file", req) else: msg += ( f"The argument you provided " f"({req}) appears to be a" f" requirements file. If that is the" f" case, use the '-r' flag to install" f" the packages specified within it." ) return msg @dataclass(frozen=True) class RequirementParts: requirement: Requirement | None link: Link | None markers: Marker | None extras: set[str] def parse_req_from_editable(editable_req: str) -> RequirementParts: name, url, extras_override = parse_editable(editable_req) if name is not None: try: req: Requirement | None = get_requirement(name) except InvalidRequirement as exc: raise InstallationError(f"Invalid requirement: {name!r}: {exc}") else: req = None link = Link(url) return RequirementParts(req, link, None, extras_override) # ---- The actual constructors follow ---- def install_req_from_editable( editable_req: str, comes_from: InstallRequirement | str | None = None, *, isolated: bool = False, hash_options: dict[str, list[str]] | None = None, constraint: bool = False, user_supplied: bool = False, permit_editable_wheels: bool = False, config_settings: dict[str, str | list[str]] | None = None, ) -> InstallRequirement: if constraint: raise InstallationError("Editable requirements are not allowed as constraints") parts = parse_req_from_editable(editable_req) return InstallRequirement( parts.requirement, comes_from=comes_from, user_supplied=user_supplied, editable=True, permit_editable_wheels=permit_editable_wheels, link=parts.link, constraint=constraint, isolated=isolated, hash_options=hash_options, config_settings=config_settings, extras=parts.extras, ) def _looks_like_path(name: str) -> bool: """Checks whether the string "looks like" a path on the filesystem. This does not check whether the target actually exists, only judge from the appearance. Returns true if any of the following conditions is true: * a path separator is found (either os.path.sep or os.path.altsep); * a dot is found (which represents the current directory). """ if os.path.sep in name: return True if os.path.altsep is not None and os.path.altsep in name: return True if name.startswith("."): return True return False def _get_url_from_path(path: str, name: str) -> str | None: """ First, it checks whether a provided path is an installable directory. If it is, returns the path. If false, check if the path is an archive file (such as a .whl). The function checks if the path is a file. If false, if the path has an @, it will treat it as a PEP 440 URL requirement and return the path. """ if _looks_like_path(name) and os.path.isdir(path): if is_installable_dir(path): return path_to_url(path) # TODO: The is_installable_dir test here might not be necessary # now that it is done in load_pyproject_toml too. raise InstallationError( f"Directory {name!r} is not installable. Neither 'setup.py' " "nor 'pyproject.toml' found." ) if not is_archive_file(path): return None if os.path.isfile(path): return path_to_url(path) urlreq_parts = name.split("@", 1) if len(urlreq_parts) >= 2 and not _looks_like_path(urlreq_parts[0]): # If the path contains '@' and the part before it does not look # like a path, try to treat it as a PEP 440 URL req instead. return None logger.warning( "Requirement %r looks like a filename, but the file does not exist", name, ) return path_to_url(path) def parse_req_from_line(name: str, line_source: str | None) -> RequirementParts: if is_url(name): marker_sep = "; " else: marker_sep = ";" if marker_sep in name: name, markers_as_string = name.split(marker_sep, 1) markers_as_string = markers_as_string.strip() if not markers_as_string: markers = None else: markers = Marker(markers_as_string) else: markers = None name = name.strip() req_as_string = None path = os.path.normpath(os.path.abspath(name)) link = None extras_as_string = None if is_url(name): link = Link(name) else: p, extras_as_string = _strip_extras(path) url = _get_url_from_path(p, name) if url is not None: link = Link(url) # it's a local file, dir, or url if link: # Handle relative file URLs if link.scheme == "file" and re.search(r"\.\./", link.url): link = Link(path_to_url(os.path.normpath(os.path.abspath(link.path)))) # wheel file if link.is_wheel: wheel = Wheel(link.filename) # can raise InvalidWheelFilename req_as_string = f"{wheel.name}=={wheel.version}" else: # set the req to the egg fragment. when it's not there, this # will become an 'unnamed' requirement req_as_string = link.egg_fragment # a requirement specifier else: req_as_string = name extras = convert_extras(extras_as_string) def with_source(text: str) -> str: if not line_source: return text return f"{text} (from {line_source})" def _parse_req_string(req_as_string: str) -> Requirement: try: return get_requirement(req_as_string) except InvalidRequirement as exc: if os.path.sep in req_as_string: add_msg = "It looks like a path." add_msg += deduce_helpful_msg(req_as_string) elif "=" in req_as_string and not any( op in req_as_string for op in operators ): add_msg = "= is not a valid operator. Did you mean == ?" else: add_msg = "" msg = with_source(f"Invalid requirement: {req_as_string!r}: {exc}") if add_msg: msg += f"\nHint: {add_msg}" raise InstallationError(msg) if req_as_string is not None: req: Requirement | None = _parse_req_string(req_as_string) else: req = None return RequirementParts(req, link, markers, extras) def install_req_from_line( name: str, comes_from: str | InstallRequirement | None = None, *, isolated: bool = False, hash_options: dict[str, list[str]] | None = None, constraint: bool = False, line_source: str | None = None, user_supplied: bool = False, config_settings: dict[str, str | list[str]] | None = None, ) -> InstallRequirement: """Creates an InstallRequirement from a name, which might be a requirement, directory containing 'setup.py', filename, or URL. :param line_source: An optional string describing where the line is from, for logging purposes in case of an error. """ parts = parse_req_from_line(name, line_source) return InstallRequirement( parts.requirement, comes_from, link=parts.link, markers=parts.markers, isolated=isolated, hash_options=hash_options, config_settings=config_settings, constraint=constraint, extras=parts.extras, user_supplied=user_supplied, ) def install_req_from_req_string( req_string: str, comes_from: InstallRequirement | None = None, isolated: bool = False, user_supplied: bool = False, ) -> InstallRequirement: try: req = get_requirement(req_string) except InvalidRequirement as exc: raise InstallationError(f"Invalid requirement: {req_string!r}: {exc}") domains_not_allowed = [ PyPI.file_storage_domain, TestPyPI.file_storage_domain, ] if ( req.url and comes_from and comes_from.link and comes_from.link.netloc in domains_not_allowed ): # Explicitly disallow pypi packages that depend on external urls raise InstallationError( "Packages installed from PyPI cannot depend on packages " "which are not also hosted on PyPI.\n" f"{comes_from.name} depends on {req} " ) return InstallRequirement( req, comes_from, isolated=isolated, user_supplied=user_supplied, ) def install_req_from_parsed_requirement( parsed_req: ParsedRequirement, isolated: bool = False, user_supplied: bool = False, config_settings: dict[str, str | list[str]] | None = None, ) -> InstallRequirement: if parsed_req.is_editable: req = install_req_from_editable( parsed_req.requirement, comes_from=parsed_req.comes_from, constraint=parsed_req.constraint, isolated=isolated, user_supplied=user_supplied, config_settings=config_settings, ) else: req = install_req_from_line( parsed_req.requirement, comes_from=parsed_req.comes_from, isolated=isolated, hash_options=( parsed_req.options.get("hashes", {}) if parsed_req.options else {} ), constraint=parsed_req.constraint, line_source=parsed_req.line_source, user_supplied=user_supplied, config_settings=config_settings, ) return req def install_req_from_link_and_ireq( link: Link, ireq: InstallRequirement ) -> InstallRequirement: return InstallRequirement( req=ireq.req, comes_from=ireq.comes_from, editable=ireq.editable, link=link, markers=ireq.markers, isolated=ireq.isolated, hash_options=ireq.hash_options, config_settings=ireq.config_settings, user_supplied=ireq.user_supplied, ) def install_req_drop_extras(ireq: InstallRequirement) -> InstallRequirement: """ Creates a new InstallationRequirement using the given template but without any extras. Sets the original requirement as the new one's parent (comes_from). """ return InstallRequirement( req=( _set_requirement_extras(ireq.req, set()) if ireq.req is not None else None ), comes_from=ireq, editable=ireq.editable, link=ireq.link, markers=ireq.markers, isolated=ireq.isolated, hash_options=ireq.hash_options, constraint=ireq.constraint, extras=[], config_settings=ireq.config_settings, user_supplied=ireq.user_supplied, permit_editable_wheels=ireq.permit_editable_wheels, ) def install_req_extend_extras( ireq: InstallRequirement, extras: Collection[str], ) -> InstallRequirement: """ Returns a copy of an installation requirement with some additional extras. Makes a shallow copy of the ireq object. """ result = copy.copy(ireq) result.extras = {*ireq.extras, *extras} result.req = ( _set_requirement_extras(ireq.req, result.extras) if ireq.req is not None else None ) return result ================================================ FILE: src/pip/_internal/req/pep723.py ================================================ import re from typing import Any from pip._internal.utils.compat import tomllib REGEX = r"(?m)^# /// (?P[a-zA-Z0-9-]+)$\s(?P(^#(| .*)$\s)+)^# ///$" class PEP723Exception(ValueError): """Raised to indicate a problem when parsing PEP 723 metadata from a script""" def __init__(self, msg: str) -> None: self.msg = msg def pep723_metadata(scriptfile: str) -> dict[str, Any]: with open(scriptfile) as f: script = f.read() name = "script" matches = list( filter(lambda m: m.group("type") == name, re.finditer(REGEX, script)) ) if len(matches) > 1: raise PEP723Exception(f"Multiple {name!r} blocks found in {scriptfile!r}") elif len(matches) == 1: content = "".join( line[2:] if line.startswith("# ") else line[1:] for line in matches[0].group("content").splitlines(keepends=True) ) try: metadata = tomllib.loads(content) except Exception as exc: raise PEP723Exception(f"Failed to parse TOML in {scriptfile!r}") from exc else: raise PEP723Exception( f"File does not contain {name!r} metadata: {scriptfile!r}" ) return metadata ================================================ FILE: src/pip/_internal/req/req_dependency_group.py ================================================ from collections.abc import Iterable, Iterator from typing import Any from pip._vendor.dependency_groups import DependencyGroupResolver from pip._internal.exceptions import InstallationError from pip._internal.utils.compat import tomllib def parse_dependency_groups(groups: list[tuple[str, str]]) -> list[str]: """ Parse dependency groups data as provided via the CLI, in a `[path:]group` syntax. Raises InstallationErrors if anything goes wrong. """ resolvers = _build_resolvers(path for (path, _) in groups) return list(_resolve_all_groups(resolvers, groups)) def _resolve_all_groups( resolvers: dict[str, DependencyGroupResolver], groups: list[tuple[str, str]] ) -> Iterator[str]: """ Run all resolution, converting any error from `DependencyGroupResolver` into an InstallationError. """ for path, groupname in groups: resolver = resolvers[path] try: yield from (str(req) for req in resolver.resolve(groupname)) except (ValueError, TypeError, LookupError) as e: raise InstallationError( f"[dependency-groups] resolution failed for '{groupname}' " f"from '{path}': {e}" ) from e def _build_resolvers(paths: Iterable[str]) -> dict[str, Any]: resolvers = {} for path in paths: if path in resolvers: continue pyproject = _load_pyproject(path) if "dependency-groups" not in pyproject: raise InstallationError( f"[dependency-groups] table was missing from '{path}'. " "Cannot resolve '--group' option." ) raw_dependency_groups = pyproject["dependency-groups"] if not isinstance(raw_dependency_groups, dict): raise InstallationError( f"[dependency-groups] table was malformed in {path}. " "Cannot resolve '--group' option." ) resolvers[path] = DependencyGroupResolver(raw_dependency_groups) return resolvers def _load_pyproject(path: str) -> dict[str, Any]: """ This helper loads a pyproject.toml as TOML. It raises an InstallationError if the operation fails. """ try: with open(path, "rb") as fp: return tomllib.load(fp) except FileNotFoundError: raise InstallationError(f"{path} not found. Cannot resolve '--group' option.") except tomllib.TOMLDecodeError as e: raise InstallationError(f"Error parsing {path}: {e}") from e except OSError as e: raise InstallationError(f"Error reading {path}: {e}") from e ================================================ FILE: src/pip/_internal/req/req_file.py ================================================ """ Requirements file parsing """ from __future__ import annotations import codecs import locale import logging import optparse import os import re import shlex import sys import urllib.parse from collections.abc import Generator, Iterable from dataclasses import dataclass from optparse import Values from typing import ( TYPE_CHECKING, Any, Callable, NoReturn, ) from pip._internal.cli import cmdoptions from pip._internal.exceptions import InstallationError, RequirementsFileParseError from pip._internal.models.release_control import ReleaseControl from pip._internal.models.search_scope import SearchScope if TYPE_CHECKING: from pip._internal.index.package_finder import PackageFinder from pip._internal.network.session import PipSession __all__ = ["parse_requirements"] ReqFileLines = Iterable[tuple[int, str]] LineParser = Callable[[str], tuple[str, Values]] SCHEME_RE = re.compile(r"^(http|https|file):", re.I) COMMENT_RE = re.compile(r"(^|\s+)#.*$") # Matches environment variable-style values in '${MY_VARIABLE_1}' with the # variable name consisting of only uppercase letters, digits or the '_' # (underscore). This follows the POSIX standard defined in IEEE Std 1003.1, # 2013 Edition. ENV_VAR_RE = re.compile(r"(?P\$\{(?P[A-Z0-9_]+)\})") SUPPORTED_OPTIONS: list[Callable[..., optparse.Option]] = [ cmdoptions.index_url, cmdoptions.extra_index_url, cmdoptions.no_index, cmdoptions.constraints, cmdoptions.requirements, cmdoptions.editable, cmdoptions.find_links, cmdoptions.no_binary, cmdoptions.only_binary, cmdoptions.prefer_binary, cmdoptions.require_hashes, cmdoptions.pre, cmdoptions.all_releases, cmdoptions.only_final, cmdoptions.trusted_host, cmdoptions.use_new_feature, ] # options to be passed to requirements SUPPORTED_OPTIONS_REQ: list[Callable[..., optparse.Option]] = [ cmdoptions.hash, cmdoptions.config_settings, ] SUPPORTED_OPTIONS_EDITABLE_REQ: list[Callable[..., optparse.Option]] = [ cmdoptions.config_settings, ] # the 'dest' string values SUPPORTED_OPTIONS_REQ_DEST = [str(o().dest) for o in SUPPORTED_OPTIONS_REQ] SUPPORTED_OPTIONS_EDITABLE_REQ_DEST = [ str(o().dest) for o in SUPPORTED_OPTIONS_EDITABLE_REQ ] # order of BOMS is important: codecs.BOM_UTF16_LE is a prefix of codecs.BOM_UTF32_LE # so data.startswith(BOM_UTF16_LE) would be true for UTF32_LE data BOMS: list[tuple[bytes, str]] = [ (codecs.BOM_UTF8, "utf-8"), (codecs.BOM_UTF32, "utf-32"), (codecs.BOM_UTF32_BE, "utf-32-be"), (codecs.BOM_UTF32_LE, "utf-32-le"), (codecs.BOM_UTF16, "utf-16"), (codecs.BOM_UTF16_BE, "utf-16-be"), (codecs.BOM_UTF16_LE, "utf-16-le"), ] PEP263_ENCODING_RE = re.compile(rb"coding[:=]\s*([-\w.]+)") DEFAULT_ENCODING = "utf-8" logger = logging.getLogger(__name__) @dataclass(frozen=True) class ParsedRequirement: # TODO: replace this with slots=True when dropping Python 3.9 support. __slots__ = ( "requirement", "is_editable", "comes_from", "constraint", "options", "line_source", ) requirement: str is_editable: bool comes_from: str constraint: bool options: dict[str, Any] | None line_source: str | None @dataclass(frozen=True) class ParsedLine: __slots__ = ("filename", "lineno", "args", "opts", "constraint") filename: str lineno: int args: str opts: Values constraint: bool @property def is_editable(self) -> bool: return bool(self.opts.editables) @property def requirement(self) -> str | None: if self.args: return self.args elif self.is_editable: # We don't support multiple -e on one line return self.opts.editables[0] return None def parse_requirements( filename: str, session: PipSession, finder: PackageFinder | None = None, options: optparse.Values | None = None, constraint: bool = False, ) -> Generator[ParsedRequirement, None, None]: """Parse a requirements file and yield ParsedRequirement instances. :param filename: Path or url of requirements file. :param session: PipSession instance. :param finder: Instance of pip.index.PackageFinder. :param options: cli options. :param constraint: If true, parsing a constraint file rather than requirements file. """ line_parser = get_line_parser(finder) parser = RequirementsFileParser(session, line_parser) for parsed_line in parser.parse(filename, constraint): parsed_req = handle_line( parsed_line, options=options, finder=finder, session=session ) if parsed_req is not None: yield parsed_req def preprocess(content: str) -> ReqFileLines: """Split, filter, and join lines, and return a line iterator :param content: the content of the requirements file """ lines_enum: ReqFileLines = enumerate(content.splitlines(), start=1) lines_enum = join_lines(lines_enum) lines_enum = ignore_comments(lines_enum) lines_enum = expand_env_variables(lines_enum) return lines_enum def handle_requirement_line( line: ParsedLine, options: optparse.Values | None = None, ) -> ParsedRequirement: # preserve for the nested code path line_comes_from = "{} {} (line {})".format( "-c" if line.constraint else "-r", line.filename, line.lineno, ) assert line.requirement is not None # get the options that apply to requirements if line.is_editable: supported_dest = SUPPORTED_OPTIONS_EDITABLE_REQ_DEST else: supported_dest = SUPPORTED_OPTIONS_REQ_DEST req_options = {} for dest in supported_dest: if dest in line.opts.__dict__ and line.opts.__dict__[dest]: req_options[dest] = line.opts.__dict__[dest] line_source = f"line {line.lineno} of {line.filename}" return ParsedRequirement( requirement=line.requirement, is_editable=line.is_editable, comes_from=line_comes_from, constraint=line.constraint, options=req_options, line_source=line_source, ) def handle_option_line( opts: Values, filename: str, lineno: int, finder: PackageFinder | None = None, options: optparse.Values | None = None, session: PipSession | None = None, ) -> None: if opts.hashes: logger.warning( "%s line %s has --hash but no requirement, and will be ignored.", filename, lineno, ) if options: # percolate options upward if opts.require_hashes: options.require_hashes = opts.require_hashes if opts.features_enabled: options.features_enabled.extend( f for f in opts.features_enabled if f not in options.features_enabled ) # set finder options if finder: find_links = finder.find_links index_urls = finder.index_urls no_index = finder.search_scope.no_index if opts.no_index is True: no_index = True index_urls = [] if opts.index_url and not no_index: index_urls = [opts.index_url] if opts.extra_index_urls and not no_index: index_urls.extend(opts.extra_index_urls) if opts.find_links: # FIXME: it would be nice to keep track of the source # of the find_links: support a find-links local path # relative to a requirements file. value = opts.find_links[0] req_dir = os.path.dirname(os.path.abspath(filename)) relative_to_reqs_file = os.path.join(req_dir, value) if os.path.exists(relative_to_reqs_file): value = relative_to_reqs_file find_links.append(value) if session: # We need to update the auth urls in session session.update_index_urls(index_urls) search_scope = SearchScope( find_links=find_links, index_urls=index_urls, no_index=no_index, ) finder.search_scope = search_scope # Transform --pre into --all-releases :all: if opts.pre: if not opts.release_control: opts.release_control = ReleaseControl() opts.release_control.all_releases.add(":all:") if opts.release_control: if not finder.release_control: # First time seeing release_control, set it on finder finder.set_release_control(opts.release_control) if opts.prefer_binary: finder.set_prefer_binary() if session: for host in opts.trusted_hosts or []: source = f"line {lineno} of {filename}" session.add_trusted_host(host, source=source) def handle_line( line: ParsedLine, options: optparse.Values | None = None, finder: PackageFinder | None = None, session: PipSession | None = None, ) -> ParsedRequirement | None: """Handle a single parsed requirements line; This can result in creating/yielding requirements, or updating the finder. :param line: The parsed line to be processed. :param options: CLI options. :param finder: The finder - updated by non-requirement lines. :param session: The session - updated by non-requirement lines. Returns a ParsedRequirement object if the line is a requirement line, otherwise returns None. For lines that contain requirements, the only options that have an effect are from SUPPORTED_OPTIONS_REQ, and they are scoped to the requirement. Other options from SUPPORTED_OPTIONS may be present, but are ignored. For lines that do not contain requirements, the only options that have an effect are from SUPPORTED_OPTIONS. Options from SUPPORTED_OPTIONS_REQ may be present, but are ignored. These lines may contain multiple options (although our docs imply only one is supported), and all our parsed and affect the finder. """ if line.requirement is not None: parsed_req = handle_requirement_line(line, options) return parsed_req else: handle_option_line( line.opts, line.filename, line.lineno, finder, options, session, ) return None class RequirementsFileParser: def __init__( self, session: PipSession, line_parser: LineParser, ) -> None: self._session = session self._line_parser = line_parser def parse( self, filename: str, constraint: bool ) -> Generator[ParsedLine, None, None]: """Parse a given file, yielding parsed lines.""" yield from self._parse_and_recurse( filename, constraint, [{os.path.abspath(filename): None}] ) def _parse_and_recurse( self, filename: str, constraint: bool, parsed_files_stack: list[dict[str, str | None]], ) -> Generator[ParsedLine, None, None]: for line in self._parse_file(filename, constraint): if line.requirement is None and ( line.opts.requirements or line.opts.constraints ): # parse a nested requirements file if line.opts.requirements: req_path = line.opts.requirements[0] nested_constraint = False else: req_path = line.opts.constraints[0] nested_constraint = True # original file is over http if SCHEME_RE.search(filename): # do a url join so relative paths work req_path = urllib.parse.urljoin(filename, req_path) # original file and nested file are paths elif not SCHEME_RE.search(req_path): # do a join so relative paths work # and then abspath so that we can identify recursive references req_path = os.path.abspath( os.path.join( os.path.dirname(filename), req_path, ) ) parsed_files = parsed_files_stack[0] if req_path in parsed_files: initial_file = parsed_files[req_path] tail = ( f" and again in {initial_file}" if initial_file is not None else "" ) raise RequirementsFileParseError( f"{req_path} recursively references itself in {filename}{tail}" ) # Keeping a track where was each file first included in new_parsed_files = parsed_files.copy() new_parsed_files[req_path] = filename yield from self._parse_and_recurse( req_path, nested_constraint, [new_parsed_files, *parsed_files_stack] ) else: yield line def _parse_file( self, filename: str, constraint: bool ) -> Generator[ParsedLine, None, None]: _, content = get_file_content(filename, self._session, constraint=constraint) lines_enum = preprocess(content) for line_number, line in lines_enum: try: args_str, opts = self._line_parser(line) except OptionParsingError as e: # add offending line msg = f"Invalid requirement: {line}\n{e.msg}" raise RequirementsFileParseError(msg) yield ParsedLine( filename, line_number, args_str, opts, constraint, ) def get_line_parser(finder: PackageFinder | None) -> LineParser: def parse_line(line: str) -> tuple[str, Values]: # Build new parser for each line since it accumulates appendable # options. parser = build_parser() defaults = parser.get_default_values() defaults.index_url = None if finder: defaults.format_control = finder.format_control defaults.release_control = finder.release_control args_str, options_str = break_args_options(line) try: options = shlex.split(options_str) except ValueError as e: raise OptionParsingError(f"Could not split options: {options_str}") from e opts, _ = parser.parse_args(options, defaults) return args_str, opts return parse_line def break_args_options(line: str) -> tuple[str, str]: """Break up the line into an args and options string. We only want to shlex (and then optparse) the options, not the args. args can contain markers which are corrupted by shlex. """ tokens = line.split(" ") args = [] options = tokens[:] for token in tokens: if token.startswith(("-", "--")): break else: args.append(token) options.pop(0) return " ".join(args), " ".join(options) class OptionParsingError(Exception): def __init__(self, msg: str) -> None: self.msg = msg def build_parser() -> optparse.OptionParser: """ Return a parser for parsing requirement lines """ parser = optparse.OptionParser(add_help_option=False) option_factories = SUPPORTED_OPTIONS + SUPPORTED_OPTIONS_REQ for option_factory in option_factories: option = option_factory() parser.add_option(option) # By default optparse sys.exits on parsing errors. We want to wrap # that in our own exception. def parser_exit(self: Any, msg: str) -> NoReturn: raise OptionParsingError(msg) # NOTE: mypy disallows assigning to a method # https://github.com/python/mypy/issues/2427 parser.exit = parser_exit # type: ignore return parser def join_lines(lines_enum: ReqFileLines) -> ReqFileLines: """Joins a line ending in '\' with the previous line (except when following comments). The joined line takes on the index of the first line. """ primary_line_number = None new_line: list[str] = [] for line_number, line in lines_enum: if not line.endswith("\\") or COMMENT_RE.match(line): if COMMENT_RE.match(line): # this ensures comments are always matched later line = " " + line if new_line: new_line.append(line) assert primary_line_number is not None yield primary_line_number, "".join(new_line) new_line = [] else: yield line_number, line else: if not new_line: primary_line_number = line_number new_line.append(line.strip("\\")) # last line contains \ if new_line: assert primary_line_number is not None yield primary_line_number, "".join(new_line) # TODO: handle space after '\'. def ignore_comments(lines_enum: ReqFileLines) -> ReqFileLines: """ Strips comments and filter empty lines. """ for line_number, line in lines_enum: line = COMMENT_RE.sub("", line) line = line.strip() if line: yield line_number, line def expand_env_variables(lines_enum: ReqFileLines) -> ReqFileLines: """Replace all environment variables that can be retrieved via `os.getenv`. The only allowed format for environment variables defined in the requirement file is `${MY_VARIABLE_1}` to ensure two things: 1. Strings that contain a `$` aren't accidentally (partially) expanded. 2. Ensure consistency across platforms for requirement files. These points are the result of a discussion on the `github pull request #3514 `_. Valid characters in variable names follow the `POSIX standard `_ and are limited to uppercase letter, digits and the `_` (underscore). """ for line_number, line in lines_enum: for env_var, var_name in ENV_VAR_RE.findall(line): value = os.getenv(var_name) if not value: continue line = line.replace(env_var, value) yield line_number, line def get_file_content( url: str, session: PipSession, *, constraint: bool = False ) -> tuple[str, str]: """Gets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode. Respects # -*- coding: declarations on the retrieved files. :param url: File path or url. :param session: PipSession instance. """ scheme = urllib.parse.urlsplit(url).scheme # Pip has special support for file:// URLs (LocalFSAdapter). if scheme in ["http", "https", "file"]: # Delay importing heavy network modules until absolutely necessary. from pip._internal.network.utils import raise_for_status resp = session.get(url) raise_for_status(resp) return resp.url, resp.text # Assume this is a bare path. try: with open(url, "rb") as f: raw_content = f.read() except OSError as exc: kind = "constraint" if constraint else "requirements" raise InstallationError(f"Could not open {kind} file: {exc}") content = _decode_req_file(raw_content, url) return url, content def _decode_req_file(data: bytes, url: str) -> str: for bom, encoding in BOMS: if data.startswith(bom): return data[len(bom) :].decode(encoding) for line in data.split(b"\n")[:2]: if line[0:1] == b"#": result = PEP263_ENCODING_RE.search(line) if result is not None: encoding = result.groups()[0].decode("ascii") return data.decode(encoding) try: return data.decode(DEFAULT_ENCODING) except UnicodeDecodeError: locale_encoding = locale.getpreferredencoding(False) or sys.getdefaultencoding() logging.warning( "unable to decode data from %s with default encoding %s, " "falling back to encoding from locale: %s. " "If this is intentional you should specify the encoding with a " "PEP-263 style comment, e.g. '# -*- coding: %s -*-'", url, DEFAULT_ENCODING, locale_encoding, locale_encoding, ) return data.decode(locale_encoding) ================================================ FILE: src/pip/_internal/req/req_install.py ================================================ from __future__ import annotations import functools import logging import os import shutil import sys import uuid import zipfile from collections.abc import Collection, Iterable from optparse import Values from pathlib import Path from typing import Any from pip._vendor.packaging.markers import Marker from pip._vendor.packaging.requirements import Requirement from pip._vendor.packaging.specifiers import SpecifierSet from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.packaging.version import Version from pip._vendor.packaging.version import parse as parse_version from pip._vendor.pyproject_hooks import BuildBackendHookCaller from pip._internal.build_env import BuildEnvironment, NoOpBuildEnvironment from pip._internal.exceptions import InstallationError, PreviousBuildDirError from pip._internal.locations import get_scheme from pip._internal.metadata import ( BaseDistribution, get_default_environment, get_directory_distribution, get_wheel_distribution, ) from pip._internal.metadata.base import FilesystemWheel from pip._internal.models.direct_url import DirectUrl from pip._internal.models.link import Link from pip._internal.operations.build.metadata import generate_metadata from pip._internal.operations.build.metadata_editable import generate_editable_metadata from pip._internal.operations.install.wheel import install_wheel from pip._internal.pyproject import load_pyproject_toml, make_pyproject_path from pip._internal.req.req_uninstall import UninstallPathSet from pip._internal.utils.deprecation import deprecated from pip._internal.utils.hashes import Hashes from pip._internal.utils.misc import ( ConfiguredBuildBackendHookCaller, ask_path_exists, backup_dir, display_path, hide_url, is_installable_dir, redact_auth_from_requirement, redact_auth_from_url, ) from pip._internal.utils.packaging import get_requirement from pip._internal.utils.subprocess import runner_with_spinner_message from pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds from pip._internal.utils.unpacking import unpack_file from pip._internal.utils.virtualenv import running_under_virtualenv from pip._internal.vcs import vcs logger = logging.getLogger(__name__) class InstallRequirement: """ Represents something that may be installed later on, may have information about where to fetch the relevant requirement and also contains logic for installing the said requirement. """ def __init__( self, req: Requirement | None, comes_from: str | InstallRequirement | None, editable: bool = False, link: Link | None = None, markers: Marker | None = None, isolated: bool = False, *, hash_options: dict[str, list[str]] | None = None, config_settings: dict[str, str | list[str]] | None = None, constraint: bool = False, extras: Collection[str] = (), user_supplied: bool = False, permit_editable_wheels: bool = False, ) -> None: assert req is None or isinstance(req, Requirement), req self.req = req self.comes_from = comes_from self.constraint = constraint self.editable = editable self.permit_editable_wheels = permit_editable_wheels # source_dir is the local directory where the linked requirement is # located, or unpacked. In case unpacking is needed, creating and # populating source_dir is done by the RequirementPreparer. Note this # is not necessarily the directory where pyproject.toml or setup.py is # located - that one is obtained via unpacked_source_directory. self.source_dir: str | None = None if self.editable: assert link if link.is_file: self.source_dir = os.path.normpath(os.path.abspath(link.file_path)) # original_link is the direct URL that was provided by the user for the # requirement, either directly or via a constraints file. if link is None and req and req.url: # PEP 508 URL requirement link = Link(req.url) self.link = self.original_link = link # When this InstallRequirement is a wheel obtained from the cache of locally # built wheels, this is the source link corresponding to the cache entry, which # was used to download and build the cached wheel. self.cached_wheel_source_link: Link | None = None # Information about the location of the artifact that was downloaded . This # property is guaranteed to be set in resolver results. self.download_info: DirectUrl | None = None # Path to any downloaded or already-existing package. self.local_file_path: str | None = None if self.link and self.link.is_file: self.local_file_path = self.link.file_path if extras: self.extras = extras elif req: self.extras = req.extras else: self.extras = set() if markers is None and req: markers = req.marker self.markers = markers # This holds the Distribution object if this requirement is already installed. self.satisfied_by: BaseDistribution | None = None # Whether the installation process should try to uninstall an existing # distribution before installing this requirement. self.should_reinstall = False # Temporary build location self._temp_build_dir: TempDirectory | None = None # Set to True after successful installation self.install_succeeded: bool | None = None # Supplied options self.hash_options = hash_options if hash_options else {} self.config_settings = config_settings # Set to True after successful preparation of this requirement self.prepared = False # User supplied requirement are explicitly requested for installation # by the user via CLI arguments or requirements files, as opposed to, # e.g. dependencies, extras or constraints. self.user_supplied = user_supplied self.isolated = isolated self.build_env: BuildEnvironment = NoOpBuildEnvironment() # For PEP 517, the directory where we request the project metadata # gets stored. We need this to pass to build_wheel, so the backend # can ensure that the wheel matches the metadata (see the PEP for # details). self.metadata_directory: str | None = None # The cached metadata distribution that this requirement represents. # See get_dist / set_dist. self._distribution: BaseDistribution | None = None # The static build requirements (from pyproject.toml) self.pyproject_requires: list[str] | None = None # Build requirements that we will check are available self.requirements_to_check: list[str] = [] # The PEP 517 backend we should use to build the project self.pep517_backend: BuildBackendHookCaller | None = None # This requirement needs more preparation before it can be built self.needs_more_preparation = False # This requirement needs to be unpacked before it can be installed. self._archive_source: Path | None = None def __str__(self) -> str: if self.req: s = redact_auth_from_requirement(self.req) if self.link: s += f" from {redact_auth_from_url(self.link.url)}" elif self.link: s = redact_auth_from_url(self.link.url) else: s = "" if self.satisfied_by is not None: if self.satisfied_by.location is not None: location = display_path(self.satisfied_by.location) else: location = "" s += f" in {location}" if self.comes_from: if isinstance(self.comes_from, str): comes_from: str | None = self.comes_from else: comes_from = self.comes_from.from_path() if comes_from: s += f" (from {comes_from})" return s def __repr__(self) -> str: return ( f"<{self.__class__.__name__} object: " f"{str(self)} editable={self.editable!r}>" ) def format_debug(self) -> str: """An un-tested helper for getting state, for debugging.""" attributes = vars(self) names = sorted(attributes) state = (f"{attr}={attributes[attr]!r}" for attr in sorted(names)) return "<{name} object: {{{state}}}>".format( name=self.__class__.__name__, state=", ".join(state), ) # Things that are valid for all kinds of requirements? @property def name(self) -> str | None: if self.req is None: return None return self.req.name @functools.cached_property def supports_pyproject_editable(self) -> bool: assert self.pep517_backend with self.build_env: runner = runner_with_spinner_message( "Checking if build backend supports build_editable" ) with self.pep517_backend.subprocess_runner(runner): return "build_editable" in self.pep517_backend._supported_features() @property def specifier(self) -> SpecifierSet: assert self.req is not None return self.req.specifier @property def is_direct(self) -> bool: """Whether this requirement was specified as a direct URL.""" return self.original_link is not None @property def is_pinned(self) -> bool: """Return whether I am pinned to an exact version. For example, some-package==1.2 is pinned; some-package>1.2 is not. """ assert self.req is not None specifiers = self.req.specifier return len(specifiers) == 1 and next(iter(specifiers)).operator in {"==", "==="} def match_markers(self, extras_requested: Iterable[str] | None = None) -> bool: if not extras_requested: # Provide an extra to safely evaluate the markers # without matching any extra extras_requested = ("",) if self.markers is not None: return any( self.markers.evaluate({"extra": extra}) for extra in extras_requested ) else: return True @property def has_hash_options(self) -> bool: """Return whether any known-good hashes are specified as options. These activate --require-hashes mode; hashes specified as part of a URL do not. """ return bool(self.hash_options) def hashes(self, trust_internet: bool = True) -> Hashes: """Return a hash-comparer that considers my option- and URL-based hashes to be known-good. Hashes in URLs--ones embedded in the requirements file, not ones downloaded from an index server--are almost peers with ones from flags. They satisfy --require-hashes (whether it was implicitly or explicitly activated) but do not activate it. md5 and sha224 are not allowed in flags, which should nudge people toward good algos. We always OR all hashes together, even ones from URLs. :param trust_internet: Whether to trust URL-based (#md5=...) hashes downloaded from the internet, as by populate_link() """ good_hashes = self.hash_options.copy() if trust_internet: link = self.link elif self.is_direct and self.user_supplied: link = self.original_link else: link = None if link and link.hash: assert link.hash_name is not None good_hashes.setdefault(link.hash_name, []).append(link.hash) return Hashes(good_hashes) def from_path(self) -> str | None: """Format a nice indicator to show where this "comes from" """ if self.req is None: return None s = str(self.req) if self.comes_from: comes_from: str | None if isinstance(self.comes_from, str): comes_from = self.comes_from else: comes_from = self.comes_from.from_path() if comes_from: s += "->" + comes_from return s def ensure_build_location( self, build_dir: str, autodelete: bool, parallel_builds: bool ) -> str: assert build_dir is not None if self._temp_build_dir is not None: assert self._temp_build_dir.path return self._temp_build_dir.path if self.req is None: # Some systems have /tmp as a symlink which confuses custom # builds (such as numpy). Thus, we ensure that the real path # is returned. self._temp_build_dir = TempDirectory( kind=tempdir_kinds.REQ_BUILD, globally_managed=True ) return self._temp_build_dir.path # This is the only remaining place where we manually determine the path # for the temporary directory. It is only needed for editables where # it is the value of the --src option. # When parallel builds are enabled, add a UUID to the build directory # name so multiple builds do not interfere with each other. dir_name: str = canonicalize_name(self.req.name) if parallel_builds: dir_name = f"{dir_name}_{uuid.uuid4().hex}" # FIXME: Is there a better place to create the build_dir? (hg and bzr # need this) if not os.path.exists(build_dir): logger.debug("Creating directory %s", build_dir) os.makedirs(build_dir) actual_build_dir = os.path.join(build_dir, dir_name) # `None` indicates that we respect the globally-configured deletion # settings, which is what we actually want when auto-deleting. delete_arg = None if autodelete else False return TempDirectory( path=actual_build_dir, delete=delete_arg, kind=tempdir_kinds.REQ_BUILD, globally_managed=True, ).path def _set_requirement(self) -> None: """Set requirement after generating metadata.""" assert self.req is None assert self.metadata is not None assert self.source_dir is not None # Construct a Requirement object from the generated metadata if isinstance(parse_version(self.metadata["Version"]), Version): op = "==" else: op = "===" self.req = get_requirement( "".join( [ self.metadata["Name"], op, self.metadata["Version"], ] ) ) def warn_on_mismatching_name(self) -> None: assert self.req is not None metadata_name = canonicalize_name(self.metadata["Name"]) if canonicalize_name(self.req.name) == metadata_name: # Everything is fine. return # If we're here, there's a mismatch. Log a warning about it. logger.warning( "Generating metadata for package %s " "produced metadata for project name %s. Fix your " "#egg=%s fragments.", self.name, metadata_name, self.name, ) self.req = get_requirement(metadata_name) def check_if_exists(self, use_user_site: bool) -> None: """Find an installed distribution that satisfies or conflicts with this requirement, and set self.satisfied_by or self.should_reinstall appropriately. """ if self.req is None: return existing_dist = get_default_environment().get_distribution(self.req.name) if not existing_dist: return version_compatible = self.req.specifier.contains( existing_dist.version, prereleases=True, ) if not version_compatible: self.satisfied_by = None if use_user_site: if existing_dist.in_usersite: self.should_reinstall = True elif running_under_virtualenv() and existing_dist.in_site_packages: raise InstallationError( f"Will not install to the user site because it will " f"lack sys.path precedence to {existing_dist.raw_name} " f"in {existing_dist.location}" ) else: self.should_reinstall = True else: if self.editable: self.should_reinstall = True # when installing editables, nothing pre-existing should ever # satisfy self.satisfied_by = None else: self.satisfied_by = existing_dist # Things valid for wheels @property def is_wheel(self) -> bool: if not self.link: return False return self.link.is_wheel @property def is_wheel_from_cache(self) -> bool: # When True, it means that this InstallRequirement is a local wheel file in the # cache of locally built wheels. return self.cached_wheel_source_link is not None # Things valid for sdists @property def unpacked_source_directory(self) -> str: assert self.source_dir, f"No source dir for {self}" return os.path.join( self.source_dir, self.link and self.link.subdirectory_fragment or "" ) @property def setup_py_path(self) -> str: assert self.source_dir, f"No source dir for {self}" setup_py = os.path.join(self.unpacked_source_directory, "setup.py") return setup_py @property def pyproject_toml_path(self) -> str: assert self.source_dir, f"No source dir for {self}" return make_pyproject_path(self.unpacked_source_directory) def load_pyproject_toml(self) -> None: """Load the pyproject.toml file. After calling this routine, all of the attributes related to PEP 517 processing for this requirement have been set. """ pyproject_toml_data = load_pyproject_toml( self.pyproject_toml_path, self.setup_py_path, str(self) ) assert pyproject_toml_data requires, backend, check, backend_path = pyproject_toml_data self.requirements_to_check = check self.pyproject_requires = requires self.pep517_backend = ConfiguredBuildBackendHookCaller( self, self.unpacked_source_directory, backend, backend_path=backend_path, ) def editable_sanity_check(self) -> None: """Check that an editable requirement if valid for use with PEP 517/518. This verifies that an editable has a build backend that supports PEP 660. """ if self.editable and not self.supports_pyproject_editable: raise InstallationError( f"Project {self} uses a build backend " f"that is missing the 'build_editable' hook, so " f"it cannot be installed in editable mode. " f"Consider using a build backend that supports PEP 660." ) def prepare_metadata(self) -> None: """Ensure that project metadata is available. Under PEP 517 and PEP 660, call the backend hook to prepare the metadata. Under legacy processing, call setup.py egg-info. """ assert self.source_dir, f"No source dir for {self}" details = self.name or f"from {self.link}" assert self.pep517_backend is not None if ( self.editable and self.permit_editable_wheels and self.supports_pyproject_editable ): self.metadata_directory = generate_editable_metadata( build_env=self.build_env, backend=self.pep517_backend, details=details, ) else: self.metadata_directory = generate_metadata( build_env=self.build_env, backend=self.pep517_backend, details=details, ) # Act on the newly generated metadata, based on the name and version. if not self.name: self._set_requirement() else: self.warn_on_mismatching_name() self.assert_source_matches_version() @property def metadata(self) -> Any: if not hasattr(self, "_metadata"): self._metadata = self.get_dist().metadata return self._metadata def set_dist(self, distribution: BaseDistribution) -> None: self._distribution = distribution def get_dist(self) -> BaseDistribution: if self._distribution is not None: return self._distribution elif self.metadata_directory: return get_directory_distribution(self.metadata_directory) elif self.local_file_path and self.is_wheel: assert self.req is not None return get_wheel_distribution( FilesystemWheel(self.local_file_path), canonicalize_name(self.req.name), ) raise AssertionError( f"InstallRequirement {self} has no metadata directory and no wheel: " f"can't make a distribution." ) def assert_source_matches_version(self) -> None: assert self.source_dir, f"No source dir for {self}" version = self.metadata["version"] if self.req and self.req.specifier and version not in self.req.specifier: logger.warning( "Requested %s, but installing version %s", self, version, ) else: logger.debug( "Source in %s has version %s, which satisfies requirement %s", display_path(self.source_dir), version, self, ) # For both source distributions and editables def ensure_has_source_dir( self, parent_dir: str, autodelete: bool = False, parallel_builds: bool = False, ) -> None: """Ensure that a source_dir is set. This will create a temporary build dir if the name of the requirement isn't known yet. :param parent_dir: The ideal pip parent_dir for the source_dir. Generally src_dir for editables and build_dir for sdists. :return: self.source_dir """ if self.source_dir is None: self.source_dir = self.ensure_build_location( parent_dir, autodelete=autodelete, parallel_builds=parallel_builds, ) def needs_unpacked_archive(self, archive_source: Path) -> None: assert self._archive_source is None self._archive_source = archive_source def ensure_pristine_source_checkout(self) -> None: """Ensure the source directory has not yet been built in.""" assert self.source_dir is not None if self._archive_source is not None: unpack_file(str(self._archive_source), self.source_dir) elif is_installable_dir(self.source_dir): # If a checkout exists, it's unwise to keep going. # version inconsistencies are logged later, but do not fail # the installation. raise PreviousBuildDirError( f"pip can't proceed with requirements '{self}' due to a " f"pre-existing build directory ({self.source_dir}). This is likely " "due to a previous installation that failed . pip is " "being responsible and not assuming it can delete this. " "Please delete it and try again." ) # For editable installations def update_editable(self) -> None: if not self.link: logger.debug( "Cannot update repository at %s; repository location is unknown", self.source_dir, ) return assert self.editable assert self.source_dir if self.link.scheme == "file": # Static paths don't get updated return vcs_backend = vcs.get_backend_for_scheme(self.link.scheme) # Editable requirements are validated in Requirement constructors. # So here, if it's neither a path nor a valid VCS URL, it's a bug. assert vcs_backend, f"Unsupported VCS URL {self.link.url}" hidden_url = hide_url(self.link.url) vcs_backend.obtain(self.source_dir, url=hidden_url, verbosity=0) # Top-level Actions def uninstall( self, auto_confirm: bool = False, verbose: bool = False ) -> UninstallPathSet | None: """ Uninstall the distribution currently satisfying this requirement. Prompts before removing or modifying files unless ``auto_confirm`` is True. Refuses to delete or modify files outside of ``sys.prefix`` - thus uninstallation within a virtual environment can only modify that virtual environment, even if the virtualenv is linked to global site-packages. """ assert self.req dist = get_default_environment().get_distribution(self.req.name) if not dist: logger.warning("Skipping %s as it is not installed.", self.name) return None logger.info("Found existing installation: %s", dist) uninstalled_pathset = UninstallPathSet.from_dist(dist) uninstalled_pathset.remove(auto_confirm, verbose) return uninstalled_pathset def _get_archive_name(self, path: str, parentdir: str, rootdir: str) -> str: def _clean_zip_name(name: str, prefix: str) -> str: assert name.startswith( prefix + os.path.sep ), f"name {name!r} doesn't start with prefix {prefix!r}" name = name[len(prefix) + 1 :] name = name.replace(os.path.sep, "/") return name assert self.req is not None path = os.path.join(parentdir, path) name = _clean_zip_name(path, rootdir) return self.req.name + "/" + name def archive(self, build_dir: str | None) -> None: """Saves archive to provided build_dir. Used for saving downloaded VCS requirements as part of `pip download`. """ assert self.source_dir if build_dir is None: return create_archive = True archive_name = "{}-{}.zip".format(self.name, self.metadata["version"]) archive_path = os.path.join(build_dir, archive_name) if os.path.exists(archive_path): response = ask_path_exists( f"The file {display_path(archive_path)} exists. (i)gnore, (w)ipe, " "(b)ackup, (a)bort ", ("i", "w", "b", "a"), ) if response == "i": create_archive = False elif response == "w": logger.warning("Deleting %s", display_path(archive_path)) os.remove(archive_path) elif response == "b": dest_file = backup_dir(archive_path) logger.warning( "Backing up %s to %s", display_path(archive_path), display_path(dest_file), ) shutil.move(archive_path, dest_file) elif response == "a": sys.exit(-1) if not create_archive: return zip_output = zipfile.ZipFile( archive_path, "w", zipfile.ZIP_DEFLATED, allowZip64=True, ) with zip_output: dir = os.path.normcase(os.path.abspath(self.unpacked_source_directory)) for dirpath, dirnames, filenames in os.walk(dir): for dirname in dirnames: dir_arcname = self._get_archive_name( dirname, parentdir=dirpath, rootdir=dir, ) zipdir = zipfile.ZipInfo(dir_arcname + "/") zipdir.external_attr = 0x1ED << 16 # 0o755 zip_output.writestr(zipdir, "") for filename in filenames: file_arcname = self._get_archive_name( filename, parentdir=dirpath, rootdir=dir, ) filename = os.path.join(dirpath, filename) zip_output.write(filename, file_arcname) logger.info("Saved %s", display_path(archive_path)) def install( self, root: str | None = None, home: str | None = None, prefix: str | None = None, warn_script_location: bool = True, use_user_site: bool = False, pycompile: bool = True, ) -> None: assert self.req is not None scheme = get_scheme( self.req.name, user=use_user_site, home=home, root=root, isolated=self.isolated, prefix=prefix, ) assert self.is_wheel assert self.local_file_path install_wheel( self.req.name, self.local_file_path, scheme=scheme, req_description=str(self.req), pycompile=pycompile, warn_script_location=warn_script_location, direct_url=self.download_info if self.is_direct else None, requested=self.user_supplied, ) self.install_succeeded = True def check_invalid_constraint_type(req: InstallRequirement) -> str: # Check for unsupported forms problem = "" if not req.name: problem = "Unnamed requirements are not allowed as constraints" elif req.editable: problem = "Editable requirements are not allowed as constraints" elif req.extras: problem = "Constraints cannot have extras" if problem: deprecated( reason=( "Constraints are only allowed to take the form of a package " "name and a version specifier. Other forms were originally " "permitted as an accident of the implementation, but were " "undocumented. The new implementation of the resolver no " "longer supports these forms." ), replacement="replacing the constraint with a requirement", # No plan yet for when the new resolver becomes default gone_in=None, issue=8210, ) return problem def _has_option(options: Values, reqs: list[InstallRequirement], option: str) -> bool: if getattr(options, option, None): return True for req in reqs: if getattr(req, option, None): return True return False ================================================ FILE: src/pip/_internal/req/req_set.py ================================================ import logging from collections import OrderedDict from pip._vendor.packaging.utils import canonicalize_name from pip._internal.req.req_install import InstallRequirement logger = logging.getLogger(__name__) class RequirementSet: def __init__(self, check_supported_wheels: bool = True) -> None: """Create a RequirementSet.""" self.requirements: dict[str, InstallRequirement] = OrderedDict() self.check_supported_wheels = check_supported_wheels self.unnamed_requirements: list[InstallRequirement] = [] def __str__(self) -> str: requirements = sorted( (req for req in self.requirements.values() if not req.comes_from), key=lambda req: canonicalize_name(req.name or ""), ) return " ".join(str(req.req) for req in requirements) def __repr__(self) -> str: requirements = sorted( self.requirements.values(), key=lambda req: canonicalize_name(req.name or ""), ) format_string = "<{classname} object; {count} requirement(s): {reqs}>" return format_string.format( classname=self.__class__.__name__, count=len(requirements), reqs=", ".join(str(req.req) for req in requirements), ) def add_unnamed_requirement(self, install_req: InstallRequirement) -> None: assert not install_req.name self.unnamed_requirements.append(install_req) def add_named_requirement(self, install_req: InstallRequirement) -> None: assert install_req.name project_name = canonicalize_name(install_req.name) self.requirements[project_name] = install_req def has_requirement(self, name: str) -> bool: project_name = canonicalize_name(name) return ( project_name in self.requirements and not self.requirements[project_name].constraint ) def get_requirement(self, name: str) -> InstallRequirement: project_name = canonicalize_name(name) if project_name in self.requirements: return self.requirements[project_name] raise KeyError(f"No project with the name {name!r}") @property def all_requirements(self) -> list[InstallRequirement]: return self.unnamed_requirements + list(self.requirements.values()) @property def requirements_to_install(self) -> list[InstallRequirement]: """Return the list of requirements that need to be installed. TODO remove this property together with the legacy resolver, since the new resolver only returns requirements that need to be installed. """ return [ install_req for install_req in self.all_requirements if not install_req.constraint and not install_req.satisfied_by ] ================================================ FILE: src/pip/_internal/req/req_uninstall.py ================================================ from __future__ import annotations import functools import os import sys import sysconfig from collections.abc import Generator, Iterable from importlib.util import cache_from_source from typing import Any, Callable from pip._internal.exceptions import LegacyDistutilsInstall, UninstallMissingRecord from pip._internal.locations import get_bin_prefix, get_bin_user from pip._internal.metadata import BaseDistribution from pip._internal.utils.compat import WINDOWS from pip._internal.utils.egg_link import egg_link_path_from_location from pip._internal.utils.logging import getLogger, indent_log from pip._internal.utils.misc import ask, normalize_path, renames, rmtree from pip._internal.utils.temp_dir import AdjacentTempDirectory, TempDirectory from pip._internal.utils.virtualenv import running_under_virtualenv logger = getLogger(__name__) def _script_names( bin_dir: str, script_name: str, is_gui: bool ) -> Generator[str, None, None]: """Create the fully qualified name of the files created by {console,gui}_scripts for the given ``dist``. Returns the list of file names """ exe_name = os.path.join(bin_dir, script_name) yield exe_name if not WINDOWS: return yield f"{exe_name}.exe" yield f"{exe_name}.exe.manifest" if is_gui: yield f"{exe_name}-script.pyw" else: yield f"{exe_name}-script.py" def _unique( fn: Callable[..., Generator[Any, None, None]], ) -> Callable[..., Generator[Any, None, None]]: @functools.wraps(fn) def unique(*args: Any, **kw: Any) -> Generator[Any, None, None]: seen: set[Any] = set() for item in fn(*args, **kw): if item not in seen: seen.add(item) yield item return unique @_unique def uninstallation_paths(dist: BaseDistribution) -> Generator[str, None, None]: """ Yield all the uninstallation paths for dist based on RECORD-without-.py[co] Yield paths to all the files in RECORD. For each .py file in RECORD, add the .pyc and .pyo in the same directory. UninstallPathSet.add() takes care of the __pycache__ .py[co]. If RECORD is not found, raises an error, with possible information from the INSTALLER file. https://packaging.python.org/specifications/recording-installed-packages/ """ location = dist.location assert location is not None, "not installed" entries = dist.iter_declared_entries() if entries is None: raise UninstallMissingRecord(distribution=dist) for entry in entries: path = os.path.join(location, entry) yield path if path.endswith(".py"): dn, fn = os.path.split(path) base = fn[:-3] path = os.path.join(dn, base + ".pyc") yield path path = os.path.join(dn, base + ".pyo") yield path def compact(paths: Iterable[str]) -> set[str]: """Compact a path set to contain the minimal number of paths necessary to contain all paths in the set. If /a/path/ and /a/path/to/a/file.txt are both in the set, leave only the shorter path.""" sep = os.path.sep short_paths: set[str] = set() for path in sorted(paths, key=len): should_skip = any( path.startswith(shortpath.rstrip("*")) and path[len(shortpath.rstrip("*").rstrip(sep))] == sep for shortpath in short_paths ) if not should_skip: short_paths.add(path) return short_paths def compress_for_rename(paths: Iterable[str]) -> set[str]: """Returns a set containing the paths that need to be renamed. This set may include directories when the original sequence of paths included every file on disk. """ case_map = {os.path.normcase(p): p for p in paths} remaining = set(case_map) unchecked = sorted({os.path.split(p)[0] for p in case_map.values()}, key=len) wildcards: set[str] = set() def norm_join(*a: str) -> str: return os.path.normcase(os.path.join(*a)) for root in unchecked: if any(os.path.normcase(root).startswith(w) for w in wildcards): # This directory has already been handled. continue all_files: set[str] = set() all_subdirs: set[str] = set() for dirname, subdirs, files in os.walk(root): all_subdirs.update(norm_join(root, dirname, d) for d in subdirs) all_files.update(norm_join(root, dirname, f) for f in files) # If all the files we found are in our remaining set of files to # remove, then remove them from the latter set and add a wildcard # for the directory. if not (all_files - remaining): remaining.difference_update(all_files) wildcards.add(root + os.sep) return set(map(case_map.__getitem__, remaining)) | wildcards def compress_for_output_listing(paths: Iterable[str]) -> tuple[set[str], set[str]]: """Returns a tuple of 2 sets of which paths to display to user The first set contains paths that would be deleted. Files of a package are not added and the top-level directory of the package has a '*' added at the end - to signify that all it's contents are removed. The second set contains files that would have been skipped in the above folders. """ will_remove = set(paths) will_skip = set() # Determine folders and files folders = set() files = set() for path in will_remove: if path.endswith(".pyc"): continue if path.endswith("__init__.py") or ".dist-info" in path: folders.add(os.path.dirname(path)) files.add(path) _normcased_files = set(map(os.path.normcase, files)) folders = compact(folders) # This walks the tree using os.walk to not miss extra folders # that might get added. for folder in folders: for dirpath, _, dirfiles in os.walk(folder): for fname in dirfiles: if fname.endswith(".pyc"): continue file_ = os.path.join(dirpath, fname) if ( os.path.isfile(file_) and os.path.normcase(file_) not in _normcased_files ): # We are skipping this file. Add it to the set. will_skip.add(file_) will_remove = files | {os.path.join(folder, "*") for folder in folders} return will_remove, will_skip class StashedUninstallPathSet: """A set of file rename operations to stash files while tentatively uninstalling them.""" def __init__(self) -> None: # Mapping from source file root to [Adjacent]TempDirectory # for files under that directory. self._save_dirs: dict[str, TempDirectory] = {} # (old path, new path) tuples for each move that may need # to be undone. self._moves: list[tuple[str, str]] = [] def _get_directory_stash(self, path: str) -> str: """Stashes a directory. Directories are stashed adjacent to their original location if possible, or else moved/copied into the user's temp dir.""" try: save_dir: TempDirectory = AdjacentTempDirectory(path) except OSError: save_dir = TempDirectory(kind="uninstall") self._save_dirs[os.path.normcase(path)] = save_dir return save_dir.path def _get_file_stash(self, path: str) -> str: """Stashes a file. If no root has been provided, one will be created for the directory in the user's temp directory.""" path = os.path.normcase(path) head, old_head = os.path.dirname(path), None save_dir = None while head != old_head: try: save_dir = self._save_dirs[head] break except KeyError: pass head, old_head = os.path.dirname(head), head else: # Did not find any suitable root head = os.path.dirname(path) save_dir = TempDirectory(kind="uninstall") self._save_dirs[head] = save_dir relpath = os.path.relpath(path, head) if relpath and relpath != os.path.curdir: return os.path.join(save_dir.path, relpath) return save_dir.path def stash(self, path: str) -> str: """Stashes the directory or file and returns its new location. Handle symlinks as files to avoid modifying the symlink targets. """ path_is_dir = os.path.isdir(path) and not os.path.islink(path) if path_is_dir: new_path = self._get_directory_stash(path) else: new_path = self._get_file_stash(path) self._moves.append((path, new_path)) if path_is_dir and os.path.isdir(new_path): # If we're moving a directory, we need to # remove the destination first or else it will be # moved to inside the existing directory. # We just created new_path ourselves, so it will # be removable. os.rmdir(new_path) renames(path, new_path) return new_path def commit(self) -> None: """Commits the uninstall by removing stashed files.""" for save_dir in self._save_dirs.values(): save_dir.cleanup() self._moves = [] self._save_dirs = {} def rollback(self) -> None: """Undoes the uninstall by moving stashed files back.""" for p in self._moves: logger.info("Moving to %s\n from %s", *p) for new_path, path in self._moves: try: logger.debug("Replacing %s from %s", new_path, path) if os.path.isfile(new_path) or os.path.islink(new_path): os.unlink(new_path) elif os.path.isdir(new_path): rmtree(new_path) renames(path, new_path) except OSError as ex: logger.error("Failed to restore %s", new_path) logger.debug("Exception: %s", ex) self.commit() @property def can_rollback(self) -> bool: return bool(self._moves) class UninstallPathSet: """A set of file paths to be removed in the uninstallation of a requirement.""" def __init__(self, dist: BaseDistribution) -> None: self._paths: set[str] = set() self._refuse: set[str] = set() self._pth: dict[str, UninstallPthEntries] = {} self._dist = dist self._moved_paths = StashedUninstallPathSet() # Create local cache of normalize_path results. Creating an UninstallPathSet # can result in hundreds/thousands of redundant calls to normalize_path with # the same args, which hurts performance. self._normalize_path_cached = functools.lru_cache(normalize_path) def _permitted(self, path: str) -> bool: """ Return True if the given path is one we are permitted to remove/modify, False otherwise. """ # aka is_local, but caching normalized sys.prefix if not running_under_virtualenv(): return True return path.startswith(self._normalize_path_cached(sys.prefix)) def add(self, path: str) -> None: head, tail = os.path.split(path) # we normalize the head to resolve parent directory symlinks, but not # the tail, since we only want to uninstall symlinks, not their targets path = os.path.join(self._normalize_path_cached(head), os.path.normcase(tail)) if not os.path.exists(path): return if self._permitted(path): self._paths.add(path) else: self._refuse.add(path) # __pycache__ files can show up after 'installed-files.txt' is created, # due to imports if os.path.splitext(path)[1] == ".py": self.add(cache_from_source(path)) def add_pth(self, pth_file: str, entry: str) -> None: pth_file = self._normalize_path_cached(pth_file) if self._permitted(pth_file): if pth_file not in self._pth: self._pth[pth_file] = UninstallPthEntries(pth_file) self._pth[pth_file].add(entry) else: self._refuse.add(pth_file) def remove(self, auto_confirm: bool = False, verbose: bool = False) -> None: """Remove paths in ``self._paths`` with confirmation (unless ``auto_confirm`` is True).""" if not self._paths: logger.info( "Can't uninstall '%s'. No files were found to uninstall.", self._dist.raw_name, ) return dist_name_version = f"{self._dist.raw_name}-{self._dist.raw_version}" logger.info("Uninstalling %s:", dist_name_version) with indent_log(): if auto_confirm or self._allowed_to_proceed(verbose): moved = self._moved_paths for_rename = compress_for_rename(self._paths) for path in sorted(compact(for_rename)): moved.stash(path) logger.verbose("Removing file or directory %s", path) for pth in self._pth.values(): pth.remove() logger.info("Successfully uninstalled %s", dist_name_version) def _allowed_to_proceed(self, verbose: bool) -> bool: """Display which files would be deleted and prompt for confirmation""" def _display(msg: str, paths: Iterable[str]) -> None: if not paths: return logger.info(msg) with indent_log(): for path in sorted(compact(paths)): logger.info(path) if not verbose: will_remove, will_skip = compress_for_output_listing(self._paths) else: # In verbose mode, display all the files that are going to be # deleted. will_remove = set(self._paths) will_skip = set() _display("Would remove:", will_remove) _display("Would not remove (might be manually added):", will_skip) _display("Would not remove (outside of prefix):", self._refuse) if verbose: _display("Will actually move:", compress_for_rename(self._paths)) return ask("Proceed (Y/n)? ", ("y", "n", "")) != "n" def rollback(self) -> None: """Rollback the changes previously made by remove().""" if not self._moved_paths.can_rollback: logger.error( "Can't roll back %s; was not uninstalled", self._dist.raw_name, ) return logger.info("Rolling back uninstall of %s", self._dist.raw_name) self._moved_paths.rollback() for pth in self._pth.values(): pth.rollback() def commit(self) -> None: """Remove temporary save dir: rollback will no longer be possible.""" self._moved_paths.commit() @classmethod def from_dist(cls, dist: BaseDistribution) -> UninstallPathSet: dist_location = dist.location info_location = dist.info_location if dist_location is None: logger.info( "Not uninstalling %s since it is not installed", dist.canonical_name, ) return cls(dist) normalized_dist_location = normalize_path(dist_location) if not dist.local: logger.info( "Not uninstalling %s at %s, outside environment %s", dist.canonical_name, normalized_dist_location, sys.prefix, ) return cls(dist) if normalized_dist_location in { p for p in {sysconfig.get_path("stdlib"), sysconfig.get_path("platstdlib")} if p }: logger.info( "Not uninstalling %s at %s, as it is in the standard library.", dist.canonical_name, normalized_dist_location, ) return cls(dist) paths_to_remove = cls(dist) develop_egg_link = egg_link_path_from_location(dist.raw_name) # Distribution is installed with metadata in a "flat" .egg-info # directory. This means it is not a modern .dist-info installation, an # egg, or legacy editable. setuptools_flat_installation = ( dist.installed_with_setuptools_egg_info and info_location is not None and os.path.exists(info_location) # If dist is editable and the location points to a ``.egg-info``, # we are in fact in the legacy editable case. and not info_location.endswith(f"{dist.setuptools_filename}.egg-info") ) # Uninstall cases order do matter as in the case of 2 installs of the # same package, pip needs to uninstall the currently detected version if setuptools_flat_installation: if info_location is not None: paths_to_remove.add(info_location) installed_files = dist.iter_declared_entries() if installed_files is not None: for installed_file in installed_files: paths_to_remove.add(os.path.join(dist_location, installed_file)) # FIXME: need a test for this elif block # occurs with --single-version-externally-managed/--record outside # of pip elif dist.is_file("top_level.txt"): try: namespace_packages = dist.read_text("namespace_packages.txt") except FileNotFoundError: namespaces = [] else: namespaces = namespace_packages.splitlines(keepends=False) for top_level_pkg in [ p for p in dist.read_text("top_level.txt").splitlines() if p and p not in namespaces ]: path = os.path.join(dist_location, top_level_pkg) paths_to_remove.add(path) paths_to_remove.add(f"{path}.py") paths_to_remove.add(f"{path}.pyc") paths_to_remove.add(f"{path}.pyo") elif dist.installed_by_distutils: raise LegacyDistutilsInstall(distribution=dist) elif dist.installed_as_egg: # package installed by easy_install # We cannot match on dist.egg_name because it can slightly vary # i.e. setuptools-0.6c11-py2.6.egg vs setuptools-0.6rc11-py2.6.egg # XXX We use normalized_dist_location because dist_location my contain # a trailing / if the distribution is a zipped egg # (which is not a directory). paths_to_remove.add(normalized_dist_location) easy_install_egg = os.path.split(normalized_dist_location)[1] easy_install_pth = os.path.join( os.path.dirname(normalized_dist_location), "easy-install.pth", ) paths_to_remove.add_pth(easy_install_pth, "./" + easy_install_egg) elif dist.installed_with_dist_info: for path in uninstallation_paths(dist): paths_to_remove.add(path) elif develop_egg_link: # PEP 660 modern editable is handled in the ``.dist-info`` case # above, so this only covers the setuptools-style editable. with open(develop_egg_link) as fh: link_pointer = os.path.normcase(fh.readline().strip()) normalized_link_pointer = paths_to_remove._normalize_path_cached( link_pointer ) assert os.path.samefile( normalized_link_pointer, normalized_dist_location ), ( f"Egg-link {develop_egg_link} (to {link_pointer}) does not match " f"installed location of {dist.raw_name} (at {dist_location})" ) paths_to_remove.add(develop_egg_link) easy_install_pth = os.path.join( os.path.dirname(develop_egg_link), "easy-install.pth" ) paths_to_remove.add_pth(easy_install_pth, dist_location) else: logger.debug( "Not sure how to uninstall: %s - Check: %s", dist, dist_location, ) if dist.in_usersite: bin_dir = get_bin_user() else: bin_dir = get_bin_prefix() # find distutils scripts= scripts try: for script in dist.iter_distutils_script_names(): paths_to_remove.add(os.path.join(bin_dir, script)) if WINDOWS: paths_to_remove.add(os.path.join(bin_dir, f"{script}.bat")) except (FileNotFoundError, NotADirectoryError): pass # find console_scripts and gui_scripts def iter_scripts_to_remove( dist: BaseDistribution, bin_dir: str, ) -> Generator[str, None, None]: for entry_point in dist.iter_entry_points(): if entry_point.group == "console_scripts": yield from _script_names(bin_dir, entry_point.name, False) elif entry_point.group == "gui_scripts": yield from _script_names(bin_dir, entry_point.name, True) for s in iter_scripts_to_remove(dist, bin_dir): paths_to_remove.add(s) return paths_to_remove class UninstallPthEntries: def __init__(self, pth_file: str) -> None: self.file = pth_file self.entries: set[str] = set() self._saved_lines: list[bytes] | None = None def add(self, entry: str) -> None: entry = os.path.normcase(entry) # On Windows, os.path.normcase converts the entry to use # backslashes. This is correct for entries that describe absolute # paths outside of site-packages, but all the others use forward # slashes. # os.path.splitdrive is used instead of os.path.isabs because isabs # treats non-absolute paths with drive letter markings like c:foo\bar # as absolute paths. It also does not recognize UNC paths if they don't # have more than "\\sever\share". Valid examples: "\\server\share\" or # "\\server\share\folder". if WINDOWS and not os.path.splitdrive(entry)[0]: entry = entry.replace("\\", "/") self.entries.add(entry) def remove(self) -> None: logger.verbose("Removing pth entries from %s:", self.file) # If the file doesn't exist, log a warning and return if not os.path.isfile(self.file): logger.warning("Cannot remove entries from nonexistent file %s", self.file) return with open(self.file, "rb") as fh: # windows uses '\r\n' with py3k, but uses '\n' with py2.x lines = fh.readlines() self._saved_lines = lines if any(b"\r\n" in line for line in lines): endline = "\r\n" else: endline = "\n" # handle missing trailing newline if lines and not lines[-1].endswith(endline.encode("utf-8")): lines[-1] = lines[-1] + endline.encode("utf-8") for entry in self.entries: try: logger.verbose("Removing entry: %s", entry) lines.remove((entry + endline).encode("utf-8")) except ValueError: pass with open(self.file, "wb") as fh: fh.writelines(lines) def rollback(self) -> bool: if self._saved_lines is None: logger.error("Cannot roll back changes to %s, none were made", self.file) return False logger.debug("Rolling %s back to previous state", self.file) with open(self.file, "wb") as fh: fh.writelines(self._saved_lines) return True ================================================ FILE: src/pip/_internal/resolution/__init__.py ================================================ ================================================ FILE: src/pip/_internal/resolution/base.py ================================================ from typing import Callable, Optional from pip._internal.req.req_install import InstallRequirement from pip._internal.req.req_set import RequirementSet InstallRequirementProvider = Callable[ [str, Optional[InstallRequirement]], InstallRequirement ] class BaseResolver: def resolve( self, root_reqs: list[InstallRequirement], check_supported_wheels: bool ) -> RequirementSet: raise NotImplementedError() def get_installation_order( self, req_set: RequirementSet ) -> list[InstallRequirement]: raise NotImplementedError() ================================================ FILE: src/pip/_internal/resolution/legacy/__init__.py ================================================ ================================================ FILE: src/pip/_internal/resolution/legacy/resolver.py ================================================ """Dependency Resolution The dependency resolution in pip is performed as follows: for top-level requirements: a. only one spec allowed per project, regardless of conflicts or not. otherwise a "double requirement" exception is raised b. they override sub-dependency requirements. for sub-dependencies a. "first found, wins" (where the order is breadth first) """ from __future__ import annotations import logging import sys from collections import defaultdict from collections.abc import Iterable from itertools import chain from typing import Optional from pip._vendor.packaging import specifiers from pip._vendor.packaging.requirements import Requirement from pip._internal.cache import WheelCache from pip._internal.exceptions import ( BestVersionAlreadyInstalled, DistributionNotFound, HashError, HashErrors, InstallationError, NoneMetadataError, UnsupportedPythonVersion, ) from pip._internal.index.package_finder import PackageFinder from pip._internal.metadata import BaseDistribution from pip._internal.models.link import Link from pip._internal.models.wheel import Wheel from pip._internal.operations.prepare import RequirementPreparer from pip._internal.req.req_install import ( InstallRequirement, check_invalid_constraint_type, ) from pip._internal.req.req_set import RequirementSet from pip._internal.resolution.base import BaseResolver, InstallRequirementProvider from pip._internal.utils import compatibility_tags from pip._internal.utils.compatibility_tags import get_supported from pip._internal.utils.direct_url_helpers import direct_url_from_link from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import normalize_version_info from pip._internal.utils.packaging import check_requires_python logger = logging.getLogger(__name__) DiscoveredDependencies = defaultdict[Optional[str], list[InstallRequirement]] def _check_dist_requires_python( dist: BaseDistribution, version_info: tuple[int, int, int], ignore_requires_python: bool = False, ) -> None: """ Check whether the given Python version is compatible with a distribution's "Requires-Python" value. :param version_info: A 3-tuple of ints representing the Python major-minor-micro version to check. :param ignore_requires_python: Whether to ignore the "Requires-Python" value if the given Python version isn't compatible. :raises UnsupportedPythonVersion: When the given Python version isn't compatible. """ # This idiosyncratically converts the SpecifierSet to str and let # check_requires_python then parse it again into SpecifierSet. But this # is the legacy resolver so I'm just not going to bother refactoring. try: requires_python = str(dist.requires_python) except FileNotFoundError as e: raise NoneMetadataError(dist, str(e)) try: is_compatible = check_requires_python( requires_python, version_info=version_info, ) except specifiers.InvalidSpecifier as exc: logger.warning( "Package %r has an invalid Requires-Python: %s", dist.raw_name, exc ) return if is_compatible: return version = ".".join(map(str, version_info)) if ignore_requires_python: logger.debug( "Ignoring failed Requires-Python check for package %r: %s not in %r", dist.raw_name, version, requires_python, ) return raise UnsupportedPythonVersion( f"Package {dist.raw_name!r} requires a different Python: " f"{version} not in {requires_python!r}" ) class Resolver(BaseResolver): """Resolves which packages need to be installed/uninstalled to perform \ the requested operation without breaking the requirements of any package. """ _allowed_strategies = {"eager", "only-if-needed", "to-satisfy-only"} def __init__( self, preparer: RequirementPreparer, finder: PackageFinder, wheel_cache: WheelCache | None, make_install_req: InstallRequirementProvider, use_user_site: bool, ignore_dependencies: bool, ignore_installed: bool, ignore_requires_python: bool, force_reinstall: bool, upgrade_strategy: str, py_version_info: tuple[int, ...] | None = None, ) -> None: super().__init__() assert upgrade_strategy in self._allowed_strategies if py_version_info is None: py_version_info = sys.version_info[:3] else: py_version_info = normalize_version_info(py_version_info) self._py_version_info = py_version_info self.preparer = preparer self.finder = finder self.wheel_cache = wheel_cache self.upgrade_strategy = upgrade_strategy self.force_reinstall = force_reinstall self.ignore_dependencies = ignore_dependencies self.ignore_installed = ignore_installed self.ignore_requires_python = ignore_requires_python self.use_user_site = use_user_site self._make_install_req = make_install_req self._discovered_dependencies: DiscoveredDependencies = defaultdict(list) def resolve( self, root_reqs: list[InstallRequirement], check_supported_wheels: bool ) -> RequirementSet: """Resolve what operations need to be done As a side-effect of this method, the packages (and their dependencies) are downloaded, unpacked and prepared for installation. This preparation is done by ``pip.operations.prepare``. Once PyPI has static dependency metadata available, it would be possible to move the preparation to become a step separated from dependency resolution. """ requirement_set = RequirementSet(check_supported_wheels=check_supported_wheels) for req in root_reqs: if req.constraint: check_invalid_constraint_type(req) self._add_requirement_to_set(requirement_set, req) # Actually prepare the files, and collect any exceptions. Most hash # exceptions cannot be checked ahead of time, because # _populate_link() needs to be called before we can make decisions # based on link type. discovered_reqs: list[InstallRequirement] = [] hash_errors = HashErrors() for req in chain(requirement_set.all_requirements, discovered_reqs): try: discovered_reqs.extend(self._resolve_one(requirement_set, req)) except HashError as exc: exc.req = req hash_errors.append(exc) if hash_errors: raise hash_errors return requirement_set def _add_requirement_to_set( self, requirement_set: RequirementSet, install_req: InstallRequirement, parent_req_name: str | None = None, extras_requested: Iterable[str] | None = None, ) -> tuple[list[InstallRequirement], InstallRequirement | None]: """Add install_req as a requirement to install. :param parent_req_name: The name of the requirement that needed this added. The name is used because when multiple unnamed requirements resolve to the same name, we could otherwise end up with dependency links that point outside the Requirements set. parent_req must already be added. Note that None implies that this is a user supplied requirement, vs an inferred one. :param extras_requested: an iterable of extras used to evaluate the environment markers. :return: Additional requirements to scan. That is either [] if the requirement is not applicable, or [install_req] if the requirement is applicable and has just been added. """ # If the markers do not match, ignore this requirement. if not install_req.match_markers(extras_requested): logger.info( "Ignoring %s: markers '%s' don't match your environment", install_req.name, install_req.markers, ) return [], None # If the wheel is not supported, raise an error. # Should check this after filtering out based on environment markers to # allow specifying different wheels based on the environment/OS, in a # single requirements file. if install_req.link and install_req.link.is_wheel: wheel = Wheel(install_req.link.filename) tags = compatibility_tags.get_supported() if requirement_set.check_supported_wheels and not wheel.supported(tags): raise InstallationError( f"{wheel.filename} is not a supported wheel on this platform." ) # This next bit is really a sanity check. assert ( not install_req.user_supplied or parent_req_name is None ), "a user supplied req shouldn't have a parent" # Unnamed requirements are scanned again and the requirement won't be # added as a dependency until after scanning. if not install_req.name: requirement_set.add_unnamed_requirement(install_req) return [install_req], None try: existing_req: InstallRequirement | None = requirement_set.get_requirement( install_req.name ) except KeyError: existing_req = None has_conflicting_requirement = ( parent_req_name is None and existing_req and not existing_req.constraint and existing_req.extras == install_req.extras and existing_req.req and install_req.req and existing_req.req.specifier != install_req.req.specifier ) if has_conflicting_requirement: raise InstallationError( f"Double requirement given: {install_req} " f"(already in {existing_req}, name={install_req.name!r})" ) # When no existing requirement exists, add the requirement as a # dependency and it will be scanned again after. if not existing_req: requirement_set.add_named_requirement(install_req) # We'd want to rescan this requirement later return [install_req], install_req # Assume there's no need to scan, and that we've already # encountered this for scanning. if install_req.constraint or not existing_req.constraint: return [], existing_req does_not_satisfy_constraint = install_req.link and not ( existing_req.link and install_req.link.path == existing_req.link.path ) if does_not_satisfy_constraint: raise InstallationError( f"Could not satisfy constraints for '{install_req.name}': " "installation from path or url cannot be " "constrained to a version" ) # If we're now installing a constraint, mark the existing # object for real installation. existing_req.constraint = False # If we're now installing a user supplied requirement, # mark the existing object as such. if install_req.user_supplied: existing_req.user_supplied = True existing_req.extras = tuple( sorted(set(existing_req.extras) | set(install_req.extras)) ) logger.debug( "Setting %s extras to: %s", existing_req, existing_req.extras, ) # Return the existing requirement for addition to the parent and # scanning again. return [existing_req], existing_req def _is_upgrade_allowed(self, req: InstallRequirement) -> bool: if self.upgrade_strategy == "to-satisfy-only": return False elif self.upgrade_strategy == "eager": return True else: assert self.upgrade_strategy == "only-if-needed" return req.user_supplied or req.constraint def _set_req_to_reinstall(self, req: InstallRequirement) -> None: """ Set a requirement to be installed. """ # Don't uninstall the conflict if doing a user install and the # conflict is not a user install. assert req.satisfied_by is not None if not self.use_user_site or req.satisfied_by.in_usersite: req.should_reinstall = True req.satisfied_by = None def _check_skip_installed(self, req_to_install: InstallRequirement) -> str | None: """Check if req_to_install should be skipped. This will check if the req is installed, and whether we should upgrade or reinstall it, taking into account all the relevant user options. After calling this req_to_install will only have satisfied_by set to None if the req_to_install is to be upgraded/reinstalled etc. Any other value will be a dist recording the current thing installed that satisfies the requirement. Note that for vcs urls and the like we can't assess skipping in this routine - we simply identify that we need to pull the thing down, then later on it is pulled down and introspected to assess upgrade/ reinstalls etc. :return: A text reason for why it was skipped, or None. """ if self.ignore_installed: return None req_to_install.check_if_exists(self.use_user_site) if not req_to_install.satisfied_by: return None if self.force_reinstall: self._set_req_to_reinstall(req_to_install) return None if not self._is_upgrade_allowed(req_to_install): if self.upgrade_strategy == "only-if-needed": return "already satisfied, skipping upgrade" return "already satisfied" # Check for the possibility of an upgrade. For link-based # requirements we have to pull the tree down and inspect to assess # the version #, so it's handled way down. if not req_to_install.link: try: self.finder.find_requirement(req_to_install, upgrade=True) except BestVersionAlreadyInstalled: # Then the best version is installed. return "already up-to-date" except DistributionNotFound: # No distribution found, so we squash the error. It will # be raised later when we re-try later to do the install. # Why don't we just raise here? pass self._set_req_to_reinstall(req_to_install) return None def _find_requirement_link(self, req: InstallRequirement) -> Link | None: upgrade = self._is_upgrade_allowed(req) best_candidate = self.finder.find_requirement(req, upgrade) if not best_candidate: return None # Log a warning per PEP 592 if necessary before returning. link = best_candidate.link if link.is_yanked: reason = link.yanked_reason or "" msg = ( # Mark this as a unicode string to prevent # "UnicodeEncodeError: 'ascii' codec can't encode character" # in Python 2 when the reason contains non-ascii characters. "The candidate selected for download or install is a " f"yanked version: {best_candidate}\n" f"Reason for being yanked: {reason}" ) logger.warning(msg) return link def _populate_link(self, req: InstallRequirement) -> None: """Ensure that if a link can be found for this, that it is found. Note that req.link may still be None - if the requirement is already installed and not needed to be upgraded based on the return value of _is_upgrade_allowed(). If preparer.require_hashes is True, don't use the wheel cache, because cached wheels, always built locally, have different hashes than the files downloaded from the index server and thus throw false hash mismatches. Furthermore, cached wheels at present have nondeterministic contents due to file modification times. """ if req.link is None: req.link = self._find_requirement_link(req) if self.wheel_cache is None or self.preparer.require_hashes: return assert req.link is not None, "_find_requirement_link unexpectedly returned None" cache_entry = self.wheel_cache.get_cache_entry( link=req.link, package_name=req.name, supported_tags=get_supported(), ) if cache_entry is not None: logger.debug("Using cached wheel link: %s", cache_entry.link) if req.link is req.original_link and cache_entry.persistent: req.cached_wheel_source_link = req.link if cache_entry.origin is not None: req.download_info = cache_entry.origin else: # Legacy cache entry that does not have origin.json. # download_info may miss the archive_info.hashes field. req.download_info = direct_url_from_link( req.link, link_is_in_wheel_cache=cache_entry.persistent ) req.link = cache_entry.link def _get_dist_for(self, req: InstallRequirement) -> BaseDistribution: """Takes a InstallRequirement and returns a single AbstractDist \ representing a prepared variant of the same. """ if req.editable: return self.preparer.prepare_editable_requirement(req) # satisfied_by is only evaluated by calling _check_skip_installed, # so it must be None here. assert req.satisfied_by is None skip_reason = self._check_skip_installed(req) if req.satisfied_by: return self.preparer.prepare_installed_requirement(req, skip_reason) # We eagerly populate the link, since that's our "legacy" behavior. self._populate_link(req) dist = self.preparer.prepare_linked_requirement(req) # NOTE # The following portion is for determining if a certain package is # going to be re-installed/upgraded or not and reporting to the user. # This should probably get cleaned up in a future refactor. # req.req is only avail after unpack for URL # pkgs repeat check_if_exists to uninstall-on-upgrade # (#14) if not self.ignore_installed: req.check_if_exists(self.use_user_site) if req.satisfied_by: should_modify = ( self.upgrade_strategy != "to-satisfy-only" or self.force_reinstall or self.ignore_installed or req.link.scheme == "file" ) if should_modify: self._set_req_to_reinstall(req) else: logger.info( "Requirement already satisfied (use --upgrade to upgrade): %s", req, ) return dist def _resolve_one( self, requirement_set: RequirementSet, req_to_install: InstallRequirement, ) -> list[InstallRequirement]: """Prepare a single requirements file. :return: A list of additional InstallRequirements to also install. """ # Tell user what we are doing for this requirement: # obtain (editable), skipping, processing (local url), collecting # (remote url or package name) if req_to_install.constraint or req_to_install.prepared: return [] req_to_install.prepared = True # Parse and return dependencies dist = self._get_dist_for(req_to_install) # This will raise UnsupportedPythonVersion if the given Python # version isn't compatible with the distribution's Requires-Python. _check_dist_requires_python( dist, version_info=self._py_version_info, ignore_requires_python=self.ignore_requires_python, ) more_reqs: list[InstallRequirement] = [] def add_req(subreq: Requirement, extras_requested: Iterable[str]) -> None: # This idiosyncratically converts the Requirement to str and let # make_install_req then parse it again into Requirement. But this is # the legacy resolver so I'm just not going to bother refactoring. sub_install_req = self._make_install_req(str(subreq), req_to_install) parent_req_name = req_to_install.name to_scan_again, add_to_parent = self._add_requirement_to_set( requirement_set, sub_install_req, parent_req_name=parent_req_name, extras_requested=extras_requested, ) if parent_req_name and add_to_parent: self._discovered_dependencies[parent_req_name].append(add_to_parent) more_reqs.extend(to_scan_again) with indent_log(): # We add req_to_install before its dependencies, so that we # can refer to it when adding dependencies. assert req_to_install.name is not None if not requirement_set.has_requirement(req_to_install.name): # 'unnamed' requirements will get added here # 'unnamed' requirements can only come from being directly # provided by the user. assert req_to_install.user_supplied self._add_requirement_to_set( requirement_set, req_to_install, parent_req_name=None ) if not self.ignore_dependencies: if req_to_install.extras: logger.debug( "Installing extra requirements: %r", ",".join(req_to_install.extras), ) missing_requested = sorted( set(req_to_install.extras) - set(dist.iter_provided_extras()) ) for missing in missing_requested: logger.warning( "%s %s does not provide the extra '%s'", dist.raw_name, dist.version, missing, ) available_requested = sorted( set(dist.iter_provided_extras()) & set(req_to_install.extras) ) for subreq in dist.iter_dependencies(available_requested): add_req(subreq, extras_requested=available_requested) return more_reqs def get_installation_order( self, req_set: RequirementSet ) -> list[InstallRequirement]: """Create the installation order. The installation order is topological - requirements are installed before the requiring thing. We break cycles at an arbitrary point, and make no other guarantees. """ # The current implementation, which we may change at any point # installs the user specified things in the order given, except when # dependencies must come earlier to achieve topological order. order = [] ordered_reqs: set[InstallRequirement] = set() def schedule(req: InstallRequirement) -> None: if req.satisfied_by or req in ordered_reqs: return if req.constraint: return ordered_reqs.add(req) for dep in self._discovered_dependencies[req.name]: schedule(dep) order.append(req) for install_req in req_set.requirements.values(): schedule(install_req) return order ================================================ FILE: src/pip/_internal/resolution/resolvelib/__init__.py ================================================ ================================================ FILE: src/pip/_internal/resolution/resolvelib/base.py ================================================ from __future__ import annotations from collections.abc import Iterable from dataclasses import dataclass from typing import Optional from pip._vendor.packaging.specifiers import SpecifierSet from pip._vendor.packaging.utils import NormalizedName from pip._vendor.packaging.version import Version from pip._internal.models.link import Link, links_equivalent from pip._internal.req.req_install import InstallRequirement from pip._internal.utils.hashes import Hashes CandidateLookup = tuple[Optional["Candidate"], Optional[InstallRequirement]] def format_name(project: NormalizedName, extras: frozenset[NormalizedName]) -> str: if not extras: return project extras_expr = ",".join(sorted(extras)) return f"{project}[{extras_expr}]" @dataclass(frozen=True) class Constraint: specifier: SpecifierSet hashes: Hashes links: frozenset[Link] @classmethod def empty(cls) -> Constraint: return Constraint(SpecifierSet(), Hashes(), frozenset()) @classmethod def from_ireq(cls, ireq: InstallRequirement) -> Constraint: links = frozenset([ireq.link]) if ireq.link else frozenset() return Constraint(ireq.specifier, ireq.hashes(trust_internet=False), links) def __bool__(self) -> bool: return bool(self.specifier) or bool(self.hashes) or bool(self.links) def __and__(self, other: InstallRequirement) -> Constraint: if not isinstance(other, InstallRequirement): return NotImplemented specifier = self.specifier & other.specifier hashes = self.hashes & other.hashes(trust_internet=False) links = self.links if other.link: links = links.union([other.link]) return Constraint(specifier, hashes, links) def is_satisfied_by(self, candidate: Candidate) -> bool: # Reject if there are any mismatched URL constraints on this package. if self.links and not all(_match_link(link, candidate) for link in self.links): return False # We can safely always allow prereleases here since PackageFinder # already implements the prerelease logic, and would have filtered out # prerelease candidates if the user does not expect them. return self.specifier.contains(candidate.version, prereleases=True) class Requirement: @property def project_name(self) -> NormalizedName: """The "project name" of a requirement. This is different from ``name`` if this requirement contains extras, in which case ``name`` would contain the ``[...]`` part, while this refers to the name of the project. """ raise NotImplementedError("Subclass should override") @property def name(self) -> str: """The name identifying this requirement in the resolver. This is different from ``project_name`` if this requirement contains extras, where ``project_name`` would not contain the ``[...]`` part. """ raise NotImplementedError("Subclass should override") def is_satisfied_by(self, candidate: Candidate) -> bool: return False def get_candidate_lookup(self) -> CandidateLookup: raise NotImplementedError("Subclass should override") def format_for_error(self) -> str: raise NotImplementedError("Subclass should override") def _match_link(link: Link, candidate: Candidate) -> bool: if candidate.source_link: return links_equivalent(link, candidate.source_link) return False class Candidate: @property def project_name(self) -> NormalizedName: """The "project name" of the candidate. This is different from ``name`` if this candidate contains extras, in which case ``name`` would contain the ``[...]`` part, while this refers to the name of the project. """ raise NotImplementedError("Override in subclass") @property def name(self) -> str: """The name identifying this candidate in the resolver. This is different from ``project_name`` if this candidate contains extras, where ``project_name`` would not contain the ``[...]`` part. """ raise NotImplementedError("Override in subclass") @property def version(self) -> Version: raise NotImplementedError("Override in subclass") @property def is_installed(self) -> bool: raise NotImplementedError("Override in subclass") @property def is_editable(self) -> bool: raise NotImplementedError("Override in subclass") @property def source_link(self) -> Link | None: raise NotImplementedError("Override in subclass") def iter_dependencies(self, with_requires: bool) -> Iterable[Requirement | None]: raise NotImplementedError("Override in subclass") def get_install_requirement(self) -> InstallRequirement | None: raise NotImplementedError("Override in subclass") def format_for_error(self) -> str: raise NotImplementedError("Subclass should override") ================================================ FILE: src/pip/_internal/resolution/resolvelib/candidates.py ================================================ from __future__ import annotations import logging import sys from collections.abc import Iterable from typing import TYPE_CHECKING, Any, Union, cast from pip._vendor.packaging.requirements import InvalidRequirement from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.packaging.version import Version from pip._internal.exceptions import ( FailedToPrepareCandidate, HashError, InstallationSubprocessError, InvalidInstalledPackage, MetadataInconsistent, MetadataInvalid, ) from pip._internal.metadata import BaseDistribution from pip._internal.models.link import Link, links_equivalent from pip._internal.models.wheel import Wheel from pip._internal.req.constructors import ( install_req_from_editable, install_req_from_line, ) from pip._internal.req.req_install import InstallRequirement from pip._internal.utils.direct_url_helpers import direct_url_from_link from pip._internal.utils.misc import normalize_version_info from .base import Candidate, Requirement, format_name if TYPE_CHECKING: from .factory import Factory logger = logging.getLogger(__name__) BaseCandidate = Union[ "AlreadyInstalledCandidate", "EditableCandidate", "LinkCandidate", ] # Avoid conflicting with the PyPI package "Python". REQUIRES_PYTHON_IDENTIFIER = cast(NormalizedName, "") def as_base_candidate(candidate: Candidate) -> BaseCandidate | None: """The runtime version of BaseCandidate.""" base_candidate_classes = ( AlreadyInstalledCandidate, EditableCandidate, LinkCandidate, ) if isinstance(candidate, base_candidate_classes): return candidate return None def make_install_req_from_link( link: Link, template: InstallRequirement ) -> InstallRequirement: assert not template.editable, "template is editable" if template.req: line = str(template.req) else: line = link.url ireq = install_req_from_line( line, user_supplied=template.user_supplied, comes_from=template.comes_from, isolated=template.isolated, constraint=template.constraint, hash_options=template.hash_options, config_settings=template.config_settings, ) ireq.original_link = template.original_link ireq.link = link ireq.extras = template.extras return ireq def make_install_req_from_editable( link: Link, template: InstallRequirement ) -> InstallRequirement: assert template.editable, "template not editable" if template.name: req_string = f"{template.name} @ {link.url}" else: req_string = link.url ireq = install_req_from_editable( req_string, user_supplied=template.user_supplied, comes_from=template.comes_from, isolated=template.isolated, constraint=template.constraint, permit_editable_wheels=template.permit_editable_wheels, hash_options=template.hash_options, config_settings=template.config_settings, ) ireq.extras = template.extras return ireq def _make_install_req_from_dist( dist: BaseDistribution, template: InstallRequirement ) -> InstallRequirement: if template.req: line = str(template.req) elif template.link: line = f"{dist.canonical_name} @ {template.link.url}" else: line = f"{dist.canonical_name}=={dist.version}" ireq = install_req_from_line( line, user_supplied=template.user_supplied, comes_from=template.comes_from, isolated=template.isolated, constraint=template.constraint, hash_options=template.hash_options, config_settings=template.config_settings, ) ireq.satisfied_by = dist return ireq class _InstallRequirementBackedCandidate(Candidate): """A candidate backed by an ``InstallRequirement``. This represents a package request with the target not being already in the environment, and needs to be fetched and installed. The backing ``InstallRequirement`` is responsible for most of the leg work; this class exposes appropriate information to the resolver. :param link: The link passed to the ``InstallRequirement``. The backing ``InstallRequirement`` will use this link to fetch the distribution. :param source_link: The link this candidate "originates" from. This is different from ``link`` when the link is found in the wheel cache. ``link`` would point to the wheel cache, while this points to the found remote link (e.g. from pypi.org). """ dist: BaseDistribution is_installed = False def __init__( self, link: Link, source_link: Link, ireq: InstallRequirement, factory: Factory, name: NormalizedName | None = None, version: Version | None = None, ) -> None: self._link = link self._source_link = source_link self._factory = factory self._ireq = ireq self._name = name self._version = version self.dist = self._prepare() self._hash: int | None = None def __str__(self) -> str: return f"{self.name} {self.version}" def __repr__(self) -> str: return f"{self.__class__.__name__}({str(self._link)!r})" def __hash__(self) -> int: if self._hash is not None: return self._hash self._hash = hash((self.__class__, self._link)) return self._hash def __eq__(self, other: Any) -> bool: if isinstance(other, self.__class__): return links_equivalent(self._link, other._link) return False @property def source_link(self) -> Link | None: return self._source_link @property def project_name(self) -> NormalizedName: """The normalised name of the project the candidate refers to""" if self._name is None: self._name = self.dist.canonical_name return self._name @property def name(self) -> str: return self.project_name @property def version(self) -> Version: if self._version is None: self._version = self.dist.version return self._version def format_for_error(self) -> str: return ( f"{self.name} {self.version} " f"(from {self._link.file_path if self._link.is_file else self._link})" ) def _prepare_distribution(self) -> BaseDistribution: raise NotImplementedError("Override in subclass") def _check_metadata_consistency(self, dist: BaseDistribution) -> None: """Check for consistency of project name and version of dist.""" if self._name is not None and self._name != dist.canonical_name: raise MetadataInconsistent( self._ireq, "name", self._name, dist.canonical_name, ) if self._version is not None and self._version != dist.version: raise MetadataInconsistent( self._ireq, "version", str(self._version), str(dist.version), ) # check dependencies are valid # TODO performance: this means we iterate the dependencies at least twice, # we may want to cache parsed Requires-Dist try: list(dist.iter_dependencies(list(dist.iter_provided_extras()))) except InvalidRequirement as e: raise MetadataInvalid(self._ireq, str(e)) def _prepare(self) -> BaseDistribution: try: dist = self._prepare_distribution() except HashError as e: # Provide HashError the underlying ireq that caused it. This # provides context for the resulting error message to show the # offending line to the user. e.req = self._ireq raise except InstallationSubprocessError as exc: if isinstance(self._ireq.comes_from, InstallRequirement): request_chain = self._ireq.comes_from.from_path() else: request_chain = self._ireq.comes_from if request_chain is None: request_chain = "directly requested" raise FailedToPrepareCandidate( package_name=self._ireq.name or str(self._link), requirement_chain=request_chain, failed_step=exc.command_description, ) self._check_metadata_consistency(dist) return dist def iter_dependencies(self, with_requires: bool) -> Iterable[Requirement | None]: # Emit the Requires-Python requirement first to fail fast on # unsupported candidates and avoid pointless downloads/preparation. yield self._factory.make_requires_python_requirement(self.dist.requires_python) requires = self.dist.iter_dependencies() if with_requires else () for r in requires: yield from self._factory.make_requirements_from_spec(str(r), self._ireq) def get_install_requirement(self) -> InstallRequirement | None: return self._ireq class LinkCandidate(_InstallRequirementBackedCandidate): is_editable = False def __init__( self, link: Link, template: InstallRequirement, factory: Factory, name: NormalizedName | None = None, version: Version | None = None, ) -> None: source_link = link cache_entry = factory.get_wheel_cache_entry(source_link, name) if cache_entry is not None: logger.debug("Using cached wheel link: %s", cache_entry.link) link = cache_entry.link ireq = make_install_req_from_link(link, template) assert ireq.link == link if ireq.link.is_wheel and not ireq.link.is_file: wheel = Wheel(ireq.link.filename) wheel_name = wheel.name assert name == wheel_name, f"{name!r} != {wheel_name!r} for wheel" # Version may not be present for PEP 508 direct URLs if version is not None: wheel_version = Version(wheel.version) assert ( version == wheel_version ), f"{version!r} != {wheel_version!r} for wheel {name}" if cache_entry is not None: assert ireq.link.is_wheel assert ireq.link.is_file if cache_entry.persistent and template.link is template.original_link: ireq.cached_wheel_source_link = source_link if cache_entry.origin is not None: ireq.download_info = cache_entry.origin else: # Legacy cache entry that does not have origin.json. # download_info may miss the archive_info.hashes field. ireq.download_info = direct_url_from_link( source_link, link_is_in_wheel_cache=cache_entry.persistent ) super().__init__( link=link, source_link=source_link, ireq=ireq, factory=factory, name=name, version=version, ) def _prepare_distribution(self) -> BaseDistribution: preparer = self._factory.preparer return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True) class EditableCandidate(_InstallRequirementBackedCandidate): is_editable = True def __init__( self, link: Link, template: InstallRequirement, factory: Factory, name: NormalizedName | None = None, version: Version | None = None, ) -> None: super().__init__( link=link, source_link=link, ireq=make_install_req_from_editable(link, template), factory=factory, name=name, version=version, ) def _prepare_distribution(self) -> BaseDistribution: return self._factory.preparer.prepare_editable_requirement(self._ireq) class AlreadyInstalledCandidate(Candidate): is_installed = True source_link = None def __init__( self, dist: BaseDistribution, template: InstallRequirement, factory: Factory, ) -> None: self.dist = dist self._ireq = _make_install_req_from_dist(dist, template) self._factory = factory self._version = None # This is just logging some messages, so we can do it eagerly. # The returned dist would be exactly the same as self.dist because we # set satisfied_by in _make_install_req_from_dist. # TODO: Supply reason based on force_reinstall and upgrade_strategy. skip_reason = "already satisfied" factory.preparer.prepare_installed_requirement(self._ireq, skip_reason) def __str__(self) -> str: return str(self.dist) def __repr__(self) -> str: return f"{self.__class__.__name__}({self.dist!r})" def __eq__(self, other: object) -> bool: if not isinstance(other, AlreadyInstalledCandidate): return NotImplemented return self.name == other.name and self.version == other.version def __hash__(self) -> int: return hash((self.name, self.version)) @property def project_name(self) -> NormalizedName: return self.dist.canonical_name @property def name(self) -> str: return self.project_name @property def version(self) -> Version: if self._version is None: self._version = self.dist.version return self._version @property def is_editable(self) -> bool: return self.dist.editable def format_for_error(self) -> str: return f"{self.name} {self.version} (Installed)" def iter_dependencies(self, with_requires: bool) -> Iterable[Requirement | None]: if not with_requires: return try: for r in self.dist.iter_dependencies(): yield from self._factory.make_requirements_from_spec(str(r), self._ireq) except InvalidRequirement as exc: raise InvalidInstalledPackage(dist=self.dist, invalid_exc=exc) from None def get_install_requirement(self) -> InstallRequirement | None: return None class ExtrasCandidate(Candidate): """A candidate that has 'extras', indicating additional dependencies. Requirements can be for a project with dependencies, something like foo[extra]. The extras don't affect the project/version being installed directly, but indicate that we need additional dependencies. We model that by having an artificial ExtrasCandidate that wraps the "base" candidate. The ExtrasCandidate differs from the base in the following ways: 1. It has a unique name, of the form foo[extra]. This causes the resolver to treat it as a separate node in the dependency graph. 2. When we're getting the candidate's dependencies, a) We specify that we want the extra dependencies as well. b) We add a dependency on the base candidate. See below for why this is needed. 3. We return None for the underlying InstallRequirement, as the base candidate will provide it, and we don't want to end up with duplicates. The dependency on the base candidate is needed so that the resolver can't decide that it should recommend foo[extra1] version 1.0 and foo[extra2] version 2.0. Having those candidates depend on foo=1.0 and foo=2.0 respectively forces the resolver to recognise that this is a conflict. """ def __init__( self, base: BaseCandidate, extras: frozenset[str], *, comes_from: InstallRequirement | None = None, ) -> None: """ :param comes_from: the InstallRequirement that led to this candidate if it differs from the base's InstallRequirement. This will often be the case in the sense that this candidate's requirement has the extras while the base's does not. Unlike the InstallRequirement backed candidates, this requirement is used solely for reporting purposes, it does not do any leg work. """ self.base = base self.extras = frozenset(canonicalize_name(e) for e in extras) self._comes_from = comes_from if comes_from is not None else self.base._ireq def __str__(self) -> str: name, rest = str(self.base).split(" ", 1) return "{}[{}] {}".format(name, ",".join(self.extras), rest) def __repr__(self) -> str: return f"{self.__class__.__name__}(base={self.base!r}, extras={self.extras!r})" def __hash__(self) -> int: return hash((self.base, self.extras)) def __eq__(self, other: Any) -> bool: if isinstance(other, self.__class__): return self.base == other.base and self.extras == other.extras return False @property def project_name(self) -> NormalizedName: return self.base.project_name @property def name(self) -> str: """The normalised name of the project the candidate refers to""" return format_name(self.base.project_name, self.extras) @property def version(self) -> Version: return self.base.version def format_for_error(self) -> str: return "{} [{}]".format( self.base.format_for_error(), ", ".join(sorted(self.extras)) ) @property def is_installed(self) -> bool: return self.base.is_installed @property def is_editable(self) -> bool: return self.base.is_editable @property def source_link(self) -> Link | None: return self.base.source_link def iter_dependencies(self, with_requires: bool) -> Iterable[Requirement | None]: factory = self.base._factory # Add a dependency on the exact base # (See note 2b in the class docstring) yield factory.make_requirement_from_candidate(self.base) if not with_requires: return # The user may have specified extras that the candidate doesn't # support. We ignore any unsupported extras here. valid_extras = self.extras.intersection(self.base.dist.iter_provided_extras()) invalid_extras = self.extras.difference(self.base.dist.iter_provided_extras()) for extra in sorted(invalid_extras): logger.warning( "%s %s does not provide the extra '%s'", self.base.name, self.version, extra, ) for r in self.base.dist.iter_dependencies(valid_extras): yield from factory.make_requirements_from_spec( str(r), self._comes_from, valid_extras, ) def get_install_requirement(self) -> InstallRequirement | None: # We don't return anything here, because we always # depend on the base candidate, and we'll get the # install requirement from that. return None class RequiresPythonCandidate(Candidate): is_installed = False source_link = None def __init__(self, py_version_info: tuple[int, ...] | None) -> None: if py_version_info is not None: version_info = normalize_version_info(py_version_info) else: version_info = sys.version_info[:3] self._version = Version(".".join(str(c) for c in version_info)) # We don't need to implement __eq__() and __ne__() since there is always # only one RequiresPythonCandidate in a resolution, i.e. the host Python. # The built-in object.__eq__() and object.__ne__() do exactly what we want. def __str__(self) -> str: return f"Python {self._version}" def __repr__(self) -> str: return f"{self.__class__.__name__}({self._version!r})" @property def project_name(self) -> NormalizedName: return REQUIRES_PYTHON_IDENTIFIER @property def name(self) -> str: return REQUIRES_PYTHON_IDENTIFIER @property def version(self) -> Version: return self._version def format_for_error(self) -> str: return f"Python {self.version}" def iter_dependencies(self, with_requires: bool) -> Iterable[Requirement | None]: return () def get_install_requirement(self) -> InstallRequirement | None: return None ================================================ FILE: src/pip/_internal/resolution/resolvelib/factory.py ================================================ from __future__ import annotations import contextlib import functools import logging from collections.abc import Iterable, Iterator, Mapping, Sequence from typing import ( TYPE_CHECKING, Callable, NamedTuple, Protocol, TypeVar, cast, ) from pip._vendor.packaging.requirements import InvalidRequirement from pip._vendor.packaging.specifiers import SpecifierSet from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.packaging.version import InvalidVersion, Version from pip._vendor.resolvelib import ResolutionImpossible from pip._internal.cache import CacheEntry, WheelCache from pip._internal.exceptions import ( DistributionNotFound, InstallationError, InvalidInstalledPackage, MetadataInconsistent, MetadataInvalid, UnsupportedPythonVersion, UnsupportedWheel, ) from pip._internal.index.package_finder import PackageFinder from pip._internal.metadata import BaseDistribution, get_default_environment from pip._internal.models.link import Link from pip._internal.models.wheel import Wheel from pip._internal.operations.prepare import RequirementPreparer from pip._internal.req.constructors import ( install_req_drop_extras, install_req_from_link_and_ireq, ) from pip._internal.req.req_install import ( InstallRequirement, check_invalid_constraint_type, ) from pip._internal.resolution.base import InstallRequirementProvider from pip._internal.utils.compatibility_tags import get_supported from pip._internal.utils.hashes import Hashes from pip._internal.utils.packaging import get_requirement from pip._internal.utils.virtualenv import running_under_virtualenv from .base import Candidate, Constraint, Requirement from .candidates import ( AlreadyInstalledCandidate, BaseCandidate, EditableCandidate, ExtrasCandidate, LinkCandidate, RequiresPythonCandidate, as_base_candidate, ) from .found_candidates import FoundCandidates, IndexCandidateInfo from .requirements import ( ExplicitRequirement, RequiresPythonRequirement, SpecifierRequirement, SpecifierWithoutExtrasRequirement, UnsatisfiableRequirement, ) if TYPE_CHECKING: class ConflictCause(Protocol): requirement: RequiresPythonRequirement parent: Candidate logger = logging.getLogger(__name__) C = TypeVar("C") Cache = dict[Link, C] class CollectedRootRequirements(NamedTuple): requirements: list[Requirement] constraints: dict[str, Constraint] user_requested: dict[str, int] class Factory: def __init__( self, finder: PackageFinder, preparer: RequirementPreparer, make_install_req: InstallRequirementProvider, wheel_cache: WheelCache | None, use_user_site: bool, force_reinstall: bool, ignore_installed: bool, ignore_requires_python: bool, py_version_info: tuple[int, ...] | None = None, ) -> None: self._finder = finder self.preparer = preparer self._wheel_cache = wheel_cache self._python_candidate = RequiresPythonCandidate(py_version_info) self._make_install_req_from_spec = make_install_req self._use_user_site = use_user_site self._force_reinstall = force_reinstall self._ignore_requires_python = ignore_requires_python self._build_failures: Cache[InstallationError] = {} self._link_candidate_cache: Cache[LinkCandidate] = {} self._editable_candidate_cache: Cache[EditableCandidate] = {} self._installed_candidate_cache: dict[str, AlreadyInstalledCandidate] = {} self._extras_candidate_cache: dict[ tuple[int, frozenset[NormalizedName]], ExtrasCandidate ] = {} self._supported_tags_cache = get_supported() if not ignore_installed: env = get_default_environment() self._installed_dists = { dist.canonical_name: dist for dist in env.iter_installed_distributions(local_only=False) } else: self._installed_dists = {} @property def force_reinstall(self) -> bool: return self._force_reinstall def _fail_if_link_is_unsupported_wheel(self, link: Link) -> None: if not link.is_wheel: return wheel = Wheel(link.filename) if wheel.supported(self._finder.target_python.get_unsorted_tags()): return msg = f"{link.filename} is not a supported wheel on this platform." raise UnsupportedWheel(msg) def _make_extras_candidate( self, base: BaseCandidate, extras: frozenset[str], *, comes_from: InstallRequirement | None = None, ) -> ExtrasCandidate: cache_key = (id(base), frozenset(canonicalize_name(e) for e in extras)) try: candidate = self._extras_candidate_cache[cache_key] except KeyError: candidate = ExtrasCandidate(base, extras, comes_from=comes_from) self._extras_candidate_cache[cache_key] = candidate return candidate def _make_candidate_from_dist( self, dist: BaseDistribution, extras: frozenset[str], template: InstallRequirement, ) -> Candidate: try: base = self._installed_candidate_cache[dist.canonical_name] except KeyError: base = AlreadyInstalledCandidate(dist, template, factory=self) self._installed_candidate_cache[dist.canonical_name] = base if not extras: return base return self._make_extras_candidate(base, extras, comes_from=template) def _make_candidate_from_link( self, link: Link, extras: frozenset[str], template: InstallRequirement, name: NormalizedName | None, version: Version | None, ) -> Candidate | None: base: BaseCandidate | None = self._make_base_candidate_from_link( link, template, name, version ) if not extras or base is None: return base return self._make_extras_candidate(base, extras, comes_from=template) def _make_base_candidate_from_link( self, link: Link, template: InstallRequirement, name: NormalizedName | None, version: Version | None, ) -> BaseCandidate | None: # TODO: Check already installed candidate, and use it if the link and # editable flag match. if link in self._build_failures: # We already tried this candidate before, and it does not build. # Don't bother trying again. return None if template.editable: if link not in self._editable_candidate_cache: try: self._editable_candidate_cache[link] = EditableCandidate( link, template, factory=self, name=name, version=version, ) except (MetadataInconsistent, MetadataInvalid) as e: logger.info( "Discarding [blue underline]%s[/]: [yellow]%s[reset]", link, e, extra={"markup": True}, ) self._build_failures[link] = e return None return self._editable_candidate_cache[link] else: if link not in self._link_candidate_cache: try: self._link_candidate_cache[link] = LinkCandidate( link, template, factory=self, name=name, version=version, ) except MetadataInconsistent as e: logger.info( "Discarding [blue underline]%s[/]: [yellow]%s[reset]", link, e, extra={"markup": True}, ) self._build_failures[link] = e return None return self._link_candidate_cache[link] def _iter_found_candidates( self, ireqs: Sequence[InstallRequirement], specifier: SpecifierSet, hashes: Hashes, prefers_installed: bool, incompatible_ids: set[int], ) -> Iterable[Candidate]: if not ireqs: return () # The InstallRequirement implementation requires us to give it a # "template". Here we just choose the first requirement to represent # all of them. # Hopefully the Project model can correct this mismatch in the future. template = ireqs[0] assert template.req, "Candidates found on index must be PEP 508" name = canonicalize_name(template.req.name) extras: frozenset[str] = frozenset() for ireq in ireqs: assert ireq.req, "Candidates found on index must be PEP 508" specifier &= ireq.req.specifier hashes &= ireq.hashes(trust_internet=False) extras |= frozenset(ireq.extras) def _get_installed_candidate() -> Candidate | None: """Get the candidate for the currently-installed version.""" # If --force-reinstall is set, we want the version from the index # instead, so we "pretend" there is nothing installed. if self._force_reinstall: return None try: installed_dist = self._installed_dists[name] except KeyError: return None try: # Don't use the installed distribution if its version # does not fit the current dependency graph. if not specifier.contains(installed_dist.version, prereleases=True): return None except InvalidVersion as e: raise InvalidInstalledPackage(dist=installed_dist, invalid_exc=e) candidate = self._make_candidate_from_dist( dist=installed_dist, extras=extras, template=template, ) # The candidate is a known incompatibility. Don't use it. if id(candidate) in incompatible_ids: return None return candidate def iter_index_candidate_infos() -> Iterator[IndexCandidateInfo]: result = self._finder.find_best_candidate( project_name=name, specifier=specifier, hashes=hashes, ) icans = result.applicable_candidates # PEP 592: Yanked releases are ignored unless the specifier # explicitly pins a version (via '==' or '===') that can be # solely satisfied by a yanked release. all_yanked = all(ican.link.is_yanked for ican in icans) def is_pinned(specifier: SpecifierSet) -> bool: for sp in specifier: if sp.operator == "===": return True if sp.operator != "==": continue if sp.version.endswith(".*"): continue return True return False pinned = is_pinned(specifier) # PackageFinder returns earlier versions first, so we reverse. for ican in reversed(icans): if not (all_yanked and pinned) and ican.link.is_yanked: continue func = functools.partial( self._make_candidate_from_link, link=ican.link, extras=extras, template=template, name=name, version=ican.version, ) yield ican.version, func return FoundCandidates( iter_index_candidate_infos, _get_installed_candidate(), prefers_installed, incompatible_ids, ) def _iter_explicit_candidates_from_base( self, base_requirements: Iterable[Requirement], extras: frozenset[str], ) -> Iterator[Candidate]: """Produce explicit candidates from the base given an extra-ed package. :param base_requirements: Requirements known to the resolver. The requirements are guaranteed to not have extras. :param extras: The extras to inject into the explicit requirements' candidates. """ for req in base_requirements: lookup_cand, _ = req.get_candidate_lookup() if lookup_cand is None: # Not explicit. continue # We've stripped extras from the identifier, and should always # get a BaseCandidate here, unless there's a bug elsewhere. base_cand = as_base_candidate(lookup_cand) assert base_cand is not None, "no extras here" yield self._make_extras_candidate(base_cand, extras) def _iter_candidates_from_constraints( self, identifier: str, constraint: Constraint, template: InstallRequirement, ) -> Iterator[Candidate]: """Produce explicit candidates from constraints. This creates "fake" InstallRequirement objects that are basically clones of what "should" be the template, but with original_link set to link. """ for link in constraint.links: self._fail_if_link_is_unsupported_wheel(link) candidate = self._make_base_candidate_from_link( link, template=install_req_from_link_and_ireq(link, template), name=canonicalize_name(identifier), version=None, ) if candidate: yield candidate def find_candidates( self, identifier: str, requirements: Mapping[str, Iterable[Requirement]], incompatibilities: Mapping[str, Iterator[Candidate]], constraint: Constraint, prefers_installed: bool, is_satisfied_by: Callable[[Requirement, Candidate], bool], ) -> Iterable[Candidate]: # Collect basic lookup information from the requirements. explicit_candidates: set[Candidate] = set() ireqs: list[InstallRequirement] = [] for req in requirements[identifier]: cand, ireq = req.get_candidate_lookup() if cand is not None: explicit_candidates.add(cand) if ireq is not None: ireqs.append(ireq) # If the current identifier contains extras, add requires and explicit # candidates from entries from extra-less identifier. with contextlib.suppress(InvalidRequirement): parsed_requirement = get_requirement(identifier) if parsed_requirement.name != identifier: explicit_candidates.update( self._iter_explicit_candidates_from_base( requirements.get(parsed_requirement.name, ()), frozenset(parsed_requirement.extras), ), ) for req in requirements.get(parsed_requirement.name, []): _, ireq = req.get_candidate_lookup() if ireq is not None: ireqs.append(ireq) # Add explicit candidates from constraints. We only do this if there are # known ireqs, which represent requirements not already explicit. If # there are no ireqs, we're constraining already-explicit requirements, # which is handled later when we return the explicit candidates. if ireqs: try: explicit_candidates.update( self._iter_candidates_from_constraints( identifier, constraint, template=ireqs[0], ), ) except UnsupportedWheel: # If we're constrained to install a wheel incompatible with the # target architecture, no candidates will ever be valid. return () # Since we cache all the candidates, incompatibility identification # can be made quicker by comparing only the id() values. incompat_ids = {id(c) for c in incompatibilities.get(identifier, ())} # If none of the requirements want an explicit candidate, we can ask # the finder for candidates. if not explicit_candidates: return self._iter_found_candidates( ireqs, constraint.specifier, constraint.hashes, prefers_installed, incompat_ids, ) return ( c for c in explicit_candidates if id(c) not in incompat_ids and constraint.is_satisfied_by(c) and all(is_satisfied_by(req, c) for req in requirements[identifier]) ) def _make_requirements_from_install_req( self, ireq: InstallRequirement, requested_extras: Iterable[str] ) -> Iterator[Requirement]: """ Returns requirement objects associated with the given InstallRequirement. In most cases this will be a single object but the following special cases exist: - the InstallRequirement has markers that do not apply -> result is empty - the InstallRequirement has both a constraint (or link) and extras -> result is split in two requirement objects: one with the constraint (or link) and one with the extra. This allows centralized constraint handling for the base, resulting in fewer candidate rejections. """ if not ireq.match_markers(requested_extras): logger.info( "Ignoring %s: markers '%s' don't match your environment", ireq.name, ireq.markers, ) elif not ireq.link: if ireq.extras and ireq.req is not None and ireq.req.specifier: yield SpecifierWithoutExtrasRequirement(ireq) yield SpecifierRequirement(ireq) else: self._fail_if_link_is_unsupported_wheel(ireq.link) # Always make the link candidate for the base requirement to make it # available to `find_candidates` for explicit candidate lookup for any # set of extras. # The extras are required separately via a second requirement. cand = self._make_base_candidate_from_link( ireq.link, template=install_req_drop_extras(ireq) if ireq.extras else ireq, name=canonicalize_name(ireq.name) if ireq.name else None, version=None, ) if cand is None: # There's no way we can satisfy a URL requirement if the underlying # candidate fails to build. An unnamed URL must be user-supplied, so # we fail eagerly. If the URL is named, an unsatisfiable requirement # can make the resolver do the right thing, either backtrack (and # maybe find some other requirement that's buildable) or raise a # ResolutionImpossible eventually. if not ireq.name: raise self._build_failures[ireq.link] yield UnsatisfiableRequirement(canonicalize_name(ireq.name)) else: # require the base from the link yield self.make_requirement_from_candidate(cand) if ireq.extras: # require the extras on top of the base candidate yield self.make_requirement_from_candidate( self._make_extras_candidate(cand, frozenset(ireq.extras)) ) def collect_root_requirements( self, root_ireqs: list[InstallRequirement] ) -> CollectedRootRequirements: collected = CollectedRootRequirements([], {}, {}) for i, ireq in enumerate(root_ireqs): if ireq.constraint: # Ensure we only accept valid constraints problem = check_invalid_constraint_type(ireq) if problem: raise InstallationError(problem) if not ireq.match_markers(): continue assert ireq.name, "Constraint must be named" name = canonicalize_name(ireq.name) if name in collected.constraints: collected.constraints[name] &= ireq else: collected.constraints[name] = Constraint.from_ireq(ireq) else: reqs = list( self._make_requirements_from_install_req( ireq, requested_extras=(), ) ) if not reqs: continue template = reqs[0] if ireq.user_supplied and template.name not in collected.user_requested: collected.user_requested[template.name] = i collected.requirements.extend(reqs) # Put requirements with extras at the end of the root requires. This does not # affect resolvelib's picking preference but it does affect its initial criteria # population: by putting extras at the end we enable the candidate finder to # present resolvelib with a smaller set of candidates to resolvelib, already # taking into account any non-transient constraints on the associated base. This # means resolvelib will have fewer candidates to visit and reject. # Python's list sort is stable, meaning relative order is kept for objects with # the same key. collected.requirements.sort(key=lambda r: r.name != r.project_name) return collected def make_requirement_from_candidate( self, candidate: Candidate ) -> ExplicitRequirement: return ExplicitRequirement(candidate) def make_requirements_from_spec( self, specifier: str, comes_from: InstallRequirement | None, requested_extras: Iterable[str] = (), ) -> Iterator[Requirement]: """ Returns requirement objects associated with the given specifier. In most cases this will be a single object but the following special cases exist: - the specifier has markers that do not apply -> result is empty - the specifier has both a constraint and extras -> result is split in two requirement objects: one with the constraint and one with the extra. This allows centralized constraint handling for the base, resulting in fewer candidate rejections. """ ireq = self._make_install_req_from_spec(specifier, comes_from) return self._make_requirements_from_install_req(ireq, requested_extras) def make_requires_python_requirement( self, specifier: SpecifierSet, ) -> Requirement | None: if self._ignore_requires_python: return None # Don't bother creating a dependency for an empty Requires-Python. if not str(specifier): return None return RequiresPythonRequirement(specifier, self._python_candidate) def get_wheel_cache_entry(self, link: Link, name: str | None) -> CacheEntry | None: """Look up the link in the wheel cache. If ``preparer.require_hashes`` is True, don't use the wheel cache, because cached wheels, always built locally, have different hashes than the files downloaded from the index server and thus throw false hash mismatches. Furthermore, cached wheels at present have nondeterministic contents due to file modification times. """ if self._wheel_cache is None: return None return self._wheel_cache.get_cache_entry( link=link, package_name=name, supported_tags=self._supported_tags_cache, ) def get_dist_to_uninstall(self, candidate: Candidate) -> BaseDistribution | None: # TODO: Are there more cases this needs to return True? Editable? dist = self._installed_dists.get(candidate.project_name) if dist is None: # Not installed, no uninstallation required. return None # We're installing into global site. The current installation must # be uninstalled, no matter it's in global or user site, because the # user site installation has precedence over global. if not self._use_user_site: return dist # We're installing into user site. Remove the user site installation. if dist.in_usersite: return dist # We're installing into user site, but the installed incompatible # package is in global site. We can't uninstall that, and would let # the new user installation to "shadow" it. But shadowing won't work # in virtual environments, so we error out. if running_under_virtualenv() and dist.in_site_packages: message = ( f"Will not install to the user site because it will lack " f"sys.path precedence to {dist.raw_name} in {dist.location}" ) raise InstallationError(message) return None def _report_requires_python_error( self, causes: Sequence[ConflictCause] ) -> UnsupportedPythonVersion: assert causes, "Requires-Python error reported with no cause" version = self._python_candidate.version if len(causes) == 1: specifier = str(causes[0].requirement.specifier) message = ( f"Package {causes[0].parent.name!r} requires a different " f"Python: {version} not in {specifier!r}" ) return UnsupportedPythonVersion(message) message = f"Packages require a different Python. {version} not in:" for cause in causes: package = cause.parent.format_for_error() specifier = str(cause.requirement.specifier) message += f"\n{specifier!r} (required by {package})" return UnsupportedPythonVersion(message) def _report_single_requirement_conflict( self, req: Requirement, parent: Candidate | None ) -> DistributionNotFound: if parent is None: req_disp = str(req) else: req_disp = f"{req} (from {parent.name})" cands = self._finder.find_all_candidates(req.project_name) skipped_by_requires_python = self._finder.requires_python_skipped_reasons() versions_set: set[Version] = set() yanked_versions_set: set[Version] = set() for c in cands: is_yanked = c.link.is_yanked if c.link else False if is_yanked: yanked_versions_set.add(c.version) else: versions_set.add(c.version) versions = [str(v) for v in sorted(versions_set)] yanked_versions = [str(v) for v in sorted(yanked_versions_set)] if yanked_versions: # Saying "version X is yanked" isn't entirely accurate. # https://github.com/pypa/pip/issues/11745#issuecomment-1402805842 logger.critical( "Ignored the following yanked versions: %s", ", ".join(yanked_versions) or "none", ) if skipped_by_requires_python: logger.critical( "Ignored the following versions that require a different python " "version: %s", "; ".join(skipped_by_requires_python) or "none", ) # Check if only final releases are allowed for this package version_type = "version" if self._finder.release_control is not None: allows_pre = self._finder.release_control.allows_prereleases( canonicalize_name(req.project_name) ) if allows_pre is False: version_type = "final version" logger.critical( "Could not find a %s that satisfies the requirement %s " "(from versions: %s)", version_type, req_disp, ", ".join(versions) or "none", ) if str(req) == "requirements.txt": logger.info( "HINT: You are attempting to install a package literally " 'named "requirements.txt" (which cannot exist). Consider ' "using the '-r' flag to install the packages listed in " "requirements.txt" ) return DistributionNotFound(f"No matching distribution found for {req}") def _has_any_candidates(self, project_name: str) -> bool: """ Check if there are any candidates available for the project name. """ return any( self.find_candidates( project_name, requirements={project_name: []}, incompatibilities={}, constraint=Constraint.empty(), prefers_installed=True, is_satisfied_by=lambda r, c: True, ) ) def get_installation_error( self, e: ResolutionImpossible[Requirement, Candidate], constraints: dict[str, Constraint], ) -> InstallationError: assert e.causes, "Installation error reported with no cause" # If one of the things we can't solve is "we need Python X.Y", # that is what we report. requires_python_causes = [ cause for cause in e.causes if isinstance(cause.requirement, RequiresPythonRequirement) and not cause.requirement.is_satisfied_by(self._python_candidate) ] if requires_python_causes: # The comprehension above makes sure all Requirement instances are # RequiresPythonRequirement, so let's cast for convenience. return self._report_requires_python_error( cast("Sequence[ConflictCause]", requires_python_causes), ) # Otherwise, we have a set of causes which can't all be satisfied # at once. # The simplest case is when we have *one* cause that can't be # satisfied. We just report that case. if len(e.causes) == 1: req, parent = next(iter(e.causes)) if req.name not in constraints: return self._report_single_requirement_conflict(req, parent) # OK, we now have a list of requirements that can't all be # satisfied at once. # A couple of formatting helpers def text_join(parts: list[str]) -> str: if len(parts) == 1: return parts[0] return ", ".join(parts[:-1]) + " and " + parts[-1] def describe_trigger(parent: Candidate) -> str: ireq = parent.get_install_requirement() if not ireq or not ireq.comes_from: return f"{parent.name}=={parent.version}" if isinstance(ireq.comes_from, InstallRequirement): return str(ireq.comes_from.name) return str(ireq.comes_from) triggers = set() for req, parent in e.causes: if parent is None: # This is a root requirement, so we can report it directly trigger = req.format_for_error() else: trigger = describe_trigger(parent) triggers.add(trigger) if triggers: info = text_join(sorted(triggers)) else: info = "the requested packages" msg = ( f"Cannot install {info} because these package versions " "have conflicting dependencies." ) logger.critical(msg) msg = "\nThe conflict is caused by:" relevant_constraints = set() for req, parent in e.causes: if req.name in constraints: relevant_constraints.add(req.name) msg = msg + "\n " if parent: msg = msg + f"{parent.name} {parent.version} depends on " else: msg = msg + "The user requested " msg = msg + req.format_for_error() for key in relevant_constraints: spec = constraints[key].specifier msg += f"\n The user requested (constraint) {key}{spec}" # Check for causes that had no candidates causes = set() for req, _ in e.causes: causes.add(req.name) no_candidates = {c for c in causes if not self._has_any_candidates(c)} if no_candidates: msg = ( msg + "\n\n" + "Additionally, some packages in these conflicts have no " + "matching distributions available for your environment:" + "\n " + "\n ".join(sorted(no_candidates)) ) msg = ( msg + "\n\n" + "To fix this you could try to:\n" + "1. loosen the range of package versions you've specified\n" + "2. remove package versions to allow pip to attempt to solve " + "the dependency conflict\n" ) logger.info(msg) return DistributionNotFound( "ResolutionImpossible: for help visit " "https://pip.pypa.io/en/latest/topics/dependency-resolution/" "#dealing-with-dependency-conflicts" ) ================================================ FILE: src/pip/_internal/resolution/resolvelib/found_candidates.py ================================================ """Utilities to lazily create and visit candidates found. Creating and visiting a candidate is a *very* costly operation. It involves fetching, extracting, potentially building modules from source, and verifying distribution metadata. It is therefore crucial for performance to keep everything here lazy all the way down, so we only touch candidates that we absolutely need, and not "download the world" when we only need one version of something. """ from __future__ import annotations import logging from collections.abc import Iterator, Sequence from typing import Any, Callable, Optional from pip._vendor.packaging.version import _BaseVersion from pip._internal.exceptions import MetadataInvalid from .base import Candidate logger = logging.getLogger(__name__) IndexCandidateInfo = tuple[_BaseVersion, Callable[[], Optional[Candidate]]] def _iter_built(infos: Iterator[IndexCandidateInfo]) -> Iterator[Candidate]: """Iterator for ``FoundCandidates``. This iterator is used when the package is not already installed. Candidates from index come later in their normal ordering. """ versions_found: set[_BaseVersion] = set() for version, func in infos: if version in versions_found: continue try: candidate = func() except MetadataInvalid as e: logger.warning( "Ignoring version %s of %s since it has invalid metadata:\n" "%s\n" "Please use pip<24.1 if you need to use this version.", version, e.ireq.name, e, ) # Mark version as found to avoid trying other candidates with the same # version, since they most likely have invalid metadata as well. versions_found.add(version) else: if candidate is None: continue yield candidate versions_found.add(version) def _iter_built_with_prepended( installed: Candidate, infos: Iterator[IndexCandidateInfo] ) -> Iterator[Candidate]: """Iterator for ``FoundCandidates``. This iterator is used when the resolver prefers the already-installed candidate and NOT to upgrade. The installed candidate is therefore always yielded first, and candidates from index come later in their normal ordering, except skipped when the version is already installed. """ yield installed versions_found: set[_BaseVersion] = {installed.version} for version, func in infos: if version in versions_found: continue candidate = func() if candidate is None: continue yield candidate versions_found.add(version) def _iter_built_with_inserted( installed: Candidate, infos: Iterator[IndexCandidateInfo] ) -> Iterator[Candidate]: """Iterator for ``FoundCandidates``. This iterator is used when the resolver prefers to upgrade an already-installed package. Candidates from index are returned in their normal ordering, except replaced when the version is already installed. The implementation iterates through and yields other candidates, inserting the installed candidate exactly once before we start yielding older or equivalent candidates, or after all other candidates if they are all newer. """ versions_found: set[_BaseVersion] = set() for version, func in infos: if version in versions_found: continue # If the installed candidate is better, yield it first. if installed.version >= version: yield installed versions_found.add(installed.version) candidate = func() if candidate is None: continue yield candidate versions_found.add(version) # If the installed candidate is older than all other candidates. if installed.version not in versions_found: yield installed class FoundCandidates(Sequence[Candidate]): """A lazy sequence to provide candidates to the resolver. The intended usage is to return this from `find_matches()` so the resolver can iterate through the sequence multiple times, but only access the index page when remote packages are actually needed. This improve performances when suitable candidates are already installed on disk. """ def __init__( self, get_infos: Callable[[], Iterator[IndexCandidateInfo]], installed: Candidate | None, prefers_installed: bool, incompatible_ids: set[int], ): self._get_infos = get_infos self._installed = installed self._prefers_installed = prefers_installed self._incompatible_ids = incompatible_ids self._bool: bool | None = None def __getitem__(self, index: Any) -> Any: # Implemented to satisfy the ABC check. This is not needed by the # resolver, and should not be used by the provider either (for # performance reasons). raise NotImplementedError("don't do this") def __iter__(self) -> Iterator[Candidate]: infos = self._get_infos() if not self._installed: iterator = _iter_built(infos) elif self._prefers_installed: iterator = _iter_built_with_prepended(self._installed, infos) else: iterator = _iter_built_with_inserted(self._installed, infos) return (c for c in iterator if id(c) not in self._incompatible_ids) def __len__(self) -> int: # Implemented to satisfy the ABC check. This is not needed by the # resolver, and should not be used by the provider either (for # performance reasons). raise NotImplementedError("don't do this") def __bool__(self) -> bool: if self._bool is not None: return self._bool if self._prefers_installed and self._installed: self._bool = True return True self._bool = any(self) return self._bool ================================================ FILE: src/pip/_internal/resolution/resolvelib/provider.py ================================================ from __future__ import annotations import math from collections.abc import Iterable, Iterator, Mapping, Sequence from functools import cache from typing import ( TYPE_CHECKING, TypeVar, ) from pip._vendor.resolvelib.providers import AbstractProvider from pip._internal.req.req_install import InstallRequirement from .base import Candidate, Constraint, Requirement from .candidates import REQUIRES_PYTHON_IDENTIFIER from .factory import Factory from .requirements import ExplicitRequirement if TYPE_CHECKING: from pip._vendor.resolvelib.providers import Preference from pip._vendor.resolvelib.resolvers import RequirementInformation PreferenceInformation = RequirementInformation[Requirement, Candidate] _ProviderBase = AbstractProvider[Requirement, Candidate, str] else: _ProviderBase = AbstractProvider # Notes on the relationship between the provider, the factory, and the # candidate and requirement classes. # # The provider is a direct implementation of the resolvelib class. Its role # is to deliver the API that resolvelib expects. # # Rather than work with completely abstract "requirement" and "candidate" # concepts as resolvelib does, pip has concrete classes implementing these two # ideas. The API of Requirement and Candidate objects are defined in the base # classes, but essentially map fairly directly to the equivalent provider # methods. In particular, `find_matches` and `is_satisfied_by` are # requirement methods, and `get_dependencies` is a candidate method. # # The factory is the interface to pip's internal mechanisms. It is stateless, # and is created by the resolver and held as a property of the provider. It is # responsible for creating Requirement and Candidate objects, and provides # services to those objects (access to pip's finder and preparer). D = TypeVar("D") V = TypeVar("V") def _get_with_identifier( mapping: Mapping[str, V], identifier: str, default: D, ) -> D | V: """Get item from a package name lookup mapping with a resolver identifier. This extra logic is needed when the target mapping is keyed by package name, which cannot be directly looked up with an identifier (which may contain requested extras). Additional logic is added to also look up a value by "cleaning up" the extras from the identifier. """ if identifier in mapping: return mapping[identifier] # HACK: Theoretically we should check whether this identifier is a valid # "NAME[EXTRAS]" format, and parse out the name part with packaging or # some regular expression. But since pip's resolver only spits out three # kinds of identifiers: normalized PEP 503 names, normalized names plus # extras, and Requires-Python, we can cheat a bit here. name, open_bracket, _ = identifier.partition("[") if open_bracket and name in mapping: return mapping[name] return default class PipProvider(_ProviderBase): """Pip's provider implementation for resolvelib. :params constraints: A mapping of constraints specified by the user. Keys are canonicalized project names. :params ignore_dependencies: Whether the user specified ``--no-deps``. :params upgrade_strategy: The user-specified upgrade strategy. :params user_requested: A set of canonicalized package names that the user supplied for pip to install/upgrade. """ def __init__( self, factory: Factory, constraints: dict[str, Constraint], ignore_dependencies: bool, upgrade_strategy: str, user_requested: dict[str, int], ) -> None: self._factory = factory self._constraints = constraints self._ignore_dependencies = ignore_dependencies self._upgrade_strategy = upgrade_strategy self._user_requested = user_requested @property def constraints(self) -> dict[str, Constraint]: """Public view of user-specified constraints. Exposes the provider's constraints mapping without encouraging external callers to reach into private attributes. """ return self._constraints def identify(self, requirement_or_candidate: Requirement | Candidate) -> str: return requirement_or_candidate.name def narrow_requirement_selection( self, identifiers: Iterable[str], resolutions: Mapping[str, Candidate], candidates: Mapping[str, Iterator[Candidate]], information: Mapping[str, Iterator[PreferenceInformation]], backtrack_causes: Sequence[PreferenceInformation], ) -> Iterable[str]: """Produce a subset of identifiers that should be considered before others. Currently pip narrows the following selection: * Requires-Python, if present is always returned by itself * Backtrack causes are considered next because they can be identified in linear time here, whereas because get_preference() is called for each identifier, it would be quadratic to check for them there. Further, the current backtrack causes likely need to be resolved before other requirements as a resolution can't be found while there is a conflict. """ backtrack_identifiers = set() for info in backtrack_causes: backtrack_identifiers.add(info.requirement.name) if info.parent is not None: backtrack_identifiers.add(info.parent.name) current_backtrack_causes = [] for identifier in identifiers: # Requires-Python has only one candidate and the check is basically # free, so we always do it first to avoid needless work if it fails. # This skips calling get_preference() for all other identifiers. if identifier == REQUIRES_PYTHON_IDENTIFIER: return [identifier] # Check if this identifier is a backtrack cause if identifier in backtrack_identifiers: current_backtrack_causes.append(identifier) continue if current_backtrack_causes: return current_backtrack_causes return identifiers def get_preference( self, identifier: str, resolutions: Mapping[str, Candidate], candidates: Mapping[str, Iterator[Candidate]], information: Mapping[str, Iterable[PreferenceInformation]], backtrack_causes: Sequence[PreferenceInformation], ) -> Preference: """Produce a sort key for given requirement based on preference. The lower the return value is, the more preferred this group of arguments is. Currently pip considers the following in order: * Any requirement that is "direct", e.g., points to an explicit URL. * Any requirement that is "pinned", i.e., contains the operator ``===`` or ``==`` without a wildcard. * Any requirement that imposes an upper version limit, i.e., contains the operator ``<``, ``<=``, ``~=``, or ``==`` with a wildcard. Because pip prioritizes the latest version, preferring explicit upper bounds can rule out infeasible candidates sooner. This does not imply that upper bounds are good practice; they can make dependency management and resolution harder. * Order user-specified requirements as they are specified, placing other requirements afterward. * Any "non-free" requirement, i.e., one that contains at least one operator, such as ``>=`` or ``!=``. * Alphabetical order for consistency (aids debuggability). """ try: next(iter(information[identifier])) except StopIteration: # There is no information for this identifier, so there's no known # candidates. has_information = False else: has_information = True if not has_information: direct = False ireqs: tuple[InstallRequirement | None, ...] = () else: # Go through the information and for each requirement, # check if it's explicit (e.g., a direct link) and get the # InstallRequirement (the second element) from get_candidate_lookup() directs, ireqs = zip( *( (isinstance(r, ExplicitRequirement), r.get_candidate_lookup()[1]) for r, _ in information[identifier] ) ) direct = any(directs) operators: list[tuple[str, str]] = [ (specifier.operator, specifier.version) for specifier_set in (ireq.specifier for ireq in ireqs if ireq) for specifier in specifier_set ] pinned = any(((op[:2] == "==") and ("*" not in ver)) for op, ver in operators) upper_bounded = any( ((op in ("<", "<=", "~=")) or (op == "==" and "*" in ver)) for op, ver in operators ) unfree = bool(operators) requested_order = self._user_requested.get(identifier, math.inf) return ( not direct, not pinned, not upper_bounded, requested_order, not unfree, identifier, ) def find_matches( self, identifier: str, requirements: Mapping[str, Iterator[Requirement]], incompatibilities: Mapping[str, Iterator[Candidate]], ) -> Iterable[Candidate]: def _eligible_for_upgrade(identifier: str) -> bool: """Are upgrades allowed for this project? This checks the upgrade strategy, and whether the project was one that the user specified in the command line, in order to decide whether we should upgrade if there's a newer version available. (Note that we don't need access to the `--upgrade` flag, because an upgrade strategy of "to-satisfy-only" means that `--upgrade` was not specified). """ if self._upgrade_strategy == "eager": return True elif self._upgrade_strategy == "only-if-needed": user_order = _get_with_identifier( self._user_requested, identifier, default=None, ) return user_order is not None return False constraint = _get_with_identifier( self._constraints, identifier, default=Constraint.empty(), ) return self._factory.find_candidates( identifier=identifier, requirements=requirements, constraint=constraint, prefers_installed=(not _eligible_for_upgrade(identifier)), incompatibilities=incompatibilities, is_satisfied_by=self.is_satisfied_by, ) @staticmethod @cache def is_satisfied_by(requirement: Requirement, candidate: Candidate) -> bool: return requirement.is_satisfied_by(candidate) def get_dependencies(self, candidate: Candidate) -> Iterable[Requirement]: with_requires = not self._ignore_dependencies # iter_dependencies() can perform nontrivial work so delay until needed. return (r for r in candidate.iter_dependencies(with_requires) if r is not None) ================================================ FILE: src/pip/_internal/resolution/resolvelib/reporter.py ================================================ from __future__ import annotations from collections import defaultdict from collections.abc import Mapping from logging import getLogger from typing import Any from pip._vendor.resolvelib.reporters import BaseReporter from .base import Candidate, Constraint, Requirement logger = getLogger(__name__) class PipReporter(BaseReporter[Requirement, Candidate, str]): def __init__(self, constraints: Mapping[str, Constraint] | None = None) -> None: self.reject_count_by_package: defaultdict[str, int] = defaultdict(int) self._constraints = constraints or {} self._messages_at_reject_count = { 1: ( "pip is looking at multiple versions of {package_name} to " "determine which version is compatible with other " "requirements. This could take a while." ), 8: ( "pip is still looking at multiple versions of {package_name} to " "determine which version is compatible with other " "requirements. This could take a while." ), 13: ( "This is taking longer than usual. You might need to provide " "the dependency resolver with stricter constraints to reduce " "runtime. See https://pip.pypa.io/warnings/backtracking for " "guidance. If you want to abort this run, press Ctrl + C." ), } def rejecting_candidate(self, criterion: Any, candidate: Candidate) -> None: """Report a candidate being rejected. Logs both the rejection count message (if applicable) and details about the requirements and constraints that caused the rejection. """ self.reject_count_by_package[candidate.name] += 1 count = self.reject_count_by_package[candidate.name] if count in self._messages_at_reject_count: message = self._messages_at_reject_count[count] logger.info("INFO: %s", message.format(package_name=candidate.name)) msg = "Will try a different candidate, due to conflict:" for req_info in criterion.information: req, parent = req_info.requirement, req_info.parent msg += "\n " if parent: msg += f"{parent.name} {parent.version} depends on " else: msg += "The user requested " msg += req.format_for_error() # Add any relevant constraints if self._constraints: name = candidate.name constraint = self._constraints.get(name) if constraint and constraint.specifier: constraint_text = f"{name}{constraint.specifier}" msg += f"\n The user requested (constraint) {constraint_text}" logger.debug(msg) class PipDebuggingReporter(BaseReporter[Requirement, Candidate, str]): """A reporter that does an info log for every event it sees.""" def starting(self) -> None: logger.info("Reporter.starting()") def starting_round(self, index: int) -> None: logger.info("Reporter.starting_round(%r)", index) def ending_round(self, index: int, state: Any) -> None: logger.info("Reporter.ending_round(%r, state)", index) logger.debug("Reporter.ending_round(%r, %r)", index, state) def ending(self, state: Any) -> None: logger.info("Reporter.ending(%r)", state) def adding_requirement( self, requirement: Requirement, parent: Candidate | None ) -> None: logger.info("Reporter.adding_requirement(%r, %r)", requirement, parent) def rejecting_candidate(self, criterion: Any, candidate: Candidate) -> None: logger.info("Reporter.rejecting_candidate(%r, %r)", criterion, candidate) def pinning(self, candidate: Candidate) -> None: logger.info("Reporter.pinning(%r)", candidate) ================================================ FILE: src/pip/_internal/resolution/resolvelib/requirements.py ================================================ from __future__ import annotations from typing import Any from pip._vendor.packaging.specifiers import SpecifierSet from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._internal.req.constructors import install_req_drop_extras from pip._internal.req.req_install import InstallRequirement from .base import Candidate, CandidateLookup, Requirement, format_name class ExplicitRequirement(Requirement): def __init__(self, candidate: Candidate) -> None: self.candidate = candidate def __str__(self) -> str: return str(self.candidate) def __repr__(self) -> str: return f"{self.__class__.__name__}({self.candidate!r})" def __hash__(self) -> int: return hash(self.candidate) def __eq__(self, other: Any) -> bool: if not isinstance(other, ExplicitRequirement): return False return self.candidate == other.candidate @property def project_name(self) -> NormalizedName: # No need to canonicalize - the candidate did this return self.candidate.project_name @property def name(self) -> str: # No need to canonicalize - the candidate did this return self.candidate.name def format_for_error(self) -> str: return self.candidate.format_for_error() def get_candidate_lookup(self) -> CandidateLookup: return self.candidate, None def is_satisfied_by(self, candidate: Candidate) -> bool: return candidate == self.candidate class SpecifierRequirement(Requirement): def __init__(self, ireq: InstallRequirement) -> None: assert ireq.link is None, "This is a link, not a specifier" self._ireq = ireq self._equal_cache: str | None = None self._hash: int | None = None self._extras = frozenset(canonicalize_name(e) for e in self._ireq.extras) @property def _equal(self) -> str: if self._equal_cache is not None: return self._equal_cache self._equal_cache = str(self._ireq) return self._equal_cache def __str__(self) -> str: return str(self._ireq.req) def __repr__(self) -> str: return f"{self.__class__.__name__}({str(self._ireq.req)!r})" def __eq__(self, other: object) -> bool: if not isinstance(other, SpecifierRequirement): return NotImplemented return self._equal == other._equal def __hash__(self) -> int: if self._hash is not None: return self._hash self._hash = hash(self._equal) return self._hash @property def project_name(self) -> NormalizedName: assert self._ireq.req, "Specifier-backed ireq is always PEP 508" return canonicalize_name(self._ireq.req.name) @property def name(self) -> str: return format_name(self.project_name, self._extras) def format_for_error(self) -> str: # Convert comma-separated specifiers into "A, B, ..., F and G" # This makes the specifier a bit more "human readable", without # risking a change in meaning. (Hopefully! Not all edge cases have # been checked) parts = [s.strip() for s in str(self).split(",")] if len(parts) == 0: return "" elif len(parts) == 1: return parts[0] return ", ".join(parts[:-1]) + " and " + parts[-1] def get_candidate_lookup(self) -> CandidateLookup: return None, self._ireq def is_satisfied_by(self, candidate: Candidate) -> bool: assert candidate.name == self.name, ( f"Internal issue: Candidate is not for this requirement " f"{candidate.name} vs {self.name}" ) # We can safely always allow prereleases here since PackageFinder # already implements the prerelease logic, and would have filtered out # prerelease candidates if the user does not expect them. assert self._ireq.req, "Specifier-backed ireq is always PEP 508" spec = self._ireq.req.specifier return spec.contains(candidate.version, prereleases=True) class SpecifierWithoutExtrasRequirement(SpecifierRequirement): """ Requirement backed by an install requirement on a base package. Trims extras from its install requirement if there are any. """ def __init__(self, ireq: InstallRequirement) -> None: assert ireq.link is None, "This is a link, not a specifier" self._ireq = install_req_drop_extras(ireq) self._equal_cache: str | None = None self._hash: int | None = None self._extras = frozenset(canonicalize_name(e) for e in self._ireq.extras) @property def _equal(self) -> str: if self._equal_cache is not None: return self._equal_cache self._equal_cache = str(self._ireq) return self._equal_cache def __eq__(self, other: object) -> bool: if not isinstance(other, SpecifierWithoutExtrasRequirement): return NotImplemented return self._equal == other._equal def __hash__(self) -> int: if self._hash is not None: return self._hash self._hash = hash(self._equal) return self._hash class RequiresPythonRequirement(Requirement): """A requirement representing Requires-Python metadata.""" def __init__(self, specifier: SpecifierSet, match: Candidate) -> None: self.specifier = specifier self._specifier_string = str(specifier) # for faster __eq__ self._hash: int | None = None self._candidate = match # Pre-compute candidate lookup to avoid repeated specifier checks if specifier.contains(match.version, prereleases=True): self._candidate_lookup: CandidateLookup = (match, None) else: self._candidate_lookup = (None, None) def __str__(self) -> str: return f"Python {self.specifier}" def __repr__(self) -> str: return f"{self.__class__.__name__}({str(self.specifier)!r})" def __hash__(self) -> int: if self._hash is not None: return self._hash self._hash = hash((self._specifier_string, self._candidate)) return self._hash def __eq__(self, other: Any) -> bool: if not isinstance(other, RequiresPythonRequirement): return False return ( self._specifier_string == other._specifier_string and self._candidate == other._candidate ) @property def project_name(self) -> NormalizedName: return self._candidate.project_name @property def name(self) -> str: return self._candidate.name def format_for_error(self) -> str: return str(self) def get_candidate_lookup(self) -> CandidateLookup: return self._candidate_lookup def is_satisfied_by(self, candidate: Candidate) -> bool: assert candidate.name == self._candidate.name, "Not Python candidate" # We can safely always allow prereleases here since PackageFinder # already implements the prerelease logic, and would have filtered out # prerelease candidates if the user does not expect them. return self.specifier.contains(candidate.version, prereleases=True) class UnsatisfiableRequirement(Requirement): """A requirement that cannot be satisfied.""" def __init__(self, name: NormalizedName) -> None: self._name = name def __str__(self) -> str: return f"{self._name} (unavailable)" def __repr__(self) -> str: return f"{self.__class__.__name__}({str(self._name)!r})" def __eq__(self, other: object) -> bool: if not isinstance(other, UnsatisfiableRequirement): return NotImplemented return self._name == other._name def __hash__(self) -> int: return hash(self._name) @property def project_name(self) -> NormalizedName: return self._name @property def name(self) -> str: return self._name def format_for_error(self) -> str: return str(self) def get_candidate_lookup(self) -> CandidateLookup: return None, None def is_satisfied_by(self, candidate: Candidate) -> bool: return False ================================================ FILE: src/pip/_internal/resolution/resolvelib/resolver.py ================================================ from __future__ import annotations import contextlib import functools import logging import os from typing import TYPE_CHECKING, cast from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.resolvelib import BaseReporter, ResolutionImpossible, ResolutionTooDeep from pip._vendor.resolvelib import Resolver as RLResolver from pip._vendor.resolvelib.structs import DirectedGraph from pip._internal.cache import WheelCache from pip._internal.exceptions import ResolutionTooDeepError from pip._internal.index.package_finder import PackageFinder from pip._internal.operations.prepare import RequirementPreparer from pip._internal.req.constructors import install_req_extend_extras from pip._internal.req.req_install import InstallRequirement from pip._internal.req.req_set import RequirementSet from pip._internal.resolution.base import BaseResolver, InstallRequirementProvider from pip._internal.resolution.resolvelib.provider import PipProvider from pip._internal.resolution.resolvelib.reporter import ( PipDebuggingReporter, PipReporter, ) from pip._internal.utils.packaging import get_requirement from .base import Candidate, Requirement from .factory import Factory if TYPE_CHECKING: from pip._vendor.resolvelib.resolvers import Result as RLResult Result = RLResult[Requirement, Candidate, str] logger = logging.getLogger(__name__) class Resolver(BaseResolver): _allowed_strategies = {"eager", "only-if-needed", "to-satisfy-only"} def __init__( self, preparer: RequirementPreparer, finder: PackageFinder, wheel_cache: WheelCache | None, make_install_req: InstallRequirementProvider, use_user_site: bool, ignore_dependencies: bool, ignore_installed: bool, ignore_requires_python: bool, force_reinstall: bool, upgrade_strategy: str, py_version_info: tuple[int, ...] | None = None, ): super().__init__() assert upgrade_strategy in self._allowed_strategies self.factory = Factory( finder=finder, preparer=preparer, make_install_req=make_install_req, wheel_cache=wheel_cache, use_user_site=use_user_site, force_reinstall=force_reinstall, ignore_installed=ignore_installed, ignore_requires_python=ignore_requires_python, py_version_info=py_version_info, ) self.ignore_dependencies = ignore_dependencies self.upgrade_strategy = upgrade_strategy self._result: Result | None = None def resolve( self, root_reqs: list[InstallRequirement], check_supported_wheels: bool ) -> RequirementSet: collected = self.factory.collect_root_requirements(root_reqs) provider = PipProvider( factory=self.factory, constraints=collected.constraints, ignore_dependencies=self.ignore_dependencies, upgrade_strategy=self.upgrade_strategy, user_requested=collected.user_requested, ) if "PIP_RESOLVER_DEBUG" in os.environ: reporter: BaseReporter[Requirement, Candidate, str] = PipDebuggingReporter() else: reporter = PipReporter(constraints=provider.constraints) resolver: RLResolver[Requirement, Candidate, str] = RLResolver( provider, reporter, ) try: limit_how_complex_resolution_can_be = 200000 result = self._result = resolver.resolve( collected.requirements, max_rounds=limit_how_complex_resolution_can_be ) except ResolutionImpossible as e: error = self.factory.get_installation_error( cast("ResolutionImpossible[Requirement, Candidate]", e), collected.constraints, ) raise error from e except ResolutionTooDeep: raise ResolutionTooDeepError from None req_set = RequirementSet(check_supported_wheels=check_supported_wheels) # process candidates with extras last to ensure their base equivalent is # already in the req_set if appropriate. # Python's sort is stable so using a binary key function keeps relative order # within both subsets. for candidate in sorted( result.mapping.values(), key=lambda c: c.name != c.project_name ): ireq = candidate.get_install_requirement() if ireq is None: if candidate.name != candidate.project_name: # extend existing req's extras with contextlib.suppress(KeyError): req = req_set.get_requirement(candidate.project_name) req_set.add_named_requirement( install_req_extend_extras( req, get_requirement(candidate.name).extras ) ) continue # Check if there is already an installation under the same name, # and set a flag for later stages to uninstall it, if needed. installed_dist = self.factory.get_dist_to_uninstall(candidate) if installed_dist is None: # There is no existing installation -- nothing to uninstall. ireq.should_reinstall = False elif self.factory.force_reinstall: # The --force-reinstall flag is set -- reinstall. ireq.should_reinstall = True elif installed_dist.version != candidate.version: # The installation is different in version -- reinstall. ireq.should_reinstall = True elif candidate.is_editable or installed_dist.editable: # The incoming distribution is editable, or different in # editable-ness to installation -- reinstall. ireq.should_reinstall = True elif candidate.source_link and candidate.source_link.is_file: # The incoming distribution is under file:// if candidate.source_link.is_wheel: # is a local wheel -- do nothing. logger.info( "%s is already installed with the same version as the " "provided wheel. Use --force-reinstall to force an " "installation of the wheel.", ireq.name, ) continue # is a local sdist or path -- reinstall ireq.should_reinstall = True else: continue link = candidate.source_link if link and link.is_yanked: # The reason can contain non-ASCII characters, Unicode # is required for Python 2. msg = ( "The candidate selected for download or install is a " "yanked version: {name!r} candidate (version {version} " "at {link})\nReason for being yanked: {reason}" ).format( name=candidate.name, version=candidate.version, link=link, reason=link.yanked_reason or "", ) logger.warning(msg) req_set.add_named_requirement(ireq) return req_set def get_installation_order( self, req_set: RequirementSet ) -> list[InstallRequirement]: """Get order for installation of requirements in RequirementSet. The returned list contains a requirement before another that depends on it. This helps ensure that the environment is kept consistent as they get installed one-by-one. The current implementation creates a topological ordering of the dependency graph, giving more weight to packages with less or no dependencies, while breaking any cycles in the graph at arbitrary points. We make no guarantees about where the cycle would be broken, other than it *would* be broken. """ assert self._result is not None, "must call resolve() first" if not req_set.requirements: # Nothing is left to install, so we do not need an order. return [] graph = self._result.graph weights = get_topological_weights(graph, set(req_set.requirements.keys())) sorted_items = sorted( req_set.requirements.items(), key=functools.partial(_req_set_item_sorter, weights=weights), reverse=True, ) return [ireq for _, ireq in sorted_items] def get_topological_weights( graph: DirectedGraph[str | None], requirement_keys: set[str] ) -> dict[str | None, int]: """Assign weights to each node based on how "deep" they are. This implementation may change at any point in the future without prior notice. We first simplify the dependency graph by pruning any leaves and giving them the highest weight: a package without any dependencies should be installed first. This is done again and again in the same way, giving ever less weight to the newly found leaves. The loop stops when no leaves are left: all remaining packages have at least one dependency left in the graph. Then we continue with the remaining graph, by taking the length for the longest path to any node from root, ignoring any paths that contain a single node twice (i.e. cycles). This is done through a depth-first search through the graph, while keeping track of the path to the node. Cycles in the graph result would result in node being revisited while also being on its own path. In this case, take no action. This helps ensure we don't get stuck in a cycle. When assigning weight, the longer path (i.e. larger length) is preferred. We are only interested in the weights of packages that are in the requirement_keys. """ path: set[str | None] = set() weights: dict[str | None, list[int]] = {} def visit(node: str | None) -> None: if node in path: # We hit a cycle, so we'll break it here. return # The walk is exponential and for pathologically connected graphs (which # are the ones most likely to contain cycles in the first place) it can # take until the heat-death of the universe. To counter this we limit # the number of attempts to visit (i.e. traverse through) any given # node. We choose a value here which gives decent enough coverage for # fairly well behaved graphs, and still limits the walk complexity to be # linear in nature. cur_weights = weights.get(node, []) if len(cur_weights) >= 5: return # Time to visit the children! path.add(node) for child in graph.iter_children(node): visit(child) path.remove(node) if node not in requirement_keys: return cur_weights.append(len(path)) weights[node] = cur_weights # Simplify the graph, pruning leaves that have no dependencies. This is # needed for large graphs (say over 200 packages) because the `visit` # function is slower for large/densely connected graphs, taking minutes. # See https://github.com/pypa/pip/issues/10557 # We repeat the pruning step until we have no more leaves to remove. while True: leaves = set() for key in graph: if key is None: continue for _child in graph.iter_children(key): # This means we have at least one child break else: # No child. leaves.add(key) if not leaves: # We are done simplifying. break # Calculate the weight for the leaves. weight = len(graph) - 1 for leaf in leaves: if leaf not in requirement_keys: continue weights[leaf] = [weight] # Remove the leaves from the graph, making it simpler. for leaf in leaves: graph.remove(leaf) # Visit the remaining graph, this will only have nodes to handle if the # graph had a cycle in it, which the pruning step above could not handle. # `None` is guaranteed to be the root node by resolvelib. visit(None) # Sanity check: all requirement keys should be in the weights, # and no other keys should be in the weights. difference = set(weights.keys()).difference(requirement_keys) assert not difference, difference # Now give back all the weights, choosing the largest ones from what we # accumulated. return {node: max(wgts) for (node, wgts) in weights.items()} def _req_set_item_sorter( item: tuple[str, InstallRequirement], weights: dict[str | None, int], ) -> tuple[int, str]: """Key function used to sort install requirements for installation. Based on the "weight" mapping calculated in ``get_installation_order()``. The canonical package name is returned as the second member as a tie- breaker to ensure the result is predictable, which is useful in tests. """ name = canonicalize_name(item[0]) return weights[name], name ================================================ FILE: src/pip/_internal/self_outdated_check.py ================================================ from __future__ import annotations import datetime import functools import hashlib import json import logging import optparse import os.path import sys from dataclasses import dataclass from typing import Callable from pip._vendor.packaging.version import Version from pip._vendor.packaging.version import parse as parse_version from pip._vendor.rich.console import Group from pip._vendor.rich.markup import escape from pip._vendor.rich.text import Text from pip._internal.index.collector import LinkCollector from pip._internal.index.package_finder import PackageFinder from pip._internal.metadata import get_default_environment from pip._internal.models.release_control import ReleaseControl from pip._internal.models.selection_prefs import SelectionPreferences from pip._internal.network.session import PipSession from pip._internal.utils.compat import WINDOWS from pip._internal.utils.datetime import parse_iso_datetime from pip._internal.utils.entrypoints import ( get_best_invocation_for_this_pip, get_best_invocation_for_this_python, ) from pip._internal.utils.filesystem import ( adjacent_tmp_file, check_path_owner, copy_directory_permissions, replace, ) from pip._internal.utils.misc import ( ExternallyManagedEnvironment, check_externally_managed, ensure_dir, ) _WEEK = datetime.timedelta(days=7) logger = logging.getLogger(__name__) def _get_statefile_name(key: str) -> str: key_bytes = key.encode() name = hashlib.sha224(key_bytes).hexdigest() return name class SelfCheckState: def __init__(self, cache_dir: str) -> None: self._state: dict[str, str] = {} self._statefile_path = None # Try to load the existing state if cache_dir: self._statefile_path = os.path.join( cache_dir, "selfcheck", _get_statefile_name(self.key) ) try: with open(self._statefile_path, encoding="utf-8") as statefile: self._state = json.load(statefile) except (OSError, ValueError, KeyError): # Explicitly suppressing exceptions, since we don't want to # error out if the cache file is invalid. pass @property def key(self) -> str: return sys.prefix def get(self, current_time: datetime.datetime) -> str | None: """Check if we have a not-outdated version loaded already.""" if not self._state: return None if "last_check" not in self._state: return None if "pypi_version" not in self._state: return None # Determine if we need to refresh the state last_check = parse_iso_datetime(self._state["last_check"]) time_since_last_check = current_time - last_check if time_since_last_check > _WEEK: return None return self._state["pypi_version"] def set(self, pypi_version: str, current_time: datetime.datetime) -> None: # If we do not have a path to cache in, don't bother saving. if not self._statefile_path: return statefile_directory = os.path.dirname(self._statefile_path) # Check to make sure that we own the directory if not check_path_owner(statefile_directory): return # Now that we've ensured the directory is owned by this user, we'll go # ahead and make sure that all our directories are created. ensure_dir(statefile_directory) state = { # Include the key so it's easy to tell which pip wrote the # file. "key": self.key, "last_check": current_time.isoformat(), "pypi_version": pypi_version, } text = json.dumps(state, sort_keys=True, separators=(",", ":")) with adjacent_tmp_file(self._statefile_path) as f: f.write(text.encode()) copy_directory_permissions(statefile_directory, f) try: # Since we have a prefix-specific state file, we can just # overwrite whatever is there, no need to check. replace(f.name, self._statefile_path) except OSError: # Best effort. pass @dataclass class UpgradePrompt: old: str new: str def __rich__(self) -> Group: if WINDOWS: pip_cmd = f"{get_best_invocation_for_this_python()} -m pip" else: pip_cmd = get_best_invocation_for_this_pip() notice = "[bold][[reset][blue]notice[reset][bold]][reset]" return Group( Text(), Text.from_markup( f"{notice} A new release of pip is available: " f"[red]{self.old}[reset] -> [green]{self.new}[reset]" ), Text.from_markup( f"{notice} To update, run: " f"[green]{escape(pip_cmd)} install --upgrade pip" ), ) def was_installed_by_pip(pkg: str) -> bool: """Checks whether pkg was installed by pip This is used not to display the upgrade message when pip is in fact installed by system package manager, such as dnf on Fedora. """ dist = get_default_environment().get_distribution(pkg) return dist is not None and "pip" == dist.installer def _get_current_remote_pip_version( session: PipSession, options: optparse.Values ) -> str | None: # Lets use PackageFinder to see what the latest pip version is link_collector = LinkCollector.create( session, options=options, suppress_no_index=True, ) # Pass allow_yanked=False so we don't suggest upgrading to a # yanked version. selection_prefs = SelectionPreferences( allow_yanked=False, release_control=ReleaseControl(only_final={"pip"}), ) finder = PackageFinder.create( link_collector=link_collector, selection_prefs=selection_prefs, ) best_candidate = finder.find_best_candidate("pip").best_candidate if best_candidate is None: return None return str(best_candidate.version) def _self_version_check_logic( *, state: SelfCheckState, current_time: datetime.datetime, local_version: Version, get_remote_version: Callable[[], str | None], ) -> UpgradePrompt | None: remote_version_str = state.get(current_time) if remote_version_str is None: remote_version_str = get_remote_version() if remote_version_str is None: logger.debug("No remote pip version found") return None state.set(remote_version_str, current_time) remote_version = parse_version(remote_version_str) logger.debug("Remote version of pip: %s", remote_version) logger.debug("Local version of pip: %s", local_version) pip_installed_by_pip = was_installed_by_pip("pip") logger.debug("Was pip installed by pip? %s", pip_installed_by_pip) if not pip_installed_by_pip: return None # Only suggest upgrade if pip is installed by pip. local_version_is_older = ( local_version < remote_version and local_version.base_version != remote_version.base_version ) if local_version_is_older: return UpgradePrompt(old=str(local_version), new=remote_version_str) return None def pip_self_version_check(session: PipSession, options: optparse.Values) -> None: """Check for an update for pip. Limit the frequency of checks to once per week. State is stored either in the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix of the pip script path. """ installed_dist = get_default_environment().get_distribution("pip") if not installed_dist: return try: check_externally_managed() except ExternallyManagedEnvironment: return upgrade_prompt = _self_version_check_logic( state=SelfCheckState(cache_dir=options.cache_dir), current_time=datetime.datetime.now(datetime.timezone.utc), local_version=installed_dist.version, get_remote_version=functools.partial( _get_current_remote_pip_version, session, options ), ) if upgrade_prompt is not None: logger.warning("%s", upgrade_prompt, extra={"rich": True}) ================================================ FILE: src/pip/_internal/utils/__init__.py ================================================ ================================================ FILE: src/pip/_internal/utils/_jaraco_text.py ================================================ """Functions brought over from jaraco.text. These functions are not supposed to be used within `pip._internal`. These are helper functions brought over from `jaraco.text` to enable vendoring newer copies of `pkg_resources` without having to vendor `jaraco.text` and its entire dependency cone; something that our vendoring setup is not currently capable of handling. License reproduced from original source below: Copyright Jason R. Coombs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ import functools import itertools def _nonblank(str): return str and not str.startswith("#") @functools.singledispatch def yield_lines(iterable): r""" Yield valid lines of a string or iterable. >>> list(yield_lines('')) [] >>> list(yield_lines(['foo', 'bar'])) ['foo', 'bar'] >>> list(yield_lines('foo\nbar')) ['foo', 'bar'] >>> list(yield_lines('\nfoo\n#bar\nbaz #comment')) ['foo', 'baz #comment'] >>> list(yield_lines(['foo\nbar', 'baz', 'bing\n\n\n'])) ['foo', 'bar', 'baz', 'bing'] """ return itertools.chain.from_iterable(map(yield_lines, iterable)) @yield_lines.register(str) def _(text): return filter(_nonblank, map(str.strip, text.splitlines())) def drop_comment(line): """ Drop comments. >>> drop_comment('foo # bar') 'foo' A hash without a space may be in a URL. >>> drop_comment('http://example.com/foo#bar') 'http://example.com/foo#bar' """ return line.partition(" #")[0] def join_continuation(lines): r""" Join lines continued by a trailing backslash. >>> list(join_continuation(['foo \\', 'bar', 'baz'])) ['foobar', 'baz'] >>> list(join_continuation(['foo \\', 'bar', 'baz'])) ['foobar', 'baz'] >>> list(join_continuation(['foo \\', 'bar \\', 'baz'])) ['foobarbaz'] Not sure why, but... The character preceding the backslash is also elided. >>> list(join_continuation(['goo\\', 'dly'])) ['godly'] A terrible idea, but... If no line is available to continue, suppress the lines. >>> list(join_continuation(['foo', 'bar\\', 'baz\\'])) ['foo'] """ lines = iter(lines) for item in lines: while item.endswith("\\"): try: item = item[:-2].strip() + next(lines) except StopIteration: return yield item ================================================ FILE: src/pip/_internal/utils/_log.py ================================================ """Customize logging Defines custom logger class for the `logger.verbose(...)` method. init_logging() must be called before any other modules that call logging.getLogger. """ import logging from typing import Any, cast # custom log level for `--verbose` output # between DEBUG and INFO VERBOSE = 15 class VerboseLogger(logging.Logger): """Custom Logger, defining a verbose log-level VERBOSE is between INFO and DEBUG. """ def verbose(self, msg: str, *args: Any, **kwargs: Any) -> None: return self.log(VERBOSE, msg, *args, **kwargs) def getLogger(name: str) -> VerboseLogger: """logging.getLogger, but ensures our VerboseLogger class is returned""" return cast(VerboseLogger, logging.getLogger(name)) def init_logging() -> None: """Register our VerboseLogger and VERBOSE log level. Should be called before any calls to getLogger(), i.e. in pip._internal.__init__ """ logging.setLoggerClass(VerboseLogger) logging.addLevelName(VERBOSE, "VERBOSE") ================================================ FILE: src/pip/_internal/utils/appdirs.py ================================================ """ This code wraps the vendored appdirs module to so the return values are compatible for the current pip code base. The intention is to rewrite current usages gradually, keeping the tests pass, and eventually drop this after all usages are changed. """ import os import sys from pip._vendor import platformdirs as _appdirs def user_cache_dir(appname: str) -> str: return _appdirs.user_cache_dir(appname, appauthor=False) def _macos_user_config_dir(appname: str, roaming: bool = True) -> str: # Use ~/Application Support/pip, if the directory exists. path = _appdirs.user_data_dir(appname, appauthor=False, roaming=roaming) if os.path.isdir(path): return path # Use a Linux-like ~/.config/pip, by default. linux_like_path = "~/.config/" if appname: linux_like_path = os.path.join(linux_like_path, appname) return os.path.expanduser(linux_like_path) def user_config_dir(appname: str, roaming: bool = True) -> str: if sys.platform == "darwin": return _macos_user_config_dir(appname, roaming) return _appdirs.user_config_dir(appname, appauthor=False, roaming=roaming) # for the discussion regarding site_config_dir locations # see def site_config_dirs(appname: str) -> list[str]: if sys.platform == "darwin": dirval = _appdirs.site_data_dir(appname, appauthor=False, multipath=True) return dirval.split(os.pathsep) dirval = _appdirs.site_config_dir(appname, appauthor=False, multipath=True) if sys.platform == "win32": return [dirval] # Unix-y system. Look in /etc as well. return dirval.split(os.pathsep) + ["/etc"] ================================================ FILE: src/pip/_internal/utils/compat.py ================================================ """Stuff that differs in different Python versions and platform distributions.""" import importlib.resources import logging import os import sys from typing import IO __all__ = ["get_path_uid", "stdlib_pkgs", "tomllib", "WINDOWS"] logger = logging.getLogger(__name__) def has_tls() -> bool: try: import _ssl # noqa: F401 # ignore unused return True except ImportError: pass from pip._vendor.urllib3.util import IS_PYOPENSSL return IS_PYOPENSSL def get_path_uid(path: str) -> int: """ Return path's uid. Does not follow symlinks: https://github.com/pypa/pip/pull/935#discussion_r5307003 Placed this function in compat due to differences on AIX and Jython, that should eventually go away. :raises OSError: When path is a symlink or can't be read. """ if hasattr(os, "O_NOFOLLOW"): fd = os.open(path, os.O_RDONLY | os.O_NOFOLLOW) file_uid = os.fstat(fd).st_uid os.close(fd) else: # AIX and Jython # WARNING: time of check vulnerability, but best we can do w/o NOFOLLOW if not os.path.islink(path): # older versions of Jython don't have `os.fstat` file_uid = os.stat(path).st_uid else: # raise OSError for parity with os.O_NOFOLLOW above raise OSError(f"{path} is a symlink; Will not return uid for symlinks") return file_uid # The importlib.resources.open_text function was deprecated in 3.11 with suggested # replacement we use below. if sys.version_info < (3, 11): open_text_resource = importlib.resources.open_text else: def open_text_resource( package: str, resource: str, encoding: str = "utf-8", errors: str = "strict" ) -> IO[str]: return (importlib.resources.files(package) / resource).open( "r", encoding=encoding, errors=errors ) if sys.version_info >= (3, 11): import tomllib else: from pip._vendor import tomli as tomllib # packages in the stdlib that may have installation metadata, but should not be # considered 'installed'. this theoretically could be determined based on # dist.location (py27:`sysconfig.get_paths()['stdlib']`, # py26:sysconfig.get_config_vars('LIBDEST')), but fear platform variation may # make this ineffective, so hard-coding stdlib_pkgs = {"python", "wsgiref", "argparse"} # windows detection, covers cpython and ironpython WINDOWS = sys.platform.startswith("win") or (sys.platform == "cli" and os.name == "nt") ================================================ FILE: src/pip/_internal/utils/compatibility_tags.py ================================================ """Generate and work with PEP 425 Compatibility Tags.""" from __future__ import annotations import re from pip._vendor.packaging.tags import ( PythonVersion, Tag, android_platforms, compatible_tags, cpython_tags, generic_tags, interpreter_name, interpreter_version, ios_platforms, mac_platforms, ) _apple_arch_pat = re.compile(r"(.+)_(\d+)_(\d+)_(.+)") def version_info_to_nodot(version_info: tuple[int, ...]) -> str: # Only use up to the first two numbers. return "".join(map(str, version_info[:2])) def _mac_platforms(arch: str) -> list[str]: match = _apple_arch_pat.match(arch) if match: name, major, minor, actual_arch = match.groups() mac_version = (int(major), int(minor)) arches = [ # Since we have always only checked that the platform starts # with "macosx", for backwards-compatibility we extract the # actual prefix provided by the user in case they provided # something like "macosxcustom_". It may be good to remove # this as undocumented or deprecate it in the future. "{}_{}".format(name, arch[len("macosx_") :]) for arch in mac_platforms(mac_version, actual_arch) ] else: # arch pattern didn't match (?!) arches = [arch] return arches def _ios_platforms(arch: str) -> list[str]: match = _apple_arch_pat.match(arch) if match: name, major, minor, actual_multiarch = match.groups() ios_version = (int(major), int(minor)) arches = [ # Since we have always only checked that the platform starts # with "ios", for backwards-compatibility we extract the # actual prefix provided by the user in case they provided # something like "ioscustom_". It may be good to remove # this as undocumented or deprecate it in the future. "{}_{}".format(name, arch[len("ios_") :]) for arch in ios_platforms(ios_version, actual_multiarch) ] else: # arch pattern didn't match (?!) arches = [arch] return arches def _android_platforms(arch: str) -> list[str]: match = re.fullmatch(r"android_(\d+)_(.+)", arch) if match: api_level, abi = match.groups() return list(android_platforms(int(api_level), abi)) else: # arch pattern didn't match (?!) return [arch] def _custom_manylinux_platforms(arch: str) -> list[str]: arches = [arch] arch_prefix, arch_sep, arch_suffix = arch.partition("_") if arch_prefix == "manylinux2014": # manylinux1/manylinux2010 wheels run on most manylinux2014 systems # with the exception of wheels depending on ncurses. PEP 599 states # manylinux1/manylinux2010 wheels should be considered # manylinux2014 wheels: # https://www.python.org/dev/peps/pep-0599/#backwards-compatibility-with-manylinux2010-wheels if arch_suffix in {"i686", "x86_64"}: arches.append("manylinux2010" + arch_sep + arch_suffix) arches.append("manylinux1" + arch_sep + arch_suffix) elif arch_prefix == "manylinux2010": # manylinux1 wheels run on most manylinux2010 systems with the # exception of wheels depending on ncurses. PEP 571 states # manylinux1 wheels should be considered manylinux2010 wheels: # https://www.python.org/dev/peps/pep-0571/#backwards-compatibility-with-manylinux1-wheels arches.append("manylinux1" + arch_sep + arch_suffix) return arches def _get_custom_platforms(arch: str) -> list[str]: arch_prefix, arch_sep, arch_suffix = arch.partition("_") if arch.startswith("macosx"): arches = _mac_platforms(arch) elif arch.startswith("ios"): arches = _ios_platforms(arch) elif arch_prefix == "android": arches = _android_platforms(arch) elif arch_prefix in ["manylinux2014", "manylinux2010"]: arches = _custom_manylinux_platforms(arch) else: arches = [arch] return arches def _expand_allowed_platforms(platforms: list[str] | None) -> list[str] | None: if not platforms: return None seen = set() result = [] for p in platforms: if p in seen: continue additions = [c for c in _get_custom_platforms(p) if c not in seen] seen.update(additions) result.extend(additions) return result def _get_python_version(version: str) -> PythonVersion: if len(version) > 1: return int(version[0]), int(version[1:]) else: return (int(version[0]),) def _get_custom_interpreter( implementation: str | None = None, version: str | None = None ) -> str: if implementation is None: implementation = interpreter_name() if version is None: version = interpreter_version() return f"{implementation}{version}" def get_supported( version: str | None = None, platforms: list[str] | None = None, impl: str | None = None, abis: list[str] | None = None, ) -> list[Tag]: """Return a list of supported tags for each version specified in `versions`. :param version: a string version, of the form "33" or "32", or None. The version will be assumed to support our ABI. :param platform: specify a list of platforms you want valid tags for, or None. If None, use the local system platform. :param impl: specify the exact implementation you want valid tags for, or None. If None, use the local interpreter impl. :param abis: specify a list of abis you want valid tags for, or None. If None, use the local interpreter abi. """ supported: list[Tag] = [] python_version: PythonVersion | None = None if version is not None: python_version = _get_python_version(version) interpreter = _get_custom_interpreter(impl, version) platforms = _expand_allowed_platforms(platforms) is_cpython = (impl or interpreter_name()) == "cp" if is_cpython: supported.extend( cpython_tags( python_version=python_version, abis=abis, platforms=platforms, ) ) else: supported.extend( generic_tags( interpreter=interpreter, abis=abis, platforms=platforms, ) ) supported.extend( compatible_tags( python_version=python_version, interpreter=interpreter, platforms=platforms, ) ) return supported ================================================ FILE: src/pip/_internal/utils/datetime.py ================================================ """For when pip wants to check the date or time.""" import datetime import sys def today_is_later_than(year: int, month: int, day: int) -> bool: today = datetime.date.today() given = datetime.date(year, month, day) return today > given def parse_iso_datetime(isodate: str) -> datetime.datetime: """Convert an ISO format string to a datetime. Handles the format 2020-01-22T14:24:01Z (trailing Z) which is not supported by older versions of fromisoformat. """ # Python 3.11+ supports Z suffix natively in fromisoformat if sys.version_info >= (3, 11): return datetime.datetime.fromisoformat(isodate) else: return datetime.datetime.fromisoformat( isodate.replace("Z", "+00:00") if isodate.endswith("Z") and ("T" in isodate or " " in isodate.strip()) else isodate ) ================================================ FILE: src/pip/_internal/utils/deprecation.py ================================================ """ A module that implements tooling to enable easy warnings about deprecations. """ from __future__ import annotations import logging import warnings from typing import Any, TextIO from pip._vendor.packaging.version import parse from pip import __version__ as current_version # NOTE: tests patch this name. DEPRECATION_MSG_PREFIX = "DEPRECATION: " class PipDeprecationWarning(Warning): pass _original_showwarning: Any = None # Warnings <-> Logging Integration def _showwarning( message: Warning | str, category: type[Warning], filename: str, lineno: int, file: TextIO | None = None, line: str | None = None, ) -> None: if file is not None: if _original_showwarning is not None: _original_showwarning(message, category, filename, lineno, file, line) elif issubclass(category, PipDeprecationWarning): # We use a specially named logger which will handle all of the # deprecation messages for pip. logger = logging.getLogger("pip._internal.deprecations") logger.warning(message) else: _original_showwarning(message, category, filename, lineno, file, line) def install_warning_logger() -> None: # Enable our Deprecation Warnings warnings.simplefilter("default", PipDeprecationWarning, append=True) global _original_showwarning if _original_showwarning is None: _original_showwarning = warnings.showwarning warnings.showwarning = _showwarning def deprecated( *, reason: str, replacement: str | None, gone_in: str | None, feature_flag: str | None = None, issue: int | None = None, ) -> None: """Helper to deprecate existing functionality. reason: Textual reason shown to the user about why this functionality has been deprecated. Should be a complete sentence. replacement: Textual suggestion shown to the user about what alternative functionality they can use. gone_in: The version of pip does this functionality should get removed in. Raises an error if pip's current version is greater than or equal to this. feature_flag: Command-line flag of the form --use-feature={feature_flag} for testing upcoming functionality. issue: Issue number on the tracker that would serve as a useful place for users to find related discussion and provide feedback. """ # Determine whether or not the feature is already gone in this version. is_gone = gone_in is not None and parse(current_version) >= parse(gone_in) message_parts = [ (reason, f"{DEPRECATION_MSG_PREFIX}{{}}"), ( gone_in, ( "pip {} will enforce this behaviour change." if not is_gone else "Since pip {}, this is no longer supported." ), ), ( replacement, "A possible replacement is {}.", ), ( feature_flag, ( "You can use the flag --use-feature={} to test the upcoming behaviour." if not is_gone else None ), ), ( issue, "Discussion can be found at https://github.com/pypa/pip/issues/{}", ), ] message = " ".join( format_str.format(value) for value, format_str in message_parts if format_str is not None and value is not None ) # Raise as an error if this behaviour is deprecated. if is_gone: raise PipDeprecationWarning(message) warnings.warn(message, category=PipDeprecationWarning, stacklevel=2) ================================================ FILE: src/pip/_internal/utils/direct_url_helpers.py ================================================ from __future__ import annotations from pip._internal.models.direct_url import ArchiveInfo, DirectUrl, DirInfo, VcsInfo from pip._internal.models.link import Link from pip._internal.utils.urls import path_to_url from pip._internal.vcs import vcs def direct_url_as_pep440_direct_reference(direct_url: DirectUrl, name: str) -> str: """Convert a DirectUrl to a pip requirement string.""" direct_url.validate() # if invalid, this is a pip bug requirement = name + " @ " fragments = [] if isinstance(direct_url.info, VcsInfo): requirement += ( f"{direct_url.info.vcs}+{direct_url.url}@{direct_url.info.commit_id}" ) elif isinstance(direct_url.info, ArchiveInfo): requirement += direct_url.url if direct_url.info.hash: fragments.append(direct_url.info.hash) else: assert isinstance(direct_url.info, DirInfo) requirement += direct_url.url if direct_url.subdirectory: fragments.append("subdirectory=" + direct_url.subdirectory) if fragments: requirement += "#" + "&".join(fragments) return requirement def direct_url_for_editable(source_dir: str) -> DirectUrl: return DirectUrl( url=path_to_url(source_dir), info=DirInfo(editable=True), ) def direct_url_from_link( link: Link, source_dir: str | None = None, link_is_in_wheel_cache: bool = False ) -> DirectUrl: if link.is_vcs: vcs_backend = vcs.get_backend_for_scheme(link.scheme) assert vcs_backend url, requested_revision, _ = vcs_backend.get_url_rev_and_auth( link.url_without_fragment ) # For VCS links, we need to find out and add commit_id. if link_is_in_wheel_cache: # If the requested VCS link corresponds to a cached # wheel, it means the requested revision was an # immutable commit hash, otherwise it would not have # been cached. In that case we don't have a source_dir # with the VCS checkout. assert requested_revision commit_id = requested_revision else: # If the wheel was not in cache, it means we have # had to checkout from VCS to build and we have a source_dir # which we can inspect to find out the commit id. assert source_dir commit_id = vcs_backend.get_revision(source_dir) return DirectUrl( url=url, info=VcsInfo( vcs=vcs_backend.name, commit_id=commit_id, requested_revision=requested_revision, ), subdirectory=link.subdirectory_fragment, ) elif link.is_existing_dir(): return DirectUrl( url=link.url_without_fragment, info=DirInfo(), subdirectory=link.subdirectory_fragment, ) else: hash = None hash_name = link.hash_name if hash_name: hash = f"{hash_name}={link.hash}" return DirectUrl( url=link.url_without_fragment, info=ArchiveInfo(hash=hash), subdirectory=link.subdirectory_fragment, ) ================================================ FILE: src/pip/_internal/utils/egg_link.py ================================================ from __future__ import annotations import os import re import sys from pip._internal.locations import site_packages, user_site from pip._internal.utils.virtualenv import ( running_under_virtualenv, virtualenv_no_global, ) __all__ = [ "egg_link_path_from_sys_path", "egg_link_path_from_location", ] def _egg_link_names(raw_name: str) -> list[str]: """ Convert a Name metadata value to a .egg-link name, by applying the same substitution as pkg_resources's safe_name function. Note: we cannot use canonicalize_name because it has a different logic. We also look for the raw name (without normalization) as setuptools 69 changed the way it names .egg-link files (https://github.com/pypa/setuptools/issues/4167). """ return [ re.sub("[^A-Za-z0-9.]+", "-", raw_name) + ".egg-link", f"{raw_name}.egg-link", ] def egg_link_path_from_sys_path(raw_name: str) -> str | None: """ Look for a .egg-link file for project name, by walking sys.path. """ egg_link_names = _egg_link_names(raw_name) for path_item in sys.path: for egg_link_name in egg_link_names: egg_link = os.path.join(path_item, egg_link_name) if os.path.isfile(egg_link): return egg_link return None def egg_link_path_from_location(raw_name: str) -> str | None: """ Return the path for the .egg-link file if it exists, otherwise, None. There's 3 scenarios: 1) not in a virtualenv try to find in site.USER_SITE, then site_packages 2) in a no-global virtualenv try to find in site_packages 3) in a yes-global virtualenv try to find in site_packages, then site.USER_SITE (don't look in global location) For #1 and #3, there could be odd cases, where there's an egg-link in 2 locations. This method will just return the first one found. """ sites: list[str] = [] if running_under_virtualenv(): sites.append(site_packages) if not virtualenv_no_global() and user_site: sites.append(user_site) else: if user_site: sites.append(user_site) sites.append(site_packages) egg_link_names = _egg_link_names(raw_name) for site in sites: for egg_link_name in egg_link_names: egglink = os.path.join(site, egg_link_name) if os.path.isfile(egglink): return egglink return None ================================================ FILE: src/pip/_internal/utils/entrypoints.py ================================================ from __future__ import annotations import itertools import os import shutil import sys from pip._internal.cli.main import main from pip._internal.utils.compat import WINDOWS _EXECUTABLE_NAMES = [ "pip", f"pip{sys.version_info.major}", f"pip{sys.version_info.major}.{sys.version_info.minor}", ] if WINDOWS: _allowed_extensions = {"", ".exe"} _EXECUTABLE_NAMES = [ "".join(parts) for parts in itertools.product(_EXECUTABLE_NAMES, _allowed_extensions) ] def _wrapper(args: list[str] | None = None) -> int: """Central wrapper for all old entrypoints. Historically pip has had several entrypoints defined. Because of issues arising from PATH, sys.path, multiple Pythons, their interactions, and most of them having a pip installed, users suffer every time an entrypoint gets moved. To alleviate this pain, and provide a mechanism for warning users and directing them to an appropriate place for help, we now define all of our old entrypoints as wrappers for the current one. """ sys.stderr.write( "WARNING: pip is being invoked by an old script wrapper. This will " "fail in a future version of pip.\n" "Please see https://github.com/pypa/pip/issues/5599 for advice on " "fixing the underlying issue.\n" "To avoid this problem you can invoke Python with '-m pip' instead of " "running pip directly.\n" ) return main(args) def get_best_invocation_for_this_pip() -> str: """Try to figure out the best way to invoke pip in the current environment.""" binary_directory = "Scripts" if WINDOWS else "bin" binary_prefix = os.path.join(sys.prefix, binary_directory) # Try to use pip[X[.Y]] names, if those executables for this environment are # the first on PATH with that name. path_parts = os.path.normcase(os.environ.get("PATH", "")).split(os.pathsep) exe_are_in_PATH = os.path.normcase(binary_prefix) in path_parts if exe_are_in_PATH: for exe_name in _EXECUTABLE_NAMES: found_executable = shutil.which(exe_name) binary_executable = os.path.join(binary_prefix, exe_name) if ( found_executable and os.path.exists(binary_executable) and os.path.samefile( found_executable, binary_executable, ) ): return exe_name # Use the `-m` invocation, if there's no "nice" invocation. return f"{get_best_invocation_for_this_python()} -m pip" def get_best_invocation_for_this_python() -> str: """Try to figure out the best way to invoke the current Python.""" exe = sys.executable exe_name = os.path.basename(exe) # Try to use the basename, if it's the first executable. found_executable = shutil.which(exe_name) # Virtual environments often symlink to their parent Python binaries, but we don't # want to treat the Python binaries as equivalent when the environment's Python is # not on PATH (not activated). Thus, we don't follow symlinks. if found_executable and os.path.samestat(os.lstat(found_executable), os.lstat(exe)): return exe_name # Use the full executable name, because we couldn't find something simpler. return exe ================================================ FILE: src/pip/_internal/utils/filesystem.py ================================================ from __future__ import annotations import fnmatch import os import os.path import random import sys from collections.abc import Generator from contextlib import contextmanager from pathlib import Path from tempfile import NamedTemporaryFile from typing import Any, BinaryIO, Callable, cast from pip._internal.utils.compat import get_path_uid from pip._internal.utils.misc import format_size from pip._internal.utils.retry import retry def check_path_owner(path: str) -> bool: # If we don't have a way to check the effective uid of this process, then # we'll just assume that we own the directory. if sys.platform == "win32" or not hasattr(os, "geteuid"): return True assert os.path.isabs(path) previous = None while path != previous: if os.path.lexists(path): # Check if path is writable by current user. if os.geteuid() == 0: # Special handling for root user in order to handle properly # cases where users use sudo without -H flag. try: path_uid = get_path_uid(path) except OSError: return False return path_uid == 0 else: return os.access(path, os.W_OK) else: previous, path = path, os.path.dirname(path) return False # assume we don't own the path @contextmanager def adjacent_tmp_file(path: str, **kwargs: Any) -> Generator[BinaryIO, None, None]: """Return a file-like object pointing to a tmp file next to path. The file is created securely and is ensured to be written to disk after the context reaches its end. kwargs will be passed to tempfile.NamedTemporaryFile to control the way the temporary file will be opened. """ with NamedTemporaryFile( delete=False, dir=os.path.dirname(path), prefix=os.path.basename(path), suffix=".tmp", **kwargs, ) as f: result = cast(BinaryIO, f) try: yield result finally: result.flush() os.fsync(result.fileno()) replace = retry(stop_after_delay=1, wait=0.25)(os.replace) # test_writable_dir and _test_writable_dir_win are copied from Flit, # with the author's agreement to also place them under pip's license. def test_writable_dir(path: str) -> bool: """Check if a directory is writable. Uses os.access() on POSIX, tries creating files on Windows. """ # If the directory doesn't exist, find the closest parent that does. while not os.path.isdir(path): parent = os.path.dirname(path) if parent == path: break # Should never get here, but infinite loops are bad path = parent if os.name == "posix": return os.access(path, os.W_OK) return _test_writable_dir_win(path) def _test_writable_dir_win(path: str) -> bool: # os.access doesn't work on Windows: http://bugs.python.org/issue2528 # and we can't use tempfile: http://bugs.python.org/issue22107 basename = "accesstest_deleteme_fishfingers_custard_" alphabet = "abcdefghijklmnopqrstuvwxyz0123456789" for _ in range(10): name = basename + "".join(random.choice(alphabet) for _ in range(6)) file = os.path.join(path, name) try: fd = os.open(file, os.O_RDWR | os.O_CREAT | os.O_EXCL) except FileExistsError: pass except PermissionError: # This could be because there's a directory with the same name. # But it's highly unlikely there's a directory called that, # so we'll assume it's because the parent dir is not writable. # This could as well be because the parent dir is not readable, # due to non-privileged user access. return False else: os.close(fd) os.unlink(file) return True # This should never be reached raise OSError("Unexpected condition testing for writable directory") def find_files(path: str, pattern: str) -> list[str]: """Returns a list of absolute paths of files beneath path, recursively, with filenames which match the UNIX-style shell glob pattern.""" result: list[str] = [] for root, _, files in os.walk(path): matches = fnmatch.filter(files, pattern) result.extend(os.path.join(root, f) for f in matches) return result def file_size(path: str) -> int | float: # If it's a symlink, return 0. if os.path.islink(path): return 0 return os.path.getsize(path) def format_file_size(path: str) -> str: return format_size(file_size(path)) def directory_size(path: str) -> int | float: size = 0.0 for root, _dirs, files in os.walk(path): for filename in files: file_path = os.path.join(root, filename) size += file_size(file_path) return size def format_directory_size(path: str) -> str: return format_size(directory_size(path)) def copy_directory_permissions(directory: str, target_file: BinaryIO) -> None: mode = ( os.stat(directory).st_mode & 0o666 # select read/write permissions of directory | 0o600 # set owner read/write permissions ) # Change permissions only if there is no risk of following a symlink. if os.chmod in os.supports_fd: os.chmod(target_file.fileno(), mode) elif os.chmod in os.supports_follow_symlinks: os.chmod(target_file.name, mode, follow_symlinks=False) def _subdirs_without_generic( path: str, predicate: Callable[[str, list[str]], bool] ) -> Generator[Path]: """Yields every subdirectory of +path+ that has no files matching the predicate under it.""" directories = [] excluded = set() for root_str, _, filenames in os.walk(Path(path).resolve()): root = Path(root_str) if predicate(root_str, filenames): # This directory should be excluded, so exclude it and all of its # parent directories. # The last item in root.parents is ".", so we ignore it. # # Wrapping this in `list()` is only needed for Python 3.9. excluded.update(list(root.parents)[:-1]) excluded.add(root) directories.append(root) for d in sorted(directories, reverse=True): if d not in excluded: yield d def subdirs_without_files(path: str) -> Generator[Path]: """Yields every subdirectory of +path+ that has no files under it.""" return _subdirs_without_generic(path, lambda root, filenames: len(filenames) > 0) def subdirs_without_wheels(path: str) -> Generator[Path]: """Yields every subdirectory of +path+ that has no .whl files under it.""" return _subdirs_without_generic( path, lambda root, filenames: any(x.endswith(".whl") for x in filenames) ) ================================================ FILE: src/pip/_internal/utils/filetypes.py ================================================ """Filetype information.""" from pip._internal.utils.misc import splitext WHEEL_EXTENSION = ".whl" BZ2_EXTENSIONS: tuple[str, ...] = (".tar.bz2", ".tbz") XZ_EXTENSIONS: tuple[str, ...] = ( ".tar.xz", ".txz", ".tlz", ".tar.lz", ".tar.lzma", ) ZIP_EXTENSIONS: tuple[str, ...] = (".zip", WHEEL_EXTENSION) TAR_EXTENSIONS: tuple[str, ...] = (".tar.gz", ".tgz", ".tar") ARCHIVE_EXTENSIONS = ZIP_EXTENSIONS + BZ2_EXTENSIONS + TAR_EXTENSIONS + XZ_EXTENSIONS def is_archive_file(name: str) -> bool: """Return True if `name` is a considered as an archive file.""" ext = splitext(name)[1].lower() if ext in ARCHIVE_EXTENSIONS: return True return False ================================================ FILE: src/pip/_internal/utils/glibc.py ================================================ from __future__ import annotations import os import sys def glibc_version_string() -> str | None: "Returns glibc version string, or None if not using glibc." return glibc_version_string_confstr() or glibc_version_string_ctypes() def glibc_version_string_confstr() -> str | None: "Primary implementation of glibc_version_string using os.confstr." # os.confstr is quite a bit faster than ctypes.DLL. It's also less likely # to be broken or missing. This strategy is used in the standard library # platform module: # https://github.com/python/cpython/blob/fcf1d003bf4f0100c9d0921ff3d70e1127ca1b71/Lib/platform.py#L175-L183 if sys.platform == "win32": return None try: gnu_libc_version = os.confstr("CS_GNU_LIBC_VERSION") if gnu_libc_version is None: return None # os.confstr("CS_GNU_LIBC_VERSION") returns a string like "glibc 2.17": _, version = gnu_libc_version.split() except (AttributeError, OSError, ValueError): # os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)... return None return version def glibc_version_string_ctypes() -> str | None: "Fallback implementation of glibc_version_string using ctypes." try: import ctypes except ImportError: return None # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen # manpage says, "If filename is NULL, then the returned handle is for the # main program". This way we can let the linker do the work to figure out # which libc our process is actually using. # # We must also handle the special case where the executable is not a # dynamically linked executable. This can occur when using musl libc, # for example. In this situation, dlopen() will error, leading to an # OSError. Interestingly, at least in the case of musl, there is no # errno set on the OSError. The single string argument used to construct # OSError comes from libc itself and is therefore not portable to # hard code here. In any case, failure to call dlopen() means we # can't proceed, so we bail on our attempt. try: process_namespace = ctypes.CDLL(None) except OSError: return None try: gnu_get_libc_version = process_namespace.gnu_get_libc_version except AttributeError: # Symbol doesn't exist -> therefore, we are not linked to # glibc. return None # Call gnu_get_libc_version, which returns a string like "2.5" gnu_get_libc_version.restype = ctypes.c_char_p version_str: str = gnu_get_libc_version() # py2 / py3 compatibility: if not isinstance(version_str, str): version_str = version_str.decode("ascii") return version_str # platform.libc_ver regularly returns completely nonsensical glibc # versions. E.g. on my computer, platform says: # # ~$ python2.7 -c 'import platform; print(platform.libc_ver())' # ('glibc', '2.7') # ~$ python3.5 -c 'import platform; print(platform.libc_ver())' # ('glibc', '2.9') # # But the truth is: # # ~$ ldd --version # ldd (Debian GLIBC 2.22-11) 2.22 # # This is unfortunate, because it means that the linehaul data on libc # versions that was generated by pip 8.1.2 and earlier is useless and # misleading. Solution: instead of using platform, use our code that actually # works. def libc_ver() -> tuple[str, str]: """Try to determine the glibc version Returns a tuple of strings (lib, version) which default to empty strings in case the lookup fails. """ glibc_version = glibc_version_string() if glibc_version is None: return ("", "") else: return ("glibc", glibc_version) ================================================ FILE: src/pip/_internal/utils/hashes.py ================================================ from __future__ import annotations import hashlib from collections.abc import Iterable from typing import TYPE_CHECKING, BinaryIO, NoReturn from pip._internal.exceptions import HashMismatch, HashMissing, InstallationError from pip._internal.utils.misc import read_chunks if TYPE_CHECKING: from hashlib import _Hash # The recommended hash algo of the moment. Change this whenever the state of # the art changes; it won't hurt backward compatibility. FAVORITE_HASH = "sha256" # Names of hashlib algorithms allowed by the --hash option and ``pip hash`` # Currently, those are the ones at least as collision-resistant as sha256. STRONG_HASHES = ["sha256", "sha384", "sha512"] class Hashes: """A wrapper that builds multiple hashes at once and checks them against known-good values """ def __init__(self, hashes: dict[str, list[str]] | None = None) -> None: """ :param hashes: A dict of algorithm names pointing to lists of allowed hex digests """ allowed = {} if hashes is not None: for alg, keys in hashes.items(): # Make sure values are always sorted (to ease equality checks) allowed[alg] = [k.lower() for k in sorted(keys)] self._allowed = allowed def __and__(self, other: Hashes) -> Hashes: if not isinstance(other, Hashes): return NotImplemented # If either of the Hashes object is entirely empty (i.e. no hash # specified at all), all hashes from the other object are allowed. if not other: return self if not self: return other # Otherwise only hashes that present in both objects are allowed. new = {} for alg, values in other._allowed.items(): if alg not in self._allowed: continue new[alg] = [v for v in values if v in self._allowed[alg]] return Hashes(new) @property def digest_count(self) -> int: return sum(len(digests) for digests in self._allowed.values()) def is_hash_allowed(self, hash_name: str, hex_digest: str) -> bool: """Return whether the given hex digest is allowed.""" return hex_digest in self._allowed.get(hash_name, []) def check_against_chunks(self, chunks: Iterable[bytes]) -> None: """Check good hashes against ones built from iterable of chunks of data. Raise HashMismatch if none match. """ gots = {} for hash_name in self._allowed.keys(): try: gots[hash_name] = hashlib.new(hash_name) except (ValueError, TypeError): raise InstallationError(f"Unknown hash name: {hash_name}") for chunk in chunks: for hash in gots.values(): hash.update(chunk) for hash_name, got in gots.items(): if got.hexdigest() in self._allowed[hash_name]: return self._raise(gots) def _raise(self, gots: dict[str, _Hash]) -> NoReturn: raise HashMismatch(self._allowed, gots) def check_against_file(self, file: BinaryIO) -> None: """Check good hashes against a file-like object Raise HashMismatch if none match. """ return self.check_against_chunks(read_chunks(file)) def check_against_path(self, path: str) -> None: with open(path, "rb") as file: return self.check_against_file(file) def has_one_of(self, hashes: dict[str, str]) -> bool: """Return whether any of the given hashes are allowed.""" for hash_name, hex_digest in hashes.items(): if self.is_hash_allowed(hash_name, hex_digest): return True return False def __bool__(self) -> bool: """Return whether I know any known-good hashes.""" return bool(self._allowed) def __eq__(self, other: object) -> bool: if not isinstance(other, Hashes): return NotImplemented return self._allowed == other._allowed def __hash__(self) -> int: return hash( ",".join( sorted( ":".join((alg, digest)) for alg, digest_list in self._allowed.items() for digest in digest_list ) ) ) class MissingHashes(Hashes): """A workalike for Hashes used when we're missing a hash for a requirement It computes the actual hash of the requirement and raises a HashMissing exception showing it to the user. """ def __init__(self) -> None: """Don't offer the ``hashes`` kwarg.""" # Pass our favorite hash in to generate a "gotten hash". With the # empty list, it will never match, so an error will always raise. super().__init__(hashes={FAVORITE_HASH: []}) def _raise(self, gots: dict[str, _Hash]) -> NoReturn: raise HashMissing(gots[FAVORITE_HASH].hexdigest()) ================================================ FILE: src/pip/_internal/utils/logging.py ================================================ from __future__ import annotations import contextlib import errno import logging import logging.handlers import os import sys import threading from collections.abc import Generator from dataclasses import dataclass from io import StringIO, TextIOWrapper from logging import Filter from typing import Any, ClassVar from pip._vendor.rich.console import ( Console, ConsoleOptions, ConsoleRenderable, RenderableType, RenderResult, RichCast, ) from pip._vendor.rich.highlighter import NullHighlighter from pip._vendor.rich.logging import RichHandler from pip._vendor.rich.segment import Segment from pip._vendor.rich.style import Style from pip._internal.utils._log import VERBOSE, getLogger from pip._internal.utils.compat import WINDOWS from pip._internal.utils.deprecation import DEPRECATION_MSG_PREFIX from pip._internal.utils.misc import StreamWrapper, ensure_dir _log_state = threading.local() _stdout_console = None _stderr_console = None subprocess_logger = getLogger("pip.subprocessor") class BrokenStdoutLoggingError(Exception): """ Raised if BrokenPipeError occurs for the stdout stream while logging. """ def _is_broken_pipe_error(exc_class: type[BaseException], exc: BaseException) -> bool: if exc_class is BrokenPipeError: return True # On Windows, a broken pipe can show up as EINVAL rather than EPIPE: # https://bugs.python.org/issue19612 # https://bugs.python.org/issue30418 if not WINDOWS: return False return isinstance(exc, OSError) and exc.errno in (errno.EINVAL, errno.EPIPE) @contextlib.contextmanager def capture_logging() -> Generator[StringIO, None, None]: """Capture all pip logs in a buffer temporarily.""" # Patching sys.std(out|err) directly is not viable as the caller # may want to emit non-logging output (e.g. a rich spinner). To # avoid capturing that, temporarily patch the root logging handlers # to use new rich consoles that write to a StringIO. handlers = {} for handler in logging.getLogger().handlers: if isinstance(handler, RichPipStreamHandler): # Also store the handler's original console so it can be # restored on context exit. handlers[handler] = handler.console fake_stream = StreamWrapper.from_stream(sys.stdout) if not handlers: yield fake_stream return # HACK: grab no_color attribute from a random handler console since # it's a global option anyway. no_color = next(iter(handlers.values())).no_color fake_console = PipConsole(file=fake_stream, no_color=no_color, soft_wrap=True) try: for handler in handlers: handler.console = fake_console yield fake_stream finally: for handler, original_console in handlers.items(): handler.console = original_console @contextlib.contextmanager def indent_log(num: int = 2) -> Generator[None, None, None]: """ A context manager which will cause the log output to be indented for any log messages emitted inside it. """ # For thread-safety _log_state.indentation = get_indentation() _log_state.indentation += num try: yield finally: _log_state.indentation -= num def get_indentation() -> int: return getattr(_log_state, "indentation", 0) class IndentingFormatter(logging.Formatter): default_time_format = "%Y-%m-%dT%H:%M:%S" def __init__( self, *args: Any, add_timestamp: bool = False, **kwargs: Any, ) -> None: """ A logging.Formatter that obeys the indent_log() context manager. :param add_timestamp: A bool indicating output lines should be prefixed with their record's timestamp. """ self.add_timestamp = add_timestamp super().__init__(*args, **kwargs) def get_message_start(self, formatted: str, levelno: int) -> str: """ Return the start of the formatted log message (not counting the prefix to add to each line). """ if levelno < logging.WARNING: return "" if formatted.startswith(DEPRECATION_MSG_PREFIX): # Then the message already has a prefix. We don't want it to # look like "WARNING: DEPRECATION: ...." return "" if levelno < logging.ERROR: return "WARNING: " return "ERROR: " def format(self, record: logging.LogRecord) -> str: """ Calls the standard formatter, but will indent all of the log message lines by our current indentation level. """ formatted = super().format(record) message_start = self.get_message_start(formatted, record.levelno) formatted = message_start + formatted prefix = "" if self.add_timestamp: prefix = f"{self.formatTime(record)} " prefix += " " * get_indentation() formatted = "".join([prefix + line for line in formatted.splitlines(True)]) return formatted @dataclass class IndentedRenderable: renderable: RenderableType indent: int def __rich_console__( self, console: Console, options: ConsoleOptions ) -> RenderResult: segments = console.render(self.renderable, options) lines = Segment.split_lines(segments) for line in lines: yield Segment(" " * self.indent) yield from line yield Segment("\n") class PipConsole(Console): def on_broken_pipe(self) -> None: # Reraise the original exception, rich 13.8.0+ exits by default # instead, preventing our handler from firing. raise BrokenPipeError() from None def get_console(*, stderr: bool = False) -> Console: if stderr: assert _stderr_console is not None, "stderr rich console is missing!" return _stderr_console else: assert _stdout_console is not None, "stdout rich console is missing!" return _stdout_console class RichPipStreamHandler(RichHandler): KEYWORDS: ClassVar[list[str] | None] = [] def __init__(self, console: Console) -> None: super().__init__( console=console, show_time=False, show_level=False, show_path=False, highlighter=NullHighlighter(), ) # Our custom override on Rich's logger, to make things work as we need them to. def emit(self, record: logging.LogRecord) -> None: style: Style | None = None # If we are given a diagnostic error to present, present it with indentation. if getattr(record, "rich", False): assert isinstance(record.args, tuple) (rich_renderable,) = record.args assert isinstance( rich_renderable, (ConsoleRenderable, RichCast, str) ), f"{rich_renderable} is not rich-console-renderable" renderable: RenderableType = IndentedRenderable( rich_renderable, indent=get_indentation() ) else: message = self.format(record) renderable = self.render_message(record, message) if record.levelno is not None: if record.levelno >= logging.ERROR: style = Style(color="red") elif record.levelno >= logging.WARNING: style = Style(color="yellow") try: self.console.print(renderable, overflow="ignore", crop=False, style=style) except Exception: self.handleError(record) def handleError(self, record: logging.LogRecord) -> None: """Called when logging is unable to log some output.""" exc_class, exc = sys.exc_info()[:2] # If a broken pipe occurred while calling write() or flush() on the # stdout stream in logging's Handler.emit(), then raise our special # exception so we can handle it in main() instead of logging the # broken pipe error and continuing. if ( exc_class and exc and self.console.file is sys.stdout and _is_broken_pipe_error(exc_class, exc) ): raise BrokenStdoutLoggingError() return super().handleError(record) class BetterRotatingFileHandler(logging.handlers.RotatingFileHandler): def _open(self) -> TextIOWrapper: ensure_dir(os.path.dirname(self.baseFilename)) return super()._open() class MaxLevelFilter(Filter): def __init__(self, level: int) -> None: self.level = level def filter(self, record: logging.LogRecord) -> bool: return record.levelno < self.level class ExcludeLoggerFilter(Filter): """ A logging Filter that excludes records from a logger (or its children). """ def filter(self, record: logging.LogRecord) -> bool: # The base Filter class allows only records from a logger (or its # children). return not super().filter(record) def setup_logging(verbosity: int, no_color: bool, user_log_file: str | None) -> int: """Configures and sets up all of the logging Returns the requested logging level, as its integer value. """ # Determine the level to be logging at. if verbosity >= 2: level_number = logging.DEBUG elif verbosity == 1: level_number = VERBOSE elif verbosity == -1: level_number = logging.WARNING elif verbosity == -2: level_number = logging.ERROR elif verbosity <= -3: level_number = logging.CRITICAL else: level_number = logging.INFO level = logging.getLevelName(level_number) # The "root" logger should match the "console" level *unless* we also need # to log to a user log file. include_user_log = user_log_file is not None if include_user_log: additional_log_file = user_log_file root_level = "DEBUG" else: additional_log_file = "/dev/null" root_level = level # Disable any logging besides WARNING unless we have DEBUG level logging # enabled for vendored libraries. vendored_log_level = "WARNING" if level in ["INFO", "ERROR"] else "DEBUG" # Shorthands for clarity handler_classes = { "stream": "pip._internal.utils.logging.RichPipStreamHandler", "file": "pip._internal.utils.logging.BetterRotatingFileHandler", } handlers = ["console", "console_errors", "console_subprocess"] + ( ["user_log"] if include_user_log else [] ) global _stdout_console, stderr_console _stdout_console = PipConsole(file=sys.stdout, no_color=no_color, soft_wrap=True) _stderr_console = PipConsole(file=sys.stderr, no_color=no_color, soft_wrap=True) logging.config.dictConfig( { "version": 1, "disable_existing_loggers": False, "filters": { "exclude_warnings": { "()": "pip._internal.utils.logging.MaxLevelFilter", "level": logging.WARNING, }, "restrict_to_subprocess": { "()": "logging.Filter", "name": subprocess_logger.name, }, "exclude_subprocess": { "()": "pip._internal.utils.logging.ExcludeLoggerFilter", "name": subprocess_logger.name, }, }, "formatters": { "indent": { "()": IndentingFormatter, "format": "%(message)s", }, "indent_with_timestamp": { "()": IndentingFormatter, "format": "%(message)s", "add_timestamp": True, }, }, "handlers": { "console": { "level": level, "class": handler_classes["stream"], "console": _stdout_console, "filters": ["exclude_subprocess", "exclude_warnings"], "formatter": "indent", }, "console_errors": { "level": "WARNING", "class": handler_classes["stream"], "console": _stderr_console, "filters": ["exclude_subprocess"], "formatter": "indent", }, # A handler responsible for logging to the console messages # from the "subprocessor" logger. "console_subprocess": { "level": level, "class": handler_classes["stream"], "console": _stderr_console, "filters": ["restrict_to_subprocess"], "formatter": "indent", }, "user_log": { "level": "DEBUG", "class": handler_classes["file"], "filename": additional_log_file, "encoding": "utf-8", "delay": True, "formatter": "indent_with_timestamp", }, }, "root": { "level": root_level, "handlers": handlers, }, "loggers": {"pip._vendor": {"level": vendored_log_level}}, } ) return level_number ================================================ FILE: src/pip/_internal/utils/misc.py ================================================ from __future__ import annotations import errno import getpass import hashlib import logging import os import posixpath import shutil import stat import sys import sysconfig import urllib.parse from collections.abc import Generator, Iterable, Iterator, Mapping, Sequence from dataclasses import dataclass from functools import partial from io import StringIO from itertools import filterfalse, tee, zip_longest from pathlib import Path from types import FunctionType, TracebackType from typing import ( Any, BinaryIO, Callable, Optional, TextIO, TypeVar, cast, ) from pip._vendor.packaging.requirements import Requirement from pip._vendor.pyproject_hooks import BuildBackendHookCaller from pip import __version__ from pip._internal.exceptions import CommandError, ExternallyManagedEnvironment from pip._internal.locations import get_major_minor_version from pip._internal.utils.compat import WINDOWS from pip._internal.utils.retry import retry from pip._internal.utils.virtualenv import running_under_virtualenv __all__ = [ "rmtree", "display_path", "backup_dir", "ask", "splitext", "format_size", "is_installable_dir", "normalize_path", "renames", "get_prog", "ensure_dir", "remove_auth_from_url", "check_externally_managed", "ConfiguredBuildBackendHookCaller", ] logger = logging.getLogger(__name__) T = TypeVar("T") ExcInfo = tuple[type[BaseException], BaseException, TracebackType] VersionInfo = tuple[int, int, int] NetlocTuple = tuple[str, tuple[Optional[str], Optional[str]]] OnExc = Callable[[FunctionType, Path, BaseException], Any] OnErr = Callable[[FunctionType, Path, ExcInfo], Any] FILE_CHUNK_SIZE = 1024 * 1024 def get_pip_version() -> str: pip_pkg_dir = os.path.join(os.path.dirname(__file__), "..", "..") pip_pkg_dir = os.path.abspath(pip_pkg_dir) return f"pip {__version__} from {pip_pkg_dir} (python {get_major_minor_version()})" def normalize_version_info(py_version_info: tuple[int, ...]) -> tuple[int, int, int]: """ Convert a tuple of ints representing a Python version to one of length three. :param py_version_info: a tuple of ints representing a Python version, or None to specify no version. The tuple can have any length. :return: a tuple of length three if `py_version_info` is non-None. Otherwise, return `py_version_info` unchanged (i.e. None). """ if len(py_version_info) < 3: py_version_info += (3 - len(py_version_info)) * (0,) elif len(py_version_info) > 3: py_version_info = py_version_info[:3] return cast("VersionInfo", py_version_info) def ensure_dir(path: str) -> None: """os.path.makedirs without EEXIST.""" try: os.makedirs(path) except OSError as e: # Windows can raise spurious ENOTEMPTY errors. See #6426. if e.errno != errno.EEXIST and e.errno != errno.ENOTEMPTY: raise def get_prog() -> str: try: prog = os.path.basename(sys.argv[0]) if prog in ("__main__.py", "-c"): return f"{sys.executable} -m pip" else: return prog except (AttributeError, TypeError, IndexError): pass return "pip" # Retry every half second for up to 3 seconds @retry(stop_after_delay=3, wait=0.5) def rmtree(dir: str, ignore_errors: bool = False, onexc: OnExc | None = None) -> None: if ignore_errors: onexc = _onerror_ignore if onexc is None: onexc = _onerror_reraise handler: OnErr = partial(rmtree_errorhandler, onexc=onexc) if sys.version_info >= (3, 12): # See https://docs.python.org/3.12/whatsnew/3.12.html#shutil. shutil.rmtree(dir, onexc=handler) # type: ignore else: shutil.rmtree(dir, onerror=handler) # type: ignore def _onerror_ignore(*_args: Any) -> None: pass def _onerror_reraise(*_args: Any) -> None: raise # noqa: PLE0704 - Bare exception used to reraise existing exception def rmtree_errorhandler( func: FunctionType, path: Path, exc_info: ExcInfo | BaseException, *, onexc: OnExc = _onerror_reraise, ) -> None: """ `rmtree` error handler to 'force' a file remove (i.e. like `rm -f`). * If a file is readonly then it's write flag is set and operation is retried. * `onerror` is the original callback from `rmtree(... onerror=onerror)` that is chained at the end if the "rm -f" still fails. """ try: st_mode = os.stat(path).st_mode except OSError: # it's equivalent to os.path.exists return if not st_mode & stat.S_IWRITE: # convert to read/write try: os.chmod(path, st_mode | stat.S_IWRITE) except OSError: pass else: # use the original function to repeat the operation try: func(path) return except OSError: pass if not isinstance(exc_info, BaseException): _, exc_info, _ = exc_info onexc(func, path, exc_info) def display_path(path: str) -> str: """Gives the display value for a given path, making it relative to cwd if possible.""" try: relative = Path(path).relative_to(Path.cwd()) except ValueError: # If the path isn't relative to the CWD, leave it alone return path return os.path.join(".", relative) def backup_dir(dir: str, ext: str = ".bak") -> str: """Figure out the name of a directory to back up the given dir to (adding .bak, .bak2, etc)""" n = 1 extension = ext while os.path.exists(dir + extension): n += 1 extension = ext + str(n) return dir + extension def ask_path_exists(message: str, options: Iterable[str]) -> str: for action in os.environ.get("PIP_EXISTS_ACTION", "").split(): if action in options: return action return ask(message, options) def _check_no_input(message: str) -> None: """Raise an error if no input is allowed.""" if os.environ.get("PIP_NO_INPUT"): raise Exception( f"No input was expected ($PIP_NO_INPUT set); question: {message}" ) def ask(message: str, options: Iterable[str]) -> str: """Ask the message interactively, with the given possible responses""" while 1: _check_no_input(message) response = input(message) response = response.strip().lower() if response not in options: print( "Your response ({!r}) was not one of the expected responses: " "{}".format(response, ", ".join(options)) ) else: return response def ask_input(message: str) -> str: """Ask for input interactively.""" _check_no_input(message) return input(message) def ask_password(message: str) -> str: """Ask for a password interactively.""" _check_no_input(message) return getpass.getpass(message) def strtobool(val: str) -> int: """Convert a string representation of truth to true (1) or false (0). True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if 'val' is anything else. """ val = val.lower() if val in ("y", "yes", "t", "true", "on", "1"): return 1 elif val in ("n", "no", "f", "false", "off", "0"): return 0 else: raise ValueError(f"invalid truth value {val!r}") def format_size(bytes: float) -> str: if bytes > 1000 * 1000: return f"{bytes / 1000.0 / 1000:.1f} MB" elif bytes > 10 * 1000: return f"{int(bytes / 1000)} kB" elif bytes > 1000: return f"{bytes / 1000.0:.1f} kB" else: return f"{int(bytes)} bytes" def tabulate(rows: Iterable[Iterable[Any]]) -> tuple[list[str], list[int]]: """Return a list of formatted rows and a list of column sizes. For example:: >>> tabulate([['foobar', 2000], [0xdeadbeef]]) (['foobar 2000', '3735928559'], [10, 4]) """ rows = [tuple(map(str, row)) for row in rows] sizes = [max(map(len, col)) for col in zip_longest(*rows, fillvalue="")] table = [" ".join(map(str.ljust, row, sizes)).rstrip() for row in rows] return table, sizes def is_installable_dir(path: str) -> bool: """Is path is a directory containing pyproject.toml or setup.py? If pyproject.toml exists, this is a PEP 517 project. Otherwise we look for a legacy setuptools layout by identifying setup.py. We don't check for the setup.cfg because using it without setup.py is only available for PEP 517 projects, which are already covered by the pyproject.toml check. """ if not os.path.isdir(path): return False if os.path.isfile(os.path.join(path, "pyproject.toml")): return True if os.path.isfile(os.path.join(path, "setup.py")): return True return False def read_chunks( file: BinaryIO, size: int = FILE_CHUNK_SIZE ) -> Generator[bytes, None, None]: """Yield pieces of data from a file-like object until EOF.""" while True: chunk = file.read(size) if not chunk: break yield chunk def normalize_path(path: str, resolve_symlinks: bool = True) -> str: """ Convert a path to its canonical, case-normalized, absolute version. """ path = os.path.expanduser(path) if resolve_symlinks: path = os.path.realpath(path) else: path = os.path.abspath(path) return os.path.normcase(path) def splitext(path: str) -> tuple[str, str]: """Like os.path.splitext, but take off .tar too""" base, ext = posixpath.splitext(path) if base.lower().endswith(".tar"): ext = base[-4:] + ext base = base[:-4] return base, ext def renames(old: str, new: str) -> None: """Like os.renames(), but handles renaming across devices.""" # Implementation borrowed from os.renames(). head, tail = os.path.split(new) if head and tail and not os.path.exists(head): os.makedirs(head) shutil.move(old, new) head, tail = os.path.split(old) if head and tail: try: os.removedirs(head) except OSError: pass def is_local(path: str) -> bool: """ Return True if path is within sys.prefix, if we're running in a virtualenv. If we're not in a virtualenv, all paths are considered "local." Caution: this function assumes the head of path has been normalized with normalize_path. """ if not running_under_virtualenv(): return True return path.startswith(normalize_path(sys.prefix)) def write_output(msg: Any, *args: Any) -> None: logger.info(msg, *args) class StreamWrapper(StringIO): orig_stream: TextIO @classmethod def from_stream(cls, orig_stream: TextIO) -> StreamWrapper: ret = cls() ret.orig_stream = orig_stream return ret # compileall.compile_dir() needs stdout.encoding to print to stdout # type ignore is because TextIOBase.encoding is writeable @property def encoding(self) -> str: # type: ignore return self.orig_stream.encoding # Simulates an enum def enum(*sequential: Any, **named: Any) -> type[Any]: enums = dict(zip(sequential, range(len(sequential))), **named) reverse = {value: key for key, value in enums.items()} enums["reverse_mapping"] = reverse return type("Enum", (), enums) def build_netloc(host: str, port: int | None) -> str: """ Build a netloc from a host-port pair """ if port is None: return host if ":" in host: # Only wrap host with square brackets when it is IPv6 host = f"[{host}]" return f"{host}:{port}" def build_url_from_netloc(netloc: str, scheme: str = "https") -> str: """ Build a full URL from a netloc. """ if netloc.count(":") >= 2 and "@" not in netloc and "[" not in netloc: # It must be a bare IPv6 address, so wrap it with brackets. netloc = f"[{netloc}]" return f"{scheme}://{netloc}" def parse_netloc(netloc: str) -> tuple[str | None, int | None]: """ Return the host-port pair from a netloc. """ url = build_url_from_netloc(netloc) parsed = urllib.parse.urlparse(url) return parsed.hostname, parsed.port def split_auth_from_netloc(netloc: str) -> NetlocTuple: """ Parse out and remove the auth information from a netloc. Returns: (netloc, (username, password)). """ if "@" not in netloc: return netloc, (None, None) # Split from the right because that's how urllib.parse.urlsplit() # behaves if more than one @ is present (which can be checked using # the password attribute of urlsplit()'s return value). auth, netloc = netloc.rsplit("@", 1) pw: str | None = None if ":" in auth: # Split from the left because that's how urllib.parse.urlsplit() # behaves if more than one : is present (which again can be checked # using the password attribute of the return value) user, pw = auth.split(":", 1) else: user, pw = auth, None user = urllib.parse.unquote(user) if pw is not None: pw = urllib.parse.unquote(pw) return netloc, (user, pw) def redact_netloc(netloc: str) -> str: """ Replace the sensitive data in a netloc with "****", if it exists. For example: - "user:pass@example.com" returns "user:****@example.com" - "accesstoken@example.com" returns "****@example.com" """ netloc, (user, password) = split_auth_from_netloc(netloc) if user is None: return netloc if password is None: user = "****" password = "" else: user = urllib.parse.quote(user) password = ":****" return f"{user}{password}@{netloc}" def _transform_url( url: str, transform_netloc: Callable[[str], tuple[Any, ...]] ) -> tuple[str, NetlocTuple]: """Transform and replace netloc in a url. transform_netloc is a function taking the netloc and returning a tuple. The first element of this tuple is the new netloc. The entire tuple is returned. Returns a tuple containing the transformed url as item 0 and the original tuple returned by transform_netloc as item 1. """ purl = urllib.parse.urlsplit(url) netloc_tuple = transform_netloc(purl.netloc) # stripped url url_pieces = (purl.scheme, netloc_tuple[0], purl.path, purl.query, purl.fragment) surl = urllib.parse.urlunsplit(url_pieces) return surl, cast("NetlocTuple", netloc_tuple) def _get_netloc(netloc: str) -> NetlocTuple: return split_auth_from_netloc(netloc) def _redact_netloc(netloc: str) -> tuple[str]: return (redact_netloc(netloc),) def split_auth_netloc_from_url( url: str, ) -> tuple[str, str, tuple[str | None, str | None]]: """ Parse a url into separate netloc, auth, and url with no auth. Returns: (url_without_auth, netloc, (username, password)) """ url_without_auth, (netloc, auth) = _transform_url(url, _get_netloc) return url_without_auth, netloc, auth def remove_auth_from_url(url: str) -> str: """Return a copy of url with 'username:password@' removed.""" # username/pass params are passed to subversion through flags # and are not recognized in the url. return _transform_url(url, _get_netloc)[0] def redact_auth_from_url(url: str) -> str: """Replace the password in a given url with ****.""" return _transform_url(url, _redact_netloc)[0] def redact_auth_from_requirement(req: Requirement) -> str: """Replace the password in a given requirement url with ****.""" if not req.url: return str(req) return str(req).replace(req.url, redact_auth_from_url(req.url)) @dataclass(frozen=True) class HiddenText: secret: str redacted: str def __repr__(self) -> str: return f"" def __str__(self) -> str: return self.redacted def __eq__(self, other: object) -> bool: # Equality is particularly useful for testing. if type(self) is type(other): # The string being used for redaction doesn't also have to match, # just the raw, original string. return self.secret == cast(HiddenText, other).secret return NotImplemented # Disable hashing, since we have a custom __eq__ and don't need hash-ability # (yet). The only required property of hashing is that objects which compare # equal have the same hash value. __hash__ = None # type: ignore[assignment] def hide_value(value: str) -> HiddenText: return HiddenText(value, redacted="****") def hide_url(url: str) -> HiddenText: redacted = redact_auth_from_url(url) return HiddenText(url, redacted=redacted) def protect_pip_from_modification_on_windows(modifying_pip: bool) -> None: """Protection of pip.exe from modification on Windows On Windows, any operation modifying pip should be run as: python -m pip ... """ pip_names = [ "pip", f"pip{sys.version_info.major}", f"pip{sys.version_info.major}.{sys.version_info.minor}", ] # See https://github.com/pypa/pip/issues/1299 for more discussion should_show_use_python_msg = ( modifying_pip and WINDOWS and os.path.basename(sys.argv[0]) in pip_names ) if should_show_use_python_msg: new_command = [sys.executable, "-m", "pip"] + sys.argv[1:] raise CommandError( "To modify pip, please run the following command:\n{}".format( " ".join(new_command) ) ) def check_externally_managed() -> None: """Check whether the current environment is externally managed. If the ``EXTERNALLY-MANAGED`` config file is found, the current environment is considered externally managed, and an ExternallyManagedEnvironment is raised. """ if running_under_virtualenv(): return marker = os.path.join(sysconfig.get_path("stdlib"), "EXTERNALLY-MANAGED") if not os.path.isfile(marker): return raise ExternallyManagedEnvironment.from_config(marker) def is_console_interactive() -> bool: """Is this console interactive?""" return sys.stdin is not None and sys.stdin.isatty() def hash_file(path: str, blocksize: int = 1 << 20) -> tuple[Any, int]: """Return (hash, length) for path using hashlib.sha256()""" h = hashlib.sha256() length = 0 with open(path, "rb") as f: for block in read_chunks(f, size=blocksize): length += len(block) h.update(block) return h, length def pairwise(iterable: Iterable[Any]) -> Iterator[tuple[Any, Any]]: """ Return paired elements. For example: s -> (s0, s1), (s2, s3), (s4, s5), ... """ iterable = iter(iterable) return zip_longest(iterable, iterable) def partition( pred: Callable[[T], bool], iterable: Iterable[T] ) -> tuple[Iterable[T], Iterable[T]]: """ Use a predicate to partition entries into false entries and true entries, like partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9 """ t1, t2 = tee(iterable) return filterfalse(pred, t1), filter(pred, t2) class ConfiguredBuildBackendHookCaller(BuildBackendHookCaller): def __init__( self, config_holder: Any, source_dir: str, build_backend: str, backend_path: str | None = None, runner: Callable[..., None] | None = None, python_executable: str | None = None, ): super().__init__( source_dir, build_backend, backend_path, runner, python_executable ) self.config_holder = config_holder def build_wheel( self, wheel_directory: str, config_settings: Mapping[str, Any] | None = None, metadata_directory: str | None = None, ) -> str: cs = self.config_holder.config_settings return super().build_wheel( wheel_directory, config_settings=cs, metadata_directory=metadata_directory ) def build_sdist( self, sdist_directory: str, config_settings: Mapping[str, Any] | None = None, ) -> str: cs = self.config_holder.config_settings return super().build_sdist(sdist_directory, config_settings=cs) def build_editable( self, wheel_directory: str, config_settings: Mapping[str, Any] | None = None, metadata_directory: str | None = None, ) -> str: cs = self.config_holder.config_settings return super().build_editable( wheel_directory, config_settings=cs, metadata_directory=metadata_directory ) def get_requires_for_build_wheel( self, config_settings: Mapping[str, Any] | None = None ) -> Sequence[str]: cs = self.config_holder.config_settings return super().get_requires_for_build_wheel(config_settings=cs) def get_requires_for_build_sdist( self, config_settings: Mapping[str, Any] | None = None ) -> Sequence[str]: cs = self.config_holder.config_settings return super().get_requires_for_build_sdist(config_settings=cs) def get_requires_for_build_editable( self, config_settings: Mapping[str, Any] | None = None ) -> Sequence[str]: cs = self.config_holder.config_settings return super().get_requires_for_build_editable(config_settings=cs) def prepare_metadata_for_build_wheel( self, metadata_directory: str, config_settings: Mapping[str, Any] | None = None, _allow_fallback: bool = True, ) -> str: cs = self.config_holder.config_settings return super().prepare_metadata_for_build_wheel( metadata_directory=metadata_directory, config_settings=cs, _allow_fallback=_allow_fallback, ) def prepare_metadata_for_build_editable( self, metadata_directory: str, config_settings: Mapping[str, Any] | None = None, _allow_fallback: bool = True, ) -> str | None: cs = self.config_holder.config_settings return super().prepare_metadata_for_build_editable( metadata_directory=metadata_directory, config_settings=cs, _allow_fallback=_allow_fallback, ) def warn_if_run_as_root() -> None: """Output a warning for sudo users on Unix. In a virtual environment, sudo pip still writes to virtualenv. On Windows, users may run pip as Administrator without issues. This warning only applies to Unix root users outside of virtualenv. """ if running_under_virtualenv(): return if not hasattr(os, "getuid"): return # On Windows, there are no "system managed" Python packages. Installing as # Administrator via pip is the correct way of updating system environments. # # We choose sys.platform over utils.compat.WINDOWS here to enable Mypy platform # checks: https://mypy.readthedocs.io/en/stable/common_issues.html if sys.platform == "win32" or sys.platform == "cygwin": return if os.getuid() != 0: return logger.warning( "Running pip as the 'root' user can result in broken permissions and " "conflicting behaviour with the system package manager, possibly " "rendering your system unusable. " "It is recommended to use a virtual environment instead: " "https://pip.pypa.io/warnings/venv. " "Use the --root-user-action option if you know what you are doing and " "want to suppress this warning." ) ================================================ FILE: src/pip/_internal/utils/packaging.py ================================================ from __future__ import annotations import functools import logging from pip._vendor.packaging import specifiers, version from pip._vendor.packaging.requirements import Requirement logger = logging.getLogger(__name__) @functools.lru_cache(maxsize=32) def check_requires_python( requires_python: str | None, version_info: tuple[int, ...] ) -> bool: """ Check if the given Python version matches a "Requires-Python" specifier. :param version_info: A 3-tuple of ints representing a Python major-minor-micro version to check (e.g. `sys.version_info[:3]`). :return: `True` if the given Python version satisfies the requirement. Otherwise, return `False`. :raises InvalidSpecifier: If `requires_python` has an invalid format. """ if requires_python is None: # The package provides no information return True requires_python_specifier = specifiers.SpecifierSet(requires_python) python_version = version.parse(".".join(map(str, version_info))) return python_version in requires_python_specifier @functools.lru_cache(maxsize=10000) def get_requirement(req_string: str) -> Requirement: """Construct a packaging.Requirement object with caching""" # Parsing requirement strings is expensive, and is also expected to happen # with a low diversity of different arguments (at least relative the number # constructed). This method adds a cache to requirement object creation to # minimize repeated parsing of the same string to construct equivalent # Requirement objects. return Requirement(req_string) ================================================ FILE: src/pip/_internal/utils/pylock.py ================================================ from collections.abc import Iterable from pathlib import Path from pip._vendor.packaging.pylock import ( Package, PackageArchive, PackageDirectory, PackageSdist, PackageVcs, PackageWheel, Pylock, ) from pip._vendor.packaging.version import Version from pip._internal.models.direct_url import ArchiveInfo, DirInfo, VcsInfo from pip._internal.models.link import Link from pip._internal.req.req_install import InstallRequirement from pip._internal.utils.urls import url_to_path def _pylock_package_from_install_requirement( ireq: InstallRequirement, base_dir: Path ) -> Package: base_dir = base_dir.resolve() dist = ireq.get_dist() download_info = ireq.download_info assert download_info package_version = None package_vcs = None package_directory = None package_archive = None package_sdist = None package_wheels = None if ireq.is_direct: if isinstance(download_info.info, VcsInfo): package_vcs = PackageVcs( type=download_info.info.vcs, url=download_info.url, path=None, requested_revision=download_info.info.requested_revision, commit_id=download_info.info.commit_id, subdirectory=download_info.subdirectory, ) elif isinstance(download_info.info, DirInfo): package_directory = PackageDirectory( path=( Path(url_to_path(download_info.url)) .resolve() .relative_to(base_dir) .as_posix() ), editable=( download_info.info.editable if download_info.info.editable else None ), subdirectory=download_info.subdirectory, ) elif isinstance(download_info.info, ArchiveInfo): if not download_info.info.hashes: raise NotImplementedError() package_archive = PackageArchive( url=download_info.url, path=None, hashes=download_info.info.hashes, subdirectory=download_info.subdirectory, ) else: # should never happen raise NotImplementedError() else: package_version = dist.version if isinstance(download_info.info, ArchiveInfo): if not download_info.info.hashes: raise NotImplementedError() link = Link(download_info.url) if link.is_wheel: package_wheels = [ PackageWheel( name=link.filename, url=download_info.url, hashes=download_info.info.hashes, ) ] else: package_sdist = PackageSdist( name=link.filename, url=download_info.url, hashes=download_info.info.hashes, ) else: # should never happen raise NotImplementedError() return Package( name=dist.canonical_name, version=package_version, vcs=package_vcs, directory=package_directory, archive=package_archive, sdist=package_sdist, wheels=package_wheels, ) def pylock_from_install_requirements( install_requirements: Iterable[InstallRequirement], base_dir: Path ) -> Pylock: return Pylock( lock_version=Version("1.0"), created_by="pip", packages=sorted( ( _pylock_package_from_install_requirement(ireq, base_dir) for ireq in install_requirements ), key=lambda p: p.name, ), ) ================================================ FILE: src/pip/_internal/utils/retry.py ================================================ from __future__ import annotations import functools from time import perf_counter, sleep from typing import TYPE_CHECKING, Callable, TypeVar if TYPE_CHECKING: from typing_extensions import ParamSpec T = TypeVar("T") P = ParamSpec("P") def retry( wait: float, stop_after_delay: float ) -> Callable[[Callable[P, T]], Callable[P, T]]: """Decorator to automatically retry a function on error. If the function raises, the function is recalled with the same arguments until it returns or the time limit is reached. When the time limit is surpassed, the last exception raised is reraised. :param wait: The time to wait after an error before retrying, in seconds. :param stop_after_delay: The time limit after which retries will cease, in seconds. """ def wrapper(func: Callable[P, T]) -> Callable[P, T]: @functools.wraps(func) def retry_wrapped(*args: P.args, **kwargs: P.kwargs) -> T: # The performance counter is monotonic on all platforms we care # about and has much better resolution than time.monotonic(). start_time = perf_counter() while True: try: return func(*args, **kwargs) except Exception: if perf_counter() - start_time > stop_after_delay: raise sleep(wait) return retry_wrapped return wrapper ================================================ FILE: src/pip/_internal/utils/subprocess.py ================================================ from __future__ import annotations import logging import os import shlex import subprocess from collections.abc import Iterable, Mapping from typing import Any, Callable, Literal, Union from pip._vendor.rich.markup import escape from pip._internal.cli.spinners import SpinnerInterface, open_spinner from pip._internal.exceptions import InstallationSubprocessError from pip._internal.utils.logging import VERBOSE, subprocess_logger from pip._internal.utils.misc import HiddenText CommandArgs = list[Union[str, HiddenText]] def make_command(*args: str | HiddenText | CommandArgs) -> CommandArgs: """ Create a CommandArgs object. """ command_args: CommandArgs = [] for arg in args: # Check for list instead of CommandArgs since CommandArgs is # only known during type-checking. if isinstance(arg, list): command_args.extend(arg) else: # Otherwise, arg is str or HiddenText. command_args.append(arg) return command_args def format_command_args(args: list[str] | CommandArgs) -> str: """ Format command arguments for display. """ # For HiddenText arguments, display the redacted form by calling str(). # Also, we don't apply str() to arguments that aren't HiddenText since # this can trigger a UnicodeDecodeError in Python 2 if the argument # has type unicode and includes a non-ascii character. (The type # checker doesn't ensure the annotations are correct in all cases.) return " ".join( shlex.quote(str(arg)) if isinstance(arg, HiddenText) else shlex.quote(arg) for arg in args ) def reveal_command_args(args: list[str] | CommandArgs) -> list[str]: """ Return the arguments in their raw, unredacted form. """ return [arg.secret if isinstance(arg, HiddenText) else arg for arg in args] def call_subprocess( cmd: list[str] | CommandArgs, show_stdout: bool = False, cwd: str | None = None, on_returncode: Literal["raise", "warn", "ignore"] = "raise", extra_ok_returncodes: Iterable[int] | None = None, extra_environ: Mapping[str, Any] | None = None, unset_environ: Iterable[str] | None = None, spinner: SpinnerInterface | None = None, log_failed_cmd: bool | None = True, stdout_only: bool | None = False, *, command_desc: str, ) -> str: """ Args: show_stdout: if true, use INFO to log the subprocess's stderr and stdout streams. Otherwise, use DEBUG. Defaults to False. extra_ok_returncodes: an iterable of integer return codes that are acceptable, in addition to 0. Defaults to None, which means []. unset_environ: an iterable of environment variable names to unset prior to calling subprocess.Popen(). log_failed_cmd: if false, failed commands are not logged, only raised. stdout_only: if true, return only stdout, else return both. When true, logging of both stdout and stderr occurs when the subprocess has terminated, else logging occurs as subprocess output is produced. """ if extra_ok_returncodes is None: extra_ok_returncodes = [] if unset_environ is None: unset_environ = [] # Most places in pip use show_stdout=False. What this means is-- # # - We connect the child's output (combined stderr and stdout) to a # single pipe, which we read. # - We log this output to stderr at DEBUG level as it is received. # - If DEBUG logging isn't enabled (e.g. if --verbose logging wasn't # requested), then we show a spinner so the user can still see the # subprocess is in progress. # - If the subprocess exits with an error, we log the output to stderr # at ERROR level if it hasn't already been displayed to the console # (e.g. if --verbose logging wasn't enabled). This way we don't log # the output to the console twice. # # If show_stdout=True, then the above is still done, but with DEBUG # replaced by INFO. if show_stdout: # Then log the subprocess output at INFO level. log_subprocess: Callable[..., None] = subprocess_logger.info used_level = logging.INFO else: # Then log the subprocess output using VERBOSE. This also ensures # it will be logged to the log file (aka user_log), if enabled. log_subprocess = subprocess_logger.verbose used_level = VERBOSE # Whether the subprocess will be visible in the console. showing_subprocess = subprocess_logger.getEffectiveLevel() <= used_level # Only use the spinner if we're not showing the subprocess output # and we have a spinner. use_spinner = not showing_subprocess and spinner is not None log_subprocess("Running command %s", command_desc) env = os.environ.copy() if extra_environ: env.update(extra_environ) for name in unset_environ: env.pop(name, None) try: proc = subprocess.Popen( # Convert HiddenText objects to the underlying str. reveal_command_args(cmd), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT if not stdout_only else subprocess.PIPE, cwd=cwd, env=env, errors="backslashreplace", ) except Exception as exc: if log_failed_cmd: subprocess_logger.critical( "Error %s while executing command %s", exc, command_desc, ) raise all_output = [] if not stdout_only: assert proc.stdout assert proc.stdin proc.stdin.close() # In this mode, stdout and stderr are in the same pipe. while True: line: str = proc.stdout.readline() if not line: break line = line.rstrip() all_output.append(line + "\n") # Show the line immediately. log_subprocess(line) # Update the spinner. if use_spinner: assert spinner spinner.spin() try: proc.wait() finally: if proc.stdout: proc.stdout.close() output = "".join(all_output) else: # In this mode, stdout and stderr are in different pipes. # We must use communicate() which is the only safe way to read both. out, err = proc.communicate() # log line by line to preserve pip log indenting for out_line in out.splitlines(): log_subprocess(out_line) all_output.append(out) for err_line in err.splitlines(): log_subprocess(err_line) all_output.append(err) output = out proc_had_error = proc.returncode and proc.returncode not in extra_ok_returncodes if use_spinner: assert spinner if proc_had_error: spinner.finish("error") else: spinner.finish("done") if proc_had_error: if on_returncode == "raise": error = InstallationSubprocessError( command_description=command_desc, exit_code=proc.returncode, output_lines=all_output if not showing_subprocess else None, ) if log_failed_cmd: subprocess_logger.error("%s", error, extra={"rich": True}) subprocess_logger.verbose( "[bold magenta]full command[/]: [blue]%s[/]", escape(format_command_args(cmd)), extra={"markup": True}, ) subprocess_logger.verbose( "[bold magenta]cwd[/]: %s", escape(cwd or "[inherit]"), extra={"markup": True}, ) raise error elif on_returncode == "warn": subprocess_logger.warning( 'Command "%s" had error code %s in %s', command_desc, proc.returncode, cwd, ) elif on_returncode == "ignore": pass else: raise ValueError(f"Invalid value: on_returncode={on_returncode!r}") return output def runner_with_spinner_message(message: str) -> Callable[..., None]: """Provide a subprocess_runner that shows a spinner message. Intended for use with for BuildBackendHookCaller. Thus, the runner has an API that matches what's expected by BuildBackendHookCaller.subprocess_runner. """ def runner( cmd: list[str], cwd: str | None = None, extra_environ: Mapping[str, Any] | None = None, ) -> None: with open_spinner(message) as spinner: call_subprocess( cmd, command_desc=message, cwd=cwd, extra_environ=extra_environ, spinner=spinner, ) return runner ================================================ FILE: src/pip/_internal/utils/temp_dir.py ================================================ from __future__ import annotations import errno import itertools import logging import os.path import tempfile import traceback from collections.abc import Generator from contextlib import ExitStack, contextmanager from pathlib import Path from typing import ( Any, Callable, TypeVar, ) from pip._internal.utils.misc import enum, rmtree logger = logging.getLogger(__name__) _T = TypeVar("_T", bound="TempDirectory") # Kinds of temporary directories. Only needed for ones that are # globally-managed. tempdir_kinds = enum( BUILD_ENV="build-env", EPHEM_WHEEL_CACHE="ephem-wheel-cache", REQ_BUILD="req-build", ) _tempdir_manager: ExitStack | None = None @contextmanager def global_tempdir_manager() -> Generator[None, None, None]: global _tempdir_manager with ExitStack() as stack: old_tempdir_manager, _tempdir_manager = _tempdir_manager, stack try: yield finally: _tempdir_manager = old_tempdir_manager class TempDirectoryTypeRegistry: """Manages temp directory behavior""" def __init__(self) -> None: self._should_delete: dict[str, bool] = {} def set_delete(self, kind: str, value: bool) -> None: """Indicate whether a TempDirectory of the given kind should be auto-deleted. """ self._should_delete[kind] = value def get_delete(self, kind: str) -> bool: """Get configured auto-delete flag for a given TempDirectory type, default True. """ return self._should_delete.get(kind, True) _tempdir_registry: TempDirectoryTypeRegistry | None = None @contextmanager def tempdir_registry() -> Generator[TempDirectoryTypeRegistry, None, None]: """Provides a scoped global tempdir registry that can be used to dictate whether directories should be deleted. """ global _tempdir_registry old_tempdir_registry = _tempdir_registry _tempdir_registry = TempDirectoryTypeRegistry() try: yield _tempdir_registry finally: _tempdir_registry = old_tempdir_registry class _Default: pass _default = _Default() class TempDirectory: """Helper class that owns and cleans up a temporary directory. This class can be used as a context manager or as an OO representation of a temporary directory. Attributes: path Location to the created temporary directory delete Whether the directory should be deleted when exiting (when used as a contextmanager) Methods: cleanup() Deletes the temporary directory When used as a context manager, if the delete attribute is True, on exiting the context the temporary directory is deleted. """ def __init__( self, path: str | None = None, delete: bool | None | _Default = _default, kind: str = "temp", globally_managed: bool = False, ignore_cleanup_errors: bool = True, ): super().__init__() if delete is _default: if path is not None: # If we were given an explicit directory, resolve delete option # now. delete = False else: # Otherwise, we wait until cleanup and see what # tempdir_registry says. delete = None # The only time we specify path is in for editables where it # is the value of the --src option. if path is None: path = self._create(kind) self._path = path self._deleted = False self.delete = delete self.kind = kind self.ignore_cleanup_errors = ignore_cleanup_errors if globally_managed: assert _tempdir_manager is not None _tempdir_manager.enter_context(self) @property def path(self) -> str: assert not self._deleted, f"Attempted to access deleted path: {self._path}" return self._path def __repr__(self) -> str: return f"<{self.__class__.__name__} {self.path!r}>" def __enter__(self: _T) -> _T: return self def __exit__(self, exc: Any, value: Any, tb: Any) -> None: if self.delete is not None: delete = self.delete elif _tempdir_registry: delete = _tempdir_registry.get_delete(self.kind) else: delete = True if delete: self.cleanup() def _create(self, kind: str) -> str: """Create a temporary directory and store its path in self.path""" # We realpath here because some systems have their default tmpdir # symlinked to another directory. This tends to confuse build # scripts, so we canonicalize the path by traversing potential # symlinks here. path = os.path.realpath(tempfile.mkdtemp(prefix=f"pip-{kind}-")) logger.debug("Created temporary directory: %s", path) return path def cleanup(self) -> None: """Remove the temporary directory created and reset state""" self._deleted = True if not os.path.exists(self._path): return errors: list[BaseException] = [] def onerror( func: Callable[..., Any], path: Path, exc_val: BaseException, ) -> None: """Log a warning for a `rmtree` error and continue""" formatted_exc = "\n".join( traceback.format_exception_only(type(exc_val), exc_val) ) formatted_exc = formatted_exc.rstrip() # remove trailing new line if func in (os.unlink, os.remove, os.rmdir): logger.debug( "Failed to remove a temporary file '%s' due to %s.\n", path, formatted_exc, ) else: logger.debug("%s failed with %s.", func.__qualname__, formatted_exc) errors.append(exc_val) if self.ignore_cleanup_errors: try: # first try with @retry; retrying to handle ephemeral errors rmtree(self._path, ignore_errors=False) except OSError: # last pass ignore/log all errors rmtree(self._path, onexc=onerror) if errors: logger.warning( "Failed to remove contents in a temporary directory '%s'.\n" "You can safely remove it manually.", self._path, ) else: rmtree(self._path) class AdjacentTempDirectory(TempDirectory): """Helper class that creates a temporary directory adjacent to a real one. Attributes: original The original directory to create a temp directory for. path After calling create() or entering, contains the full path to the temporary directory. delete Whether the directory should be deleted when exiting (when used as a contextmanager) """ # The characters that may be used to name the temp directory # We always prepend a ~ and then rotate through these until # a usable name is found. # pkg_resources raises a different error for .dist-info folder # with leading '-' and invalid metadata LEADING_CHARS = "-~.=%0123456789" def __init__(self, original: str, delete: bool | None = None) -> None: self.original = original.rstrip("/\\") super().__init__(delete=delete) @classmethod def _generate_names(cls, name: str) -> Generator[str, None, None]: """Generates a series of temporary names. The algorithm replaces the leading characters in the name with ones that are valid filesystem characters, but are not valid package names (for both Python and pip definitions of package). """ for i in range(1, len(name)): for candidate in itertools.combinations_with_replacement( cls.LEADING_CHARS, i - 1 ): new_name = "~" + "".join(candidate) + name[i:] if new_name != name: yield new_name # If we make it this far, we will have to make a longer name for i in range(len(cls.LEADING_CHARS)): for candidate in itertools.combinations_with_replacement( cls.LEADING_CHARS, i ): new_name = "~" + "".join(candidate) + name if new_name != name: yield new_name def _create(self, kind: str) -> str: root, name = os.path.split(self.original) for candidate in self._generate_names(name): path = os.path.join(root, candidate) try: os.mkdir(path) except OSError as ex: # Continue if the name exists already if ex.errno != errno.EEXIST: raise else: path = os.path.realpath(path) break else: # Final fallback on the default behavior. path = os.path.realpath(tempfile.mkdtemp(prefix=f"pip-{kind}-")) logger.debug("Created temporary directory: %s", path) return path ================================================ FILE: src/pip/_internal/utils/unpacking.py ================================================ """Utilities related archives.""" from __future__ import annotations import logging import os import shutil import stat import sys import tarfile import zipfile from collections.abc import Iterable from zipfile import ZipInfo from pip._internal.exceptions import InstallationError from pip._internal.utils.filetypes import ( BZ2_EXTENSIONS, TAR_EXTENSIONS, XZ_EXTENSIONS, ZIP_EXTENSIONS, ) from pip._internal.utils.misc import ensure_dir logger = logging.getLogger(__name__) SUPPORTED_EXTENSIONS = ZIP_EXTENSIONS + TAR_EXTENSIONS try: import bz2 # noqa SUPPORTED_EXTENSIONS += BZ2_EXTENSIONS except ImportError: logger.debug("bz2 module is not available") try: # Only for Python 3.3+ import lzma # noqa SUPPORTED_EXTENSIONS += XZ_EXTENSIONS except ImportError: logger.debug("lzma module is not available") def current_umask() -> int: """Get the current umask which involves having to set it temporarily.""" mask = os.umask(0) os.umask(mask) return mask def split_leading_dir(path: str) -> list[str]: path = path.lstrip("/").lstrip("\\") if "/" in path and ( ("\\" in path and path.find("/") < path.find("\\")) or "\\" not in path ): return path.split("/", 1) elif "\\" in path: return path.split("\\", 1) else: return [path, ""] def has_leading_dir(paths: Iterable[str]) -> bool: """Returns true if all the paths have the same leading path name (i.e., everything is in one subdirectory in an archive)""" common_prefix = None for path in paths: prefix, rest = split_leading_dir(path) if not prefix: return False elif common_prefix is None: common_prefix = prefix elif prefix != common_prefix: return False return True def is_within_directory(directory: str, target: str) -> bool: """ Return true if the absolute path of target is within the directory """ abs_directory = os.path.abspath(directory) abs_target = os.path.abspath(target) prefix = os.path.commonpath([abs_directory, abs_target]) return prefix == abs_directory def _get_default_mode_plus_executable() -> int: return 0o777 & ~current_umask() | 0o111 def set_extracted_file_to_default_mode_plus_executable(path: str) -> None: """ Make file present at path have execute for user/group/world (chmod +x) is no-op on windows per python docs """ os.chmod(path, _get_default_mode_plus_executable()) def zip_item_is_executable(info: ZipInfo) -> bool: mode = info.external_attr >> 16 # if mode and regular file and any execute permissions for # user/group/world? return bool(mode and stat.S_ISREG(mode) and mode & 0o111) def unzip_file(filename: str, location: str, flatten: bool = True) -> None: """ Unzip the file (with path `filename`) to the destination `location`. All files are written based on system defaults and umask (i.e. permissions are not preserved), except that regular file members with any execute permissions (user, group, or world) have "chmod +x" applied after being written. Note that for windows, any execute changes using os.chmod are no-ops per the python docs. """ ensure_dir(location) zipfp = open(filename, "rb") try: zip = zipfile.ZipFile(zipfp, allowZip64=True) leading = has_leading_dir(zip.namelist()) and flatten for info in zip.infolist(): name = info.filename fn = name if leading: fn = split_leading_dir(name)[1] fn = os.path.join(location, fn) dir = os.path.dirname(fn) if not is_within_directory(location, fn): message = ( "The zip file ({}) has a file ({}) trying to install " "outside target directory ({})" ) raise InstallationError(message.format(filename, fn, location)) if fn.endswith(("/", "\\")): # A directory ensure_dir(fn) else: ensure_dir(dir) # Don't use read() to avoid allocating an arbitrarily large # chunk of memory for the file's content fp = zip.open(name) try: with open(fn, "wb") as destfp: shutil.copyfileobj(fp, destfp) finally: fp.close() if zip_item_is_executable(info): set_extracted_file_to_default_mode_plus_executable(fn) finally: zipfp.close() def untar_file(filename: str, location: str) -> None: """ Untar the file (with path `filename`) to the destination `location`. All files are written based on system defaults and umask (i.e. permissions are not preserved), except that regular file members with any execute permissions (user, group, or world) have "chmod +x" applied on top of the default. Note that for windows, any execute changes using os.chmod are no-ops per the python docs. """ ensure_dir(location) if filename.lower().endswith(".gz") or filename.lower().endswith(".tgz"): mode = "r:gz" elif filename.lower().endswith(BZ2_EXTENSIONS): mode = "r:bz2" elif filename.lower().endswith(XZ_EXTENSIONS): mode = "r:xz" elif filename.lower().endswith(".tar"): mode = "r" else: logger.warning( "Cannot determine compression type for file %s", filename, ) mode = "r:*" tar = tarfile.open(filename, mode, encoding="utf-8") # type: ignore try: leading = has_leading_dir([member.name for member in tar.getmembers()]) # PEP 706 added `tarfile.data_filter`, and made some other changes to # Python's tarfile module (see below). The features were backported to # security releases. try: data_filter = tarfile.data_filter except AttributeError: _untar_without_filter(filename, location, tar, leading) else: default_mode_plus_executable = _get_default_mode_plus_executable() if leading: # Strip the leading directory from all files in the archive, # including hardlink targets (which are relative to the # unpack location). for member in tar.getmembers(): name_lead, name_rest = split_leading_dir(member.name) member.name = name_rest if member.islnk(): lnk_lead, lnk_rest = split_leading_dir(member.linkname) if lnk_lead == name_lead: member.linkname = lnk_rest def pip_filter(member: tarfile.TarInfo, path: str) -> tarfile.TarInfo: orig_mode = member.mode try: try: member = data_filter(member, location) except tarfile.LinkOutsideDestinationError: if sys.version_info[:3] in { (3, 9, 17), (3, 10, 12), (3, 11, 4), }: # The tarfile filter in specific Python versions # raises LinkOutsideDestinationError on valid input # (https://github.com/python/cpython/issues/107845) # Ignore the error there, but do use the # more lax `tar_filter` member = tarfile.tar_filter(member, location) else: raise except tarfile.TarError as exc: message = "Invalid member in the tar file {}: {}" # Filter error messages mention the member name. # No need to add it here. raise InstallationError( message.format( filename, exc, ) ) if member.isfile() and orig_mode & 0o111: member.mode = default_mode_plus_executable else: # See PEP 706 note above. # The PEP changed this from `int` to `Optional[int]`, # where None means "use the default". Mypy doesn't # know this yet. member.mode = None # type: ignore [assignment] return member tar.extractall(location, filter=pip_filter) finally: tar.close() def is_symlink_target_in_tar(tar: tarfile.TarFile, tarinfo: tarfile.TarInfo) -> bool: """Check if the file pointed to by the symbolic link is in the tar archive""" linkname = os.path.join(os.path.dirname(tarinfo.name), tarinfo.linkname) linkname = os.path.normpath(linkname) linkname = linkname.replace("\\", "/") try: tar.getmember(linkname) return True except KeyError: return False def _untar_without_filter( filename: str, location: str, tar: tarfile.TarFile, leading: bool, ) -> None: """Fallback for Python without tarfile.data_filter""" # NOTE: This function can be removed once pip requires CPython ≥ 3.12.​ # PEP 706 added tarfile.data_filter, made tarfile extraction operations more secure. # This feature is fully supported from CPython 3.12 onward. for member in tar.getmembers(): fn = member.name if leading: fn = split_leading_dir(fn)[1] path = os.path.join(location, fn) if not is_within_directory(location, path): message = ( "The tar file ({}) has a file ({}) trying to install " "outside target directory ({})" ) raise InstallationError(message.format(filename, path, location)) if member.isdir(): ensure_dir(path) elif member.issym(): if not is_symlink_target_in_tar(tar, member): message = ( "The tar file ({}) has a file ({}) trying to install " "outside target directory ({})" ) raise InstallationError( message.format(filename, member.name, member.linkname) ) try: tar._extract_member(member, path) except Exception as exc: # Some corrupt tar files seem to produce this # (specifically bad symlinks) logger.warning( "In the tar file %s the member %s is invalid: %s", filename, member.name, exc, ) continue else: try: fp = tar.extractfile(member) except (KeyError, AttributeError) as exc: # Some corrupt tar files seem to produce this # (specifically bad symlinks) logger.warning( "In the tar file %s the member %s is invalid: %s", filename, member.name, exc, ) continue ensure_dir(os.path.dirname(path)) assert fp is not None with open(path, "wb") as destfp: shutil.copyfileobj(fp, destfp) fp.close() # Update the timestamp (useful for cython compiled files) tar.utime(member, path) # member have any execute permissions for user/group/world? if member.mode & 0o111: set_extracted_file_to_default_mode_plus_executable(path) def unpack_file( filename: str, location: str, content_type: str | None = None, ) -> None: filename = os.path.realpath(filename) if ( content_type == "application/zip" or filename.lower().endswith(ZIP_EXTENSIONS) or zipfile.is_zipfile(filename) ): unzip_file(filename, location, flatten=not filename.endswith(".whl")) elif ( content_type == "application/x-gzip" or tarfile.is_tarfile(filename) or filename.lower().endswith(TAR_EXTENSIONS + BZ2_EXTENSIONS + XZ_EXTENSIONS) ): untar_file(filename, location) else: # FIXME: handle? # FIXME: magic signatures? logger.critical( "Cannot unpack file %s (downloaded from %s, content-type: %s); " "cannot detect archive format", filename, location, content_type, ) raise InstallationError(f"Cannot determine archive format of {location}") ================================================ FILE: src/pip/_internal/utils/urls.py ================================================ import os import string import urllib.parse import urllib.request from .compat import WINDOWS def path_to_url(path: str) -> str: """ Convert a path to a file: URL. The path will be made absolute and have quoted path parts. """ path = os.path.normpath(os.path.abspath(path)) url = urllib.parse.urljoin("file://", urllib.request.pathname2url(path)) return url def url_to_path(url: str) -> str: """ Convert a file: URL to a path. """ assert url.startswith( "file:" ), f"You can only turn file: urls into filenames (not {url!r})" _, netloc, path, _, _ = urllib.parse.urlsplit(url) if not netloc or netloc == "localhost": # According to RFC 8089, same as empty authority. netloc = "" elif WINDOWS: # If we have a UNC path, prepend UNC share notation. netloc = "\\\\" + netloc else: raise ValueError( f"non-local file URIs are not supported on this platform: {url!r}" ) path = urllib.request.url2pathname(netloc + path) # On Windows, urlsplit parses the path as something like "/C:/Users/foo". # This creates issues for path-related functions like io.open(), so we try # to detect and strip the leading slash. if ( WINDOWS and not netloc # Not UNC. and len(path) >= 3 and path[0] == "/" # Leading slash to strip. and path[1] in string.ascii_letters # Drive letter. and path[2:4] in (":", ":/") # Colon + end of string, or colon + absolute path. ): path = path[1:] return path ================================================ FILE: src/pip/_internal/utils/virtualenv.py ================================================ from __future__ import annotations import logging import os import re import site import sys logger = logging.getLogger(__name__) _INCLUDE_SYSTEM_SITE_PACKAGES_REGEX = re.compile( r"include-system-site-packages\s*=\s*(?Ptrue|false)" ) def _running_under_venv() -> bool: """Checks if sys.base_prefix and sys.prefix match. This handles PEP 405 compliant virtual environments. """ return sys.prefix != getattr(sys, "base_prefix", sys.prefix) def _running_under_legacy_virtualenv() -> bool: """Checks if sys.real_prefix is set. This handles virtual environments created with pypa's virtualenv. """ # pypa/virtualenv case return hasattr(sys, "real_prefix") def running_under_virtualenv() -> bool: """True if we're running inside a virtual environment, False otherwise.""" return _running_under_venv() or _running_under_legacy_virtualenv() def _get_pyvenv_cfg_lines() -> list[str] | None: """Reads {sys.prefix}/pyvenv.cfg and returns its contents as list of lines Returns None, if it could not read/access the file. """ pyvenv_cfg_file = os.path.join(sys.prefix, "pyvenv.cfg") try: # Although PEP 405 does not specify, the built-in venv module always # writes with UTF-8. (pypa/pip#8717) with open(pyvenv_cfg_file, encoding="utf-8") as f: return f.read().splitlines() # avoids trailing newlines except OSError: return None def _no_global_under_venv() -> bool: """Check `{sys.prefix}/pyvenv.cfg` for system site-packages inclusion PEP 405 specifies that when system site-packages are not supposed to be visible from a virtual environment, `pyvenv.cfg` must contain the following line: include-system-site-packages = false Additionally, log a warning if accessing the file fails. """ cfg_lines = _get_pyvenv_cfg_lines() if cfg_lines is None: # We're not in a "sane" venv, so assume there is no system # site-packages access (since that's PEP 405's default state). logger.warning( "Could not access 'pyvenv.cfg' despite a virtual environment " "being active. Assuming global site-packages is not accessible " "in this environment." ) return True for line in cfg_lines: match = _INCLUDE_SYSTEM_SITE_PACKAGES_REGEX.match(line) if match is not None and match.group("value") == "false": return True return False def _no_global_under_legacy_virtualenv() -> bool: """Check if "no-global-site-packages.txt" exists beside site.py This mirrors logic in pypa/virtualenv for determining whether system site-packages are visible in the virtual environment. """ site_mod_dir = os.path.dirname(os.path.abspath(site.__file__)) no_global_site_packages_file = os.path.join( site_mod_dir, "no-global-site-packages.txt", ) return os.path.exists(no_global_site_packages_file) def virtualenv_no_global() -> bool: """Returns a boolean, whether running in venv with no system site-packages.""" # PEP 405 compliance needs to be checked first since virtualenv >=20 would # return True for both checks, but is only able to use the PEP 405 config. if _running_under_venv(): return _no_global_under_venv() if _running_under_legacy_virtualenv(): return _no_global_under_legacy_virtualenv() return False ================================================ FILE: src/pip/_internal/utils/wheel.py ================================================ """Support functions for working with wheel files.""" import logging from email.message import Message from email.parser import Parser from zipfile import BadZipFile, ZipFile from pip._vendor.packaging.utils import canonicalize_name from pip._internal.exceptions import UnsupportedWheel VERSION_COMPATIBLE = (1, 0) logger = logging.getLogger(__name__) def parse_wheel(wheel_zip: ZipFile, name: str) -> tuple[str, Message]: """Extract information from the provided wheel, ensuring it meets basic standards. Returns the name of the .dist-info directory and the parsed WHEEL metadata. """ try: info_dir = wheel_dist_info_dir(wheel_zip, name) metadata = wheel_metadata(wheel_zip, info_dir) version = wheel_version(metadata) except UnsupportedWheel as e: raise UnsupportedWheel(f"{name} has an invalid wheel, {e}") check_compatibility(version, name) return info_dir, metadata def wheel_dist_info_dir(source: ZipFile, name: str) -> str: """Returns the name of the contained .dist-info directory. Raises AssertionError or UnsupportedWheel if not found, >1 found, or it doesn't match the provided name. """ # Zip file path separators must be / subdirs = {p.split("/", 1)[0] for p in source.namelist()} info_dirs = [s for s in subdirs if s.endswith(".dist-info")] if not info_dirs: raise UnsupportedWheel(".dist-info directory not found") if len(info_dirs) > 1: raise UnsupportedWheel( "multiple .dist-info directories found: {}".format(", ".join(info_dirs)) ) info_dir = info_dirs[0] info_dir_name = canonicalize_name(info_dir) canonical_name = canonicalize_name(name) if not info_dir_name.startswith(canonical_name): raise UnsupportedWheel( f".dist-info directory {info_dir!r} does not start with {canonical_name!r}" ) return info_dir def read_wheel_metadata_file(source: ZipFile, path: str) -> bytes: try: return source.read(path) # BadZipFile for general corruption, KeyError for missing entry, # and RuntimeError for password-protected files except (BadZipFile, KeyError, RuntimeError) as e: raise UnsupportedWheel(f"could not read {path!r} file: {e!r}") def wheel_metadata(source: ZipFile, dist_info_dir: str) -> Message: """Return the WHEEL metadata of an extracted wheel, if possible. Otherwise, raise UnsupportedWheel. """ path = f"{dist_info_dir}/WHEEL" # Zip file path separators must be / wheel_contents = read_wheel_metadata_file(source, path) try: wheel_text = wheel_contents.decode() except UnicodeDecodeError as e: raise UnsupportedWheel(f"error decoding {path!r}: {e!r}") # FeedParser (used by Parser) does not raise any exceptions. The returned # message may have .defects populated, but for backwards-compatibility we # currently ignore them. return Parser().parsestr(wheel_text) def wheel_version(wheel_data: Message) -> tuple[int, ...]: """Given WHEEL metadata, return the parsed Wheel-Version. Otherwise, raise UnsupportedWheel. """ version_text = wheel_data["Wheel-Version"] if version_text is None: raise UnsupportedWheel("WHEEL is missing Wheel-Version") version = version_text.strip() try: return tuple(map(int, version.split("."))) except ValueError: raise UnsupportedWheel(f"invalid Wheel-Version: {version!r}") def check_compatibility(version: tuple[int, ...], name: str) -> None: """Raises errors or warns if called with an incompatible Wheel-Version. pip should refuse to install a Wheel-Version that's a major series ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when installing a version only minor version ahead (e.g 1.2 > 1.1). version: a 2-tuple representing a Wheel-Version (Major, Minor) name: name of wheel or package to raise exception about :raises UnsupportedWheel: when an incompatible Wheel-Version is given """ if version[0] > VERSION_COMPATIBLE[0]: raise UnsupportedWheel( "{}'s Wheel-Version ({}) is not compatible with this version " "of pip".format(name, ".".join(map(str, version))) ) elif version > VERSION_COMPATIBLE: logger.warning( "Installing from a newer Wheel-Version (%s)", ".".join(map(str, version)), ) ================================================ FILE: src/pip/_internal/vcs/__init__.py ================================================ # Expose a limited set of classes and functions so callers outside of # the vcs package don't need to import deeper than `pip._internal.vcs`. # (The test directory may still need to import from a vcs sub-package.) # Import all vcs modules to register each VCS in the VcsSupport object. import pip._internal.vcs.bazaar import pip._internal.vcs.git import pip._internal.vcs.mercurial import pip._internal.vcs.subversion # noqa: F401 from pip._internal.vcs.versioncontrol import ( # noqa: F401 RemoteNotFoundError, RemoteNotValidError, is_url, make_vcs_requirement_url, vcs, ) ================================================ FILE: src/pip/_internal/vcs/bazaar.py ================================================ from __future__ import annotations import logging from pip._internal.utils.misc import HiddenText, display_path from pip._internal.utils.subprocess import make_command from pip._internal.utils.urls import path_to_url from pip._internal.vcs.versioncontrol import ( AuthInfo, RemoteNotFoundError, RevOptions, VersionControl, vcs, ) logger = logging.getLogger(__name__) class Bazaar(VersionControl): name = "bzr" dirname = ".bzr" repo_name = "branch" schemes = ( "bzr+http", "bzr+https", "bzr+ssh", "bzr+sftp", "bzr+ftp", "bzr+lp", "bzr+file", ) @staticmethod def get_base_rev_args(rev: str) -> list[str]: return ["-r", rev] def fetch_new( self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int ) -> None: rev_display = rev_options.to_display() logger.info( "Checking out %s%s to %s", url, rev_display, display_path(dest), ) if verbosity <= 0: flags = ["--quiet"] elif verbosity == 1: flags = [] else: flags = [f"-{'v'*verbosity}"] cmd_args = make_command( "checkout", "--lightweight", *flags, rev_options.to_args(), url, dest ) self.run_command(cmd_args) def switch( self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int = 0, ) -> None: self.run_command(make_command("switch", url), cwd=dest) def update( self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int = 0, ) -> None: flags = [] if verbosity <= 0: flags.append("-q") output = self.run_command( make_command("info"), show_stdout=False, stdout_only=True, cwd=dest ) if output.startswith("Standalone "): # Older versions of pip used to create standalone branches. # Convert the standalone branch to a checkout by calling "bzr bind". cmd_args = make_command("bind", *flags, url) self.run_command(cmd_args, cwd=dest) cmd_args = make_command("update", *flags, rev_options.to_args()) self.run_command(cmd_args, cwd=dest) @classmethod def get_url_rev_and_auth(cls, url: str) -> tuple[str, str | None, AuthInfo]: # hotfix the URL scheme after removing bzr+ from bzr+ssh:// re-add it url, rev, user_pass = super().get_url_rev_and_auth(url) if url.startswith("ssh://"): url = "bzr+" + url return url, rev, user_pass @classmethod def get_remote_url(cls, location: str) -> str: urls = cls.run_command( ["info"], show_stdout=False, stdout_only=True, cwd=location ) for line in urls.splitlines(): line = line.strip() for x in ("checkout of branch: ", "parent branch: "): if line.startswith(x): repo = line.split(x)[1] if cls._is_local_repository(repo): return path_to_url(repo) return repo raise RemoteNotFoundError @classmethod def get_revision(cls, location: str) -> str: revision = cls.run_command( ["revno"], show_stdout=False, stdout_only=True, cwd=location, ) return revision.splitlines()[-1] @classmethod def is_commit_id_equal(cls, dest: str, name: str | None) -> bool: """Always assume the versions don't match""" return False vcs.register(Bazaar) ================================================ FILE: src/pip/_internal/vcs/git.py ================================================ from __future__ import annotations import logging import os.path import pathlib import re import urllib.parse import urllib.request from dataclasses import replace from typing import Any from pip._internal.exceptions import BadCommand, InstallationError from pip._internal.utils.misc import HiddenText, display_path, hide_url from pip._internal.utils.subprocess import make_command from pip._internal.vcs.versioncontrol import ( AuthInfo, RemoteNotFoundError, RemoteNotValidError, RevOptions, VersionControl, find_path_to_project_root_from_repo_root, vcs, ) urlsplit = urllib.parse.urlsplit urlunsplit = urllib.parse.urlunsplit logger = logging.getLogger(__name__) GIT_VERSION_REGEX = re.compile( r"^git version " # Prefix. r"(\d+)" # Major. r"\.(\d+)" # Dot, minor. r"(?:\.(\d+))?" # Optional dot, patch. r".*$" # Suffix, including any pre- and post-release segments we don't care about. ) HASH_REGEX = re.compile("^[a-fA-F0-9]{40}$") # SCP (Secure copy protocol) shorthand. e.g. 'git@example.com:foo/bar.git' SCP_REGEX = re.compile( r"""^ # Optional user, e.g. 'git@' (\w+@)? # Server, e.g. 'github.com'. ([^/:]+): # The server-side path. e.g. 'user/project.git'. Must start with an # alphanumeric character so as not to be confusable with a Windows paths # like 'C:/foo/bar' or 'C:\foo\bar'. (\w[^:]*) $""", re.VERBOSE, ) def looks_like_hash(sha: str) -> bool: return bool(HASH_REGEX.match(sha)) class Git(VersionControl): name = "git" dirname = ".git" repo_name = "clone" schemes = ( "git+http", "git+https", "git+ssh", "git+git", "git+file", ) # Prevent the user's environment variables from interfering with pip: # https://github.com/pypa/pip/issues/1130 unset_environ = ("GIT_DIR", "GIT_WORK_TREE") default_arg_rev = "HEAD" @staticmethod def get_base_rev_args(rev: str) -> list[str]: return [rev] @classmethod def run_command(cls, *args: Any, **kwargs: Any) -> str: if os.environ.get("PIP_NO_INPUT"): extra_environ = kwargs.get("extra_environ", {}) extra_environ["GIT_TERMINAL_PROMPT"] = "0" extra_environ["GIT_SSH_COMMAND"] = "ssh -oBatchMode=yes" kwargs["extra_environ"] = extra_environ return super().run_command(*args, **kwargs) def is_immutable_rev_checkout(self, url: str, dest: str) -> bool: _, rev_options = self.get_url_rev_options(hide_url(url)) if not rev_options.rev: return False if not self.is_commit_id_equal(dest, rev_options.rev): # the current commit is different from rev, # which means rev was something else than a commit hash return False # return False in the rare case rev is both a commit hash # and a tag or a branch; we don't want to cache in that case # because that branch/tag could point to something else in the future is_tag_or_branch = bool(self.get_revision_sha(dest, rev_options.rev)[0]) return not is_tag_or_branch def get_git_version(self) -> tuple[int, ...]: version = self.run_command( ["version"], command_desc="git version", show_stdout=False, stdout_only=True, ) match = GIT_VERSION_REGEX.match(version) if not match: logger.warning("Can't parse git version: %s", version) return () return (int(match.group(1)), int(match.group(2))) @classmethod def get_current_branch(cls, location: str) -> str | None: """ Return the current branch, or None if HEAD isn't at a branch (e.g. detached HEAD). """ # git-symbolic-ref exits with empty stdout if "HEAD" is a detached # HEAD rather than a symbolic ref. In addition, the -q causes the # command to exit with status code 1 instead of 128 in this case # and to suppress the message to stderr. args = ["symbolic-ref", "-q", "HEAD"] output = cls.run_command( args, extra_ok_returncodes=(1,), show_stdout=False, stdout_only=True, cwd=location, ) ref = output.strip() if ref.startswith("refs/heads/"): return ref[len("refs/heads/") :] return None @classmethod def get_revision_sha(cls, dest: str, rev: str) -> tuple[str | None, bool]: """ Return (sha_or_none, is_branch), where sha_or_none is a commit hash if the revision names a remote branch or tag, otherwise None. Args: dest: the repository directory. rev: the revision name. """ # Pass rev to pre-filter the list. output = cls.run_command( ["show-ref", rev], cwd=dest, show_stdout=False, stdout_only=True, on_returncode="ignore", ) refs = {} # NOTE: We do not use splitlines here since that would split on other # unicode separators, which can be maliciously used to install a # different revision. for line in output.strip().split("\n"): line = line.rstrip("\r") if not line: continue try: ref_sha, ref_name = line.split(" ", maxsplit=2) except ValueError: # Include the offending line to simplify troubleshooting if # this error ever occurs. raise ValueError(f"unexpected show-ref line: {line!r}") refs[ref_name] = ref_sha branch_ref = f"refs/remotes/origin/{rev}" tag_ref = f"refs/tags/{rev}" sha = refs.get(branch_ref) if sha is not None: return (sha, True) sha = refs.get(tag_ref) return (sha, False) @classmethod def _should_fetch(cls, dest: str, rev: str) -> bool: """ Return true if rev is a ref or is a commit that we don't have locally. Branches and tags are not considered in this method because they are assumed to be always available locally (which is a normal outcome of ``git clone`` and ``git fetch --tags``). """ if rev.startswith("refs/"): # Always fetch remote refs. return True if not looks_like_hash(rev): # Git fetch would fail with abbreviated commits. return False if cls.has_commit(dest, rev): # Don't fetch if we have the commit locally. return False return True @classmethod def resolve_revision( cls, dest: str, url: HiddenText, rev_options: RevOptions ) -> RevOptions: """ Resolve a revision to a new RevOptions object with the SHA1 of the branch, tag, or ref if found. Args: rev_options: a RevOptions object. """ rev = rev_options.arg_rev # The arg_rev property's implementation for Git ensures that the # rev return value is always non-None. assert rev is not None sha, is_branch = cls.get_revision_sha(dest, rev) if sha is not None: rev_options = rev_options.make_new(sha) rev_options = replace(rev_options, branch_name=(rev if is_branch else None)) return rev_options # Do not show a warning for the common case of something that has # the form of a Git commit hash. if not looks_like_hash(rev): logger.info( "Did not find branch or tag '%s', assuming revision or ref.", rev, ) if not cls._should_fetch(dest, rev): return rev_options # fetch the requested revision cls.run_command( make_command("fetch", "-q", url, rev_options.to_args()), cwd=dest, ) # Change the revision to the SHA of the ref we fetched sha = cls.get_revision(dest, rev="FETCH_HEAD") rev_options = rev_options.make_new(sha) return rev_options @classmethod def is_commit_id_equal(cls, dest: str, name: str | None) -> bool: """ Return whether the current commit hash equals the given name. Args: dest: the repository directory. name: a string name. """ if not name: # Then avoid an unnecessary subprocess call. return False return cls.get_revision(dest) == name def fetch_new( self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int ) -> None: rev_display = rev_options.to_display() logger.info("Cloning %s%s to %s", url, rev_display, display_path(dest)) if verbosity <= 0: flags: tuple[str, ...] = ("--quiet",) elif verbosity == 1: flags = () else: flags = ("--verbose", "--progress") if self.get_git_version() >= (2, 17): # Git added support for partial clone in 2.17 # https://git-scm.com/docs/partial-clone # Speeds up cloning by functioning without a complete copy of repository self.run_command( make_command( "clone", "--filter=blob:none", *flags, url, dest, ) ) else: self.run_command(make_command("clone", *flags, url, dest)) if rev_options.rev: # Then a specific revision was requested. rev_options = self.resolve_revision(dest, url, rev_options) branch_name = getattr(rev_options, "branch_name", None) logger.debug("Rev options %s, branch_name %s", rev_options, branch_name) if branch_name is None: # Only do a checkout if the current commit id doesn't match # the requested revision. if not self.is_commit_id_equal(dest, rev_options.rev): cmd_args = make_command( "checkout", "-q", rev_options.to_args(), ) self.run_command(cmd_args, cwd=dest) elif self.get_current_branch(dest) != branch_name: # Then a specific branch was requested, and that branch # is not yet checked out. track_branch = f"origin/{branch_name}" cmd_args = [ "checkout", "-b", branch_name, "--track", track_branch, ] self.run_command(cmd_args, cwd=dest) else: sha = self.get_revision(dest) rev_options = rev_options.make_new(sha) logger.info("Resolved %s to commit %s", url, rev_options.rev) #: repo may contain submodules self.update_submodules(dest, verbosity=verbosity) def switch( self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int = 0, ) -> None: self.run_command( make_command("config", "remote.origin.url", url), cwd=dest, ) extra_flags = [] if verbosity <= 0: extra_flags.append("-q") cmd_args = make_command("checkout", *extra_flags, rev_options.to_args()) self.run_command(cmd_args, cwd=dest) self.update_submodules(dest, verbosity=verbosity) def update( self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int = 0, ) -> None: extra_flags = [] if verbosity <= 0: extra_flags.append("-q") # First fetch changes from the default remote if self.get_git_version() >= (1, 9): # fetch tags in addition to everything else self.run_command(["fetch", "--tags", *extra_flags], cwd=dest) else: self.run_command(["fetch", *extra_flags], cwd=dest) # Then reset to wanted revision (maybe even origin/master) rev_options = self.resolve_revision(dest, url, rev_options) cmd_args = make_command( "reset", "--hard", *extra_flags, rev_options.to_args(), ) self.run_command(cmd_args, cwd=dest) #: update submodules self.update_submodules(dest, verbosity=verbosity) @classmethod def get_remote_url(cls, location: str) -> str: """ Return URL of the first remote encountered. Raises RemoteNotFoundError if the repository does not have a remote url configured. """ # We need to pass 1 for extra_ok_returncodes since the command # exits with return code 1 if there are no matching lines. stdout = cls.run_command( ["config", "--get-regexp", r"remote\..*\.url"], extra_ok_returncodes=(1,), show_stdout=False, stdout_only=True, cwd=location, ) remotes = stdout.splitlines() try: found_remote = remotes[0] except IndexError: raise RemoteNotFoundError for remote in remotes: if remote.startswith("remote.origin.url "): found_remote = remote break url = found_remote.split(" ")[1] return cls._git_remote_to_pip_url(url.strip()) @staticmethod def _git_remote_to_pip_url(url: str) -> str: """ Convert a remote url from what git uses to what pip accepts. There are 3 legal forms **url** may take: 1. A fully qualified url: ssh://git@example.com/foo/bar.git 2. A local project.git folder: /path/to/bare/repository.git 3. SCP shorthand for form 1: git@example.com:foo/bar.git Form 1 is output as-is. Form 2 must be converted to URI and form 3 must be converted to form 1. See the corresponding test test_git_remote_url_to_pip() for examples of sample inputs/outputs. """ if re.match(r"\w+://", url): # This is already valid. Pass it though as-is. return url if os.path.exists(url): # A local bare remote (git clone --mirror). # Needs a file:// prefix. return pathlib.PurePath(url).as_uri() scp_match = SCP_REGEX.match(url) if scp_match: # Add an ssh:// prefix and replace the ':' with a '/'. return scp_match.expand(r"ssh://\1\2/\3") # Otherwise, bail out. raise RemoteNotValidError(url) @classmethod def has_commit(cls, location: str, rev: str) -> bool: """ Check if rev is a commit that is available in the local repository. """ try: cls.run_command( ["rev-parse", "-q", "--verify", "sha^" + rev], cwd=location, log_failed_cmd=False, ) except InstallationError: return False else: return True @classmethod def get_revision(cls, location: str, rev: str | None = None) -> str: if rev is None: rev = "HEAD" current_rev = cls.run_command( ["rev-parse", rev], show_stdout=False, stdout_only=True, cwd=location, ) return current_rev.strip() @classmethod def get_subdirectory(cls, location: str) -> str | None: """ Return the path to Python project root, relative to the repo root. Return None if the project root is in the repo root. """ # find the repo root git_dir = cls.run_command( ["rev-parse", "--git-dir"], show_stdout=False, stdout_only=True, cwd=location, ).strip() if not os.path.isabs(git_dir): git_dir = os.path.join(location, git_dir) repo_root = os.path.abspath(os.path.join(git_dir, "..")) return find_path_to_project_root_from_repo_root(location, repo_root) @classmethod def get_url_rev_and_auth(cls, url: str) -> tuple[str, str | None, AuthInfo]: """ Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'. That's required because although they use SSH they sometimes don't work with a ssh:// scheme (e.g. GitHub). But we need a scheme for parsing. Hence we remove it again afterwards and return it as a stub. """ # Works around an apparent Git bug # (see https://article.gmane.org/gmane.comp.version-control.git/146500) scheme, netloc, path, query, fragment = urlsplit(url) if scheme.endswith("file"): initial_slashes = path[: -len(path.lstrip("/"))] newpath = initial_slashes + urllib.request.url2pathname(path).replace( "\\", "/" ).lstrip("/") after_plus = scheme.find("+") + 1 url = scheme[:after_plus] + urlunsplit( (scheme[after_plus:], netloc, newpath, query, fragment), ) if "://" not in url: assert "file:" not in url url = url.replace("git+", "git+ssh://") url, rev, user_pass = super().get_url_rev_and_auth(url) url = url.replace("ssh://", "") else: url, rev, user_pass = super().get_url_rev_and_auth(url) return url, rev, user_pass @classmethod def update_submodules(cls, location: str, verbosity: int = 0) -> None: argv = ["submodule", "update", "--init", "--recursive"] if verbosity <= 0: argv.append("-q") if not os.path.exists(os.path.join(location, ".gitmodules")): return cls.run_command( argv, cwd=location, ) @classmethod def get_repository_root(cls, location: str) -> str | None: loc = super().get_repository_root(location) if loc: return loc try: r = cls.run_command( ["rev-parse", "--show-toplevel"], cwd=location, show_stdout=False, stdout_only=True, on_returncode="raise", log_failed_cmd=False, ) except BadCommand: logger.debug( "could not determine if %s is under git control " "because git is not available", location, ) return None except InstallationError: return None return os.path.normpath(r.rstrip("\r\n")) @staticmethod def should_add_vcs_url_prefix(repo_url: str) -> bool: """In either https or ssh form, requirements must be prefixed with git+.""" return True vcs.register(Git) ================================================ FILE: src/pip/_internal/vcs/mercurial.py ================================================ from __future__ import annotations import configparser import logging import os from pip._internal.exceptions import BadCommand, InstallationError from pip._internal.utils.misc import HiddenText, display_path from pip._internal.utils.subprocess import make_command from pip._internal.utils.urls import path_to_url from pip._internal.vcs.versioncontrol import ( RevOptions, VersionControl, find_path_to_project_root_from_repo_root, vcs, ) logger = logging.getLogger(__name__) class Mercurial(VersionControl): name = "hg" dirname = ".hg" repo_name = "clone" schemes = ( "hg+file", "hg+http", "hg+https", "hg+ssh", "hg+static-http", ) @staticmethod def get_base_rev_args(rev: str) -> list[str]: return [f"--rev={rev}"] def fetch_new( self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int ) -> None: rev_display = rev_options.to_display() logger.info( "Cloning hg %s%s to %s", url, rev_display, display_path(dest), ) if verbosity <= 0: flags: tuple[str, ...] = ("--quiet",) elif verbosity == 1: flags = () elif verbosity == 2: flags = ("--verbose",) else: flags = ("--verbose", "--debug") self.run_command(make_command("clone", "--noupdate", *flags, url, dest)) self.run_command( make_command("update", *flags, rev_options.to_args()), cwd=dest, ) def switch( self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int = 0, ) -> None: extra_flags = [] repo_config = os.path.join(dest, self.dirname, "hgrc") config = configparser.RawConfigParser() if verbosity <= 0: extra_flags.append("-q") try: config.read(repo_config) config.set("paths", "default", url.secret) with open(repo_config, "w") as config_file: config.write(config_file) except (OSError, configparser.NoSectionError) as exc: logger.warning("Could not switch Mercurial repository to %s: %s", url, exc) else: cmd_args = make_command("update", *extra_flags, rev_options.to_args()) self.run_command(cmd_args, cwd=dest) def update( self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int = 0, ) -> None: extra_flags = [] if verbosity <= 0: extra_flags.append("-q") self.run_command(["pull", *extra_flags], cwd=dest) cmd_args = make_command("update", *extra_flags, rev_options.to_args()) self.run_command(cmd_args, cwd=dest) @classmethod def get_remote_url(cls, location: str) -> str: url = cls.run_command( ["showconfig", "paths.default"], show_stdout=False, stdout_only=True, cwd=location, ).strip() if cls._is_local_repository(url): url = path_to_url(url) return url.strip() @classmethod def get_revision(cls, location: str) -> str: """ Return the repository-local changeset revision number, as an integer. """ current_revision = cls.run_command( ["parents", "--template={rev}"], show_stdout=False, stdout_only=True, cwd=location, ).strip() return current_revision @classmethod def get_requirement_revision(cls, location: str) -> str: """ Return the changeset identification hash, as a 40-character hexadecimal string """ current_rev_hash = cls.run_command( ["parents", "--template={node}"], show_stdout=False, stdout_only=True, cwd=location, ).strip() return current_rev_hash @classmethod def is_commit_id_equal(cls, dest: str, name: str | None) -> bool: """Always assume the versions don't match""" return False @classmethod def get_subdirectory(cls, location: str) -> str | None: """ Return the path to Python project root, relative to the repo root. Return None if the project root is in the repo root. """ # find the repo root repo_root = cls.run_command( ["root"], show_stdout=False, stdout_only=True, cwd=location ).strip() if not os.path.isabs(repo_root): repo_root = os.path.abspath(os.path.join(location, repo_root)) return find_path_to_project_root_from_repo_root(location, repo_root) @classmethod def get_repository_root(cls, location: str) -> str | None: loc = super().get_repository_root(location) if loc: return loc try: r = cls.run_command( ["root"], cwd=location, show_stdout=False, stdout_only=True, on_returncode="raise", log_failed_cmd=False, ) except BadCommand: logger.debug( "could not determine if %s is under hg control " "because hg is not available", location, ) return None except InstallationError: return None return os.path.normpath(r.rstrip("\r\n")) vcs.register(Mercurial) ================================================ FILE: src/pip/_internal/vcs/subversion.py ================================================ from __future__ import annotations import logging import os import re from pip._internal.utils.misc import ( HiddenText, display_path, is_console_interactive, is_installable_dir, split_auth_from_netloc, ) from pip._internal.utils.subprocess import CommandArgs, make_command from pip._internal.vcs.versioncontrol import ( AuthInfo, RemoteNotFoundError, RevOptions, VersionControl, vcs, ) logger = logging.getLogger(__name__) _svn_xml_url_re = re.compile('url="([^"]+)"') _svn_rev_re = re.compile(r'committed-rev="(\d+)"') _svn_info_xml_rev_re = re.compile(r'\s*revision="(\d+)"') _svn_info_xml_url_re = re.compile(r"(.*)") class Subversion(VersionControl): name = "svn" dirname = ".svn" repo_name = "checkout" schemes = ("svn+ssh", "svn+http", "svn+https", "svn+svn", "svn+file") @classmethod def should_add_vcs_url_prefix(cls, remote_url: str) -> bool: return True @staticmethod def get_base_rev_args(rev: str) -> list[str]: return ["-r", rev] @classmethod def get_revision(cls, location: str) -> str: """ Return the maximum revision for all files under a given location """ # Note: taken from setuptools.command.egg_info revision = 0 for base, dirs, _ in os.walk(location): if cls.dirname not in dirs: dirs[:] = [] continue # no sense walking uncontrolled subdirs dirs.remove(cls.dirname) entries_fn = os.path.join(base, cls.dirname, "entries") if not os.path.exists(entries_fn): # FIXME: should we warn? continue dirurl, localrev = cls._get_svn_url_rev(base) if base == location: assert dirurl is not None base = dirurl + "/" # save the root url elif not dirurl or not dirurl.startswith(base): dirs[:] = [] continue # not part of the same svn tree, skip it revision = max(revision, localrev) return str(revision) @classmethod def get_netloc_and_auth( cls, netloc: str, scheme: str ) -> tuple[str, tuple[str | None, str | None]]: """ This override allows the auth information to be passed to svn via the --username and --password options instead of via the URL. """ if scheme == "ssh": # The --username and --password options can't be used for # svn+ssh URLs, so keep the auth information in the URL. return super().get_netloc_and_auth(netloc, scheme) return split_auth_from_netloc(netloc) @classmethod def get_url_rev_and_auth(cls, url: str) -> tuple[str, str | None, AuthInfo]: # hotfix the URL scheme after removing svn+ from svn+ssh:// re-add it url, rev, user_pass = super().get_url_rev_and_auth(url) if url.startswith("ssh://"): url = "svn+" + url return url, rev, user_pass @staticmethod def make_rev_args(username: str | None, password: HiddenText | None) -> CommandArgs: extra_args: CommandArgs = [] if username: extra_args += ["--username", username] if password: extra_args += ["--password", password] return extra_args @classmethod def get_remote_url(cls, location: str) -> str: # In cases where the source is in a subdirectory, we have to look up in # the location until we find a valid project root. orig_location = location while not is_installable_dir(location): last_location = location location = os.path.dirname(location) if location == last_location: # We've traversed up to the root of the filesystem without # finding a Python project. logger.warning( "Could not find Python project for directory %s (tried all " "parent directories)", orig_location, ) raise RemoteNotFoundError url, _rev = cls._get_svn_url_rev(location) if url is None: raise RemoteNotFoundError return url @classmethod def _get_svn_url_rev(cls, location: str) -> tuple[str | None, int]: from pip._internal.exceptions import InstallationError entries_path = os.path.join(location, cls.dirname, "entries") if os.path.exists(entries_path): with open(entries_path) as f: data = f.read() else: # subversion >= 1.7 does not have the 'entries' file data = "" url = None if data.startswith(("8", "9", "10")): entries = list(map(str.splitlines, data.split("\n\x0c\n"))) del entries[0][0] # get rid of the '8' url = entries[0][3] revs = [int(d[9]) for d in entries if len(d) > 9 and d[9]] + [0] elif data.startswith("= 1.7 # Note that using get_remote_call_options is not necessary here # because `svn info` is being run against a local directory. # We don't need to worry about making sure interactive mode # is being used to prompt for passwords, because passwords # are only potentially needed for remote server requests. xml = cls.run_command( ["info", "--xml", location], show_stdout=False, stdout_only=True, ) match = _svn_info_xml_url_re.search(xml) assert match is not None url = match.group(1) revs = [int(m.group(1)) for m in _svn_info_xml_rev_re.finditer(xml)] except InstallationError: url, revs = None, [] if revs: rev = max(revs) else: rev = 0 return url, rev @classmethod def is_commit_id_equal(cls, dest: str, name: str | None) -> bool: """Always assume the versions don't match""" return False def __init__(self, use_interactive: bool | None = None) -> None: if use_interactive is None: use_interactive = is_console_interactive() self.use_interactive = use_interactive # This member is used to cache the fetched version of the current # ``svn`` client. # Special value definitions: # None: Not evaluated yet. # Empty tuple: Could not parse version. self._vcs_version: tuple[int, ...] | None = None super().__init__() def call_vcs_version(self) -> tuple[int, ...]: """Query the version of the currently installed Subversion client. :return: A tuple containing the parts of the version information or ``()`` if the version returned from ``svn`` could not be parsed. :raises: BadCommand: If ``svn`` is not installed. """ # Example versions: # svn, version 1.10.3 (r1842928) # compiled Feb 25 2019, 14:20:39 on x86_64-apple-darwin17.0.0 # svn, version 1.7.14 (r1542130) # compiled Mar 28 2018, 08:49:13 on x86_64-pc-linux-gnu # svn, version 1.12.0-SlikSvn (SlikSvn/1.12.0) # compiled May 28 2019, 13:44:56 on x86_64-microsoft-windows6.2 version_prefix = "svn, version " version = self.run_command(["--version"], show_stdout=False, stdout_only=True) if not version.startswith(version_prefix): return () version = version[len(version_prefix) :].split()[0] version_list = version.partition("-")[0].split(".") try: parsed_version = tuple(map(int, version_list)) except ValueError: return () return parsed_version def get_vcs_version(self) -> tuple[int, ...]: """Return the version of the currently installed Subversion client. If the version of the Subversion client has already been queried, a cached value will be used. :return: A tuple containing the parts of the version information or ``()`` if the version returned from ``svn`` could not be parsed. :raises: BadCommand: If ``svn`` is not installed. """ if self._vcs_version is not None: # Use cached version, if available. # If parsing the version failed previously (empty tuple), # do not attempt to parse it again. return self._vcs_version vcs_version = self.call_vcs_version() self._vcs_version = vcs_version return vcs_version def get_remote_call_options(self) -> CommandArgs: """Return options to be used on calls to Subversion that contact the server. These options are applicable for the following ``svn`` subcommands used in this class. - checkout - switch - update :return: A list of command line arguments to pass to ``svn``. """ if not self.use_interactive: # --non-interactive switch is available since Subversion 0.14.4. # Subversion < 1.8 runs in interactive mode by default. return ["--non-interactive"] svn_version = self.get_vcs_version() # By default, Subversion >= 1.8 runs in non-interactive mode if # stdin is not a TTY. Since that is how pip invokes SVN, in # call_subprocess(), pip must pass --force-interactive to ensure # the user can be prompted for a password, if required. # SVN added the --force-interactive option in SVN 1.8. Since # e.g. RHEL/CentOS 7, which is supported until 2024, ships with # SVN 1.7, pip should continue to support SVN 1.7. Therefore, pip # can't safely add the option if the SVN version is < 1.8 (or unknown). if svn_version >= (1, 8): return ["--force-interactive"] return [] def fetch_new( self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int ) -> None: rev_display = rev_options.to_display() logger.info( "Checking out %s%s to %s", url, rev_display, display_path(dest), ) if verbosity <= 0: flags = ["--quiet"] else: flags = [] cmd_args = make_command( "checkout", *flags, self.get_remote_call_options(), rev_options.to_args(), url, dest, ) self.run_command(cmd_args) def switch( self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int = 0, ) -> None: cmd_args = make_command( "switch", self.get_remote_call_options(), rev_options.to_args(), url, dest, ) self.run_command(cmd_args) def update( self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int = 0, ) -> None: cmd_args = make_command( "update", self.get_remote_call_options(), rev_options.to_args(), dest, ) self.run_command(cmd_args) vcs.register(Subversion) ================================================ FILE: src/pip/_internal/vcs/versioncontrol.py ================================================ """Handles all VCS (version control) support""" from __future__ import annotations import logging import os import shutil import sys import urllib.parse from collections.abc import Iterable, Iterator, Mapping from dataclasses import dataclass, field from typing import ( Any, Literal, Optional, ) from pip._internal.cli.spinners import SpinnerInterface from pip._internal.exceptions import BadCommand, InstallationError from pip._internal.utils.misc import ( HiddenText, ask_path_exists, backup_dir, display_path, hide_url, hide_value, is_installable_dir, rmtree, ) from pip._internal.utils.subprocess import ( CommandArgs, call_subprocess, format_command_args, make_command, ) __all__ = ["vcs"] logger = logging.getLogger(__name__) AuthInfo = tuple[Optional[str], Optional[str]] def is_url(name: str) -> bool: """ Return true if the name looks like a URL. """ scheme = urllib.parse.urlsplit(name).scheme if not scheme: return False return scheme in ["http", "https", "file", "ftp"] + vcs.all_schemes def make_vcs_requirement_url( repo_url: str, rev: str, project_name: str, subdir: str | None = None ) -> str: """ Return the URL for a VCS requirement. Args: repo_url: the remote VCS url, with any needed VCS prefix (e.g. "git+"). project_name: the (unescaped) project name. """ quoted_rev = urllib.parse.quote(rev, "/") egg_project_name = project_name.replace("-", "_") req = f"{repo_url}@{quoted_rev}#egg={egg_project_name}" if subdir: req += f"&subdirectory={subdir}" return req def find_path_to_project_root_from_repo_root( location: str, repo_root: str ) -> str | None: """ Find the the Python project's root by searching up the filesystem from `location`. Return the path to project root relative to `repo_root`. Return None if the project root is `repo_root`, or cannot be found. """ # find project root. orig_location = location while not is_installable_dir(location): last_location = location location = os.path.dirname(location) if location == last_location: # We've traversed up to the root of the filesystem without # finding a Python project. logger.warning( "Could not find a Python project for directory %s (tried all " "parent directories)", orig_location, ) return None if os.path.samefile(repo_root, location): return None return os.path.relpath(location, repo_root) class RemoteNotFoundError(Exception): pass class RemoteNotValidError(Exception): def __init__(self, url: str): super().__init__(url) self.url = url @dataclass(frozen=True) class RevOptions: """ Encapsulates a VCS-specific revision to install, along with any VCS install options. Args: vc_class: a VersionControl subclass. rev: the name of the revision to install. extra_args: a list of extra options. """ vc_class: type[VersionControl] rev: str | None = None extra_args: CommandArgs = field(default_factory=list) branch_name: str | None = None def __repr__(self) -> str: return f"" @property def arg_rev(self) -> str | None: if self.rev is None: return self.vc_class.default_arg_rev return self.rev def to_args(self) -> CommandArgs: """ Return the VCS-specific command arguments. """ args: CommandArgs = [] rev = self.arg_rev if rev is not None: args += self.vc_class.get_base_rev_args(rev) args += self.extra_args return args def to_display(self) -> str: if not self.rev: return "" return f" (to revision {self.rev})" def make_new(self, rev: str) -> RevOptions: """ Make a copy of the current instance, but with a new rev. Args: rev: the name of the revision for the new object. """ return self.vc_class.make_rev_options(rev, extra_args=self.extra_args) class VcsSupport: _registry: dict[str, VersionControl] = {} schemes = ["ssh", "git", "hg", "bzr", "sftp", "svn"] def __init__(self) -> None: # Register more schemes with urlparse for various version control # systems urllib.parse.uses_netloc.extend(self.schemes) super().__init__() def __iter__(self) -> Iterator[str]: return self._registry.__iter__() @property def backends(self) -> list[VersionControl]: return list(self._registry.values()) @property def dirnames(self) -> list[str]: return [backend.dirname for backend in self.backends] @property def all_schemes(self) -> list[str]: schemes: list[str] = [] for backend in self.backends: schemes.extend(backend.schemes) return schemes def register(self, cls: type[VersionControl]) -> None: if not hasattr(cls, "name"): logger.warning("Cannot register VCS %s", cls.__name__) return if cls.name not in self._registry: self._registry[cls.name] = cls() logger.debug("Registered VCS backend: %s", cls.name) def unregister(self, name: str) -> None: if name in self._registry: del self._registry[name] def get_backend_for_dir(self, location: str) -> VersionControl | None: """ Return a VersionControl object if a repository of that type is found at the given directory. """ vcs_backends = {} for vcs_backend in self._registry.values(): repo_path = vcs_backend.get_repository_root(location) if not repo_path: continue logger.debug("Determine that %s uses VCS: %s", location, vcs_backend.name) vcs_backends[repo_path] = vcs_backend if not vcs_backends: return None # Choose the VCS in the inner-most directory. Since all repository # roots found here would be either `location` or one of its # parents, the longest path should have the most path components, # i.e. the backend representing the inner-most repository. inner_most_repo_path = max(vcs_backends, key=len) return vcs_backends[inner_most_repo_path] def get_backend_for_scheme(self, scheme: str) -> VersionControl | None: """ Return a VersionControl object or None. """ for vcs_backend in self._registry.values(): if scheme in vcs_backend.schemes: return vcs_backend return None def get_backend(self, name: str) -> VersionControl | None: """ Return a VersionControl object or None. """ name = name.lower() return self._registry.get(name) vcs = VcsSupport() class VersionControl: name = "" dirname = "" repo_name = "" # List of supported schemes for this Version Control schemes: tuple[str, ...] = () # Iterable of environment variable names to pass to call_subprocess(). unset_environ: tuple[str, ...] = () default_arg_rev: str | None = None @classmethod def should_add_vcs_url_prefix(cls, remote_url: str) -> bool: """ Return whether the vcs prefix (e.g. "git+") should be added to a repository's remote url when used in a requirement. """ return not remote_url.lower().startswith(f"{cls.name}:") @classmethod def get_subdirectory(cls, location: str) -> str | None: """ Return the path to Python project root, relative to the repo root. Return None if the project root is in the repo root. """ return None @classmethod def get_requirement_revision(cls, repo_dir: str) -> str: """ Return the revision string that should be used in a requirement. """ return cls.get_revision(repo_dir) @classmethod def get_src_requirement(cls, repo_dir: str, project_name: str) -> str: """ Return the requirement string to use to redownload the files currently at the given repository directory. Args: project_name: the (unescaped) project name. The return value has a form similar to the following: {repository_url}@{revision}#egg={project_name} """ repo_url = cls.get_remote_url(repo_dir) if cls.should_add_vcs_url_prefix(repo_url): repo_url = f"{cls.name}+{repo_url}" revision = cls.get_requirement_revision(repo_dir) subdir = cls.get_subdirectory(repo_dir) req = make_vcs_requirement_url(repo_url, revision, project_name, subdir=subdir) return req @staticmethod def get_base_rev_args(rev: str) -> list[str]: """ Return the base revision arguments for a vcs command. Args: rev: the name of a revision to install. Cannot be None. """ raise NotImplementedError def is_immutable_rev_checkout(self, url: str, dest: str) -> bool: """ Return true if the commit hash checked out at dest matches the revision in url. Always return False, if the VCS does not support immutable commit hashes. This method does not check if there are local uncommitted changes in dest after checkout, as pip currently has no use case for that. """ return False @classmethod def make_rev_options( cls, rev: str | None = None, extra_args: CommandArgs | None = None ) -> RevOptions: """ Return a RevOptions object. Args: rev: the name of a revision to install. extra_args: a list of extra options. """ return RevOptions(cls, rev, extra_args=extra_args or []) @classmethod def _is_local_repository(cls, repo: str) -> bool: """ posix absolute paths start with os.path.sep, win32 ones start with drive (like c:\\folder) """ drive, tail = os.path.splitdrive(repo) return repo.startswith(os.path.sep) or bool(drive) @classmethod def get_netloc_and_auth( cls, netloc: str, scheme: str ) -> tuple[str, tuple[str | None, str | None]]: """ Parse the repository URL's netloc, and return the new netloc to use along with auth information. Args: netloc: the original repository URL netloc. scheme: the repository URL's scheme without the vcs prefix. This is mainly for the Subversion class to override, so that auth information can be provided via the --username and --password options instead of through the URL. For other subclasses like Git without such an option, auth information must stay in the URL. Returns: (netloc, (username, password)). """ return netloc, (None, None) @classmethod def get_url_rev_and_auth(cls, url: str) -> tuple[str, str | None, AuthInfo]: """ Parse the repository URL to use, and return the URL, revision, and auth info to use. Returns: (url, rev, (username, password)). """ scheme, netloc, path, query, frag = urllib.parse.urlsplit(url) if "+" not in scheme: raise ValueError( f"Sorry, {url!r} is a malformed VCS url. " "The format is +://, " "e.g. svn+http://myrepo/svn/MyApp#egg=MyApp" ) # Remove the vcs prefix. scheme = scheme.split("+", 1)[1] netloc, user_pass = cls.get_netloc_and_auth(netloc, scheme) rev = None if "@" in path: path, rev = path.rsplit("@", 1) if not rev: raise InstallationError( f"The URL {url!r} has an empty revision (after @) " "which is not supported. Include a revision after @ " "or remove @ from the URL." ) rev = urllib.parse.unquote(rev) url = urllib.parse.urlunsplit((scheme, netloc, path, query, "")) return url, rev, user_pass @staticmethod def make_rev_args(username: str | None, password: HiddenText | None) -> CommandArgs: """ Return the RevOptions "extra arguments" to use in obtain(). """ return [] def get_url_rev_options(self, url: HiddenText) -> tuple[HiddenText, RevOptions]: """ Return the URL and RevOptions object to use in obtain(), as a tuple (url, rev_options). """ secret_url, rev, user_pass = self.get_url_rev_and_auth(url.secret) username, secret_password = user_pass password: HiddenText | None = None if secret_password is not None: password = hide_value(secret_password) extra_args = self.make_rev_args(username, password) rev_options = self.make_rev_options(rev, extra_args=extra_args) return hide_url(secret_url), rev_options @staticmethod def normalize_url(url: str) -> str: """ Normalize a URL for comparison by unquoting it and removing any trailing slash. """ return urllib.parse.unquote(url).rstrip("/") @classmethod def compare_urls(cls, url1: str, url2: str) -> bool: """ Compare two repo URLs for identity, ignoring incidental differences. """ return cls.normalize_url(url1) == cls.normalize_url(url2) def fetch_new( self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int ) -> None: """ Fetch a revision from a repository, in the case that this is the first fetch from the repository. Args: dest: the directory to fetch the repository to. rev_options: a RevOptions object. verbosity: verbosity level. """ raise NotImplementedError def switch( self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int = 0, ) -> None: """ Switch the repo at ``dest`` to point to ``URL``. Args: rev_options: a RevOptions object. """ raise NotImplementedError def update( self, dest: str, url: HiddenText, rev_options: RevOptions, verbosity: int = 0, ) -> None: """ Update an already-existing repo to the given ``rev_options``. Args: rev_options: a RevOptions object. """ raise NotImplementedError @classmethod def is_commit_id_equal(cls, dest: str, name: str | None) -> bool: """ Return whether the id of the current commit equals the given name. Args: dest: the repository directory. name: a string name. """ raise NotImplementedError def obtain(self, dest: str, url: HiddenText, verbosity: int) -> None: """ Install or update in editable mode the package represented by this VersionControl object. :param dest: the repository directory in which to install or update. :param url: the repository URL starting with a vcs prefix. :param verbosity: verbosity level. """ url, rev_options = self.get_url_rev_options(url) if not os.path.exists(dest): self.fetch_new(dest, url, rev_options, verbosity=verbosity) return rev_display = rev_options.to_display() if self.is_repository_directory(dest): existing_url = self.get_remote_url(dest) if self.compare_urls(existing_url, url.secret): logger.debug( "%s in %s exists, and has correct URL (%s)", self.repo_name.title(), display_path(dest), url, ) if not self.is_commit_id_equal(dest, rev_options.rev): logger.info( "Updating %s %s%s", display_path(dest), self.repo_name, rev_display, ) self.update(dest, url, rev_options, verbosity=verbosity) else: logger.info("Skipping because already up-to-date.") return logger.warning( "%s %s in %s exists with URL %s", self.name, self.repo_name, display_path(dest), existing_url, ) prompt = ("(s)witch, (i)gnore, (w)ipe, (b)ackup ", ("s", "i", "w", "b")) else: logger.warning( "Directory %s already exists, and is not a %s %s.", dest, self.name, self.repo_name, ) # https://github.com/python/mypy/issues/1174 prompt = ("(i)gnore, (w)ipe, (b)ackup ", ("i", "w", "b")) # type: ignore logger.warning( "The plan is to install the %s repository %s", self.name, url, ) response = ask_path_exists(f"What to do? {prompt[0]}", prompt[1]) if response == "a": sys.exit(-1) if response == "w": logger.warning("Deleting %s", display_path(dest)) rmtree(dest) self.fetch_new(dest, url, rev_options, verbosity=verbosity) return if response == "b": dest_dir = backup_dir(dest) logger.warning("Backing up %s to %s", display_path(dest), dest_dir) shutil.move(dest, dest_dir) self.fetch_new(dest, url, rev_options, verbosity=verbosity) return # Do nothing if the response is "i". if response == "s": logger.info( "Switching %s %s to %s%s", self.repo_name, display_path(dest), url, rev_display, ) self.switch(dest, url, rev_options, verbosity=verbosity) def unpack(self, location: str, url: HiddenText, verbosity: int) -> None: """ Clean up current location and download the url repository (and vcs infos) into location :param url: the repository URL starting with a vcs prefix. :param verbosity: verbosity level. """ if os.path.exists(location): rmtree(location) self.obtain(location, url=url, verbosity=verbosity) @classmethod def get_remote_url(cls, location: str) -> str: """ Return the url used at location Raises RemoteNotFoundError if the repository does not have a remote url configured. """ raise NotImplementedError @classmethod def get_revision(cls, location: str) -> str: """ Return the current commit id of the files at the given location. """ raise NotImplementedError @classmethod def run_command( cls, cmd: list[str] | CommandArgs, show_stdout: bool = True, cwd: str | None = None, on_returncode: Literal["raise", "warn", "ignore"] = "raise", extra_ok_returncodes: Iterable[int] | None = None, command_desc: str | None = None, extra_environ: Mapping[str, Any] | None = None, spinner: SpinnerInterface | None = None, log_failed_cmd: bool = True, stdout_only: bool = False, ) -> str: """ Run a VCS subcommand This is simply a wrapper around call_subprocess that adds the VCS command name, and checks that the VCS is available """ cmd = make_command(cls.name, *cmd) if command_desc is None: command_desc = format_command_args(cmd) try: return call_subprocess( cmd, show_stdout, cwd, on_returncode=on_returncode, extra_ok_returncodes=extra_ok_returncodes, command_desc=command_desc, extra_environ=extra_environ, unset_environ=cls.unset_environ, spinner=spinner, log_failed_cmd=log_failed_cmd, stdout_only=stdout_only, ) except NotADirectoryError: raise BadCommand(f"Cannot find command {cls.name!r} - invalid PATH") except FileNotFoundError: # errno.ENOENT = no such file or directory # In other words, the VCS executable isn't available raise BadCommand( f"Cannot find command {cls.name!r} - do you have " f"{cls.name!r} installed and in your PATH?" ) except PermissionError: # errno.EACCES = Permission denied # This error occurs, for instance, when the command is installed # only for another user. So, the current user don't have # permission to call the other user command. raise BadCommand( f"No permission to execute {cls.name!r} - install it " f"locally, globally (ask admin), or check your PATH. " f"See possible solutions at " f"https://pip.pypa.io/en/latest/reference/pip_freeze/" f"#fixing-permission-denied." ) @classmethod def is_repository_directory(cls, path: str) -> bool: """ Return whether a directory path is a repository directory. """ logger.debug("Checking in %s for %s (%s)...", path, cls.dirname, cls.name) return os.path.exists(os.path.join(path, cls.dirname)) @classmethod def get_repository_root(cls, location: str) -> str | None: """ Return the "root" (top-level) directory controlled by the vcs, or `None` if the directory is not in any. It is meant to be overridden to implement smarter detection mechanisms for specific vcs. This can do more than is_repository_directory() alone. For example, the Git override checks that Git is actually available. """ if cls.is_repository_directory(location): return location return None ================================================ FILE: src/pip/_internal/wheel_builder.py ================================================ """Orchestrator for building wheels from InstallRequirements.""" from __future__ import annotations import logging import os.path import re from collections.abc import Iterable from tempfile import TemporaryDirectory from pip._vendor.packaging.utils import canonicalize_name, canonicalize_version from pip._vendor.packaging.version import InvalidVersion, Version from pip._internal.cache import WheelCache from pip._internal.exceptions import InvalidWheelFilename, UnsupportedWheel from pip._internal.metadata import FilesystemWheel, get_wheel_distribution from pip._internal.models.link import Link from pip._internal.models.wheel import Wheel from pip._internal.operations.build.wheel import build_wheel_pep517 from pip._internal.operations.build.wheel_editable import build_wheel_editable from pip._internal.req.req_install import InstallRequirement from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import ensure_dir, hash_file from pip._internal.utils.urls import path_to_url from pip._internal.vcs import vcs logger = logging.getLogger(__name__) _egg_info_re = re.compile(r"([a-z0-9_.]+)-([a-z0-9_.!+-]+)", re.IGNORECASE) BuildResult = tuple[list[InstallRequirement], list[InstallRequirement]] def _contains_egg_info(s: str) -> bool: """Determine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1 """ return bool(_egg_info_re.search(s)) def _should_cache( req: InstallRequirement, ) -> bool | None: """ Return whether a built InstallRequirement can be stored in the persistent wheel cache, assuming the wheel cache is available. """ if req.editable or not req.source_dir: # never cache editable requirements return False if req.link and req.link.is_vcs: # VCS checkout. Do not cache # unless it points to an immutable commit hash. assert not req.editable assert req.source_dir vcs_backend = vcs.get_backend_for_scheme(req.link.scheme) assert vcs_backend if vcs_backend.is_immutable_rev_checkout(req.link.url, req.source_dir): return True return False assert req.link base, ext = req.link.splitext() if _contains_egg_info(base): return True # Otherwise, do not cache. return False def _get_cache_dir( req: InstallRequirement, wheel_cache: WheelCache, ) -> str: """Return the persistent or temporary cache directory where the built wheel need to be stored. """ cache_available = bool(wheel_cache.cache_dir) assert req.link if cache_available and _should_cache(req): cache_dir = wheel_cache.get_path_for_link(req.link) else: cache_dir = wheel_cache.get_ephem_path_for_link(req.link) return cache_dir def _verify_one(req: InstallRequirement, wheel_path: str) -> None: canonical_name = canonicalize_name(req.name or "") w = Wheel(os.path.basename(wheel_path)) if w.name != canonical_name: raise InvalidWheelFilename( f"Wheel has unexpected file name: expected {canonical_name!r}, " f"got {w.name!r}", ) dist = get_wheel_distribution(FilesystemWheel(wheel_path), canonical_name) dist_verstr = str(dist.version) if canonicalize_version(dist_verstr) != canonicalize_version(w.version): raise InvalidWheelFilename( f"Wheel has unexpected file name: expected {dist_verstr!r}, " f"got {w.version!r}", ) metadata_version_value = dist.metadata_version if metadata_version_value is None: raise UnsupportedWheel("Missing Metadata-Version") try: metadata_version = Version(metadata_version_value) except InvalidVersion: msg = f"Invalid Metadata-Version: {metadata_version_value}" raise UnsupportedWheel(msg) if metadata_version >= Version("1.2") and not isinstance(dist.version, Version): raise UnsupportedWheel( f"Metadata 1.2 mandates PEP 440 version, but {dist_verstr!r} is not" ) def _build_one( req: InstallRequirement, output_dir: str, verify: bool, editable: bool, ) -> str | None: """Build one wheel. :return: The filename of the built wheel, or None if the build failed. """ artifact = "editable" if editable else "wheel" try: ensure_dir(output_dir) except OSError as e: logger.warning( "Building %s for %s failed: %s", artifact, req.name, e, ) return None # Install build deps into temporary directory (PEP 518) with req.build_env: wheel_path = _build_one_inside_env(req, output_dir, editable) if wheel_path and verify: try: _verify_one(req, wheel_path) except (InvalidWheelFilename, UnsupportedWheel) as e: logger.warning("Built %s for %s is invalid: %s", artifact, req.name, e) return None return wheel_path def _build_one_inside_env( req: InstallRequirement, output_dir: str, editable: bool, ) -> str | None: with TemporaryDirectory(dir=output_dir) as wheel_directory: assert req.name assert req.metadata_directory assert req.pep517_backend if editable: wheel_path = build_wheel_editable( name=req.name, backend=req.pep517_backend, metadata_directory=req.metadata_directory, wheel_directory=wheel_directory, ) else: wheel_path = build_wheel_pep517( name=req.name, backend=req.pep517_backend, metadata_directory=req.metadata_directory, wheel_directory=wheel_directory, ) if wheel_path is not None: wheel_name = os.path.basename(wheel_path) dest_path = os.path.join(output_dir, wheel_name) try: wheel_hash, length = hash_file(wheel_path) # We can do a replace here because wheel_path is guaranteed to # be in the same filesystem as output_dir. This will perform an # atomic rename, which is necessary to avoid concurrency issues # when populating the cache. os.replace(wheel_path, dest_path) logger.info( "Created wheel for %s: filename=%s size=%d sha256=%s", req.name, wheel_name, length, wheel_hash.hexdigest(), ) logger.info("Stored in directory: %s", output_dir) return dest_path except Exception as e: logger.warning( "Building wheel for %s failed: %s", req.name, e, ) return None def build( requirements: Iterable[InstallRequirement], wheel_cache: WheelCache, verify: bool, ) -> BuildResult: """Build wheels. :return: The list of InstallRequirement that succeeded to build and the list of InstallRequirement that failed to build. """ if not requirements: return [], [] # Build the wheels. logger.info( "Building wheels for collected packages: %s", ", ".join(req.name for req in requirements), # type: ignore ) with indent_log(): build_successes, build_failures = [], [] for req in requirements: assert req.name cache_dir = _get_cache_dir(req, wheel_cache) wheel_file = _build_one( req, cache_dir, verify, req.editable and req.permit_editable_wheels, ) if wheel_file: # Record the download origin in the cache if req.download_info is not None: # download_info is guaranteed to be set because when we build an # InstallRequirement it has been through the preparer before, but # let's be cautious. wheel_cache.record_download_origin(cache_dir, req.download_info) # Update the link for this. req.link = Link(path_to_url(wheel_file)) req.local_file_path = req.link.file_path assert req.link.is_wheel build_successes.append(req) else: build_failures.append(req) # notify success/failure if build_successes: logger.info( "Successfully built %s", " ".join([req.name for req in build_successes]), # type: ignore ) if build_failures: logger.info( "Failed to build %s", " ".join([req.name for req in build_failures]), # type: ignore ) # Return a list of requirements that failed to build return build_successes, build_failures ================================================ FILE: src/pip/_vendor/README.rst ================================================ ================ Vendoring Policy ================ * Vendored libraries **MUST** not be modified except as required to successfully vendor them. * Vendored libraries **MUST** be released copies of libraries available on PyPI. * Vendored libraries **MUST** be available under a license that allows them to be integrated into ``pip``, which is released under the MIT license. * Vendored libraries **MUST** be accompanied with LICENSE files. * The versions of libraries vendored in pip **MUST** be reflected in ``pip/_vendor/vendor.txt``. * Vendored libraries **MUST** function without any build steps such as ``2to3`` or compilation of C code, practically this limits to single source 2.x/3.x and pure Python. * Any modifications made to libraries **MUST** be noted in ``pip/_vendor/README.rst`` and their corresponding patches **MUST** be included ``tools/vendoring/patches``. * Vendored libraries should have corresponding ``vendored()`` entries in ``pip/_vendor/__init__.py``. Rationale ========= Historically pip has not had any dependencies except for ``setuptools`` itself, choosing instead to implement any functionality it needed to prevent needing a dependency. However, starting with pip 1.5, we began to replace code that was implemented inside of pip with reusable libraries from PyPI. This brought the typical benefits of reusing libraries instead of reinventing the wheel like higher quality and more battle tested code, centralization of bug fixes (particularly security sensitive ones), and better/more features for less work. However, there are several issues with having dependencies in the traditional way (via ``install_requires``) for pip. These issues are: **Fragility** When pip depends on another library to function then if for whatever reason that library either isn't installed or an incompatible version is installed then pip ceases to function. This is of course true for all Python applications, however for every application *except* for pip the way you fix it is by re-running pip. Obviously, when pip can't run, you can't use pip to fix pip, so you're left having to manually resolve dependencies and installing them by hand. **Making other libraries uninstallable** One of pip's current dependencies is the ``requests`` library, for which pip requires a fairly recent version to run. If pip depended on ``requests`` in the traditional manner, then we'd either have to maintain compatibility with every ``requests`` version that has ever existed (and ever will), OR allow pip to render certain versions of ``requests`` uninstallable. (The second issue, although technically true for any Python application, is magnified by pip's ubiquity; pip is installed by default in Python, in ``pyvenv``, and in ``virtualenv``.) **Security** This might seem puzzling at first glance, since vendoring has a tendency to complicate updating dependencies for security updates, and that holds true for pip. However, given the *other* reasons for avoiding dependencies, the alternative is for pip to reinvent the wheel itself. This is what pip did historically. It forced pip to re-implement its own HTTPS verification routines as a workaround for the Python standard library's lack of SSL validation, which resulted in similar bugs in the validation routine in ``requests`` and ``urllib3``, except that they had to be discovered and fixed independently. Even though we're vendoring, reusing libraries keeps pip more secure by relying on the great work of our dependencies, *and* allowing for faster, easier security fixes by simply pulling in newer versions of dependencies. **Bootstrapping** Currently most popular methods of installing pip rely on pip's self-contained nature to install pip itself. These tools work by bundling a copy of pip, adding it to ``sys.path``, and then executing that copy of pip. This is done instead of implementing a "mini installer" (to reduce duplication); pip already knows how to install a Python package, and is far more battle-tested than any "mini installer" could ever possibly be. Many downstream redistributors have policies against this kind of bundling, and instead opt to patch the software they distribute to debundle it and make it rely on the global versions of the software that they already have packaged (which may have its own patches applied to it). We (the pip team) would prefer it if pip was *not* debundled in this manner due to the above reasons and instead we would prefer it if pip would be left intact as it is now. In the longer term, if someone has a *portable* solution to the above problems, other than the bundling method we currently use, that doesn't add additional problems that are unreasonable then we would be happy to consider, and possibly switch to said method. This solution must function correctly across all of the situation that we expect pip to be used and not mandate some external mechanism such as OS packages. Modifications ============= * ``setuptools`` is completely stripped to only keep ``pkg_resources``. * ``pkg_resources`` has been modified to import its dependencies from ``pip._vendor``, and to use the vendored copy of ``platformdirs`` rather than ``appdirs``. * ``packaging`` has been modified to import its dependencies from ``pip._vendor``. * ``CacheControl`` has been modified to import its dependencies from ``pip._vendor``. * ``requests`` has been modified to import its other dependencies from ``pip._vendor`` and to *not* load ``simplejson`` (all platforms) and ``pyopenssl`` (Windows). * ``platformdirs`` has been modified to import its submodules from ``pip._vendor.platformdirs``. Automatic Vendoring =================== Vendoring is automated via the `vendoring `_ tool from the content of ``pip/_vendor/vendor.txt`` and the different patches in ``tools/vendoring/patches``. Launch it via ``vendoring sync . -v`` (requires ``vendoring>=0.2.2``). Tool configuration is done via ``pyproject.toml``. To update the vendored library versions, we have a session defined in ``nox``. The command to upgrade everything is:: nox -s vendoring -- --upgrade-all --skip urllib3 --skip setuptools At the time of writing (April 2025) we do not upgrade ``urllib3`` because the next version is a major upgrade and will be handled as an independent PR. We also do not upgrade ``setuptools``, because we only rely on ``pkg_resources``, and tracking every ``setuptools`` change is unnecessary for our needs. Managing Local Patches ====================== The ``vendoring`` tool automatically applies our local patches, but updating, the patches sometimes no longer apply cleanly. In that case, the update will fail. To resolve this, take the following steps: 1. Revert any incomplete changes in the revendoring branch, to ensure you have a clean starting point. 2. Run the revendoring of the library with a problem again: ``nox -s vendoring -- --upgrade ``. 3. This will fail again, but you will have the original source in your working directory. Review the existing patch against the source, and modify the patch to reflect the new version of the source. If you ``git add`` the changes the vendoring made, you can modify the source to reflect the patch file and then generate a new patch with ``git diff``. 4. Now, revert everything *except* the patch file changes. Leave the modified patch file unstaged but saved in the working tree. 5. Re-run the vendoring. This time, it should pick up the changed patch file and apply it cleanly. The patch file changes will be committed along with the revendoring, so the new commit should be ready to test and publish as a PR. Debundling ========== As mentioned in the rationale, we, the pip team, would prefer it if pip was not debundled (other than optionally ``pip/_vendor/requests/cacert.pem``) and that pip was left intact. However, if you insist on doing so, we have a semi-supported method (that we don't test in our CI) and requires a bit of extra work on your end in order to solve the problems described above. 1. Delete everything in ``pip/_vendor/`` **except** for ``pip/_vendor/__init__.py`` and ``pip/_vendor/vendor.txt``. 2. Generate wheels for each of pip's dependencies (and any of their dependencies) using your patched copies of these libraries. These must be placed somewhere on the filesystem that pip can access (``pip/_vendor`` is the default assumption). 3. Modify ``pip/_vendor/__init__.py`` so that the ``DEBUNDLED`` variable is ``True``. 4. Upon installation, the ``INSTALLER`` file in pip's own ``dist-info`` directory should be set to something other than ``pip``, so that pip can detect that it wasn't installed using itself. 5. *(optional)* If you've placed the wheels in a location other than ``pip/_vendor/``, then modify ``pip/_vendor/__init__.py`` so that the ``WHEEL_DIR`` variable points to the location you've placed them. 6. *(optional)* Update the ``pip_self_version_check`` logic to use the appropriate logic for determining the latest available version of pip and prompt the user with the correct upgrade message. Note that partial debundling is **NOT** supported. You need to prepare wheels for all dependencies for successful debundling. ================================================ FILE: src/pip/_vendor/__init__.py ================================================ """ pip._vendor is for vendoring dependencies of pip to prevent needing pip to depend on something external. Files inside of pip._vendor should be considered immutable and should only be updated to versions from upstream. """ from __future__ import absolute_import import glob import os.path import sys # Downstream redistributors which have debundled our dependencies should also # patch this value to be true. This will trigger the additional patching # to cause things like "six" to be available as pip. DEBUNDLED = False # By default, look in this directory for a bunch of .whl files which we will # add to the beginning of sys.path before attempting to import anything. This # is done to support downstream re-distributors like Debian and Fedora who # wish to create their own Wheels for our dependencies to aid in debundling. WHEEL_DIR = os.path.abspath(os.path.dirname(__file__)) # Define a small helper function to alias our vendored modules to the real ones # if the vendored ones do not exist. This idea of this was taken from # https://github.com/kennethreitz/requests/pull/2567. def vendored(modulename): vendored_name = "{0}.{1}".format(__name__, modulename) try: __import__(modulename, globals(), locals(), level=0) except ImportError: # We can just silently allow import failures to pass here. If we # got to this point it means that ``import pip._vendor.whatever`` # failed and so did ``import whatever``. Since we're importing this # upfront in an attempt to alias imports, not erroring here will # just mean we get a regular import error whenever pip *actually* # tries to import one of these modules to use it, which actually # gives us a better error message than we would have otherwise # gotten. pass else: sys.modules[vendored_name] = sys.modules[modulename] base, head = vendored_name.rsplit(".", 1) setattr(sys.modules[base], head, sys.modules[modulename]) # If we're operating in a debundled setup, then we want to go ahead and trigger # the aliasing of our vendored libraries as well as looking for wheels to add # to our sys.path. This will cause all of this code to be a no-op typically # however downstream redistributors can enable it in a consistent way across # all platforms. if DEBUNDLED: # Actually look inside of WHEEL_DIR to find .whl files and add them to the # front of our sys.path. sys.path[:] = glob.glob(os.path.join(WHEEL_DIR, "*.whl")) + sys.path # Actually alias all of our vendored dependencies. vendored("cachecontrol") vendored("certifi") vendored("dependency-groups") vendored("distlib") vendored("distro") vendored("packaging") vendored("packaging.version") vendored("packaging.specifiers") vendored("pkg_resources") vendored("platformdirs") vendored("progress") vendored("pyproject_hooks") vendored("requests") vendored("requests.exceptions") vendored("requests.packages") vendored("requests.packages.urllib3") vendored("requests.packages.urllib3._collections") vendored("requests.packages.urllib3.connection") vendored("requests.packages.urllib3.connectionpool") vendored("requests.packages.urllib3.contrib") vendored("requests.packages.urllib3.contrib.ntlmpool") vendored("requests.packages.urllib3.contrib.pyopenssl") vendored("requests.packages.urllib3.exceptions") vendored("requests.packages.urllib3.fields") vendored("requests.packages.urllib3.filepost") vendored("requests.packages.urllib3.packages") vendored("requests.packages.urllib3.packages.ordered_dict") vendored("requests.packages.urllib3.packages.six") vendored("requests.packages.urllib3.packages.ssl_match_hostname") vendored("requests.packages.urllib3.packages.ssl_match_hostname." "_implementation") vendored("requests.packages.urllib3.poolmanager") vendored("requests.packages.urllib3.request") vendored("requests.packages.urllib3.response") vendored("requests.packages.urllib3.util") vendored("requests.packages.urllib3.util.connection") vendored("requests.packages.urllib3.util.request") vendored("requests.packages.urllib3.util.response") vendored("requests.packages.urllib3.util.retry") vendored("requests.packages.urllib3.util.ssl_") vendored("requests.packages.urllib3.util.timeout") vendored("requests.packages.urllib3.util.url") vendored("resolvelib") vendored("rich") vendored("rich.console") vendored("rich.highlighter") vendored("rich.logging") vendored("rich.markup") vendored("rich.progress") vendored("rich.segment") vendored("rich.style") vendored("rich.text") vendored("rich.traceback") if sys.version_info < (3, 11): vendored("tomli") vendored("truststore") vendored("urllib3") ================================================ FILE: src/pip/_vendor/cachecontrol/LICENSE.txt ================================================ Copyright 2012-2021 Eric Larson Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: src/pip/_vendor/cachecontrol/__init__.py ================================================ # SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 """CacheControl import Interface. Make it easy to import from cachecontrol without long namespaces. """ import importlib.metadata from pip._vendor.cachecontrol.adapter import CacheControlAdapter from pip._vendor.cachecontrol.controller import CacheController from pip._vendor.cachecontrol.wrapper import CacheControl __author__ = "Eric Larson" __email__ = "eric@ionrock.org" # pip patch: this won't work when vendored, so just patch it out as it's unused # __version__ = importlib.metadata.version("cachecontrol") __all__ = [ "__author__", "__email__", "__version__", "CacheControlAdapter", "CacheController", "CacheControl", ] import logging logging.getLogger(__name__).addHandler(logging.NullHandler()) ================================================ FILE: src/pip/_vendor/cachecontrol/_cmd.py ================================================ # SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import logging from argparse import ArgumentParser from typing import TYPE_CHECKING from pip._vendor import requests from pip._vendor.cachecontrol.adapter import CacheControlAdapter from pip._vendor.cachecontrol.cache import DictCache from pip._vendor.cachecontrol.controller import logger if TYPE_CHECKING: from argparse import Namespace from pip._vendor.cachecontrol.controller import CacheController def setup_logging() -> None: logger.setLevel(logging.DEBUG) handler = logging.StreamHandler() logger.addHandler(handler) def get_session() -> requests.Session: adapter = CacheControlAdapter( DictCache(), cache_etags=True, serializer=None, heuristic=None ) sess = requests.Session() sess.mount("http://", adapter) sess.mount("https://", adapter) sess.cache_controller = adapter.controller # type: ignore[attr-defined] return sess def get_args() -> Namespace: parser = ArgumentParser() parser.add_argument("url", help="The URL to try and cache") return parser.parse_args() def main() -> None: args = get_args() sess = get_session() # Make a request to get a response resp = sess.get(args.url) # Turn on logging setup_logging() # try setting the cache cache_controller: CacheController = ( sess.cache_controller # type: ignore[attr-defined] ) cache_controller.cache_response(resp.request, resp.raw) # Now try to get it if cache_controller.cached_request(resp.request): print("Cached!") else: print("Not cached :(") if __name__ == "__main__": main() ================================================ FILE: src/pip/_vendor/cachecontrol/adapter.py ================================================ # SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import functools import weakref import zlib from typing import TYPE_CHECKING, Any, Collection, Mapping from pip._vendor.requests.adapters import HTTPAdapter from pip._vendor.cachecontrol.cache import DictCache from pip._vendor.cachecontrol.controller import PERMANENT_REDIRECT_STATUSES, CacheController from pip._vendor.cachecontrol.filewrapper import CallbackFileWrapper if TYPE_CHECKING: from pip._vendor.requests import PreparedRequest, Response from pip._vendor.urllib3 import HTTPResponse from pip._vendor.cachecontrol.cache import BaseCache from pip._vendor.cachecontrol.heuristics import BaseHeuristic from pip._vendor.cachecontrol.serialize import Serializer class CacheControlAdapter(HTTPAdapter): invalidating_methods = {"PUT", "PATCH", "DELETE"} def __init__( self, cache: BaseCache | None = None, cache_etags: bool = True, controller_class: type[CacheController] | None = None, serializer: Serializer | None = None, heuristic: BaseHeuristic | None = None, cacheable_methods: Collection[str] | None = None, *args: Any, **kw: Any, ) -> None: super().__init__(*args, **kw) self.cache = DictCache() if cache is None else cache self.heuristic = heuristic self.cacheable_methods = cacheable_methods or ("GET",) controller_factory = controller_class or CacheController self.controller = controller_factory( self.cache, cache_etags=cache_etags, serializer=serializer ) def send( self, request: PreparedRequest, stream: bool = False, timeout: None | float | tuple[float, float] | tuple[float, None] = None, verify: bool | str = True, cert: (None | bytes | str | tuple[bytes | str, bytes | str]) = None, proxies: Mapping[str, str] | None = None, cacheable_methods: Collection[str] | None = None, ) -> Response: """ Send a request. Use the request information to see if it exists in the cache and cache the response if we need to and can. """ cacheable = cacheable_methods or self.cacheable_methods if request.method in cacheable: try: cached_response = self.controller.cached_request(request) except zlib.error: cached_response = None if cached_response: return self.build_response(request, cached_response, from_cache=True) # check for etags and add headers if appropriate request.headers.update(self.controller.conditional_headers(request)) resp = super().send(request, stream, timeout, verify, cert, proxies) return resp def build_response( # type: ignore[override] self, request: PreparedRequest, response: HTTPResponse, from_cache: bool = False, cacheable_methods: Collection[str] | None = None, ) -> Response: """ Build a response by making a request or using the cache. This will end up calling send and returning a potentially cached response """ cacheable = cacheable_methods or self.cacheable_methods if not from_cache and request.method in cacheable: # Check for any heuristics that might update headers # before trying to cache. if self.heuristic: response = self.heuristic.apply(response) # apply any expiration heuristics if response.status == 304: # We must have sent an ETag request. This could mean # that we've been expired already or that we simply # have an etag. In either case, we want to try and # update the cache if that is the case. cached_response = self.controller.update_cached_response( request, response ) if cached_response is not response: from_cache = True # We are done with the server response, read a # possible response body (compliant servers will # not return one, but we cannot be 100% sure) and # release the connection back to the pool. response.read(decode_content=False) response.release_conn() response = cached_response # We always cache the 301 responses elif int(response.status) in PERMANENT_REDIRECT_STATUSES: self.controller.cache_response(request, response) else: # Wrap the response file with a wrapper that will cache the # response when the stream has been consumed. response._fp = CallbackFileWrapper( # type: ignore[assignment] response._fp, # type: ignore[arg-type] functools.partial( self.controller.cache_response, request, weakref.ref(response) ), ) if response.chunked: super_update_chunk_length = response.__class__._update_chunk_length def _update_chunk_length( weak_self: weakref.ReferenceType[HTTPResponse], ) -> None: self = weak_self() if self is None: return super_update_chunk_length(self) if self.chunk_left == 0: self._fp._close() # type: ignore[union-attr] response._update_chunk_length = functools.partial( # type: ignore[method-assign] _update_chunk_length, weakref.ref(response) ) resp: Response = super().build_response(request, response) # See if we should invalidate the cache. if request.method in self.invalidating_methods and resp.ok: assert request.url is not None cache_url = self.controller.cache_url(request.url) self.cache.delete(cache_url) # Give the request a from_cache attr to let people use it resp.from_cache = from_cache # type: ignore[attr-defined] return resp def close(self) -> None: self.cache.close() super().close() # type: ignore[no-untyped-call] ================================================ FILE: src/pip/_vendor/cachecontrol/cache.py ================================================ # SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 """ The cache object API for implementing caches. The default is a thread safe in-memory dictionary. """ from __future__ import annotations from threading import Lock from typing import IO, TYPE_CHECKING, MutableMapping if TYPE_CHECKING: from datetime import datetime class BaseCache: def get(self, key: str) -> bytes | None: raise NotImplementedError() def set( self, key: str, value: bytes, expires: int | datetime | None = None ) -> None: raise NotImplementedError() def delete(self, key: str) -> None: raise NotImplementedError() def close(self) -> None: pass class DictCache(BaseCache): def __init__(self, init_dict: MutableMapping[str, bytes] | None = None) -> None: self.lock = Lock() self.data = init_dict or {} def get(self, key: str) -> bytes | None: return self.data.get(key, None) def set( self, key: str, value: bytes, expires: int | datetime | None = None ) -> None: with self.lock: self.data.update({key: value}) def delete(self, key: str) -> None: with self.lock: if key in self.data: self.data.pop(key) class SeparateBodyBaseCache(BaseCache): """ In this variant, the body is not stored mixed in with the metadata, but is passed in (as a bytes-like object) in a separate call to ``set_body()``. That is, the expected interaction pattern is:: cache.set(key, serialized_metadata) cache.set_body(key) Similarly, the body should be loaded separately via ``get_body()``. """ def set_body(self, key: str, body: bytes) -> None: raise NotImplementedError() def get_body(self, key: str) -> IO[bytes] | None: """ Return the body as file-like object. """ raise NotImplementedError() ================================================ FILE: src/pip/_vendor/cachecontrol/caches/__init__.py ================================================ # SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 from pip._vendor.cachecontrol.caches.file_cache import FileCache, SeparateBodyFileCache from pip._vendor.cachecontrol.caches.redis_cache import RedisCache __all__ = ["FileCache", "SeparateBodyFileCache", "RedisCache"] ================================================ FILE: src/pip/_vendor/cachecontrol/caches/file_cache.py ================================================ # SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import hashlib import os import tempfile from textwrap import dedent from typing import IO, TYPE_CHECKING from pathlib import Path from pip._vendor.cachecontrol.cache import BaseCache, SeparateBodyBaseCache from pip._vendor.cachecontrol.controller import CacheController if TYPE_CHECKING: from datetime import datetime from filelock import BaseFileLock class _FileCacheMixin: """Shared implementation for both FileCache variants.""" def __init__( self, directory: str | Path, forever: bool = False, filemode: int = 0o0600, dirmode: int = 0o0700, lock_class: type[BaseFileLock] | None = None, ) -> None: try: if lock_class is None: from filelock import FileLock lock_class = FileLock except ImportError: notice = dedent( """ NOTE: In order to use the FileCache you must have filelock installed. You can install it via pip: pip install cachecontrol[filecache] """ ) raise ImportError(notice) self.directory = directory self.forever = forever self.filemode = filemode self.dirmode = dirmode self.lock_class = lock_class @staticmethod def encode(x: str) -> str: return hashlib.sha224(x.encode()).hexdigest() def _fn(self, name: str) -> str: # NOTE: This method should not change as some may depend on it. # See: https://github.com/ionrock/cachecontrol/issues/63 hashed = self.encode(name) parts = list(hashed[:5]) + [hashed] return os.path.join(self.directory, *parts) def get(self, key: str) -> bytes | None: name = self._fn(key) try: with open(name, "rb") as fh: return fh.read() except FileNotFoundError: return None def set( self, key: str, value: bytes, expires: int | datetime | None = None ) -> None: name = self._fn(key) self._write(name, value) def _write(self, path: str, data: bytes) -> None: """ Safely write the data to the given path. """ # Make sure the directory exists dirname = os.path.dirname(path) os.makedirs(dirname, self.dirmode, exist_ok=True) with self.lock_class(path + ".lock"): # Write our actual file (fd, name) = tempfile.mkstemp(dir=dirname) try: os.write(fd, data) finally: os.close(fd) os.chmod(name, self.filemode) os.replace(name, path) def _delete(self, key: str, suffix: str) -> None: name = self._fn(key) + suffix if not self.forever: try: os.remove(name) except FileNotFoundError: pass class FileCache(_FileCacheMixin, BaseCache): """ Traditional FileCache: body is stored in memory, so not suitable for large downloads. """ def delete(self, key: str) -> None: self._delete(key, "") class SeparateBodyFileCache(_FileCacheMixin, SeparateBodyBaseCache): """ Memory-efficient FileCache: body is stored in a separate file, reducing peak memory usage. """ def get_body(self, key: str) -> IO[bytes] | None: name = self._fn(key) + ".body" try: return open(name, "rb") except FileNotFoundError: return None def set_body(self, key: str, body: bytes) -> None: name = self._fn(key) + ".body" self._write(name, body) def delete(self, key: str) -> None: self._delete(key, "") self._delete(key, ".body") def url_to_file_path(url: str, filecache: FileCache) -> str: """Return the file cache path based on the URL. This does not ensure the file exists! """ key = CacheController.cache_url(url) return filecache._fn(key) ================================================ FILE: src/pip/_vendor/cachecontrol/caches/redis_cache.py ================================================ # SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from datetime import datetime, timezone from typing import TYPE_CHECKING from pip._vendor.cachecontrol.cache import BaseCache if TYPE_CHECKING: from redis import Redis class RedisCache(BaseCache): def __init__(self, conn: Redis[bytes]) -> None: self.conn = conn def get(self, key: str) -> bytes | None: return self.conn.get(key) def set( self, key: str, value: bytes, expires: int | datetime | None = None ) -> None: if not expires: self.conn.set(key, value) elif isinstance(expires, datetime): now_utc = datetime.now(timezone.utc) if expires.tzinfo is None: now_utc = now_utc.replace(tzinfo=None) delta = expires - now_utc self.conn.setex(key, int(delta.total_seconds()), value) else: self.conn.setex(key, expires, value) def delete(self, key: str) -> None: self.conn.delete(key) def clear(self) -> None: """Helper for clearing all the keys in a database. Use with caution!""" for key in self.conn.keys(): self.conn.delete(key) def close(self) -> None: """Redis uses connection pooling, no need to close the connection.""" pass ================================================ FILE: src/pip/_vendor/cachecontrol/controller.py ================================================ # SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 """ The httplib2 algorithms ported for use with requests. """ from __future__ import annotations import calendar import logging import re import time import weakref from email.utils import parsedate_tz from typing import TYPE_CHECKING, Collection, Mapping from pip._vendor.requests.structures import CaseInsensitiveDict from pip._vendor.cachecontrol.cache import DictCache, SeparateBodyBaseCache from pip._vendor.cachecontrol.serialize import Serializer if TYPE_CHECKING: from typing import Literal from pip._vendor.requests import PreparedRequest from pip._vendor.urllib3 import HTTPResponse from pip._vendor.cachecontrol.cache import BaseCache logger = logging.getLogger(__name__) URI = re.compile(r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?") PERMANENT_REDIRECT_STATUSES = (301, 308) def parse_uri(uri: str) -> tuple[str, str, str, str, str]: """Parses a URI using the regex given in Appendix B of RFC 3986. (scheme, authority, path, query, fragment) = parse_uri(uri) """ match = URI.match(uri) assert match is not None groups = match.groups() return (groups[1], groups[3], groups[4], groups[6], groups[8]) class CacheController: """An interface to see if request should cached or not.""" def __init__( self, cache: BaseCache | None = None, cache_etags: bool = True, serializer: Serializer | None = None, status_codes: Collection[int] | None = None, ): self.cache = DictCache() if cache is None else cache self.cache_etags = cache_etags self.serializer = serializer or Serializer() self.cacheable_status_codes = status_codes or (200, 203, 300, 301, 308) @classmethod def _urlnorm(cls, uri: str) -> str: """Normalize the URL to create a safe key for the cache""" (scheme, authority, path, query, fragment) = parse_uri(uri) if not scheme or not authority: raise Exception("Only absolute URIs are allowed. uri = %s" % uri) scheme = scheme.lower() authority = authority.lower() if not path: path = "/" # Could do syntax based normalization of the URI before # computing the digest. See Section 6.2.2 of Std 66. request_uri = query and "?".join([path, query]) or path defrag_uri = scheme + "://" + authority + request_uri return defrag_uri @classmethod def cache_url(cls, uri: str) -> str: return cls._urlnorm(uri) def parse_cache_control(self, headers: Mapping[str, str]) -> dict[str, int | None]: known_directives = { # https://tools.ietf.org/html/rfc7234#section-5.2 "max-age": (int, True), "max-stale": (int, False), "min-fresh": (int, True), "no-cache": (None, False), "no-store": (None, False), "no-transform": (None, False), "only-if-cached": (None, False), "must-revalidate": (None, False), "public": (None, False), "private": (None, False), "proxy-revalidate": (None, False), "s-maxage": (int, True), } cc_headers = headers.get("cache-control", headers.get("Cache-Control", "")) retval: dict[str, int | None] = {} for cc_directive in cc_headers.split(","): if not cc_directive.strip(): continue parts = cc_directive.split("=", 1) directive = parts[0].strip() try: typ, required = known_directives[directive] except KeyError: logger.debug("Ignoring unknown cache-control directive: %s", directive) continue if not typ or not required: retval[directive] = None if typ: try: retval[directive] = typ(parts[1].strip()) except IndexError: if required: logger.debug( "Missing value for cache-control " "directive: %s", directive, ) except ValueError: logger.debug( "Invalid value for cache-control directive " "%s, must be %s", directive, typ.__name__, ) return retval def _load_from_cache(self, request: PreparedRequest) -> HTTPResponse | None: """ Load a cached response, or return None if it's not available. """ # We do not support caching of partial content: so if the request contains a # Range header then we don't want to load anything from the cache. if "Range" in request.headers: return None cache_url = request.url assert cache_url is not None cache_data = self.cache.get(cache_url) if cache_data is None: logger.debug("No cache entry available") return None if isinstance(self.cache, SeparateBodyBaseCache): body_file = self.cache.get_body(cache_url) else: body_file = None result = self.serializer.loads(request, cache_data, body_file) if result is None: logger.warning("Cache entry deserialization failed, entry ignored") return result def cached_request(self, request: PreparedRequest) -> HTTPResponse | Literal[False]: """ Return a cached response if it exists in the cache, otherwise return False. """ assert request.url is not None cache_url = self.cache_url(request.url) logger.debug('Looking up "%s" in the cache', cache_url) cc = self.parse_cache_control(request.headers) # Bail out if the request insists on fresh data if "no-cache" in cc: logger.debug('Request header has "no-cache", cache bypassed') return False if "max-age" in cc and cc["max-age"] == 0: logger.debug('Request header has "max_age" as 0, cache bypassed') return False # Check whether we can load the response from the cache: resp = self._load_from_cache(request) if not resp: return False # If we have a cached permanent redirect, return it immediately. We # don't need to test our response for other headers b/c it is # intrinsically "cacheable" as it is Permanent. # # See: # https://tools.ietf.org/html/rfc7231#section-6.4.2 # # Client can try to refresh the value by repeating the request # with cache busting headers as usual (ie no-cache). if int(resp.status) in PERMANENT_REDIRECT_STATUSES: msg = ( "Returning cached permanent redirect response " "(ignoring date and etag information)" ) logger.debug(msg) return resp headers: CaseInsensitiveDict[str] = CaseInsensitiveDict(resp.headers) if not headers or "date" not in headers: if "etag" not in headers: # Without date or etag, the cached response can never be used # and should be deleted. logger.debug("Purging cached response: no date or etag") self.cache.delete(cache_url) logger.debug("Ignoring cached response: no date") return False now = time.time() time_tuple = parsedate_tz(headers["date"]) assert time_tuple is not None date = calendar.timegm(time_tuple[:6]) current_age = max(0, now - date) logger.debug("Current age based on date: %i", current_age) # TODO: There is an assumption that the result will be a # urllib3 response object. This may not be best since we # could probably avoid instantiating or constructing the # response until we know we need it. resp_cc = self.parse_cache_control(headers) # determine freshness freshness_lifetime = 0 # Check the max-age pragma in the cache control header max_age = resp_cc.get("max-age") if max_age is not None: freshness_lifetime = max_age logger.debug("Freshness lifetime from max-age: %i", freshness_lifetime) # If there isn't a max-age, check for an expires header elif "expires" in headers: expires = parsedate_tz(headers["expires"]) if expires is not None: expire_time = calendar.timegm(expires[:6]) - date freshness_lifetime = max(0, expire_time) logger.debug("Freshness lifetime from expires: %i", freshness_lifetime) # Determine if we are setting freshness limit in the # request. Note, this overrides what was in the response. max_age = cc.get("max-age") if max_age is not None: freshness_lifetime = max_age logger.debug( "Freshness lifetime from request max-age: %i", freshness_lifetime ) min_fresh = cc.get("min-fresh") if min_fresh is not None: # adjust our current age by our min fresh current_age += min_fresh logger.debug("Adjusted current age from min-fresh: %i", current_age) # Return entry if it is fresh enough if freshness_lifetime > current_age: logger.debug('The response is "fresh", returning cached response') logger.debug("%i > %i", freshness_lifetime, current_age) return resp # we're not fresh. If we don't have an Etag, clear it out if "etag" not in headers: logger.debug('The cached response is "stale" with no etag, purging') self.cache.delete(cache_url) # return the original handler return False def conditional_headers(self, request: PreparedRequest) -> dict[str, str]: resp = self._load_from_cache(request) new_headers = {} if resp: headers: CaseInsensitiveDict[str] = CaseInsensitiveDict(resp.headers) if "etag" in headers: new_headers["If-None-Match"] = headers["ETag"] if "last-modified" in headers: new_headers["If-Modified-Since"] = headers["Last-Modified"] return new_headers def _cache_set( self, cache_url: str, request: PreparedRequest, response: HTTPResponse, body: bytes | None = None, expires_time: int | None = None, ) -> None: """ Store the data in the cache. """ if isinstance(self.cache, SeparateBodyBaseCache): # We pass in the body separately; just put a placeholder empty # string in the metadata. self.cache.set( cache_url, self.serializer.dumps(request, response, b""), expires=expires_time, ) # body is None can happen when, for example, we're only updating # headers, as is the case in update_cached_response(). if body is not None: self.cache.set_body(cache_url, body) else: self.cache.set( cache_url, self.serializer.dumps(request, response, body), expires=expires_time, ) def cache_response( self, request: PreparedRequest, response_or_ref: HTTPResponse | weakref.ReferenceType[HTTPResponse], body: bytes | None = None, status_codes: Collection[int] | None = None, ) -> None: """ Algorithm for caching requests. This assumes a requests Response object. """ if isinstance(response_or_ref, weakref.ReferenceType): response = response_or_ref() if response is None: # The weakref can be None only in case the user used streamed request # and did not consume or close it, and holds no reference to requests.Response. # In such case, we don't want to cache the response. return else: response = response_or_ref # From httplib2: Don't cache 206's since we aren't going to # handle byte range requests cacheable_status_codes = status_codes or self.cacheable_status_codes if response.status not in cacheable_status_codes: logger.debug( "Status code %s not in %s", response.status, cacheable_status_codes ) return response_headers: CaseInsensitiveDict[str] = CaseInsensitiveDict( response.headers ) if "date" in response_headers: time_tuple = parsedate_tz(response_headers["date"]) assert time_tuple is not None date = calendar.timegm(time_tuple[:6]) else: date = 0 # If we've been given a body, our response has a Content-Length, that # Content-Length is valid then we can check to see if the body we've # been given matches the expected size, and if it doesn't we'll just # skip trying to cache it. if ( body is not None and "content-length" in response_headers and response_headers["content-length"].isdigit() and int(response_headers["content-length"]) != len(body) ): return cc_req = self.parse_cache_control(request.headers) cc = self.parse_cache_control(response_headers) assert request.url is not None cache_url = self.cache_url(request.url) logger.debug('Updating cache with response from "%s"', cache_url) # Delete it from the cache if we happen to have it stored there no_store = False if "no-store" in cc: no_store = True logger.debug('Response header has "no-store"') if "no-store" in cc_req: no_store = True logger.debug('Request header has "no-store"') if no_store and self.cache.get(cache_url): logger.debug('Purging existing cache entry to honor "no-store"') self.cache.delete(cache_url) if no_store: return # https://tools.ietf.org/html/rfc7234#section-4.1: # A Vary header field-value of "*" always fails to match. # Storing such a response leads to a deserialization warning # during cache lookup and is not allowed to ever be served, # so storing it can be avoided. if "*" in response_headers.get("vary", ""): logger.debug('Response header has "Vary: *"') return # If we've been given an etag, then keep the response if self.cache_etags and "etag" in response_headers: expires_time = 0 if response_headers.get("expires"): expires = parsedate_tz(response_headers["expires"]) if expires is not None: expires_time = calendar.timegm(expires[:6]) - date expires_time = max(expires_time, 14 * 86400) logger.debug(f"etag object cached for {expires_time} seconds") logger.debug("Caching due to etag") self._cache_set(cache_url, request, response, body, expires_time) # Add to the cache any permanent redirects. We do this before looking # that the Date headers. elif int(response.status) in PERMANENT_REDIRECT_STATUSES: logger.debug("Caching permanent redirect") self._cache_set(cache_url, request, response, b"") # Add to the cache if the response headers demand it. If there # is no date header then we can't do anything about expiring # the cache. elif "date" in response_headers: time_tuple = parsedate_tz(response_headers["date"]) assert time_tuple is not None date = calendar.timegm(time_tuple[:6]) # cache when there is a max-age > 0 max_age = cc.get("max-age") if max_age is not None and max_age > 0: logger.debug("Caching b/c date exists and max-age > 0") expires_time = max_age self._cache_set( cache_url, request, response, body, expires_time, ) # If the request can expire, it means we should cache it # in the meantime. elif "expires" in response_headers: if response_headers["expires"]: expires = parsedate_tz(response_headers["expires"]) if expires is not None: expires_time = calendar.timegm(expires[:6]) - date else: expires_time = None logger.debug( "Caching b/c of expires header. expires in {} seconds".format( expires_time ) ) self._cache_set( cache_url, request, response, body, expires_time, ) def update_cached_response( self, request: PreparedRequest, response: HTTPResponse ) -> HTTPResponse: """On a 304 we will get a new set of headers that we want to update our cached value with, assuming we have one. This should only ever be called when we've sent an ETag and gotten a 304 as the response. """ assert request.url is not None cache_url = self.cache_url(request.url) cached_response = self._load_from_cache(request) if not cached_response: # we didn't have a cached response return response # Lets update our headers with the headers from the new request: # http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-26#section-4.1 # # The server isn't supposed to send headers that would make # the cached body invalid. But... just in case, we'll be sure # to strip out ones we know that might be problematic due to # typical assumptions. excluded_headers = ["content-length"] cached_response.headers.update( { k: v for k, v in response.headers.items() if k.lower() not in excluded_headers } ) # we want a 200 b/c we have content via the cache cached_response.status = 200 # update our cache self._cache_set(cache_url, request, cached_response) return cached_response ================================================ FILE: src/pip/_vendor/cachecontrol/filewrapper.py ================================================ # SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import mmap from tempfile import NamedTemporaryFile from typing import TYPE_CHECKING, Any, Callable if TYPE_CHECKING: from collections.abc import Buffer from http.client import HTTPResponse class CallbackFileWrapper: """ Small wrapper around a fp object which will tee everything read into a buffer, and when that file is closed it will execute a callback with the contents of that buffer. All attributes are proxied to the underlying file object. This class uses members with a double underscore (__) leading prefix so as not to accidentally shadow an attribute. The data is stored in a temporary file until it is all available. As long as the temporary files directory is disk-based (sometimes it's a memory-backed-``tmpfs`` on Linux), data will be unloaded to disk if memory pressure is high. For small files the disk usually won't be used at all, it'll all be in the filesystem memory cache, so there should be no performance impact. """ def __init__( self, fp: HTTPResponse, callback: Callable[[Buffer], None] | None ) -> None: self.__buf = NamedTemporaryFile("rb+", delete=True) self.__fp = fp self.__callback = callback def __getattr__(self, name: str) -> Any: # The vagaries of garbage collection means that self.__fp is # not always set. By using __getattribute__ and the private # name[0] allows looking up the attribute value and raising an # AttributeError when it doesn't exist. This stop things from # infinitely recursing calls to getattr in the case where # self.__fp hasn't been set. # # [0] https://docs.python.org/2/reference/expressions.html#atom-identifiers fp = self.__getattribute__("_CallbackFileWrapper__fp") return getattr(fp, name) def __is_fp_closed(self) -> bool: try: return self.__fp.fp is None except AttributeError: pass try: closed: bool = self.__fp.closed return closed except AttributeError: pass # We just don't cache it then. # TODO: Add some logging here... return False def _close(self) -> None: result: Buffer if self.__callback: if self.__buf.tell() == 0: # Empty file: result = b"" else: # Return the data without actually loading it into memory, # relying on Python's buffer API and mmap(). mmap() just gives # a view directly into the filesystem's memory cache, so it # doesn't result in duplicate memory use. self.__buf.seek(0, 0) result = memoryview( mmap.mmap(self.__buf.fileno(), 0, access=mmap.ACCESS_READ) ) self.__callback(result) # We assign this to None here, because otherwise we can get into # really tricky problems where the CPython interpreter dead locks # because the callback is holding a reference to something which # has a __del__ method. Setting this to None breaks the cycle # and allows the garbage collector to do it's thing normally. self.__callback = None # Closing the temporary file releases memory and frees disk space. # Important when caching big files. self.__buf.close() def read(self, amt: int | None = None) -> bytes: data: bytes = self.__fp.read(amt) if data: # We may be dealing with b'', a sign that things are over: # it's passed e.g. after we've already closed self.__buf. self.__buf.write(data) if self.__is_fp_closed(): self._close() return data def _safe_read(self, amt: int) -> bytes: data: bytes = self.__fp._safe_read(amt) # type: ignore[attr-defined] if amt == 2 and data == b"\r\n": # urllib executes this read to toss the CRLF at the end # of the chunk. return data self.__buf.write(data) if self.__is_fp_closed(): self._close() return data ================================================ FILE: src/pip/_vendor/cachecontrol/heuristics.py ================================================ # SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import calendar import time from datetime import datetime, timedelta, timezone from email.utils import formatdate, parsedate, parsedate_tz from typing import TYPE_CHECKING, Any, Mapping if TYPE_CHECKING: from pip._vendor.urllib3 import HTTPResponse TIME_FMT = "%a, %d %b %Y %H:%M:%S GMT" def expire_after(delta: timedelta, date: datetime | None = None) -> datetime: date = date or datetime.now(timezone.utc) return date + delta def datetime_to_header(dt: datetime) -> str: return formatdate(calendar.timegm(dt.timetuple())) class BaseHeuristic: def warning(self, response: HTTPResponse) -> str | None: """ Return a valid 1xx warning header value describing the cache adjustments. The response is provided too allow warnings like 113 http://tools.ietf.org/html/rfc7234#section-5.5.4 where we need to explicitly say response is over 24 hours old. """ return '110 - "Response is Stale"' def update_headers(self, response: HTTPResponse) -> dict[str, str]: """Update the response headers with any new headers. NOTE: This SHOULD always include some Warning header to signify that the response was cached by the client, not by way of the provided headers. """ return {} def apply(self, response: HTTPResponse) -> HTTPResponse: updated_headers = self.update_headers(response) if updated_headers: response.headers.update(updated_headers) warning_header_value = self.warning(response) if warning_header_value is not None: response.headers.update({"Warning": warning_header_value}) return response class OneDayCache(BaseHeuristic): """ Cache the response by providing an expires 1 day in the future. """ def update_headers(self, response: HTTPResponse) -> dict[str, str]: headers = {} if "expires" not in response.headers: date = parsedate(response.headers["date"]) expires = expire_after( timedelta(days=1), date=datetime(*date[:6], tzinfo=timezone.utc), # type: ignore[index,misc] ) headers["expires"] = datetime_to_header(expires) headers["cache-control"] = "public" return headers class ExpiresAfter(BaseHeuristic): """ Cache **all** requests for a defined time period. """ def __init__(self, **kw: Any) -> None: self.delta = timedelta(**kw) def update_headers(self, response: HTTPResponse) -> dict[str, str]: expires = expire_after(self.delta) return {"expires": datetime_to_header(expires), "cache-control": "public"} def warning(self, response: HTTPResponse) -> str | None: tmpl = "110 - Automatically cached for %s. Response might be stale" return tmpl % self.delta class LastModified(BaseHeuristic): """ If there is no Expires header already, fall back on Last-Modified using the heuristic from http://tools.ietf.org/html/rfc7234#section-4.2.2 to calculate a reasonable value. Firefox also does something like this per https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching_FAQ http://lxr.mozilla.org/mozilla-release/source/netwerk/protocol/http/nsHttpResponseHead.cpp#397 Unlike mozilla we limit this to 24-hr. """ cacheable_by_default_statuses = { 200, 203, 204, 206, 300, 301, 404, 405, 410, 414, 501, } def update_headers(self, resp: HTTPResponse) -> dict[str, str]: headers: Mapping[str, str] = resp.headers if "expires" in headers: return {} if "cache-control" in headers and headers["cache-control"] != "public": return {} if resp.status not in self.cacheable_by_default_statuses: return {} if "date" not in headers or "last-modified" not in headers: return {} time_tuple = parsedate_tz(headers["date"]) assert time_tuple is not None date = calendar.timegm(time_tuple[:6]) last_modified = parsedate(headers["last-modified"]) if last_modified is None: return {} now = time.time() current_age = max(0, now - date) delta = date - calendar.timegm(last_modified) freshness_lifetime = max(0, min(delta / 10, 24 * 3600)) if freshness_lifetime <= current_age: return {} expires = date + freshness_lifetime return {"expires": time.strftime(TIME_FMT, time.gmtime(expires))} def warning(self, resp: HTTPResponse) -> str | None: return None ================================================ FILE: src/pip/_vendor/cachecontrol/py.typed ================================================ ================================================ FILE: src/pip/_vendor/cachecontrol/serialize.py ================================================ # SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import io from typing import IO, TYPE_CHECKING, Any, Mapping, cast from pip._vendor import msgpack from pip._vendor.requests.structures import CaseInsensitiveDict from pip._vendor.urllib3 import HTTPResponse if TYPE_CHECKING: from pip._vendor.requests import PreparedRequest class Serializer: serde_version = "4" def dumps( self, request: PreparedRequest, response: HTTPResponse, body: bytes | None = None, ) -> bytes: response_headers: CaseInsensitiveDict[str] = CaseInsensitiveDict( response.headers ) if body is None: # When a body isn't passed in, we'll read the response. We # also update the response with a new file handler to be # sure it acts as though it was never read. body = response.read(decode_content=False) response._fp = io.BytesIO(body) # type: ignore[assignment] response.length_remaining = len(body) data = { "response": { "body": body, # Empty bytestring if body is stored separately "headers": {str(k): str(v) for k, v in response.headers.items()}, "status": response.status, "version": response.version, "reason": str(response.reason), "decode_content": response.decode_content, } } # Construct our vary headers data["vary"] = {} if "vary" in response_headers: varied_headers = response_headers["vary"].split(",") for header in varied_headers: header = str(header).strip() header_value = request.headers.get(header, None) if header_value is not None: header_value = str(header_value) data["vary"][header] = header_value return b",".join([f"cc={self.serde_version}".encode(), self.serialize(data)]) def serialize(self, data: dict[str, Any]) -> bytes: return cast(bytes, msgpack.dumps(data, use_bin_type=True)) def loads( self, request: PreparedRequest, data: bytes, body_file: IO[bytes] | None = None, ) -> HTTPResponse | None: # Short circuit if we've been given an empty set of data if not data: return None # Previous versions of this library supported other serialization # formats, but these have all been removed. if not data.startswith(f"cc={self.serde_version},".encode()): return None data = data[5:] return self._loads_v4(request, data, body_file) def prepare_response( self, request: PreparedRequest, cached: Mapping[str, Any], body_file: IO[bytes] | None = None, ) -> HTTPResponse | None: """Verify our vary headers match and construct a real urllib3 HTTPResponse object. """ # Special case the '*' Vary value as it means we cannot actually # determine if the cached response is suitable for this request. # This case is also handled in the controller code when creating # a cache entry, but is left here for backwards compatibility. if "*" in cached.get("vary", {}): return None # Ensure that the Vary headers for the cached response match our # request for header, value in cached.get("vary", {}).items(): if request.headers.get(header, None) != value: return None body_raw = cached["response"].pop("body") headers: CaseInsensitiveDict[str] = CaseInsensitiveDict( data=cached["response"]["headers"] ) if headers.get("transfer-encoding", "") == "chunked": headers.pop("transfer-encoding") cached["response"]["headers"] = headers try: body: IO[bytes] if body_file is None: body = io.BytesIO(body_raw) else: body = body_file except TypeError: # This can happen if cachecontrol serialized to v1 format (pickle) # using Python 2. A Python 2 str(byte string) will be unpickled as # a Python 3 str (unicode string), which will cause the above to # fail with: # # TypeError: 'str' does not support the buffer interface body = io.BytesIO(body_raw.encode("utf8")) # Discard any `strict` parameter serialized by older version of cachecontrol. cached["response"].pop("strict", None) return HTTPResponse(body=body, preload_content=False, **cached["response"]) def _loads_v4( self, request: PreparedRequest, data: bytes, body_file: IO[bytes] | None = None, ) -> HTTPResponse | None: try: cached = msgpack.loads(data, raw=False) except ValueError: return None return self.prepare_response(request, cached, body_file) ================================================ FILE: src/pip/_vendor/cachecontrol/wrapper.py ================================================ # SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from typing import TYPE_CHECKING, Collection from pip._vendor.cachecontrol.adapter import CacheControlAdapter from pip._vendor.cachecontrol.cache import DictCache if TYPE_CHECKING: from pip._vendor import requests from pip._vendor.cachecontrol.cache import BaseCache from pip._vendor.cachecontrol.controller import CacheController from pip._vendor.cachecontrol.heuristics import BaseHeuristic from pip._vendor.cachecontrol.serialize import Serializer def CacheControl( sess: requests.Session, cache: BaseCache | None = None, cache_etags: bool = True, serializer: Serializer | None = None, heuristic: BaseHeuristic | None = None, controller_class: type[CacheController] | None = None, adapter_class: type[CacheControlAdapter] | None = None, cacheable_methods: Collection[str] | None = None, ) -> requests.Session: cache = DictCache() if cache is None else cache adapter_class = adapter_class or CacheControlAdapter adapter = adapter_class( cache, cache_etags=cache_etags, serializer=serializer, heuristic=heuristic, controller_class=controller_class, cacheable_methods=cacheable_methods, ) sess.mount("http://", adapter) sess.mount("https://", adapter) return sess ================================================ FILE: src/pip/_vendor/certifi/LICENSE ================================================ This package contains a modified version of ca-bundle.crt: ca-bundle.crt -- Bundle of CA Root Certificates This is a bundle of X.509 certificates of public Certificate Authorities (CA). These were automatically extracted from Mozilla's root certificates file (certdata.txt). This file can be found in the mozilla source tree: https://hg.mozilla.org/mozilla-central/file/tip/security/nss/lib/ckfw/builtins/certdata.txt It contains the certificates in PEM format and therefore can be directly used with curl / libcurl / php_curl, or with an Apache+mod_ssl webserver for SSL client authentication. Just configure this file as the SSLCACertificateFile.# ***** BEGIN LICENSE BLOCK ***** This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. ***** END LICENSE BLOCK ***** @(#) $RCSfile: certdata.txt,v $ $Revision: 1.80 $ $Date: 2011/11/03 15:11:58 $ ================================================ FILE: src/pip/_vendor/certifi/__init__.py ================================================ from .core import contents, where __all__ = ["contents", "where"] __version__ = "2026.01.04" ================================================ FILE: src/pip/_vendor/certifi/__main__.py ================================================ import argparse from pip._vendor.certifi import contents, where parser = argparse.ArgumentParser() parser.add_argument("-c", "--contents", action="store_true") args = parser.parse_args() if args.contents: print(contents()) else: print(where()) ================================================ FILE: src/pip/_vendor/certifi/cacert.pem ================================================ # Issuer: CN=QuoVadis Root CA 2 O=QuoVadis Limited # Subject: CN=QuoVadis Root CA 2 O=QuoVadis Limited # Label: "QuoVadis Root CA 2" # Serial: 1289 # MD5 Fingerprint: 5e:39:7b:dd:f8:ba:ec:82:e9:ac:62:ba:0c:54:00:2b # SHA1 Fingerprint: ca:3a:fb:cf:12:40:36:4b:44:b2:16:20:88:80:48:39:19:93:7c:f7 # SHA256 Fingerprint: 85:a0:dd:7d:d7:20:ad:b7:ff:05:f8:3d:54:2b:20:9d:c7:ff:45:28:f7:d6:77:b1:83:89:fe:a5:e5:c4:9e:86 -----BEGIN CERTIFICATE----- MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv b3QgQ0EgMjAeFw0wNjExMjQxODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNV BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W YWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCa GMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6XJxg Fyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55J WpzmM+Yklvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bB rrcCaoF6qUWD4gXmuVbBlDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp +ARz8un+XJiM9XOva7R+zdRcAitMOeGylZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1 ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt66/3FsvbzSUr5R/7mp/i Ucw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1JdxnwQ5hYIiz PtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og /zOhD7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UH oycR7hYQe7xFSkyyBNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuI yV77zGHcizN300QyNQliBJIWENieJ0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1Ud EwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBQahGK8SEwzJQTU7tD2 A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGUa6FJpEcwRTEL MAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2f BluornFdLwUvZ+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzn g/iN/Ae42l9NLmeyhP3ZRPx3UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2Bl fF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodmVjB3pjd4M1IQWK4/YY7yarHvGH5K WWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK+JDSV6IZUaUtl0Ha B0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrWIozc hLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPR TUIZ3Ph1WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWD mbA4CD/pXvk1B+TJYm5Xf6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0Z ohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y 4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8VCLAAVBpQ570su9t+Oza 8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u -----END CERTIFICATE----- # Issuer: CN=QuoVadis Root CA 3 O=QuoVadis Limited # Subject: CN=QuoVadis Root CA 3 O=QuoVadis Limited # Label: "QuoVadis Root CA 3" # Serial: 1478 # MD5 Fingerprint: 31:85:3c:62:94:97:63:b9:aa:fd:89:4e:af:6f:e0:cf # SHA1 Fingerprint: 1f:49:14:f7:d8:74:95:1d:dd:ae:02:c0:be:fd:3a:2d:82:75:51:85 # SHA256 Fingerprint: 18:f1:fc:7f:20:5d:f8:ad:dd:eb:7f:e0:07:dd:57:e3:af:37:5a:9c:4d:8d:73:54:6b:f4:f1:fe:d1:e1:8d:35 -----BEGIN CERTIFICATE----- MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv b3QgQ0EgMzAeFw0wNjExMjQxOTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNV BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W YWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDM V0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNggDhoB 4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUr H556VOijKTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd 8lyyBTNvijbO0BNO/79KDDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9Cabwv vWhDFlaJKjdhkf2mrk7AyxRllDdLkgbvBNDInIjbC3uBr7E9KsRlOni27tyAsdLT mZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwpp5ijJUMv7/FfJuGITfhe btfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8nT8KKdjc T5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDt WAEXMJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZ c6tsgLjoC2SToJyMGf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A 4iLItLRkT9a6fUg+qGkM17uGcclzuD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYD VR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHTBgkrBgEEAb5YAAMwgcUwgZMG CCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmljYXRlIGNvbnN0 aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0 aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVu dC4wLQYIKwYBBQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2Nw czALBgNVHQ8EBAMCAQYwHQYDVR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4G A1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4ywLQoUmkRzBFMQswCQYDVQQGEwJC TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UEAxMSUXVvVmFkaXMg Um9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZVqyM0 7ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSem d1o417+shvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd +LJ2w/w4E6oM3kJpK27zPOuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B 4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadN t54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp8kokUvd0/bpO5qgdAm6x DYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBCbjPsMZ57 k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6s zHXug/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0j Wy10QJLZYxkNc91pvGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeT mJlglFwjz1onl14LBQaTNx47aTbrqZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK 4SVhM7JZG+Ju1zdXtg2pEto= -----END CERTIFICATE----- # Issuer: CN=DigiCert Assured ID Root CA O=DigiCert Inc OU=www.digicert.com # Subject: CN=DigiCert Assured ID Root CA O=DigiCert Inc OU=www.digicert.com # Label: "DigiCert Assured ID Root CA" # Serial: 17154717934120587862167794914071425081 # MD5 Fingerprint: 87:ce:0b:7b:2a:0e:49:00:e1:58:71:9b:37:a8:93:72 # SHA1 Fingerprint: 05:63:b8:63:0d:62:d7:5a:bb:c8:ab:1e:4b:df:b5:a8:99:b2:4d:43 # SHA256 Fingerprint: 3e:90:99:b5:01:5e:8f:48:6c:00:bc:ea:9d:11:1e:e7:21:fa:ba:35:5a:89:bc:f1:df:69:56:1e:3d:c6:32:5c -----BEGIN CERTIFICATE----- MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP mDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+ wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4 VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpyoeb6pNnVFzF1roV9Iq4/ AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whfGHdPAgMB AAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW BBRF66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYun pyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRC dWKuh+vy1dneVrOfzM4UKLkNl2BcEkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTf fwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38FnSbNd67IJKusm7Xi+fT8r87cm NW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i8b5QZ7dsvfPx H2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g== -----END CERTIFICATE----- # Issuer: CN=DigiCert Global Root CA O=DigiCert Inc OU=www.digicert.com # Subject: CN=DigiCert Global Root CA O=DigiCert Inc OU=www.digicert.com # Label: "DigiCert Global Root CA" # Serial: 10944719598952040374951832963794454346 # MD5 Fingerprint: 79:e4:a9:84:0d:7d:3a:96:d7:c0:4f:e2:43:4c:89:2e # SHA1 Fingerprint: a8:98:5d:3a:65:e5:e5:c4:b2:d7:d6:6d:40:c6:dd:2f:b1:9c:54:36 # SHA256 Fingerprint: 43:48:a0:e9:44:4c:78:cb:26:5e:05:8d:5e:89:44:b4:d8:4f:96:62:bd:26:db:25:7f:89:34:a4:43:c7:01:61 -----BEGIN CERTIFICATE----- MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG 9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97 nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt 43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4 gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg 06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= -----END CERTIFICATE----- # Issuer: CN=DigiCert High Assurance EV Root CA O=DigiCert Inc OU=www.digicert.com # Subject: CN=DigiCert High Assurance EV Root CA O=DigiCert Inc OU=www.digicert.com # Label: "DigiCert High Assurance EV Root CA" # Serial: 3553400076410547919724730734378100087 # MD5 Fingerprint: d4:74:de:57:5c:39:b2:d3:9c:85:83:c5:c0:65:49:8a # SHA1 Fingerprint: 5f:b7:ee:06:33:e2:59:db:ad:0c:4c:9a:e6:d3:8f:1a:61:c7:dc:25 # SHA256 Fingerprint: 74:31:e5:f4:c3:c1:ce:46:90:77:4f:0b:61:e0:54:40:88:3b:a9:a0:1e:d0:0b:a6:ab:d7:80:6e:d3:b1:18:cf -----BEGIN CERTIFICATE----- MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3 LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm +9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3 hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2 Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep +OkuE6N36B9K -----END CERTIFICATE----- # Issuer: CN=SwissSign Gold CA - G2 O=SwissSign AG # Subject: CN=SwissSign Gold CA - G2 O=SwissSign AG # Label: "SwissSign Gold CA - G2" # Serial: 13492815561806991280 # MD5 Fingerprint: 24:77:d9:a8:91:d1:3b:fa:88:2d:c2:ff:f8:cd:33:93 # SHA1 Fingerprint: d8:c5:38:8a:b7:30:1b:1b:6e:d4:7a:e6:45:25:3a:6f:9f:1a:27:61 # SHA256 Fingerprint: 62:dd:0b:e9:b9:f5:0a:16:3e:a0:f8:e7:5c:05:3b:1e:ca:57:ea:55:c8:68:8f:64:7c:68:81:f2:c8:35:7b:95 -----BEGIN CERTIFICATE----- MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV BAYTAkNIMRUwEwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2ln biBHb2xkIENBIC0gRzIwHhcNMDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBF MQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dpc3NTaWduIEFHMR8wHQYDVQQDExZT d2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC CgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUqt2/8 76LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+ bbqBHH5CjCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c 6bM8K8vzARO/Ws/BtQpgvd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqE emA8atufK+ze3gE/bk3lUIbLtK/tREDFylqM2tIrfKjuvqblCqoOpd8FUrdVxyJd MmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvRAiTysybUa9oEVeXBCsdt MDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuendjIj3o02y MszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69y FGkOpeUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPi aG59je883WX0XaxR7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxM gI93e2CaHt+28kgeDrpOVG2Y4OGiGqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCB qTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUWyV7 lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64OfPAeGZe6Drn 8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe6 45R88a7A3hfm5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczO UYrHUDFu4Up+GC9pWbY9ZIEr44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5 O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOfMke6UiI0HTJ6CVanfCU2qT1L2sCC bwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6mGu6uLftIdxf+u+yv GPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxpmo/a 77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCC hdiDyyJkvC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid3 92qgQmwLOM7XdVAyksLfKzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEpp Ld6leNcG2mqeSz53OiATIgHQv2ieY2BrNU0LbbqhPcCT4H8js1WtciVORvnSFu+w ZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6LqjviOvrv1vA+ACOzB2+htt Qc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ -----END CERTIFICATE----- # Issuer: CN=SecureTrust CA O=SecureTrust Corporation # Subject: CN=SecureTrust CA O=SecureTrust Corporation # Label: "SecureTrust CA" # Serial: 17199774589125277788362757014266862032 # MD5 Fingerprint: dc:32:c3:a7:6d:25:57:c7:68:09:9d:ea:2d:a9:a2:d1 # SHA1 Fingerprint: 87:82:c6:c3:04:35:3b:cf:d2:96:92:d2:59:3e:7d:44:d9:34:ff:11 # SHA256 Fingerprint: f1:c1:b5:0a:e5:a2:0d:d8:03:0e:c9:f6:bc:24:82:3d:d3:67:b5:25:57:59:b4:e7:1b:61:fc:e9:f7:37:5d:73 -----BEGIN CERTIFICATE----- MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBI MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x FzAVBgNVBAMTDlNlY3VyZVRydXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIz MTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1NlY3VyZVRydXN0IENv cnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCCASIwDQYJKoZIhvcN AQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQXOZEz Zum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO 0gMdA+9tDWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIao wW8xQmxSPmjL8xk037uHGFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj 7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b01k/unK8RCSc43Oz969XL0Imnal0ugBS 8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmHursCAwEAAaOBnTCBmjAT BgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB /zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCeg JYYjaHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGC NxUBBAMCAQAwDQYJKoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt3 6Z3q059c4EVlew3KW+JwULKUBRSuSceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/ 3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHfmbx8IVQr5Fiiu1cprp6poxkm D5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZnMUFdAvnZyPS CPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE= -----END CERTIFICATE----- # Issuer: CN=Secure Global CA O=SecureTrust Corporation # Subject: CN=Secure Global CA O=SecureTrust Corporation # Label: "Secure Global CA" # Serial: 9751836167731051554232119481456978597 # MD5 Fingerprint: cf:f4:27:0d:d4:ed:dc:65:16:49:6d:3d:da:bf:6e:de # SHA1 Fingerprint: 3a:44:73:5a:e5:81:90:1f:24:86:61:46:1e:3b:9c:c4:5f:f5:3a:1b # SHA256 Fingerprint: 42:00:f5:04:3a:c8:59:0e:bb:52:7d:20:9e:d1:50:30:29:fb:cb:d4:1c:a1:b5:06:ec:27:f1:5a:de:7d:ac:69 -----BEGIN CERTIFICATE----- MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBK MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x GTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkx MjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3Qg Q29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwggEiMA0GCSqG SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jxYDiJ iQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa /FHtaMbQbqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJ jnIFHovdRIWCQtBJwB1g8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnI HmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYVHDGA76oYa8J719rO+TMg1fW9ajMtgQT7 sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi0XPnj3pDAgMBAAGjgZ0w gZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1UdEwEB/wQF MAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCsw KaAnoCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsG AQQBgjcVAQQDAgEAMA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0L URYD7xh8yOOvaliTFGCRsoTciE6+OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXO H0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cnCDpOGR86p1hcF895P4vkp9Mm I50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/53CYNv6ZHdAbY iNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW -----END CERTIFICATE----- # Issuer: CN=COMODO Certification Authority O=COMODO CA Limited # Subject: CN=COMODO Certification Authority O=COMODO CA Limited # Label: "COMODO Certification Authority" # Serial: 104350513648249232941998508985834464573 # MD5 Fingerprint: 5c:48:dc:f7:42:72:ec:56:94:6d:1c:cc:71:35:80:75 # SHA1 Fingerprint: 66:31:bf:9e:f7:4f:9e:b6:c9:d5:a6:0c:ba:6a:be:d1:f7:bd:ef:7b # SHA256 Fingerprint: 0c:2c:d6:3d:f7:80:6f:a3:99:ed:e8:09:11:6b:57:5b:f8:79:89:f0:65:18:f9:80:8c:86:05:03:17:8b:af:66 -----BEGIN CERTIFICATE----- MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCB gTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNV BAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEyMDEwMDAw MDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEbMBkGA1UECBMSR3Jl YXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFDT01P RE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0 aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3 UcEbVASY06m/weaKXTuH+7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI 2GqGd0S7WWaXUF601CxwRM/aN5VCaTwwxHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8 Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV4EajcNxo2f8ESIl33rXp +2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA1KGzqSX+ DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5O nKVIrLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW /zAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6g PKA6hjhodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9u QXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOCAQEAPpiem/Yb6dc5t3iuHXIY SdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CPOGEIqB6BCsAv IC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/ RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4 zJVSk/BwJVmcIGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5dd BA6+C4OmF4O5MBKgxTMVBbkN+8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IB ZQ== -----END CERTIFICATE----- # Issuer: CN=COMODO ECC Certification Authority O=COMODO CA Limited # Subject: CN=COMODO ECC Certification Authority O=COMODO CA Limited # Label: "COMODO ECC Certification Authority" # Serial: 41578283867086692638256921589707938090 # MD5 Fingerprint: 7c:62:ff:74:9d:31:53:5e:68:4a:d5:78:aa:1e:bf:23 # SHA1 Fingerprint: 9f:74:4e:9f:2b:4d:ba:ec:0f:31:2c:50:b6:56:3b:8e:2d:93:c3:11 # SHA256 Fingerprint: 17:93:92:7a:06:14:54:97:89:ad:ce:2f:8f:34:f7:f0:b6:6d:0f:3a:e3:a3:b8:4d:21:ec:15:db:ba:4f:ad:c7 -----BEGIN CERTIFICATE----- MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTEL MAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE BxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMT IkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDgwMzA2MDAw MDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdy ZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09N T0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlv biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSR FtSrYpn1PlILBs5BAH+X4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0J cfRK9ChQtP6IHG4/bC8vCVlbpVsLM5niwz2J+Wos77LTBumjQjBAMB0GA1UdDgQW BBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VGFAkK+qDm fQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdv GDeAU/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY= -----END CERTIFICATE----- # Issuer: CN=Certigna O=Dhimyotis # Subject: CN=Certigna O=Dhimyotis # Label: "Certigna" # Serial: 18364802974209362175 # MD5 Fingerprint: ab:57:a6:5b:7d:42:82:19:b5:d8:58:26:28:5e:fd:ff # SHA1 Fingerprint: b1:2e:13:63:45:86:a4:6f:1a:b2:60:68:37:58:2d:c4:ac:fd:94:97 # SHA256 Fingerprint: e3:b6:a2:db:2e:d7:ce:48:84:2f:7a:c5:32:41:c7:b7:1d:54:14:4b:fb:40:c1:1f:3f:1d:0b:42:f5:ee:a1:2d -----BEGIN CERTIFICATE----- MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNV BAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4X DTA3MDYyOTE1MTMwNVoXDTI3MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQ BgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwIQ2VydGlnbmEwggEiMA0GCSqGSIb3 DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7qXOEm7RFHYeGifBZ4 QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyHGxny gQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbw zBfsV1/pogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q 130yGLMLLGq/jj8UEYkgDncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2 JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKfIrjxwo1p3Po6WAbfAgMBAAGjgbwwgbkw DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQtCRZvgHyUtVF9lo53BEw ZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJBgNVBAYT AkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzj AQ/JSP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG 9w0BAQUFAAOCAQEAhQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8h bV6lUmPOEvjvKtpv6zf+EwLHyzs+ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFnc fca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1kluPBS1xp81HlDQwY9qcEQCYsuu HWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY1gkIl2PlwS6w t0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg== -----END CERTIFICATE----- # Issuer: O=Chunghwa Telecom Co., Ltd. OU=ePKI Root Certification Authority # Subject: O=Chunghwa Telecom Co., Ltd. OU=ePKI Root Certification Authority # Label: "ePKI Root Certification Authority" # Serial: 28956088682735189655030529057352760477 # MD5 Fingerprint: 1b:2e:00:ca:26:06:90:3d:ad:fe:6f:15:68:d3:6b:b3 # SHA1 Fingerprint: 67:65:0d:f1:7e:8e:7e:5b:82:40:a4:f4:56:4b:cf:e2:3d:69:c6:f0 # SHA256 Fingerprint: c0:a6:f4:dc:63:a2:4b:fd:cf:54:ef:2a:6a:08:2a:0a:72:de:35:80:3e:2f:f5:ff:52:7a:e5:d8:72:06:df:d5 -----BEGIN CERTIFICATE----- MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBe MQswCQYDVQQGEwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0 ZC4xKjAoBgNVBAsMIWVQS0kgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe Fw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMxMjdaMF4xCzAJBgNVBAYTAlRXMSMw IQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEqMCgGA1UECwwhZVBL SSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEF AAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAH SyZbCUNsIZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAh ijHyl3SJCRImHJ7K2RKilTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3X DZoTM1PRYfl61dd4s5oz9wCGzh1NlDivqOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1 TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX12ruOzjjK9SXDrkb5wdJ fzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0OWQqraffA sgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uU WH1+ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLS nT0IFaUQAS2zMnaolQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pH dmX2Os+PYhcZewoozRrSgx4hxyy/vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJip NiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXiZo1jDiVN1Rmy5nk3pyKdVDEC AwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/QkqiMAwGA1UdEwQF MAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGB uvl2ICO1J2B01GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6Yl PwZpVnPDimZI+ymBV3QGypzqKOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkP JXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdVxrsStZf0X4OFunHB2WyBEXYKCrC/ gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEPNXubrjlpC2JgQCA2 j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+rGNm6 5ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUB o2M3IUxExJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS /jQ6fbjpKdx2qcgw+BRxgMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2z Gp1iro2C6pSe3VkQw63d4k3jMdXH7OjysP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTE W9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmODBCEIZ43ygknQW/2xzQ+D hNQ+IIX3Sj0rnP0qCglN6oH4EZw= -----END CERTIFICATE----- # Issuer: O=certSIGN OU=certSIGN ROOT CA # Subject: O=certSIGN OU=certSIGN ROOT CA # Label: "certSIGN ROOT CA" # Serial: 35210227249154 # MD5 Fingerprint: 18:98:c0:d6:e9:3a:fc:f9:b0:f5:0c:f7:4b:01:44:17 # SHA1 Fingerprint: fa:b7:ee:36:97:26:62:fb:2d:b0:2a:f6:bf:03:fd:e8:7c:4b:2f:9b # SHA256 Fingerprint: ea:a9:62:c4:fa:4a:6b:af:eb:e4:15:19:6d:35:1c:cd:88:8d:4f:53:f3:fa:8a:e6:d7:c4:66:a9:4e:60:42:bb -----BEGIN CERTIFICATE----- MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYT AlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBD QTAeFw0wNjA3MDQxNzIwMDRaFw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJP MREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTCC ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7IJUqOtdu0KBuqV5Do 0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHHrfAQ UySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5d RdY4zTW2ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQ OA7+j0xbm0bqQfWwCHTD0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwv JoIQ4uNllAoEwF73XVv4EOLQunpL+943AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08C AwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAcYwHQYDVR0O BBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IBAQA+0hyJ LjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecY MnQ8SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ 44gx+FkagQnIl6Z0x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6I Jd1hJyMctTEHBDa0GpC9oHRxUIltvBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNw i/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7NzTogVZ96edhBiIL5VaZVDADlN 9u6wWk5JRFRYX0KD -----END CERTIFICATE----- # Issuer: CN=NetLock Arany (Class Gold) F\u0151tan\xfas\xedtv\xe1ny O=NetLock Kft. OU=Tan\xfas\xedtv\xe1nykiad\xf3k (Certification Services) # Subject: CN=NetLock Arany (Class Gold) F\u0151tan\xfas\xedtv\xe1ny O=NetLock Kft. OU=Tan\xfas\xedtv\xe1nykiad\xf3k (Certification Services) # Label: "NetLock Arany (Class Gold) F\u0151tan\xfas\xedtv\xe1ny" # Serial: 80544274841616 # MD5 Fingerprint: c5:a1:b7:ff:73:dd:d6:d7:34:32:18:df:fc:3c:ad:88 # SHA1 Fingerprint: 06:08:3f:59:3f:15:a1:04:a0:69:a4:6b:a9:03:d0:06:b7:97:09:91 # SHA256 Fingerprint: 6c:61:da:c3:a2:de:f0:31:50:6b:e0:36:d2:a6:fe:40:19:94:fb:d1:3d:f9:c8:d4:66:59:92:74:c4:46:ec:98 -----BEGIN CERTIFICATE----- MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQG EwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3 MDUGA1UECwwuVGFuw7pzw610dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNl cnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBBcmFueSAoQ2xhc3MgR29sZCkgRsWR dGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgxMjA2MTUwODIxWjCB pzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxOZXRM b2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlm aWNhdGlvbiBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNz IEdvbGQpIEbFkXRhbsO6c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A MIIBCgKCAQEAxCRec75LbRTDofTjl5Bu0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrT lF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw/HpYzY6b7cNGbIRwXdrz AZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAkH3B5r9s5 VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRG ILdwfzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2 BJtr+UBdADTHLpl1neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAG AQH/AgEEMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2M U9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwWqZw8UQCgwBEIBaeZ5m8BiFRh bvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTtaYtOUZcTh5m2C +C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2F uLjbvrW5KfnaNwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2 XjG4Kvte9nHfRCaexOYNkbQudZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E= -----END CERTIFICATE----- # Issuer: CN=Microsec e-Szigno Root CA 2009 O=Microsec Ltd. # Subject: CN=Microsec e-Szigno Root CA 2009 O=Microsec Ltd. # Label: "Microsec e-Szigno Root CA 2009" # Serial: 14014712776195784473 # MD5 Fingerprint: f8:49:f4:03:bc:44:2d:83:be:48:69:7d:29:64:fc:b1 # SHA1 Fingerprint: 89:df:74:fe:5c:f4:0f:4a:80:f9:e3:37:7d:54:da:91:e1:01:31:8e # SHA256 Fingerprint: 3c:5f:81:fe:a5:fa:b8:2c:64:bf:a2:ea:ec:af:cd:e8:e0:77:fc:86:20:a7:ca:e5:37:16:3d:f3:6e:db:f3:78 -----BEGIN CERTIFICATE----- MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYD VQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0 ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0G CSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTAeFw0wOTA2MTYxMTMwMThaFw0y OTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3Qx FjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3pp Z25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o dTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvP kd6mJviZpWNwrZuuyjNAfW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tc cbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG0IMZfcChEhyVbUr02MelTTMuhTlAdX4U fIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKApxn1ntxVUwOXewdI/5n7 N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm1HxdrtbC xkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1 +rUCAwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G A1UdDgQWBBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPM Pcu1SCOhGnqmKrs0aDAbBgNVHREEFDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqG SIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0olZMEyL/azXm4Q5DwpL7v8u8h mLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfXI/OMn74dseGk ddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775 tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c 2Pm2G2JwCz02yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5t HMN1Rq41Bab2XD0h7lbwyYIiLXpUq3DDfSJlgnCW -----END CERTIFICATE----- # Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R3 # Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R3 # Label: "GlobalSign Root CA - R3" # Serial: 4835703278459759426209954 # MD5 Fingerprint: c5:df:b8:49:ca:05:13:55:ee:2d:ba:1a:c3:3e:b0:28 # SHA1 Fingerprint: d6:9b:56:11:48:f0:1c:77:c5:45:78:c1:09:26:df:5b:85:69:76:ad # SHA256 Fingerprint: cb:b5:22:d7:b7:f1:27:ad:6a:01:13:86:5b:df:1c:d4:10:2e:7d:07:59:af:63:5a:7c:f4:72:0d:c9:63:c5:3b -----BEGIN CERTIFICATE----- MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4 MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI hvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8 RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT gHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm KPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ XriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o LkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU RUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp jjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK 6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX mcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH WD9f -----END CERTIFICATE----- # Issuer: CN=Izenpe.com O=IZENPE S.A. # Subject: CN=Izenpe.com O=IZENPE S.A. # Label: "Izenpe.com" # Serial: 917563065490389241595536686991402621 # MD5 Fingerprint: a6:b0:cd:85:80:da:5c:50:34:a3:39:90:2f:55:67:73 # SHA1 Fingerprint: 2f:78:3d:25:52:18:a7:4a:65:39:71:b5:2c:a2:9c:45:15:6f:e9:19 # SHA256 Fingerprint: 25:30:cc:8e:98:32:15:02:ba:d9:6f:9b:1f:ba:1b:09:9e:2d:29:9e:0f:45:48:bb:91:4f:36:3b:c0:d4:53:1f -----BEGIN CERTIFICATE----- MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4 MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6 ZW5wZS5jb20wHhcNMDcxMjEzMTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYD VQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5j b20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ03rKDx6sp4boFmVq scIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAKClaO xdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6H LmYRY2xU+zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFX uaOKmMPsOzTFlUFpfnXCPCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQD yCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxTOTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+ JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbKF7jJeodWLBoBHmy+E60Q rLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK0GqfvEyN BjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8L hij+0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIB QFqNeb+Lz0vPqhbBleStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+ HMh3/1uaD7euBUbl8agW7EekFwIDAQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2lu Zm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+SVpFTlBFIFMuQS4gLSBDSUYg QTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBGNjIgUzgxQzBB BgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC AQYwHQYDVR0OBBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUA A4ICAQB4pgwWSp9MiDrAyw6lFn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWb laQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbgakEyrkgPH7UIBzg/YsfqikuFgba56 awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8qhT/AQKM6WfxZSzwo JNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Csg1lw LDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCT VyvehQP5aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGk LhObNA5me0mrZJfQRsN5nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJb UjWumDqtujWTI6cfSN01RpiyEGjkpTHCClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/ QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZoQ0iy2+tzJOeRf1SktoA+ naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1ZWrOZyGls QyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw== -----END CERTIFICATE----- # Issuer: CN=Go Daddy Root Certificate Authority - G2 O=GoDaddy.com, Inc. # Subject: CN=Go Daddy Root Certificate Authority - G2 O=GoDaddy.com, Inc. # Label: "Go Daddy Root Certificate Authority - G2" # Serial: 0 # MD5 Fingerprint: 80:3a:bc:22:c1:e6:fb:8d:9b:3b:27:4a:32:1b:9a:01 # SHA1 Fingerprint: 47:be:ab:c9:22:ea:e8:0e:78:78:34:62:a7:9f:45:c2:54:fd:e6:8b # SHA256 Fingerprint: 45:14:0b:32:47:eb:9c:c8:c5:b4:f0:d7:b5:30:91:f7:32:92:08:9e:6e:5a:63:e2:74:9d:d3:ac:a9:19:8e:da -----BEGIN CERTIFICATE----- MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIz NTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8GA1UE AxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIw DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKD E6bFIEMBO4Tx5oVJnyfq9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH /PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD+qK+ihVqf94Lw7YZFAXK6sOoBJQ7Rnwy DfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutdfMh8+7ArU6SSYmlRJQVh GkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMlNAJWJwGR tDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEA AaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE FDqahQcQZyi27/a9BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmX WWcDYfF+OwYxdS2hII5PZYe096acvNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu 9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r5N9ss4UXnT3ZJE95kTXWXwTr gIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYVN8Gb5DKj7Tjo 2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI 4uJEvlz36hz1 -----END CERTIFICATE----- # Issuer: CN=Starfield Root Certificate Authority - G2 O=Starfield Technologies, Inc. # Subject: CN=Starfield Root Certificate Authority - G2 O=Starfield Technologies, Inc. # Label: "Starfield Root Certificate Authority - G2" # Serial: 0 # MD5 Fingerprint: d6:39:81:c6:52:7e:96:69:fc:fc:ca:66:ed:05:f2:96 # SHA1 Fingerprint: b5:1c:06:7c:ee:2b:0c:3d:f8:55:ab:2d:92:f4:fe:39:d4:e7:0f:0e # SHA256 Fingerprint: 2c:e1:cb:0b:f9:d2:f9:e1:02:99:3f:be:21:51:52:c3:b2:dd:0c:ab:de:1c:68:e5:31:9b:83:91:54:db:b7:f5 -----BEGIN CERTIFICATE----- MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVs ZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAw MFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6 b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQgVGVj aG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZp Y2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC ggEBAL3twQP89o/8ArFvW59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMg nLRJdzIpVv257IzdIvpy3Cdhl+72WoTsbhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1 HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNkN3mSwOxGXn/hbVNMYq/N Hwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7NfZTD4p7dN dloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0 HZbUJtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0G CSqGSIb3DQEBCwUAA4IBAQARWfolTwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjU sHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx4mcujJUDJi5DnUox9g61DLu3 4jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUwF5okxBDgBPfg 8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1 mMpYjn0q7pBZc2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0 -----END CERTIFICATE----- # Issuer: CN=Starfield Services Root Certificate Authority - G2 O=Starfield Technologies, Inc. # Subject: CN=Starfield Services Root Certificate Authority - G2 O=Starfield Technologies, Inc. # Label: "Starfield Services Root Certificate Authority - G2" # Serial: 0 # MD5 Fingerprint: 17:35:74:af:7b:61:1c:eb:f4:f9:3c:e2:ee:40:f9:a2 # SHA1 Fingerprint: 92:5a:8f:8d:2c:6d:04:e0:66:5f:59:6a:ff:22:d8:63:e8:25:6f:3f # SHA256 Fingerprint: 56:8d:69:05:a2:c8:87:08:a4:b3:02:51:90:ed:cf:ed:b1:97:4a:60:6a:13:c6:e5:29:0f:cb:2a:e6:3e:da:b5 -----BEGIN CERTIFICATE----- MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMx EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVs ZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5 MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNVBAYTAlVTMRAwDgYD VQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFy ZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2Vy dmljZXMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI hvcNAQEBBQADggEPADCCAQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20p OsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm2 8xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4PahHQUw2eeBGg6345AWh1K Ts9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLPLJGmpufe hRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk 6mFBrMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAw DwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+q AdcwKziIorhtSpzyEZGDMA0GCSqGSIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMI bw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPPE95Dz+I0swSdHynVv/heyNXB ve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTyxQGjhdByPq1z qwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn 0q23KXB56jzaYyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCN sSi6 -----END CERTIFICATE----- # Issuer: CN=Certum Trusted Network CA O=Unizeto Technologies S.A. OU=Certum Certification Authority # Subject: CN=Certum Trusted Network CA O=Unizeto Technologies S.A. OU=Certum Certification Authority # Label: "Certum Trusted Network CA" # Serial: 279744 # MD5 Fingerprint: d5:e9:81:40:c5:18:69:fc:46:2c:89:75:62:0f:aa:78 # SHA1 Fingerprint: 07:e0:32:e0:20:b7:2c:3f:19:2f:06:28:a2:59:3a:19:a7:0f:06:9e # SHA256 Fingerprint: 5c:58:46:8d:55:f5:8e:49:7e:74:39:82:d2:b5:00:10:b6:d1:65:37:4a:cf:83:a7:d4:a3:2d:b7:68:c4:40:8e -----BEGIN CERTIFICATE----- MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBM MSIwIAYDVQQKExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5D ZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBU cnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIyMTIwNzM3WhcNMjkxMjMxMTIwNzM3 WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMg Uy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MSIw IAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0B AQEFAAOCAQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rH UV+rpDKmYYe2bg+G0jACl/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LM TXPb865Px1bVWqeWifrzq2jUI4ZZJ88JJ7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVU BBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4fOQtf/WsX+sWn7Et0brM kUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0cvW0QM8x AcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNV HRMBAf8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNV HQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15y sHhE49wcrwn9I0j6vSrEuVUEtRCjjSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfL I9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1mS1FhIrlQgnXdAIv94nYmem8 J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5ajZt3hrvJBW8qY VoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw= -----END CERTIFICATE----- # Issuer: CN=TWCA Root Certification Authority O=TAIWAN-CA OU=Root CA # Subject: CN=TWCA Root Certification Authority O=TAIWAN-CA OU=Root CA # Label: "TWCA Root Certification Authority" # Serial: 1 # MD5 Fingerprint: aa:08:8f:f6:f9:7b:b7:f2:b1:a7:1e:9b:ea:ea:bd:79 # SHA1 Fingerprint: cf:9e:87:6d:d3:eb:fc:42:26:97:a3:b5:a3:7a:a0:76:a9:06:23:48 # SHA256 Fingerprint: bf:d8:8f:e1:10:1c:41:ae:3e:80:1b:f8:be:56:35:0e:e9:ba:d1:a6:b9:bd:51:5e:dc:5c:6d:5b:87:11:ac:44 -----BEGIN CERTIFICATE----- MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzES MBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFU V0NBIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMz WhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJVEFJV0FO LUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlm aWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB AQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFE AcK0HMMxQhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HH K3XLfJ+utdGdIzdjp9xCoi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeX RfwZVzsrb+RH9JlF/h3x+JejiB03HFyP4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/z rX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1ry+UPizgN7gr8/g+YnzAx 3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkq hkiG9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeC MErJk/9q56YAf4lCmtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdls XebQ79NqZp4VKIV66IIArB6nCWlWQtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62D lhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVYT0bf+215WfKEIlKuD8z7fDvn aspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocnyYh0igzyXxfkZ YiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw== -----END CERTIFICATE----- # Issuer: O=SECOM Trust Systems CO.,LTD. OU=Security Communication RootCA2 # Subject: O=SECOM Trust Systems CO.,LTD. OU=Security Communication RootCA2 # Label: "Security Communication RootCA2" # Serial: 0 # MD5 Fingerprint: 6c:39:7d:a4:0e:55:59:b2:3f:d6:41:b1:12:50:de:43 # SHA1 Fingerprint: 5f:3b:8c:f2:f8:10:b3:7d:78:b4:ce:ec:19:19:c3:73:34:b9:c7:74 # SHA256 Fingerprint: 51:3b:2c:ec:b8:10:d4:cd:e5:dd:85:39:1a:df:c6:c2:dd:60:d8:7b:b7:36:d2:b5:21:48:4a:a4:7a:0e:be:f6 -----BEGIN CERTIFICATE----- MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDEl MCMGA1UEChMcU0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMe U2VjdXJpdHkgQ29tbXVuaWNhdGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoX DTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRy dXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3VyaXR5IENvbW11bmlj YXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANAV OVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGr zbl+dp+++T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVM VAX3NuRFg3sUZdbcDE3R3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQ hNBqyjoGADdH5H5XTz+L62e4iKrFvlNVspHEfbmwhRkGeC7bYRr6hfVKkaHnFtWO ojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1KEOtOghY6rCcMU/Gt1SSw awNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8QIH4D5cs OPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3 DQEBCwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpF coJxDjrSzG+ntKEju/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXc okgfGT+Ok+vx+hfuzU7jBBJV1uXk3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8 t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6qtnRGEmyR7jTV7JqR50S+kDFy 1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29mvVXIwAHIRc/ SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03 -----END CERTIFICATE----- # Issuer: CN=Actalis Authentication Root CA O=Actalis S.p.A./03358520967 # Subject: CN=Actalis Authentication Root CA O=Actalis S.p.A./03358520967 # Label: "Actalis Authentication Root CA" # Serial: 6271844772424770508 # MD5 Fingerprint: 69:c1:0d:4f:07:a3:1b:c3:fe:56:3d:04:bc:11:f6:a6 # SHA1 Fingerprint: f3:73:b3:87:06:5a:28:84:8a:f2:f3:4a:ce:19:2b:dd:c7:8e:9c:ac # SHA256 Fingerprint: 55:92:60:84:ec:96:3a:64:b9:6e:2a:be:01:ce:0b:a8:6a:64:fb:fe:bc:c7:aa:b5:af:c1:55:b3:7f:d7:60:66 -----BEGIN CERTIFICATE----- MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UE BhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8w MzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290 IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDkyMjExMjIwMlowazELMAkGA1UEBhMC SVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1 ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENB MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNv UTufClrJwkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX 4ay8IMKx4INRimlNAJZaby/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9 KK3giq0itFZljoZUj5NDKd45RnijMCO6zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/ gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1fYVEiVRvjRuPjPdA1Yprb rxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2oxgkg4YQ 51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2F be8lEfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxe KF+w6D9Fz8+vm2/7hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4F v6MGn8i1zeQf1xcGDXqVdFUNaBr8EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbn fpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5jF66CyCU3nuDuP/jVo23Eek7 jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLYiDrIn3hm7Ynz ezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQAL e3KHwGCmSUyIWOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70 jsNjLiNmsGe+b7bAEzlgqqI0JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDz WochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKxK3JCaKygvU5a2hi/a5iB0P2avl4V SM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+Xlff1ANATIGk0k9j pwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC4yyX X04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+Ok fcvHlXHo2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7R K4X9p2jIugErsWx0Hbhzlefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btU ZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXemOR/qnuOf0GZvBeyqdn6/axag67XH/JJU LysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9vwGYT7JZVEc+NHt4bVaT LnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg== -----END CERTIFICATE----- # Issuer: CN=Buypass Class 2 Root CA O=Buypass AS-983163327 # Subject: CN=Buypass Class 2 Root CA O=Buypass AS-983163327 # Label: "Buypass Class 2 Root CA" # Serial: 2 # MD5 Fingerprint: 46:a7:d2:fe:45:fb:64:5a:a8:59:90:9b:78:44:9b:29 # SHA1 Fingerprint: 49:0a:75:74:de:87:0a:47:fe:58:ee:f6:c7:6b:eb:c6:0b:12:40:99 # SHA256 Fingerprint: 9a:11:40:25:19:7c:5b:b9:5d:94:e6:3d:55:cd:43:79:08:47:b6:46:b2:3c:df:11:ad:a4:a0:0e:ff:15:fb:48 -----BEGIN CERTIFICATE----- MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg Q2xhc3MgMiBSb290IENBMB4XDTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1ow TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw HgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB BQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1g1Lr 6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPV L4O2fuPn9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC91 1K2GScuVr1QGbNgGE41b/+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHx MlAQTn/0hpPshNOOvEu/XAFOBz3cFIqUCqTqc/sLUegTBxj6DvEr0VQVfTzh97QZ QmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeffawrbD02TTqigzXsu8lkB arcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgIzRFo1clr Us3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLi FRhnBkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRS P/TizPJhk9H9Z2vXUq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN 9SG9dKpN6nIDSdvHXx1iY8f93ZHsM+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxP AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMmAd+BikoL1Rpzz uvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAU18h 9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3t OluwlN5E40EIosHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo +fsicdl9sz1Gv7SEr5AcD48Saq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7 KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYdDnkM/crqJIByw5c/8nerQyIKx+u2 DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWDLfJ6v9r9jv6ly0Us H8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0oyLQ I+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK7 5t98biGCwWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h 3PFaTWwyI0PurKju7koSCTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPz Y11aWOIv4x3kqdbQCtCev9eBCfHJxyYNrJgWVqA= -----END CERTIFICATE----- # Issuer: CN=Buypass Class 3 Root CA O=Buypass AS-983163327 # Subject: CN=Buypass Class 3 Root CA O=Buypass AS-983163327 # Label: "Buypass Class 3 Root CA" # Serial: 2 # MD5 Fingerprint: 3d:3b:18:9e:2c:64:5a:e8:d5:88:ce:0e:f9:37:c2:ec # SHA1 Fingerprint: da:fa:f7:fa:66:84:ec:06:8f:14:50:bd:c7:c2:81:a5:bc:a9:64:57 # SHA256 Fingerprint: ed:f7:eb:bc:a2:7a:2a:38:4d:38:7b:7d:40:10:c6:66:e2:ed:b4:84:3e:4c:29:b4:ae:1d:5b:93:32:e6:b2:4d -----BEGIN CERTIFICATE----- MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg Q2xhc3MgMyBSb290IENBMB4XDTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFow TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw HgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB BQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRHsJ8Y ZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3E N3coTRiR5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9 tznDDgFHmV0ST9tD+leh7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX 0DJq1l1sDPGzbjniazEuOQAnFN44wOwZZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c /3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH2xc519woe2v1n/MuwU8X KhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV/afmiSTY zIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvS O1UQRwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D 34xFMFbG02SrZvPAXpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgP K9Dx2hzLabjKSWJtyNBjYt1gD1iqj6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3 AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFEe4zf/lb+74suwv Tg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAACAj QTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXS IGrs/CIBKM+GuIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2 HJLw5QY33KbmkJs4j1xrG0aGQ0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsa O5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8ZORK15FTAaggiG6cX0S5y2CBNOxv 033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2KSb12tjE8nVhz36u dmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz6MkE kbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg41 3OEMXbugUZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvD u79leNKGef9JOxqDDPDeeOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq 4/g7u9xN12TyUb7mqqta6THuBrxzvxNiCp/HuZc= -----END CERTIFICATE----- # Issuer: CN=T-TeleSec GlobalRoot Class 3 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center # Subject: CN=T-TeleSec GlobalRoot Class 3 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center # Label: "T-TeleSec GlobalRoot Class 3" # Serial: 1 # MD5 Fingerprint: ca:fb:40:a8:4e:39:92:8a:1d:fe:8e:2f:c4:27:ea:ef # SHA1 Fingerprint: 55:a6:72:3e:cb:f2:ec:cd:c3:23:74:70:19:9d:2a:be:11:e3:81:d1 # SHA256 Fingerprint: fd:73:da:d3:1c:64:4f:f1:b4:3b:ef:0c:cd:da:96:71:0b:9c:d9:87:5e:ca:7e:31:70:7a:f3:e9:6d:52:2b:bd -----BEGIN CERTIFICATE----- MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl YyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgxMDAxMTAyOTU2WhcNMzMxMDAxMjM1 OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0G CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN 8ELg63iIVl6bmlQdTQyK9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/ RLyTPWGrTs0NvvAgJ1gORH8EGoel15YUNpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4 hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZFiP0Zf3WHHx+xGwpzJFu5 ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W0eDrXltM EnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGj QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1 A/d2O2GCahKqGFPrAyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOy WL6ukK2YJ5f+AbGwUgC4TeQbIXQbfsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ 1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzTucpH9sry9uetuUg/vBa3wW30 6gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7hP0HHRwA11fXT 91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4p TpPDpFQUWw== -----END CERTIFICATE----- # Issuer: CN=D-TRUST Root Class 3 CA 2 2009 O=D-Trust GmbH # Subject: CN=D-TRUST Root Class 3 CA 2 2009 O=D-Trust GmbH # Label: "D-TRUST Root Class 3 CA 2 2009" # Serial: 623603 # MD5 Fingerprint: cd:e0:25:69:8d:47:ac:9c:89:35:90:f7:fd:51:3d:2f # SHA1 Fingerprint: 58:e8:ab:b0:36:15:33:fb:80:f7:9b:1b:6d:29:d3:ff:8d:5f:00:f0 # SHA256 Fingerprint: 49:e7:a4:42:ac:f0:ea:62:87:05:00:54:b5:25:64:b6:50:e4:f4:9e:42:e3:48:d6:aa:38:e0:39:e9:57:b1:c1 -----BEGIN CERTIFICATE----- MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRF MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBD bGFzcyAzIENBIDIgMjAwOTAeFw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NTha ME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMM HkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIwDQYJKoZIhvcNAQEB BQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOADER03 UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42 tSHKXzlABF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9R ySPocq60vFYJfxLLHLGvKZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsM lFqVlNpQmvH/pStmMaTJOKDfHR+4CS7zp+hnUquVH+BGPtikw8paxTGA6Eian5Rp /hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUCAwEAAaOCARowggEWMA8G A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ4PGEMA4G A1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVj dG9yeS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUy MENBJTIwMiUyMDIwMDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRl cmV2b2NhdGlvbmxpc3QwQ6BBoD+GPWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3Js L2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAwOS5jcmwwDQYJKoZIhvcNAQEL BQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm2H6NMLVwMeni acfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0 o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4K zCUqNQT4YJEVdT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8 PIWmawomDeCTmGCufsYkl4phX5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3Y Johw1+qRzT65ysCQblrGXnRl11z+o+I= -----END CERTIFICATE----- # Issuer: CN=D-TRUST Root Class 3 CA 2 EV 2009 O=D-Trust GmbH # Subject: CN=D-TRUST Root Class 3 CA 2 EV 2009 O=D-Trust GmbH # Label: "D-TRUST Root Class 3 CA 2 EV 2009" # Serial: 623604 # MD5 Fingerprint: aa:c6:43:2c:5e:2d:cd:c4:34:c0:50:4f:11:02:4f:b6 # SHA1 Fingerprint: 96:c9:1b:0b:95:b4:10:98:42:fa:d0:d8:22:79:fe:60:fa:b9:16:83 # SHA256 Fingerprint: ee:c5:49:6b:98:8c:e9:86:25:b9:34:09:2e:ec:29:08:be:d0:b0:f3:16:c2:d4:73:0c:84:ea:f1:f3:d3:48:81 -----BEGIN CERTIFICATE----- MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRF MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBD bGFzcyAzIENBIDIgRVYgMjAwOTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUw NDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNV BAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAwOTCCASIwDQYJKoZI hvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfSegpn ljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM0 3TP1YtHhzRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6Z qQTMFexgaDbtCHu39b+T7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lR p75mpoo6Kr3HGrHhFPC+Oh25z1uxav60sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8 HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure3511H3a6UCAwEAAaOCASQw ggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyvcop9Ntea HNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFw Oi8vZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xh c3MlMjAzJTIwQ0ElMjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1E RT9jZXJ0aWZpY2F0ZXJldm9jYXRpb25saXN0MEagRKBChkBodHRwOi8vd3d3LmQt dHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xhc3NfM19jYV8yX2V2XzIwMDku Y3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+PPoeUSbrh/Yp 3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05 nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNF CSuGdXzfX2lXANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7na xpeG0ILD5EJt/rDiZE4OJudANCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqX KVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVvw9y4AyHqnxbxLFS1 -----END CERTIFICATE----- # Issuer: CN=CA Disig Root R2 O=Disig a.s. # Subject: CN=CA Disig Root R2 O=Disig a.s. # Label: "CA Disig Root R2" # Serial: 10572350602393338211 # MD5 Fingerprint: 26:01:fb:d8:27:a7:17:9a:45:54:38:1a:43:01:3b:03 # SHA1 Fingerprint: b5:61:eb:ea:a4:de:e4:25:4b:69:1a:98:a5:57:47:c2:34:c7:d9:71 # SHA256 Fingerprint: e2:3d:4a:03:6d:7b:70:e9:f5:95:b1:42:20:79:d2:b9:1e:df:bb:1f:b6:51:a0:63:3e:aa:8a:9d:c5:f8:07:03 -----BEGIN CERTIFICATE----- MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNV BAYTAlNLMRMwEQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMu MRkwFwYDVQQDExBDQSBEaXNpZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQy MDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sxEzARBgNVBAcTCkJyYXRpc2xhdmEx EzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERpc2lnIFJvb3QgUjIw ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbCw3Oe NcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNH PWSb6WiaxswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3I x2ymrdMxp7zo5eFm1tL7A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbe QTg06ov80egEFGEtQX6sx3dOy1FU+16SGBsEWmjGycT6txOgmLcRK7fWV8x8nhfR yyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqVg8NTEQxzHQuyRpDRQjrO QG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa5Beny912 H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJ QfYEkoopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUD i/ZnWejBBhG93c+AAk9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORs nLMOPReisjQS1n6yqEm70XooQL6iFh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1 rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud DwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5uQu0wDQYJKoZI hvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqf GopTpti72TVVsRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkb lvdhuDvEK7Z4bLQjb/D907JedR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka +elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W81k/BfDxujRNt+3vrMNDcTa/F1bal TFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjxmHHEt38OFdAlab0i nSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01utI3 gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18Dr G5gPcFw0sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3Os zMOl6W8KjptlwlCFtaOgUxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8x L4ysEr3vQCj8KWefshNPZiTEUxnpHikV7+ZtsH8tZ/3zbBt1RqPlShfppNcL -----END CERTIFICATE----- # Issuer: CN=ACCVRAIZ1 O=ACCV OU=PKIACCV # Subject: CN=ACCVRAIZ1 O=ACCV OU=PKIACCV # Label: "ACCVRAIZ1" # Serial: 6828503384748696800 # MD5 Fingerprint: d0:a0:5a:ee:05:b6:09:94:21:a1:7d:f1:b2:29:82:02 # SHA1 Fingerprint: 93:05:7a:88:15:c6:4f:ce:88:2f:fa:91:16:52:28:78:bc:53:64:17 # SHA256 Fingerprint: 9a:6e:c0:12:e1:a7:da:9d:be:34:19:4d:47:8a:d7:c0:db:18:22:fb:07:1d:f1:29:81:49:6e:d1:04:38:41:13 -----BEGIN CERTIFICATE----- MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UE AwwJQUNDVlJBSVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQsw CQYDVQQGEwJFUzAeFw0xMTA1MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQ BgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwHUEtJQUNDVjENMAsGA1UECgwEQUND VjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCb qau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gMjmoY HtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWo G2ioPej0RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpA lHPrzg5XPAOBOp0KoVdDaaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhr IA8wKFSVf+DuzgpmndFALW4ir50awQUZ0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/ 0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDGWuzndN9wrqODJerWx5eH k6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs78yM2x/47 4KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMO m3WR5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpa cXpkatcnYGMN285J9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPl uUsXQA+xtrn13k/c4LOsOxFwYIRKQ26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYI KwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRwOi8vd3d3LmFjY3YuZXMvZmls ZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEuY3J0MB8GCCsG AQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2 VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeT VfZW6oHlNsyMHj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIG CCsGAQUFBwICMIIBFB6CARAAQQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUA cgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBhAO0AegAgAGQAZQAgAGwAYQAgAEEA QwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUAYwBuAG8AbABvAGcA 7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBjAHQA cgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAA QwBQAFMAIABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUA czAwBggrBgEFBQcCARYkaHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2Mu aHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRt aW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2MV9kZXIuY3JsMA4GA1Ud DwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZIhvcNAQEF BQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdp D70ER9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gU JyCpZET/LtZ1qmxNYEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+m AM/EKXMRNt6GGT6d7hmKG9Ww7Y49nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepD vV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJTS+xJlsndQAJxGJ3KQhfnlms tn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3sCPdK6jT2iWH 7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szA h1xA2syVP1XgNce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xF d3+YJ5oyXSrjhO7FmGYvliAd3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2H pPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3pEfbRD0tVNEYqi4Y7 -----END CERTIFICATE----- # Issuer: CN=TWCA Global Root CA O=TAIWAN-CA OU=Root CA # Subject: CN=TWCA Global Root CA O=TAIWAN-CA OU=Root CA # Label: "TWCA Global Root CA" # Serial: 3262 # MD5 Fingerprint: f9:03:7e:cf:e6:9e:3c:73:7a:2a:90:07:69:ff:2b:96 # SHA1 Fingerprint: 9c:bb:48:53:f6:a4:f6:d3:52:a4:e8:32:52:55:60:13:f5:ad:af:65 # SHA256 Fingerprint: 59:76:90:07:f7:68:5d:0f:cd:50:87:2f:9f:95:d5:75:5a:5b:2b:45:7d:81:f3:69:2b:61:0a:98:67:2f:0e:1b -----BEGIN CERTIFICATE----- MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcx EjAQBgNVBAoTCVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMT VFdDQSBHbG9iYWwgUm9vdCBDQTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5 NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQKEwlUQUlXQU4tQ0ExEDAOBgNVBAsT B1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3QgQ0EwggIiMA0GCSqG SIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2CnJfF 10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz 0ALfUPZVr2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfCh MBwqoJimFb3u/Rk28OKRQ4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbH zIh1HrtsBv+baz4X7GGqcXzGHaL3SekVtTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc 46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1WKKD+u4ZqyPpcC1jcxkt2 yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99sy2sbZCi laLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYP oA/pyJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQA BDzfuBSO6N+pjWxnkjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcE qYSjMq+u7msXi7Kx/mzhkIyIqJdIzshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm 4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB /zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6gcFGn90xHNcgL 1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WF H6vPNOw/KP4M8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNo RI2T9GRwoD2dKAXDOXC4Ynsg/eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+ nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlglPx4mI88k1HtQJAH32RjJMtOcQWh 15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryPA9gK8kxkRr05YuWW 6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3mi4TW nsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5j wa19hAM8EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWz aGHQRiapIVJpLesux+t3zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmy KwbQBM0= -----END CERTIFICATE----- # Issuer: CN=TeliaSonera Root CA v1 O=TeliaSonera # Subject: CN=TeliaSonera Root CA v1 O=TeliaSonera # Label: "TeliaSonera Root CA v1" # Serial: 199041966741090107964904287217786801558 # MD5 Fingerprint: 37:41:49:1b:18:56:9a:26:f5:ad:c2:66:fb:40:a5:4c # SHA1 Fingerprint: 43:13:bb:96:f1:d5:86:9b:c1:4e:6a:92:f6:cf:f6:34:69:87:82:37 # SHA256 Fingerprint: dd:69:36:fe:21:f8:f0:77:c1:23:a1:a5:21:c1:22:24:f7:22:55:b7:3e:03:a7:26:06:93:e8:a2:4b:0f:a3:89 -----BEGIN CERTIFICATE----- MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAw NzEUMBIGA1UECgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJv b3QgQ0EgdjEwHhcNMDcxMDE4MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYD VQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwWVGVsaWFTb25lcmEgUm9vdCBDQSB2 MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+6yfwIaPzaSZVfp3F VRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA3GV1 7CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+X Z75Ljo1kB1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+ /jXh7VB7qTCNGdMJjmhnXb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs 81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxHoLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkm dtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3F0fUTPHSiXk+TT2YqGHe Oh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJoWjiUIMu sDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4 pgd7gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fs slESl1MpWtTwEhDcTwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQ arMCpgKIv7NHfirZ1fpoeDVNAgMBAAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYD VR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qWDNXr+nuqF+gTEjANBgkqhkiG 9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNmzqjMDfz1mgbl dxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1Tj TQpgcmLNkQfWpb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBed Y2gea+zDTYa4EzAvXUYNR0PVG6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7 Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpcc41teyWRyu5FrgZLAMzTsVlQ2jqI OylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOTJsjrDNYmiLbAJM+7 vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2qReW t88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcn HL/EVlP6Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVx SK236thZiNSQvxaz2emsWWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY= -----END CERTIFICATE----- # Issuer: CN=T-TeleSec GlobalRoot Class 2 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center # Subject: CN=T-TeleSec GlobalRoot Class 2 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center # Label: "T-TeleSec GlobalRoot Class 2" # Serial: 1 # MD5 Fingerprint: 2b:9b:9e:e4:7b:6c:1f:00:72:1a:cc:c1:77:79:df:6a # SHA1 Fingerprint: 59:0d:2d:7d:88:4f:40:2e:61:7e:a5:62:32:17:65:cf:17:d8:94:e9 # SHA256 Fingerprint: 91:e2:f5:78:8d:58:10:eb:a7:ba:58:73:7d:e1:54:8a:8e:ca:cd:01:45:98:bc:0b:14:3e:04:1b:17:05:25:52 -----BEGIN CERTIFICATE----- MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl YyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgxMDAxMTA0MDE0WhcNMzMxMDAxMjM1 OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0G CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUd AqSzm1nzHoqvNK38DcLZSBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiC FoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/FvudocP05l03Sx5iRUKrERLMjfTlH6VJi 1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx9702cu+fjOlbpSD8DT6Iavq jnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGVWOHAD3bZ wI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGj QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/ WSA2AHmgoCJrjNXyYdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhy NsZt+U2e+iKo4YFWz827n+qrkRk4r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPAC uvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNfvNoBYimipidx5joifsFvHZVw IEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR3p1m0IvVVGb6 g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlP BSeOE6Fuwg== -----END CERTIFICATE----- # Issuer: CN=Atos TrustedRoot 2011 O=Atos # Subject: CN=Atos TrustedRoot 2011 O=Atos # Label: "Atos TrustedRoot 2011" # Serial: 6643877497813316402 # MD5 Fingerprint: ae:b9:c4:32:4b:ac:7f:5d:66:cc:77:94:bb:2a:77:56 # SHA1 Fingerprint: 2b:b1:f5:3e:55:0c:1d:c5:f1:d4:e6:b7:6a:46:4b:55:06:02:ac:21 # SHA256 Fingerprint: f3:56:be:a2:44:b7:a9:1e:b3:5d:53:ca:9a:d7:86:4a:ce:01:8e:2d:35:d5:f8:f9:6d:df:68:a6:f4:1a:a4:74 -----BEGIN CERTIFICATE----- MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UE AwwVQXRvcyBUcnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQG EwJERTAeFw0xMTA3MDcxNDU4MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMM FUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsGA1UECgwEQXRvczELMAkGA1UEBhMC REUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCVhTuXbyo7LjvPpvMp Nb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr54rM VD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+ SZFhyBH+DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ 4J7sVaE3IqKHBAUsR320HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0L cp2AMBYHlT8oDv3FdU9T1nSatCQujgKRz3bFmx5VdJx4IbHwLfELn8LVlhgf8FQi eowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7Rl+lwrrw7GWzbITAPBgNV HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZbNshMBgG A1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3 DQEBCwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8j vZfza1zv7v1Apt+hk6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kP DpFrdRbhIfzYJsdHt6bPWHJxfrrhTZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pc maHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a961qn8FYiqTxlVMYVqL2Gns2D lmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G3mB/ufNPRJLv KrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed -----END CERTIFICATE----- # Issuer: CN=QuoVadis Root CA 1 G3 O=QuoVadis Limited # Subject: CN=QuoVadis Root CA 1 G3 O=QuoVadis Limited # Label: "QuoVadis Root CA 1 G3" # Serial: 687049649626669250736271037606554624078720034195 # MD5 Fingerprint: a4:bc:5b:3f:fe:37:9a:fa:64:f0:e2:fa:05:3d:0b:ab # SHA1 Fingerprint: 1b:8e:ea:57:96:29:1a:c9:39:ea:b8:0a:81:1a:73:73:c0:93:79:67 # SHA256 Fingerprint: 8a:86:6f:d1:b2:76:b5:7e:57:8e:92:1c:65:82:8a:2b:ed:58:e9:f2:f2:88:05:41:34:b7:f1:f4:bf:c9:cc:74 -----BEGIN CERTIFICATE----- MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQEL BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00 MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEgRzMwggIiMA0GCSqG SIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakEPBtV wedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWe rNrwU8lmPNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF341 68Xfuw6cwI2H44g4hWf6Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh 4Pw5qlPafX7PGglTvF0FBM+hSo+LdoINofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXp UhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/lg6AnhF4EwfWQvTA9xO+o abw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV7qJZjqlc 3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/G KubX9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSt hfbZxbGL0eUQMk1fiyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KO Tk0k+17kBL5yG6YnLUlamXrXXAkgt3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOt zCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB BjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZIhvcNAQELBQAD ggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2 cDMT/uFPpiN3GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUN qXsCHKnQO18LwIE6PWThv6ctTr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5 YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP+V04ikkwj+3x6xn0dxoxGE1nVGwv b2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh3jRJjehZrJ3ydlo2 8hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fawx/k NSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNj ZgKAvQU6O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhp q1467HxpvMc7hU6eFbm0FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFt nh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOVhMJKzRwuJIczYOXD -----END CERTIFICATE----- # Issuer: CN=QuoVadis Root CA 2 G3 O=QuoVadis Limited # Subject: CN=QuoVadis Root CA 2 G3 O=QuoVadis Limited # Label: "QuoVadis Root CA 2 G3" # Serial: 390156079458959257446133169266079962026824725800 # MD5 Fingerprint: af:0c:86:6e:bf:40:2d:7f:0b:3e:12:50:ba:12:3d:06 # SHA1 Fingerprint: 09:3c:61:f3:8b:8b:dc:7d:55:df:75:38:02:05:00:e1:25:f5:c8:36 # SHA256 Fingerprint: 8f:e4:fb:0a:f9:3a:4d:0d:67:db:0b:eb:b2:3e:37:c7:1b:f3:25:dc:bc:dd:24:0e:a0:4d:af:58:b4:7e:18:40 -----BEGIN CERTIFICATE----- MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQEL BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00 MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIgRzMwggIiMA0GCSqG SIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFhZiFf qq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMW n4rjyduYNM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ym c5GQYaYDFCDy54ejiK2toIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+ O7q414AB+6XrW7PFXmAqMaCvN+ggOp+oMiwMzAkd056OXbxMmO7FGmh77FOm6RQ1 o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+lV0POKa2Mq1W/xPtbAd0j IaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZoL1NesNKq IcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz 8eQQsSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43eh vNURG3YBZwjgQQvD6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l 7ZizlWNof/k19N+IxWA1ksB8aRxhlRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALG cC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB BjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZIhvcNAQELBQAD ggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66 AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RC roijQ1h5fq7KpVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0Ga W/ZZGYjeVYg3UQt4XAoeo0L9x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4n lv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgzdWqTHBLmYF5vHX/JHyPLhGGfHoJE +V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6XU/IyAgkwo1jwDQHV csaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+NwmNtd dbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNg KCLjsZWDzYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeM HVOyToV7BjjHLPj4sHKNJeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4 WSr2Rz0ZiC3oheGe7IUIarFsNMkd7EgrO3jtZsSOeWmD3n+M -----END CERTIFICATE----- # Issuer: CN=QuoVadis Root CA 3 G3 O=QuoVadis Limited # Subject: CN=QuoVadis Root CA 3 G3 O=QuoVadis Limited # Label: "QuoVadis Root CA 3 G3" # Serial: 268090761170461462463995952157327242137089239581 # MD5 Fingerprint: df:7d:b9:ad:54:6f:68:a1:df:89:57:03:97:43:b0:d7 # SHA1 Fingerprint: 48:12:bd:92:3c:a8:c4:39:06:e7:30:6d:27:96:e6:a4:cf:22:2e:7d # SHA256 Fingerprint: 88:ef:81:de:20:2e:b0:18:45:2e:43:f8:64:72:5c:ea:5f:bd:1f:c2:d9:d2:05:73:07:09:c5:d8:b8:69:0f:46 -----BEGIN CERTIFICATE----- MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQEL BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00 MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMgRzMwggIiMA0GCSqG SIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286IxSR /xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNu FoM7pmRLMon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXR U7Ox7sWTaYI+FrUoRqHe6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+c ra1AdHkrAj80//ogaX3T7mH1urPnMNA3I4ZyYUUpSFlob3emLoG+B01vr87ERROR FHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3UVDmrJqMz6nWB2i3ND0/k A9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f75li59wzw eyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634Ryl sSqiMd5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBp VzgeAVuNVejH38DMdyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0Q A4XN8f+MFrXBsj6IbGB/kE+V9/YtrQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB BjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZIhvcNAQELBQAD ggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnI FUBhynLWcKzSt/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5Wvv oxXqA/4Ti2Tk08HS6IT7SdEQTXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFg u/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9DuDcpmvJRPpq3t/O5jrFc/ZSXPsoaP 0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGibIh6BJpsQBJFxwAYf 3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmDhPbl 8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+ DhcI00iX0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HN PlopNLk9hM6xZdRZkZFWdSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ ywaZWWDYWGWVjUTR939+J399roD1B0y2PpxxVJkES/1Y+Zj0 -----END CERTIFICATE----- # Issuer: CN=DigiCert Assured ID Root G2 O=DigiCert Inc OU=www.digicert.com # Subject: CN=DigiCert Assured ID Root G2 O=DigiCert Inc OU=www.digicert.com # Label: "DigiCert Assured ID Root G2" # Serial: 15385348160840213938643033620894905419 # MD5 Fingerprint: 92:38:b9:f8:63:24:82:65:2c:57:33:e6:fe:81:8f:9d # SHA1 Fingerprint: a1:4b:48:d9:43:ee:0a:0e:40:90:4f:3c:e0:a4:c0:91:93:51:5d:3f # SHA256 Fingerprint: 7d:05:eb:b6:82:33:9f:8c:94:51:ee:09:4e:eb:fe:fa:79:53:a1:14:ed:b2:f4:49:49:45:2f:ab:7d:2f:c1:85 -----BEGIN CERTIFICATE----- MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBl MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv b3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQG EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwggEi MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSA n61UQbVH35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4Htecc biJVMWWXvdMX0h5i89vqbFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9Hp EgjAALAcKxHad3A2m67OeYfcgnDmCXRwVWmvo2ifv922ebPynXApVfSr/5Vh88lA bx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OPYLfykqGxvYmJHzDNw6Yu YjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+RnlTGNAgMB AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQW BBTOw0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPI QW5pJ6d1Ee88hjZv0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I 0jJmwYrA8y8678Dj1JGG0VDjA9tzd29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4Gni lmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAWhsI6yLETcDbYz+70CjTVW0z9 B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0MjomZmWzwPDCv ON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo IhNzbM8m9Yop5w== -----END CERTIFICATE----- # Issuer: CN=DigiCert Assured ID Root G3 O=DigiCert Inc OU=www.digicert.com # Subject: CN=DigiCert Assured ID Root G3 O=DigiCert Inc OU=www.digicert.com # Label: "DigiCert Assured ID Root G3" # Serial: 15459312981008553731928384953135426796 # MD5 Fingerprint: 7c:7f:65:31:0c:81:df:8d:ba:3e:99:e2:5c:ad:6e:fb # SHA1 Fingerprint: f5:17:a2:4f:9a:48:c6:c9:f8:a2:00:26:9f:dc:0f:48:2c:ab:30:89 # SHA256 Fingerprint: 7e:37:cb:8b:4c:47:09:0c:ab:36:55:1b:a6:f4:5d:b8:40:68:0f:ba:16:6a:95:2d:b1:00:71:7f:43:05:3f:c2 -----BEGIN CERTIFICATE----- MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQsw CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu ZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3Qg RzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQGEwJV UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu Y29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQBgcq hkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJf Zn4f5dwbRXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17Q RSAPWXYQ1qAk8C3eNvJsKTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgFUaFNN6KDec6NHSrkhDAKBggqhkjOPQQD AwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5FyYZ5eEJJZVrmDxxDnOOlY JjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy1vUhZscv 6pZjamVFkpUBtA== -----END CERTIFICATE----- # Issuer: CN=DigiCert Global Root G2 O=DigiCert Inc OU=www.digicert.com # Subject: CN=DigiCert Global Root G2 O=DigiCert Inc OU=www.digicert.com # Label: "DigiCert Global Root G2" # Serial: 4293743540046975378534879503202253541 # MD5 Fingerprint: e4:a6:8a:c8:54:ac:52:42:46:0a:fd:72:48:1b:2a:44 # SHA1 Fingerprint: df:3c:24:f9:bf:d6:66:76:1b:26:80:73:fe:06:d1:cc:8d:4f:82:a4 # SHA256 Fingerprint: cb:3c:cb:b7:60:31:e5:e0:13:8f:8d:d3:9a:23:f9:de:47:ff:c3:5e:43:c1:14:4c:ea:27:d4:6a:5a:b1:cb:5f -----BEGIN CERTIFICATE----- MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBh MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH MjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVT MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkqhkiG 9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI 2/Ou8jqJkTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx 1x7e/dfgy5SDN67sH0NO3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQ q2EGnI/yuum06ZIya7XzV+hdG82MHauVBJVJ8zUtluNJbd134/tJS7SsVQepj5Wz tCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyMUNGPHgm+F6HmIcr9g+UQ vIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQABo0IwQDAP BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV 5uNu5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY 1Yl9PMWLSn/pvtsrF9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4 NeF22d+mQrvHRAiGfzZ0JFrabA0UWTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NG Fdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBHQRFXGU7Aj64GxJUTFy8bJZ91 8rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/iyK5S9kJRaTe pLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl MrY= -----END CERTIFICATE----- # Issuer: CN=DigiCert Global Root G3 O=DigiCert Inc OU=www.digicert.com # Subject: CN=DigiCert Global Root G3 O=DigiCert Inc OU=www.digicert.com # Label: "DigiCert Global Root G3" # Serial: 7089244469030293291760083333884364146 # MD5 Fingerprint: f5:5d:a4:50:a5:fb:28:7e:1e:0f:0d:cc:96:57:56:ca # SHA1 Fingerprint: 7e:04:de:89:6a:3e:66:6d:00:e6:87:d3:3f:fa:d9:3b:e8:3d:34:9e # SHA256 Fingerprint: 31:ad:66:48:f8:10:41:38:c7:38:f3:9e:a4:32:01:33:39:3e:3a:18:cc:02:29:6e:f9:7c:2a:c9:ef:67:31:d0 -----BEGIN CERTIFICATE----- MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQsw CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu ZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAe Fw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVTMRUw EwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20x IDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0CAQYF K4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FG fp4tn+6OYwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPO Z9wj/wMco+I+o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAd BgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNpYim8S8YwCgYIKoZIzj0EAwMDaAAwZQIx AK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y3maTD/HMsQmP3Wyr+mt/ oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34VOKa5Vt8 sycX -----END CERTIFICATE----- # Issuer: CN=DigiCert Trusted Root G4 O=DigiCert Inc OU=www.digicert.com # Subject: CN=DigiCert Trusted Root G4 O=DigiCert Inc OU=www.digicert.com # Label: "DigiCert Trusted Root G4" # Serial: 7451500558977370777930084869016614236 # MD5 Fingerprint: 78:f2:fc:aa:60:1f:2f:b4:eb:c9:37:ba:53:2e:75:49 # SHA1 Fingerprint: dd:fb:16:cd:49:31:c9:73:a2:03:7d:3f:c8:3a:4d:7d:77:5d:05:e4 # SHA256 Fingerprint: 55:2f:7b:dc:f1:a7:af:9e:6c:e6:72:01:7f:4f:12:ab:f7:72:40:c7:8e:76:1a:c2:03:d1:d9:d2:0a:c8:99:88 -----BEGIN CERTIFICATE----- MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBi MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3Qg RzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBiMQswCQYDVQQGEwJV UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu Y29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0GCSqG SIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3y ithZwuEppz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1If xp4VpX6+n6lXFllVcq9ok3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDV ySAdYyktzuxeTsiT+CFhmzTrBcZe7FsavOvJz82sNEBfsXpm7nfISKhmV1efVFiO DCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGYQJB5w3jHtrHEtWoYOAMQ jdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6MUSaM0C/ CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCi EhtmmnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADM fRyVw4/3IbKyEbe7f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QY uKZ3AeEPlAwhHbJUKSWJbOUOUlFHdL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXK chYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8oR7FwI+isX4KJpn15GkvmB0t 9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB hjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2 SV1EY+CtnJYYZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd +SeuMIW59mdNOj6PWTkiU0TryF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWc fFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy7zBZLq7gcfJW5GqXb5JQbZaNaHqa sjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iahixTXTBmyUEFxPT9N cCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN5r5N 0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie 4u1Ki7wb/UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mI r/OSmbaz5mEP0oUA51Aa5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1 /YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tKG48BtieVU+i2iW1bvGjUI+iLUaJW+fCm gKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP82Z+ -----END CERTIFICATE----- # Issuer: CN=COMODO RSA Certification Authority O=COMODO CA Limited # Subject: CN=COMODO RSA Certification Authority O=COMODO CA Limited # Label: "COMODO RSA Certification Authority" # Serial: 101909084537582093308941363524873193117 # MD5 Fingerprint: 1b:31:b0:71:40:36:cc:14:36:91:ad:c4:3e:fd:ec:18 # SHA1 Fingerprint: af:e5:d2:44:a8:d1:19:42:30:ff:47:9f:e2:f8:97:bb:cd:7a:8c:b4 # SHA256 Fingerprint: 52:f0:e1:c4:e5:8e:c6:29:29:1b:60:31:7f:07:46:71:b8:5d:7e:a8:0d:5b:07:27:34:63:53:4b:32:b4:02:34 -----BEGIN CERTIFICATE----- MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCB hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV BAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMTE5 MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgT EkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNh dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR 6FSS0gpWsawNJN3Fz0RndJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8X pz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZFGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC 9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+5eNu/Nio5JIk2kNrYrhV /erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pGx8cgoLEf Zd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z +pUX2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7w qP/0uK3pN/u6uPQLOvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZah SL0896+1DSJMwBGB7FY79tOi4lu3sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVIC u9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+CGCe01a60y1Dma/RMhnEw6abf Fobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5WdYgGq/yapiq crxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB /wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvl wFTPoCWOAvn9sKIN9SCYPBMtrFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM 4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+nq6PK7o9mfjYcwlYRm6mnPTXJ9OV 2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSgtZx8jb8uk2Intzna FxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwWsRqZ CuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiK boHGhfKppC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmcke jkk9u+UJueBPSZI9FoJAzMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yL S0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHqZJx64SIDqZxubw5lT2yHh17zbqD5daWb QOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk527RH89elWsn2/x20Kk4yl 0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7ILaZRfyHB NVOFBkpdn627G190 -----END CERTIFICATE----- # Issuer: CN=USERTrust RSA Certification Authority O=The USERTRUST Network # Subject: CN=USERTrust RSA Certification Authority O=The USERTRUST Network # Label: "USERTrust RSA Certification Authority" # Serial: 2645093764781058787591871645665788717 # MD5 Fingerprint: 1b:fe:69:d1:91:b7:19:33:a3:72:a8:0f:e1:55:e5:b5 # SHA1 Fingerprint: 2b:8f:1b:57:33:0d:bb:a2:d0:7a:6c:51:f7:0e:e9:0d:da:b9:ad:8e # SHA256 Fingerprint: e7:93:c9:b0:2f:d8:aa:13:e2:1c:31:22:8a:cc:b0:81:19:64:3b:74:9c:89:89:64:b1:74:6d:46:c3:d4:cb:d2 -----BEGIN CERTIFICATE----- MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCB iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAw MjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNV BAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2Vy dGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK AoICAQCAEmUXNg7D2wiz0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B 3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2jY0K2dvKpOyuR+OJv0OwWIJAJPuLodMkY tJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFnRghRy4YUVD+8M/5+bJz/ Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O+T23LLb2 VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT 79uq/nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6 c0Plfg6lZrEpfDKEY1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmT Yo61Zs8liM2EuLE/pDkP2QKe6xJMlXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97l c6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8yexDJtC/QV9AqURE9JnnV4ee UB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+eLf8ZxXhyVeE Hg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8G A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPF Up/L+M+ZBn8b2kMVn54CVVeWFPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KO VWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ7l8wXEskEVX/JJpuXior7gtNn3/3 ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQEg9zKC7F4iRO/Fjs 8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM8WcR iQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYze Sf7dNXGiFSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZ XHlKYC6SQK5MNyosycdiyA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/ qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9cJ2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRB VXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGwsAvgnEzDHNb842m1R0aB L6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gxQ+6IHdfG jjxDah2nGN59PRbxYvnKkKj9 -----END CERTIFICATE----- # Issuer: CN=USERTrust ECC Certification Authority O=The USERTRUST Network # Subject: CN=USERTrust ECC Certification Authority O=The USERTRUST Network # Label: "USERTrust ECC Certification Authority" # Serial: 123013823720199481456569720443997572134 # MD5 Fingerprint: fa:68:bc:d9:b5:7f:ad:fd:c9:1d:06:83:28:cc:24:c1 # SHA1 Fingerprint: d1:cb:ca:5d:b2:d5:2a:7f:69:3b:67:4d:e5:f0:5a:1d:0c:95:7d:f0 # SHA256 Fingerprint: 4f:f4:60:d5:4b:9c:86:da:bf:bc:fc:57:12:e0:40:0d:2b:ed:3f:bc:4d:4f:bd:aa:86:e0:6a:dc:d2:a9:ad:7a -----BEGIN CERTIFICATE----- MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDEL MAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNl eSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMT JVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMjAx MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgT Ck5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVUaGUg VVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlm aWNhdGlvbiBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqflo I+d61SRvU8Za2EurxtW20eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinng o4N+LZfQYcTxmdwlkWOrfzCjtHDix6EznPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0G A1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNVHQ8BAf8EBAMCAQYwDwYD VR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBBHU6+4WMB zzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbW RNZu9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg= -----END CERTIFICATE----- # Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R5 # Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R5 # Label: "GlobalSign ECC Root CA - R5" # Serial: 32785792099990507226680698011560947931244 # MD5 Fingerprint: 9f:ad:3b:1c:02:1e:8a:ba:17:74:38:81:0c:a2:bc:08 # SHA1 Fingerprint: 1f:24:c6:30:cd:a4:18:ef:20:69:ff:ad:4f:dd:5f:46:3a:1b:69:aa # SHA256 Fingerprint: 17:9f:bc:14:8a:3d:d0:0f:d2:4e:a1:34:58:cc:43:bf:a7:f5:9c:81:82:d7:83:a5:13:f6:eb:ec:10:0c:89:24 -----BEGIN CERTIFICATE----- MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEk MCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpH bG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoX DTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBD QSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWdu MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6SFkc 8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8ke hOvRnkmSh5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYI KoZIzj0EAwMDaAAwZQIxAOVpEslu28YxuglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg 515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7yFz9SO8NdCKoCOJuxUnO xwy8p2Fp8fc74SrL+SvzZpA3 -----END CERTIFICATE----- # Issuer: CN=IdenTrust Commercial Root CA 1 O=IdenTrust # Subject: CN=IdenTrust Commercial Root CA 1 O=IdenTrust # Label: "IdenTrust Commercial Root CA 1" # Serial: 13298821034946342390520003877796839426 # MD5 Fingerprint: b3:3e:77:73:75:ee:a0:d3:e3:7e:49:63:49:59:bb:c7 # SHA1 Fingerprint: df:71:7e:aa:4a:d9:4e:c9:55:84:99:60:2d:48:de:5f:bc:f0:3a:25 # SHA256 Fingerprint: 5d:56:49:9b:e4:d2:e0:8b:cf:ca:d0:8a:3e:38:72:3d:50:50:3b:de:70:69:48:e4:2f:55:60:30:19:e5:28:ae -----BEGIN CERTIFICATE----- MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBK MQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVu VHJ1c3QgQ29tbWVyY2lhbCBSb290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQw MTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScw JQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENBIDEwggIiMA0GCSqG SIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ldhNlT 3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU +ehcCuz/mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gp S0l4PJNgiCL8mdo2yMKi1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1 bVoE/c40yiTcdCMbXTMTEl3EASX2MN0CXZ/g1Ue9tOsbobtJSdifWwLziuQkkORi T0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl3ZBWzvurpWCdxJ35UrCL vYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzyNeVJSQjK Vsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZK dHzVWYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHT c+XvvqDtMwt0viAgxGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hv l7yTmvmcEpB4eoCHFddydJxVdHixuuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5N iGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB /zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZIhvcNAQELBQAD ggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwt LRvM7Kqas6pgghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93 nAbowacYXVKV7cndJZ5t+qntozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3 +wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmVYjzlVYA211QC//G5Xc7UI2/YRYRK W2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUXfeu+h1sXIFRRk0pT AwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/rokTLq l1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG 4iZZRHUe2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZ mUlO+KWA2yUPHGNiiskzZ2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A 7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7RcGzM7vRX+Bi6hG6H -----END CERTIFICATE----- # Issuer: CN=IdenTrust Public Sector Root CA 1 O=IdenTrust # Subject: CN=IdenTrust Public Sector Root CA 1 O=IdenTrust # Label: "IdenTrust Public Sector Root CA 1" # Serial: 13298821034946342390521976156843933698 # MD5 Fingerprint: 37:06:a5:b0:fc:89:9d:ba:f4:6b:8c:1a:64:cd:d5:ba # SHA1 Fingerprint: ba:29:41:60:77:98:3f:f4:f3:ef:f2:31:05:3b:2e:ea:6d:4d:45:fd # SHA256 Fingerprint: 30:d0:89:5a:9a:44:8a:26:20:91:63:55:22:d1:f5:20:10:b5:86:7a:ca:e1:2c:78:ef:95:8f:d4:f4:38:9f:2f -----BEGIN CERTIFICATE----- MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBN MQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVu VHJ1c3QgUHVibGljIFNlY3RvciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcN MzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0 MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBSb290IENBIDEwggIi MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTyP4o7 ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGy RBb06tD6Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlS bdsHyo+1W/CD80/HLaXIrcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF /YTLNiCBWS2ab21ISGHKTN9T0a9SvESfqy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R 3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoSmJxZZoY+rfGwyj4GD3vw EUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFnol57plzy 9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9V GxyhLrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ 2fjXctscvG29ZV/viDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsV WaFHVCkugyhfHMKiq3IXAAaOReyL4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gD W/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMwDQYJKoZIhvcN AQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHV DRDtfULAj+7AmgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9 TaDKQGXSc3z1i9kKlT/YPyNtGtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8G lwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFtm6/n6J91eEyrRjuazr8FGF1NFTwW mhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMxNRF4eKLg6TCMf4Df WN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4Mhn5 +bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJ tshquDDIajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhA GaQdp/lLQzfcaFpPz+vCZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv 8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ3Wl9af0AVqW3rLatt8o+Ae+c -----END CERTIFICATE----- # Issuer: CN=CFCA EV ROOT O=China Financial Certification Authority # Subject: CN=CFCA EV ROOT O=China Financial Certification Authority # Label: "CFCA EV ROOT" # Serial: 407555286 # MD5 Fingerprint: 74:e1:b6:ed:26:7a:7a:44:30:33:94:ab:7b:27:81:30 # SHA1 Fingerprint: e2:b8:29:4b:55:84:ab:6b:58:c2:90:46:6c:ac:3f:b8:39:8f:84:83 # SHA256 Fingerprint: 5c:c3:d7:8e:4e:1d:5e:45:54:7a:04:e6:87:3e:64:f9:0c:f9:53:6d:1c:cc:2e:f8:00:f3:55:c4:c5:fd:70:fd -----BEGIN CERTIFICATE----- MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJD TjEwMC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9y aXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkx MjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEwMC4GA1UECgwnQ2hpbmEgRmluYW5j aWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJP T1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnVBU03 sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpL TIpTUnrD7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5 /ZOkVIBMUtRSqy5J35DNuF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp 7hZZLDRJGqgG16iI0gNyejLi6mhNbiyWZXvKWfry4t3uMCz7zEasxGPrb382KzRz EpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7xzbh72fROdOXW3NiGUgt hxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9fpy25IGvP a931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqot aK8KgWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNg TnYGmE69g60dWIolhdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfV PKPtl8MeNPo4+QgO48BdK4PRVmrJtqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hv cWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAfBgNVHSMEGDAWgBTj/i39KNAL tbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAd BgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObT ej/tUxPQ4i9qecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdL jOztUmCypAbqTuv0axn96/Ua4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBS ESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sGE5uPhnEFtC+NiWYzKXZUmhH4J/qy P5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfXBDrDMlI1Dlb4pd19 xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjnaH9d Ci77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN 5mydLIhyPDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe /v5WOaHIz16eGWRGENoXkbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+Z AAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3CekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ 5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su -----END CERTIFICATE----- # Issuer: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed # Subject: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed # Label: "OISTE WISeKey Global Root GB CA" # Serial: 157768595616588414422159278966750757568 # MD5 Fingerprint: a4:eb:b9:61:28:2e:b7:2f:98:b0:35:26:90:99:51:1d # SHA1 Fingerprint: 0f:f9:40:76:18:d3:d7:6a:4b:98:f0:a8:35:9e:0c:fd:27:ac:cc:ed # SHA256 Fingerprint: 6b:9c:08:e8:6e:b0:f7:67:cf:ad:65:cd:98:b6:21:49:e5:49:4a:67:f5:84:5e:7b:d1:ed:01:9f:27:b8:6b:d6 -----BEGIN CERTIFICATE----- MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBt MQswCQYDVQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUg Rm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9i YWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAwMzJaFw0zOTEyMDExNTEwMzFaMG0x CzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQLExlPSVNURSBG b3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh bCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3 HEokKtaXscriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGx WuR51jIjK+FTzJlFXHtPrby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX 1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNk u7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4oQnc/nSMbsrY9gBQHTC5P 99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvgGUpuuy9r M2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw AwEB/zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUB BAMCAQAwDQYJKoZIhvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrgh cViXfa43FK8+5/ea4n32cZiZBKpDdHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5 gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0VQreUGdNZtGn//3ZwLWoo4rO ZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEuiHZeeevJuQHHf aPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM= -----END CERTIFICATE----- # Issuer: CN=SZAFIR ROOT CA2 O=Krajowa Izba Rozliczeniowa S.A. # Subject: CN=SZAFIR ROOT CA2 O=Krajowa Izba Rozliczeniowa S.A. # Label: "SZAFIR ROOT CA2" # Serial: 357043034767186914217277344587386743377558296292 # MD5 Fingerprint: 11:64:c1:89:b0:24:b1:8c:b1:07:7e:89:9e:51:9e:99 # SHA1 Fingerprint: e2:52:fa:95:3f:ed:db:24:60:bd:6e:28:f3:9c:cc:cf:5e:b3:3f:de # SHA256 Fingerprint: a1:33:9d:33:28:1a:0b:56:e5:57:d3:d3:2b:1c:e7:f9:36:7e:b0:94:bd:5f:a7:2a:7e:50:04:c8:de:d7:ca:fe -----BEGIN CERTIFICATE----- MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQEL BQAwUTELMAkGA1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6 ZW5pb3dhIFMuQS4xGDAWBgNVBAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkw NzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJBgNVBAYTAlBMMSgwJgYDVQQKDB9L cmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYDVQQDDA9TWkFGSVIg Uk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5QqEvN QLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT 3PSQ1hNKDJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw 3gAeqDRHu5rr/gsUvTaE2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr6 3fE9biCloBK0TXC5ztdyO4mTp4CEHCdJckm1/zuVnsHMyAHs6A6KCpbns6aH5db5 BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwiieDhZNRnvDF5YTy7ykHN XGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD AgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsF AAOCAQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw 8PRBEew/R40/cof5O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOG nXkZ7/e7DDWQw4rtTw/1zBLZpD67oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCP oky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul4+vJhaAlIDf7js4MNIThPIGy d05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6+/NNIxuZMzSg LvWpCz/UXeHPhJ/iGcJfitYgHuNztw== -----END CERTIFICATE----- # Issuer: CN=Certum Trusted Network CA 2 O=Unizeto Technologies S.A. OU=Certum Certification Authority # Subject: CN=Certum Trusted Network CA 2 O=Unizeto Technologies S.A. OU=Certum Certification Authority # Label: "Certum Trusted Network CA 2" # Serial: 44979900017204383099463764357512596969 # MD5 Fingerprint: 6d:46:9e:d9:25:6d:08:23:5b:5e:74:7d:1e:27:db:f2 # SHA1 Fingerprint: d3:dd:48:3e:2b:bf:4c:05:e8:af:10:f5:fa:76:26:cf:d3:dc:30:92 # SHA256 Fingerprint: b6:76:f2:ed:da:e8:77:5c:d3:6c:b0:f6:3c:d1:d4:60:39:61:f4:9e:62:65:ba:01:3a:2f:03:07:b6:d0:b8:04 -----BEGIN CERTIFICATE----- MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCB gDELMAkGA1UEBhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMu QS4xJzAlBgNVBAsTHkNlcnR1bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIG A1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29yayBDQSAyMCIYDzIwMTExMDA2MDgz OTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQTDEiMCAGA1UEChMZ VW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRp ZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3 b3JrIENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWA DGSdhhuWZGc/IjoedQF97/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn 0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+oCgCXhVqqndwpyeI1B+twTUrWwbNWuKFB OJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40bRr5HMNUuctHFY9rnY3lE fktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2puTRZCr+E Sv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1m o130GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02i sx7QBlrd9pPPV3WZ9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOW OZV7bIBaTxNyxtd9KXpEulKkKtVBRgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgez Tv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pyehizKV/Ma5ciSixqClnrDvFAS adgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vMBhBgu4M1t15n 3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMC AQYwDQYJKoZIhvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQ F/xlhMcQSZDe28cmk4gmb3DWAl45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTf CVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuAL55MYIR4PSFk1vtBHxgP58l1cb29 XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMoclm2q8KMZiYcdywm djWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tMpkT/ WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jb AoJnwTnbw3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksq P/ujmv5zMnHCnsZy4YpoJ/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Ko b7a6bINDd82Kkhehnlt4Fj1F4jNy3eFmypnTycUm/Q1oBEauttmbjL4ZvrHG8hnj XALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLXis7VmFxWlgPF7ncGNf/P 5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7zAYspsbi DrW5viSP -----END CERTIFICATE----- # Issuer: CN=Hellenic Academic and Research Institutions RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority # Subject: CN=Hellenic Academic and Research Institutions RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority # Label: "Hellenic Academic and Research Institutions RootCA 2015" # Serial: 0 # MD5 Fingerprint: ca:ff:e2:db:03:d9:cb:4b:e9:0f:ad:84:fd:7b:18:ce # SHA1 Fingerprint: 01:0c:06:95:a6:98:19:14:ff:bf:5f:c6:b0:b6:95:ea:29:e9:12:a6 # SHA256 Fingerprint: a0:40:92:9a:02:ce:53:b4:ac:f4:f2:ff:c6:98:1c:e4:49:6f:75:5e:6d:45:fe:0b:2a:69:2b:cd:52:52:3f:36 -----BEGIN CERTIFICATE----- MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1Ix DzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5k IFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMT N0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9v dENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAxMTIxWjCBpjELMAkG A1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNh ZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkx QDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1 dGlvbnMgUm9vdENBIDIwMTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC AQDC+Kk/G4n8PDwEXT2QNrCROnk8ZlrvbTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA 4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+ehiGsxr/CL0BgzuNtFajT0 AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+6PAQZe10 4S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06C ojXdFPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV 9Cz82XBST3i4vTwri5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrD gfgXy5I2XdGj2HUb4Ysn6npIQf1FGQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6 Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2fu/Z8VFRfS0myGlZYeCsargq NhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9muiNX6hME6wGko LfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNV HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVd ctA4GGqd83EkVAswDQYJKoZIhvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0I XtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+D1hYc2Ryx+hFjtyp8iY/xnmMsVMI M4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrMd/K4kPFox/la/vot 9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+yd+2V Z5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/ea j8GsGsVn82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnh X9izjFk0WaSrT2y7HxjbdavYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQ l033DlZdwJVqwjbDG2jJ9SrcR5q+ss7FJej6A7na+RZukYT1HCjI/CbM1xyQVqdf bzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVtJ94Cj8rDtSvK6evIIVM4 pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGaJI7ZjnHK e7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0 vm9qp/UsQu0yrbYhnr68 -----END CERTIFICATE----- # Issuer: CN=Hellenic Academic and Research Institutions ECC RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority # Subject: CN=Hellenic Academic and Research Institutions ECC RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority # Label: "Hellenic Academic and Research Institutions ECC RootCA 2015" # Serial: 0 # MD5 Fingerprint: 81:e5:b4:17:eb:c2:f5:e1:4b:0d:41:7b:49:92:fe:ef # SHA1 Fingerprint: 9f:f1:71:8d:92:d5:9a:f3:7d:74:97:b4:bc:6f:84:68:0b:ba:b6:66 # SHA256 Fingerprint: 44:b5:45:aa:8a:25:e6:5a:73:ca:15:dc:27:fc:36:d2:4c:1c:b9:95:3a:06:65:39:b1:15:82:dc:48:7b:48:33 -----BEGIN CERTIFICATE----- MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzAN BgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl c2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hl bGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgRUNDIFJv b3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEwMzcxMlowgaoxCzAJ BgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmljIEFj YWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5 MUQwQgYDVQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0 dXRpb25zIEVDQyBSb290Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKg QehLgoRc4vgxEZmGZE4JJS+dQS8KrjVPdJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJa jq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoKVlp8aQuqgAkkbH7BRqNC MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFLQi C4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaep lSTAGiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7Sof TUwJCA3sS61kFyjndc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR -----END CERTIFICATE----- # Issuer: CN=ISRG Root X1 O=Internet Security Research Group # Subject: CN=ISRG Root X1 O=Internet Security Research Group # Label: "ISRG Root X1" # Serial: 172886928669790476064670243504169061120 # MD5 Fingerprint: 0c:d2:f9:e0:da:17:73:e9:ed:86:4d:a5:e3:70:e7:4e # SHA1 Fingerprint: ca:bd:2a:79:a1:07:6a:31:f2:1d:25:36:35:cb:03:9d:43:29:a5:e8 # SHA256 Fingerprint: 96:bc:ec:06:26:49:76:f3:74:60:77:9a:cf:28:c5:a7:cf:e8:a3:c0:aa:e1:1a:8f:fc:ee:05:c0:bd:df:08:c6 -----BEGIN CERTIFICATE----- MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+ 0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ 3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq 4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= -----END CERTIFICATE----- # Issuer: O=FNMT-RCM OU=AC RAIZ FNMT-RCM # Subject: O=FNMT-RCM OU=AC RAIZ FNMT-RCM # Label: "AC RAIZ FNMT-RCM" # Serial: 485876308206448804701554682760554759 # MD5 Fingerprint: e2:09:04:b4:d3:bd:d1:a0:14:fd:1a:d2:47:c4:57:1d # SHA1 Fingerprint: ec:50:35:07:b2:15:c4:95:62:19:e2:a8:9a:5b:42:99:2c:4c:2c:20 # SHA256 Fingerprint: eb:c5:57:0c:29:01:8c:4d:67:b1:aa:12:7b:af:12:f7:03:b4:61:1e:bc:17:b7:da:b5:57:38:94:17:9b:93:fa -----BEGIN CERTIFICATE----- MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsx CzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJ WiBGTk1ULVJDTTAeFw0wODEwMjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJ BgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBG Tk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALpxgHpMhm5/ yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcfqQgf BBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAz WHFctPVrbtQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxF tBDXaEAUwED653cXeuYLj2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z 374jNUUeAlz+taibmSXaXvMiwzn15Cou08YfxGyqxRxqAQVKL9LFwag0Jl1mpdIC IfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mwWsXmo8RZZUc1g16p6DUL mbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnTtOmlcYF7 wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peS MKGJ47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2 ZSysV4999AeU14ECll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMet UqIJ5G+GR4of6ygnXYMgrwTJbFaai0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUw AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFPd9xf3E6Jobd2Sn9R2gzL+H YJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1odHRwOi8vd3d3 LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1 RXxlDPiyN8+sD8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYM LVN0V2Ue1bLdI4E7pWYjJ2cJj+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf 77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrTQfv6MooqtyuGC2mDOL7Nii4LcK2N JpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW+YJF1DngoABd15jm fZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7Ixjp 6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp 1txyM/1d8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B 9kiABdcPUXmsEKvU7ANm5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wok RqEIr9baRRmW1FMdW4R58MD3R++Lj8UGrp1MYp3/RgT408m2ECVAdf4WqslKYIYv uu8wd+RU4riEmViAqhOLUTpPSPaLtrM= -----END CERTIFICATE----- # Issuer: CN=Amazon Root CA 1 O=Amazon # Subject: CN=Amazon Root CA 1 O=Amazon # Label: "Amazon Root CA 1" # Serial: 143266978916655856878034712317230054538369994 # MD5 Fingerprint: 43:c6:bf:ae:ec:fe:ad:2f:18:c6:88:68:30:fc:c8:e6 # SHA1 Fingerprint: 8d:a7:f9:65:ec:5e:fc:37:91:0f:1c:6e:59:fd:c1:cc:6a:6e:de:16 # SHA256 Fingerprint: 8e:cd:e6:88:4f:3d:87:b1:12:5b:a3:1a:c3:fc:b1:3d:70:16:de:7f:57:cc:90:4f:e1:cb:97:c6:ae:98:19:6e -----BEGIN CERTIFICATE----- MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6 b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj ca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM 9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw IFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6 VOujw5H5SNz/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L 93FcXmn/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm jgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC AYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3DQEBCwUA A4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDI U5PMCCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUs N+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv o/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU 5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy rqXRfboQnoZsG4q5WTP468SQvvG5 -----END CERTIFICATE----- # Issuer: CN=Amazon Root CA 2 O=Amazon # Subject: CN=Amazon Root CA 2 O=Amazon # Label: "Amazon Root CA 2" # Serial: 143266982885963551818349160658925006970653239 # MD5 Fingerprint: c8:e5:8d:ce:a8:42:e2:7a:c0:2a:5c:7c:9e:26:bf:66 # SHA1 Fingerprint: 5a:8c:ef:45:d7:a6:98:59:76:7a:8c:8b:44:96:b5:78:cf:47:4b:1a # SHA256 Fingerprint: 1b:a5:b2:aa:8c:65:40:1a:82:96:01:18:f8:0b:ec:4f:62:30:4d:83:ce:c4:71:3a:19:c3:9c:01:1e:a4:6d:b4 -----BEGIN CERTIFICATE----- MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwF ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6 b24gUm9vdCBDQSAyMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTEL MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv b3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK2Wny2cSkxK gXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4kHbZ W0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg 1dKmSYXpN+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K 8nu+NQWpEjTj82R0Yiw9AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r 2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvdfLC6HM783k81ds8P+HgfajZRRidhW+me z/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAExkv8LV/SasrlX6avvDXbR 8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSSbtqDT6Zj mUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz 7Mt0Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6 +XUyo05f7O0oYtlNc/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI 0u1ufm8/0i2BWSlmy5A5lREedCf+3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMB Af8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSwDPBMMPQFWAJI/TPlUq9LhONm UjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oAA7CXDpO8Wqj2 LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kS k5Nrp+gvU5LEYFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl 7uxMMne0nxrpS10gxdr9HIcWxkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygm btmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQgj9sAq+uEjonljYE1x2igGOpm/Hl urR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbWaQbLU8uz/mtBzUF+ fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoVYh63 n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE 76KlXIx3KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H 9jVlpNMKVv/1F2Rs76giJUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT 4PsJYGw= -----END CERTIFICATE----- # Issuer: CN=Amazon Root CA 3 O=Amazon # Subject: CN=Amazon Root CA 3 O=Amazon # Label: "Amazon Root CA 3" # Serial: 143266986699090766294700635381230934788665930 # MD5 Fingerprint: a0:d4:ef:0b:f7:b5:d8:49:95:2a:ec:f5:c4:fc:81:87 # SHA1 Fingerprint: 0d:44:dd:8c:3c:8c:1a:1a:58:75:64:81:e9:0f:2e:2a:ff:b3:d2:6e # SHA256 Fingerprint: 18:ce:6c:fe:7b:f1:4e:60:b2:e3:47:b8:df:e8:68:cb:31:d0:2e:bb:3a:da:27:15:69:f5:03:43:b4:6d:b3:a4 -----BEGIN CERTIFICATE----- MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5 MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g Um9vdCBDQSAzMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg Q0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZBf8ANm+gBG1bG8lKl ui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjrZt6j QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSr ttvXBp43rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkr BqWTrBqYaGFy+uGh0PsceGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteM YyRIHN8wfdVoOw== -----END CERTIFICATE----- # Issuer: CN=Amazon Root CA 4 O=Amazon # Subject: CN=Amazon Root CA 4 O=Amazon # Label: "Amazon Root CA 4" # Serial: 143266989758080763974105200630763877849284878 # MD5 Fingerprint: 89:bc:27:d5:eb:17:8d:06:6a:69:d5:fd:89:47:b4:cd # SHA1 Fingerprint: f6:10:84:07:d6:f8:bb:67:98:0c:c2:e2:44:c2:eb:ae:1c:ef:63:be # SHA256 Fingerprint: e3:5d:28:41:9e:d0:20:25:cf:a6:90:38:cd:62:39:62:45:8d:a5:c6:95:fb:de:a3:c2:2b:0b:fb:25:89:70:92 -----BEGIN CERTIFICATE----- MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5 MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g Um9vdCBDQSA0MB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg Q0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN/sGKe0uoe0ZLY7Bi 9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri83Bk M6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WB MAoGCCqGSM49BAMDA2gAMGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlw CkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1AE47xDqUEpHJWEadIRNyp4iciuRMStuW 1KyLa2tJElMzrdfkviT8tQp21KW8EA== -----END CERTIFICATE----- # Issuer: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM # Subject: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM # Label: "TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1" # Serial: 1 # MD5 Fingerprint: dc:00:81:dc:69:2f:3e:2f:b0:3b:f6:3d:5a:91:8e:49 # SHA1 Fingerprint: 31:43:64:9b:ec:ce:27:ec:ed:3a:3f:0b:8f:0d:e4:e8:91:dd:ee:ca # SHA256 Fingerprint: 46:ed:c3:68:90:46:d5:3a:45:3f:b3:10:4a:b8:0d:ca:ec:65:8b:26:60:ea:16:29:dd:7e:86:79:90:64:87:16 -----BEGIN CERTIFICATE----- MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIx GDAWBgNVBAcTD0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxp bXNlbCB2ZSBUZWtub2xvamlrIEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0w KwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24gTWVya2V6aSAtIEthbXUgU00xNjA0 BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRpZmlrYXNpIC0gU3Vy dW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYDVQQG EwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXll IEJpbGltc2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklU QUsxLTArBgNVBAsTJEthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBT TTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11IFNNIFNTTCBLb2sgU2VydGlmaWthc2kg LSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr3UwM6q7 a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y86Ij5iySr LqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INr N3wcwv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2X YacQuFWQfw4tJzh03+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/ iSIzL+aFCr2lqBs23tPcLG07xxO9WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4f AJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQUZT/HiobGPN08VFw1+DrtUgxH V8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL BQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPf IPP54+M638yclNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4 lzwDGrpDxpa5RXI4s6ehlj2Re37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c 8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0jq5Rm+K37DwhuJi1/FwcJsoz7UMCf lo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM= -----END CERTIFICATE----- # Issuer: CN=GDCA TrustAUTH R5 ROOT O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD. # Subject: CN=GDCA TrustAUTH R5 ROOT O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD. # Label: "GDCA TrustAUTH R5 ROOT" # Serial: 9009899650740120186 # MD5 Fingerprint: 63:cc:d9:3d:34:35:5c:6f:53:a3:e2:08:70:48:1f:b4 # SHA1 Fingerprint: 0f:36:38:5b:81:1a:25:c3:9b:31:4e:83:ca:e9:34:66:70:cc:74:b4 # SHA256 Fingerprint: bf:ff:8f:d0:44:33:48:7d:6a:8a:a6:0c:1a:29:76:7a:9f:c2:bb:b0:5e:42:0f:71:3a:13:b9:92:89:1d:38:93 -----BEGIN CERTIFICATE----- MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UE BhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0 MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVowYjELMAkGA1UEBhMCQ04xMjAwBgNV BAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8w HQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0BAQEF AAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJj Dp6L3TQsAlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBj TnnEt1u9ol2x8kECK62pOqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+u KU49tm7srsHwJ5uu4/Ts765/94Y9cnrrpftZTqfrlYwiOXnhLQiPzLyRuEH3FMEj qcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ9Cy5WmYqsBebnh52nUpm MUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQxXABZG12 ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloP zgsMR6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3Gk L30SgLdTMEZeS1SZD2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeC jGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4oR24qoAATILnsn8JuLwwoC8N9VKejveSswoA HQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx9hoh49pwBiFYFIeFd3mqgnkC AwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlRMA8GA1UdEwEB /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZm DRd9FBUb1Ov9H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5 COmSdI31R9KrO9b7eGZONn356ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ry L3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd+PwyvzeG5LuOmCd+uh8W4XAR8gPf JWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQHtZa37dG/OaG+svg IHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBDF8Io 2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV 09tL7ECQ8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQ XR4EzzffHqhmsYzmIGrv/EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrq T8p+ck0LcIymSLumoRT2+1hEmRSuqguTaaApJUqlyyvdimYHFngVV3Eb7PVHhPOe MTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g== -----END CERTIFICATE----- # Issuer: CN=SSL.com Root Certification Authority RSA O=SSL Corporation # Subject: CN=SSL.com Root Certification Authority RSA O=SSL Corporation # Label: "SSL.com Root Certification Authority RSA" # Serial: 8875640296558310041 # MD5 Fingerprint: 86:69:12:c0:70:f1:ec:ac:ac:c2:d5:bc:a5:5b:a1:29 # SHA1 Fingerprint: b7:ab:33:08:d1:ea:44:77:ba:14:80:12:5a:6f:bd:a9:36:49:0c:bb # SHA256 Fingerprint: 85:66:6a:56:2e:e0:be:5c:e9:25:c1:d8:89:0a:6f:76:a8:7e:c1:6d:4d:7d:5f:29:ea:74:19:cf:20:12:3b:69 -----BEGIN CERTIFICATE----- MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UE BhMCVVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQK DA9TU0wgQ29ycG9yYXRpb24xMTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZp Y2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYwMjEyMTczOTM5WhcNNDEwMjEyMTcz OTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hv dXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcN AQEBBQADggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2R xFdHaxh3a3by/ZPkPQ/CFp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aX qhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcC C52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/geoeOy3ZExqysdBP+lSgQ3 6YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkpk8zruFvh /l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrF YD3ZfBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93E JNyAKoFBbZQ+yODJgUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVc US4cK38acijnALXRdMbX5J+tB5O2UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8 ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi81xtZPCvM8hnIk2snYxnP/Okm +Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4sbE6x/c+cCbqi M+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4G A1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGV cpNxJK1ok1iOMq8bs3AD/CUrdIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBc Hadm47GUBwwyOabqG7B52B2ccETjit3E+ZUfijhDPwGFpUenPUayvOUiaPd7nNgs PgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAslu1OJD7OAUN5F7kR/ q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjqerQ0 cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jr a6x+3uxjMxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90I H37hVZkLId6Tngr75qNJvTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/Y K9f1JmzJBjSWFupwWRoyeXkLtoh/D1JIPb9s2KJELtFOt3JY04kTlf5Eq/jXixtu nLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406ywKBjYZC6VWg3dGq2ktuf oYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NIWuuA8ShY Ic2wBlX7Jz9TkHCpBB5XJ7k= -----END CERTIFICATE----- # Issuer: CN=SSL.com Root Certification Authority ECC O=SSL Corporation # Subject: CN=SSL.com Root Certification Authority ECC O=SSL Corporation # Label: "SSL.com Root Certification Authority ECC" # Serial: 8495723813297216424 # MD5 Fingerprint: 2e:da:e4:39:7f:9c:8f:37:d1:70:9f:26:17:51:3a:8e # SHA1 Fingerprint: c3:19:7c:39:24:e6:54:af:1b:c4:ab:20:95:7a:e2:c3:0e:13:02:6a # SHA256 Fingerprint: 34:17:bb:06:cc:60:07:da:1b:96:1c:92:0b:8a:b4:ce:3f:ad:82:0e:4a:a3:0b:9a:cb:c4:a7:4e:bd:ce:bc:65 -----BEGIN CERTIFICATE----- MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMC VVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9T U0wgQ29ycG9yYXRpb24xMTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0 aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEyMTgxNDAzWhcNNDEwMjEyMTgxNDAz WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hvdXN0 b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNvbSBS b290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB BAAiA2IABEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI 7Z4INcgn64mMU1jrYor+8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPg CemB+vNH06NjMGEwHQYDVR0OBBYEFILRhXMw5zUE044CkvvlpNHEIejNMA8GA1Ud EwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTTjgKS++Wk0cQh6M0wDgYD VR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCWe+0F+S8T kdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+ gA0z5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl -----END CERTIFICATE----- # Issuer: CN=SSL.com EV Root Certification Authority RSA R2 O=SSL Corporation # Subject: CN=SSL.com EV Root Certification Authority RSA R2 O=SSL Corporation # Label: "SSL.com EV Root Certification Authority RSA R2" # Serial: 6248227494352943350 # MD5 Fingerprint: e1:1e:31:58:1a:ae:54:53:02:f6:17:6a:11:7b:4d:95 # SHA1 Fingerprint: 74:3a:f0:52:9b:d0:32:a0:f4:4a:83:cd:d4:ba:a9:7b:7c:2e:c4:9a # SHA256 Fingerprint: 2e:7b:f1:6c:c2:24:85:a7:bb:e2:aa:86:96:75:07:61:b0:ae:39:be:3b:2f:e9:d0:cc:6d:4e:f7:34:91:42:5c -----BEGIN CERTIFICATE----- MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNV BAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UE CgwPU1NMIENvcnBvcmF0aW9uMTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2Vy dGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMB4XDTE3MDUzMTE4MTQzN1oXDTQy MDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEQMA4G A1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYDVQQD DC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvq M0fNTPl9fb69LT3w23jhhqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssuf OePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7wcXHswxzpY6IXFJ3vG2fThVUCAtZJycxa 4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTOZw+oz12WGQvE43LrrdF9 HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+B6KjBSYR aZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcA b9ZhCBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQ Gp8hLH94t2S42Oim9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQV PWKchjgGAGYS5Fl2WlPAApiiECtoRHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMO pgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+SlmJuwgUHfbSguPvuUCYHBBXtSu UDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48+qvWBkofZ6aY MBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa4 9QaAJadz20ZpqJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBW s47LCp1Jjr+kxJG7ZhcFUZh1++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5 Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nxY/hoLVUE0fKNsKTPvDxeH3jnpaAg cLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2GguDKBAdRUNf/ktUM 79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDzOFSz /bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXt ll9ldDz7CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEm Kf7GUmG6sXP/wwyc5WxqlD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKK QbNmC1r7fSOl8hqw/96bg5Qu0T/fkreRrwU7ZcegbLHNYhLDkBvjJc40vG93drEQ w/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1hlMYegouCRw2n5H9gooi S9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX9hwJ1C07 mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w== -----END CERTIFICATE----- # Issuer: CN=SSL.com EV Root Certification Authority ECC O=SSL Corporation # Subject: CN=SSL.com EV Root Certification Authority ECC O=SSL Corporation # Label: "SSL.com EV Root Certification Authority ECC" # Serial: 3182246526754555285 # MD5 Fingerprint: 59:53:22:65:83:42:01:54:c0:ce:42:b9:5a:7c:f2:90 # SHA1 Fingerprint: 4c:dd:51:a3:d1:f5:20:32:14:b0:c6:c5:32:23:03:91:c7:46:42:6d # SHA256 Fingerprint: 22:a2:c1:f7:bd:ed:70:4c:c1:e7:01:b5:f4:08:c3:10:88:0f:e9:56:b5:de:2a:4a:44:f9:9c:87:3a:25:a7:c8 -----BEGIN CERTIFICATE----- MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMC VVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9T U0wgQ29ycG9yYXRpb24xNDAyBgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZp Y2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEyMTgxNTIzWhcNNDEwMjEyMTgx NTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hv dXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NMLmNv bSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49 AgEGBSuBBAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMA VIbc/R/fALhBYlzccBYy3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1Kthku WnBaBu2+8KGwytAJKaNjMGEwHQYDVR0OBBYEFFvKXuXe0oGqzagtZFG22XKbl+ZP MA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe5d7SgarNqC1kUbbZcpuX 5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJN+vp1RPZ ytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZg h5Mmm7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg== -----END CERTIFICATE----- # Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R6 # Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R6 # Label: "GlobalSign Root CA - R6" # Serial: 1417766617973444989252670301619537 # MD5 Fingerprint: 4f:dd:07:e4:d4:22:64:39:1e:0c:37:42:ea:d1:c6:ae # SHA1 Fingerprint: 80:94:64:0e:b5:a7:a1:ca:11:9c:1f:dd:d5:9f:81:02:63:a7:fb:d1 # SHA256 Fingerprint: 2c:ab:ea:fe:37:d0:6c:a2:2a:ba:73:91:c0:03:3d:25:98:29:52:c4:53:64:73:49:76:3a:3a:b5:ad:6c:cf:69 -----BEGIN CERTIFICATE----- MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEg MB4GA1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2Jh bFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQx MjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSNjET MBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCAiIwDQYJ KoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQssgrRI xutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1k ZguSgMpE3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxD aNc9PIrFsmbVkJq3MQbFvuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJw LnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqMPKq0pPbzlUoSB239jLKJz9CgYXfIWHSw 1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+azayOeSsJDa38O+2HBNX k7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05OWgtH8wY2 SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/h bguyCLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4n WUx2OVvq+aWh2IMP0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpY rZxCRXluDocZXFSxZba/jJvcE+kNb7gu3GduyYsRtYQUigAZcIN5kZeR1Bonvzce MgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTAD AQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNVHSMEGDAWgBSu bAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGt Ixg93eFyRJa0lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr61 55wsTLxDKZmOMNOsIeDjHfrYBzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLj vUYAGm0CuiVdjaExUd1URhxN25mW7xocBFymFe944Hn+Xds+qkxV/ZoVqW/hpvvf cDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr3TsTjxKM4kEaSHpz oHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB10jZp nOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfs pA9MRf/TuTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+v JJUEeKgDu+6B5dpffItKoZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R 8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+tJDfLRVpOoERIyNiwmcUVhAn21klJwGW4 5hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA= -----END CERTIFICATE----- # Issuer: CN=OISTE WISeKey Global Root GC CA O=WISeKey OU=OISTE Foundation Endorsed # Subject: CN=OISTE WISeKey Global Root GC CA O=WISeKey OU=OISTE Foundation Endorsed # Label: "OISTE WISeKey Global Root GC CA" # Serial: 44084345621038548146064804565436152554 # MD5 Fingerprint: a9:d6:b9:2d:2f:93:64:f8:a5:69:ca:91:e9:68:07:23 # SHA1 Fingerprint: e0:11:84:5e:34:de:be:88:81:b9:9c:f6:16:26:d1:96:1f:c3:b9:31 # SHA256 Fingerprint: 85:60:f9:1c:36:24:da:ba:95:70:b5:fe:a0:db:e3:6f:f1:1a:83:23:be:94:86:85:4f:b3:f3:4a:55:71:19:8d -----BEGIN CERTIFICATE----- MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQsw CQYDVQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91 bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwg Um9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRaFw00MjA1MDkwOTU4MzNaMG0xCzAJ BgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQLExlPSVNURSBGb3Vu ZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2JhbCBS b290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4ni eUqjFqdrVCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4W p2OQ0jnUsYd4XxiWD1AbNTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8E BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7T rYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0EAwMDaAAwZQIwJsdpW9zV 57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtkAjEA2zQg Mgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9 -----END CERTIFICATE----- # Issuer: CN=UCA Global G2 Root O=UniTrust # Subject: CN=UCA Global G2 Root O=UniTrust # Label: "UCA Global G2 Root" # Serial: 124779693093741543919145257850076631279 # MD5 Fingerprint: 80:fe:f0:c4:4a:f0:5c:62:32:9f:1c:ba:78:a9:50:f8 # SHA1 Fingerprint: 28:f9:78:16:19:7a:ff:18:25:18:aa:44:fe:c1:a0:ce:5c:b6:4c:8a # SHA256 Fingerprint: 9b:ea:11:c9:76:fe:01:47:64:c1:be:56:a6:f9:14:b5:a5:60:31:7a:bd:99:88:39:33:82:e5:16:1a:a0:49:3c -----BEGIN CERTIFICATE----- MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9 MQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBH bG9iYWwgRzIgUm9vdDAeFw0xNjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0x CzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlUcnVzdDEbMBkGA1UEAwwSVUNBIEds b2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxeYr b3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmToni9 kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzm VHqUwCoV8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/R VogvGjqNO7uCEeBHANBSh6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDc C/Vkw85DvG1xudLeJ1uK6NjGruFZfc8oLTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIj tm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/R+zvWr9LesGtOxdQXGLY D0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBeKW4bHAyv j5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6Dl NaBa4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6 iIis7nCs+dwp4wwcOxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznP O6Q0ibd5Ei9Hxeepl2n8pndntd978XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/ BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFIHEjMz15DD/pQwIX4wV ZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo5sOASD0Ee/oj L3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5 1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl 1qnN3e92mI0ADs0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oU b3n09tDh05S60FdRvScFDcH9yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LV PtateJLbXDzz2K36uGt/xDYotgIVilQsnLAXc47QN6MUPJiVAAwpBVueSUmxX8fj y88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHojhJi6IjMtX9Gl8Cb EGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZkbxqg DMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI +Vg7RE+xygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGy YiGqhkCyLmTTX8jjfhFnRR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bX UB+K+wb1whnw0A== -----END CERTIFICATE----- # Issuer: CN=UCA Extended Validation Root O=UniTrust # Subject: CN=UCA Extended Validation Root O=UniTrust # Label: "UCA Extended Validation Root" # Serial: 106100277556486529736699587978573607008 # MD5 Fingerprint: a1:f3:5f:43:c6:34:9b:da:bf:8c:7e:05:53:ad:96:e2 # SHA1 Fingerprint: a3:a1:b0:6f:24:61:23:4a:e3:36:a5:c2:37:fc:a6:ff:dd:f0:d7:3a # SHA256 Fingerprint: d4:3a:f9:b3:54:73:75:5c:96:84:fc:06:d7:d8:cb:70:ee:5c:28:e7:73:fb:29:4e:b4:1e:e7:17:22:92:4d:24 -----BEGIN CERTIFICATE----- MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBH MQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBF eHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMx MDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNV BAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIiMA0GCSqGSIb3DQEB AQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrsiWog D4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvS sPGP2KxFRv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aop O2z6+I9tTcg1367r3CTueUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dk sHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR59mzLC52LqGj3n5qiAno8geK+LLNEOfi c0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH0mK1lTnj8/FtDw5lhIpj VMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KRel7sFsLz KuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/ TuDvB0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41G sx2VYVdWf6/wFlthWG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs 1+lvK9JKBZP8nm9rZ/+I8U6laUpSNwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQD fwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS3H5aBZ8eNJr34RQwDwYDVR0T AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBADaN l8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQ VBcZEhrxH9cMaVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5 c6sq1WnIeJEmMX3ixzDx/BR4dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp 4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb+7lsq+KePRXBOy5nAliRn+/4Qh8s t2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOWF3sGPjLtx7dCvHaj 2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwiGpWO vpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2C xR9GUeOcGMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmx cmtpzyKEC2IPrNkZAJSidjzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbM fjKaiJUINlK73nZfdklJrX+9ZSCyycErdhh2n1ax -----END CERTIFICATE----- # Issuer: CN=Certigna Root CA O=Dhimyotis OU=0002 48146308100036 # Subject: CN=Certigna Root CA O=Dhimyotis OU=0002 48146308100036 # Label: "Certigna Root CA" # Serial: 269714418870597844693661054334862075617 # MD5 Fingerprint: 0e:5c:30:62:27:eb:5b:bc:d7:ae:62:ba:e9:d5:df:77 # SHA1 Fingerprint: 2d:0d:52:14:ff:9e:ad:99:24:01:74:20:47:6e:6c:85:27:27:f5:43 # SHA256 Fingerprint: d4:8d:3d:23:ee:db:50:a4:59:e5:51:97:60:1c:27:77:4b:9d:7b:18:c9:4d:5a:05:95:11:a1:02:50:b9:31:68 -----BEGIN CERTIFICATE----- MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAw WjELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAw MiA0ODE0NjMwODEwMDAzNjEZMBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0x MzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjdaMFoxCzAJBgNVBAYTAkZSMRIwEAYD VQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYzMDgxMDAwMzYxGTAX BgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw ggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sO ty3tRQgXstmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9M CiBtnyN6tMbaLOQdLNyzKNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPu I9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8JXrJhFwLrN1CTivngqIkicuQstDuI7pm TLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16XdG+RCYyKfHx9WzMfgIh C59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq4NYKpkDf ePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3Yz IoejwpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWT Co/1VTp2lc5ZmIoJlXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1k JWumIWmbat10TWuXekG9qxf5kBdIjzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5 hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp//TBt2dzhauH8XwIDAQABo4IB GjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE FBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of 1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczov L3d3d3cuY2VydGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilo dHRwOi8vY3JsLmNlcnRpZ25hLmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYr aHR0cDovL2NybC5kaGlteW90aXMuY29tL2NlcnRpZ25hcm9vdGNhLmNybDANBgkq hkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOItOoldaDgvUSILSo3L 6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxPTGRG HVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH6 0BGM+RFq7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncB lA2c5uk5jR+mUYyZDDl34bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdi o2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1 gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS6Cvu5zHbugRqh5jnxV/v faci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaYtlu3zM63 Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayh jWZSaX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw 3kAP+HwV96LOPNdeE4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0= -----END CERTIFICATE----- # Issuer: CN=emSign Root CA - G1 O=eMudhra Technologies Limited OU=emSign PKI # Subject: CN=emSign Root CA - G1 O=eMudhra Technologies Limited OU=emSign PKI # Label: "emSign Root CA - G1" # Serial: 235931866688319308814040 # MD5 Fingerprint: 9c:42:84:57:dd:cb:0b:a7:2e:95:ad:b6:f3:da:bc:ac # SHA1 Fingerprint: 8a:c7:ad:8f:73:ac:4e:c1:b5:75:4d:a5:40:f4:fc:cf:7c:b5:8e:8c # SHA256 Fingerprint: 40:f6:af:03:46:a9:9a:a1:cd:1d:55:5a:4e:9c:ce:62:c7:f9:63:46:03:ee:40:66:15:83:3d:c8:c8:d0:03:67 -----BEGIN CERTIFICATE----- MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYD VQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBU ZWNobm9sb2dpZXMgTGltaXRlZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBH MTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgxODMwMDBaMGcxCzAJBgNVBAYTAklO MRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVkaHJhIFRlY2hub2xv Z2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIBIjAN BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQz f2N4aLTNLnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO 8oG0x5ZOrRkVUkr+PHB1cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aq d7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHWDV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhM tTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ6DqS0hdW5TUaQBw+jSzt Od9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrHhQIDAQAB o0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQD AgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31x PaOfG1vR2vjTnGs2vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjM wiI/aTvFthUvozXGaCocV685743QNcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6d GNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q+Mri/Tm3R7nrft8EI6/6nAYH 6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeihU80Bv2noWgby RQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx iN66zB+Afko= -----END CERTIFICATE----- # Issuer: CN=emSign ECC Root CA - G3 O=eMudhra Technologies Limited OU=emSign PKI # Subject: CN=emSign ECC Root CA - G3 O=eMudhra Technologies Limited OU=emSign PKI # Label: "emSign ECC Root CA - G3" # Serial: 287880440101571086945156 # MD5 Fingerprint: ce:0b:72:d1:9f:88:8e:d0:50:03:e8:e3:b8:8b:67:40 # SHA1 Fingerprint: 30:43:fa:4f:f2:57:dc:a0:c3:80:ee:2e:58:ea:78:b2:3f:e6:bb:c1 # SHA256 Fingerprint: 86:a1:ec:ba:08:9c:4a:8d:3b:be:27:34:c6:12:ba:34:1d:81:3e:04:3c:f9:e8:a8:62:cd:5c:57:a3:6b:be:6b -----BEGIN CERTIFICATE----- MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQG EwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNo bm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g RzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4MTgzMDAwWjBrMQswCQYDVQQGEwJJ TjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9s b2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMw djAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0 WXTsuwYc58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xyS fvalY8L1X44uT6EYGQIrMgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuB zhccLikenEhjQjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggq hkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+DCBeQyh+KTOgNG3qxrdWB CUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7jHvrZQnD +JbNR6iC8hZVdyR+EhCVBCyj -----END CERTIFICATE----- # Issuer: CN=emSign Root CA - C1 O=eMudhra Inc OU=emSign PKI # Subject: CN=emSign Root CA - C1 O=eMudhra Inc OU=emSign PKI # Label: "emSign Root CA - C1" # Serial: 825510296613316004955058 # MD5 Fingerprint: d8:e3:5d:01:21:fa:78:5a:b0:df:ba:d2:ee:2a:5f:68 # SHA1 Fingerprint: e7:2e:f1:df:fc:b2:09:28:cf:5d:d4:d5:67:37:b1:51:cb:86:4f:01 # SHA256 Fingerprint: 12:56:09:aa:30:1d:a0:a2:49:b9:7a:82:39:cb:6a:34:21:6f:44:dc:ac:9f:39:54:b1:42:92:f2:e8:c8:60:8f -----BEGIN CERTIFICATE----- MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkG A1UEBhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEg SW5jMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAw MFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UEBhMCVVMxEzARBgNVBAsTCmVtU2ln biBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNpZ24gUm9v dCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+upufGZ BczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZ HdPIWoU/Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH 3DspVpNqs8FqOp099cGXOFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvH GPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4VI5b2P/AgNBbeCsbEBEV5f6f9vtKppa+c xSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleoomslMuoaJuvimUnzYnu3Yy1 aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+XJGFehiq TbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL BQADggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87 /kOXSTKZEhVb3xEp/6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4 kqNPEjE2NuLe/gDEo2APJ62gsIq1NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrG YQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9wC68AivTxEDkigcxHpvOJpkT +xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQBmIMMMAVSKeo WXzhriKi4gp6D/piq1JM4fHfyr6DDUI= -----END CERTIFICATE----- # Issuer: CN=emSign ECC Root CA - C3 O=eMudhra Inc OU=emSign PKI # Subject: CN=emSign ECC Root CA - C3 O=eMudhra Inc OU=emSign PKI # Label: "emSign ECC Root CA - C3" # Serial: 582948710642506000014504 # MD5 Fingerprint: 3e:53:b3:a3:81:ee:d7:10:f8:d3:b0:1d:17:92:f5:d5 # SHA1 Fingerprint: b6:af:43:c2:9b:81:53:7d:f6:ef:6b:c3:1f:1f:60:15:0c:ee:48:66 # SHA256 Fingerprint: bc:4d:80:9b:15:18:9d:78:db:3e:1d:8c:f4:f9:72:6a:79:5d:a1:64:3c:a5:f1:35:8e:1d:db:0e:dc:0d:7e:b3 -----BEGIN CERTIFICATE----- MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQG EwJVUzETMBEGA1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMx IDAeBgNVBAMTF2VtU2lnbiBFQ0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAw MFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UEBhMCVVMxEzARBgNVBAsTCmVtU2ln biBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQDExdlbVNpZ24gRUND IFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd6bci MK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4Ojavti sIGJAnB9SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0O BBYEFPtaSNCAIEDyqOkAB2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB Af8EBTADAQH/MAoGCCqGSM49BAMDA2gAMGUCMQC02C8Cif22TGK6Q04ThHK1rt0c 3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwUZOR8loMRnLDRWmFLpg9J 0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ== -----END CERTIFICATE----- # Issuer: CN=Hongkong Post Root CA 3 O=Hongkong Post # Subject: CN=Hongkong Post Root CA 3 O=Hongkong Post # Label: "Hongkong Post Root CA 3" # Serial: 46170865288971385588281144162979347873371282084 # MD5 Fingerprint: 11:fc:9f:bd:73:30:02:8a:fd:3f:f3:58:b9:cb:20:f0 # SHA1 Fingerprint: 58:a2:d0:ec:20:52:81:5b:c1:f3:f8:64:02:24:4e:c2:8e:02:4b:02 # SHA256 Fingerprint: 5a:2f:c0:3f:0c:83:b0:90:bb:fa:40:60:4b:09:88:44:6c:76:36:18:3d:f9:84:6e:17:10:1a:44:7f:b8:ef:d6 -----BEGIN CERTIFICATE----- MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQEL BQAwbzELMAkGA1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJ SG9uZyBLb25nMRYwFAYDVQQKEw1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25n a29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2MDMwMjI5NDZaFw00MjA2MDMwMjI5 NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtvbmcxEjAQBgNVBAcT CUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMXSG9u Z2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK AoICAQCziNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFO dem1p+/l6TWZ5Mwc50tfjTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mI VoBc+L0sPOFMV4i707mV78vH9toxdCim5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV 9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOesL4jpNrcyCse2m5FHomY 2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj0mRiikKY vLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+Tt bNe/JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZb x39ri1UbSsUgYT2uy1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+ l2oBlKN8W4UdKjk60FSh0Tlxnf0h+bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YK TE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsGxVd7GYYKecsAyVKvQv83j+Gj Hno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwIDAQABo2MwYTAP BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEw DQYJKoZIhvcNAQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG 7BJ8dNVI0lkUmcDrudHr9EgwW62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCk MpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWldy8joRTnU+kLBEUx3XZL7av9YROXr gZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov+BS5gLNdTaqX4fnk GMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDceqFS 3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJm Ozj/2ZQw9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+ l6mc1X5VTMbeRRAc6uk7nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6c JfTzPV4e0hz5sy229zdcxsshTrD3mUcYhcErulWuBurQB7Lcq9CClnXO0lD+mefP L5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB60PZ2Pierc+xYw5F9KBa LJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fqdBb9HxEG mpv0 -----END CERTIFICATE----- # Issuer: CN=Microsoft ECC Root Certificate Authority 2017 O=Microsoft Corporation # Subject: CN=Microsoft ECC Root Certificate Authority 2017 O=Microsoft Corporation # Label: "Microsoft ECC Root Certificate Authority 2017" # Serial: 136839042543790627607696632466672567020 # MD5 Fingerprint: dd:a1:03:e6:4a:93:10:d1:bf:f0:19:42:cb:fe:ed:67 # SHA1 Fingerprint: 99:9a:64:c3:7f:f4:7d:9f:ab:95:f1:47:69:89:14:60:ee:c4:c3:c5 # SHA256 Fingerprint: 35:8d:f3:9d:76:4a:f9:e1:b7:66:e9:c9:72:df:35:2e:e1:5c:fa:c2:27:af:6a:d1:d7:0e:8e:4a:6e:dc:ba:02 -----BEGIN CERTIFICATE----- MIICWTCCAd+gAwIBAgIQZvI9r4fei7FK6gxXMQHC7DAKBggqhkjOPQQDAzBlMQsw CQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYD VQQDEy1NaWNyb3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIw MTcwHhcNMTkxMjE4MjMwNjQ1WhcNNDIwNzE4MjMxNjA0WjBlMQswCQYDVQQGEwJV UzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNy b3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwdjAQBgcq hkjOPQIBBgUrgQQAIgNiAATUvD0CQnVBEyPNgASGAlEvaqiBYgtlzPbKnR5vSmZR ogPZnZH6thaxjG7efM3beaYvzrvOcS/lpaso7GMEZpn4+vKTEAXhgShC48Zo9OYb hGBKia/teQ87zvH2RPUBeMCjVDBSMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8E BTADAQH/MB0GA1UdDgQWBBTIy5lycFIM+Oa+sgRXKSrPQhDtNTAQBgkrBgEEAYI3 FQEEAwIBADAKBggqhkjOPQQDAwNoADBlAjBY8k3qDPlfXu5gKcs68tvWMoQZP3zV L8KxzJOuULsJMsbG7X7JNpQS5GiFBqIb0C8CMQCZ6Ra0DvpWSNSkMBaReNtUjGUB iudQZsIxtzm6uBoiB078a1QWIP8rtedMDE2mT3M= -----END CERTIFICATE----- # Issuer: CN=Microsoft RSA Root Certificate Authority 2017 O=Microsoft Corporation # Subject: CN=Microsoft RSA Root Certificate Authority 2017 O=Microsoft Corporation # Label: "Microsoft RSA Root Certificate Authority 2017" # Serial: 40975477897264996090493496164228220339 # MD5 Fingerprint: 10:ff:00:ff:cf:c9:f8:c7:7a:c0:ee:35:8e:c9:0f:47 # SHA1 Fingerprint: 73:a5:e6:4a:3b:ff:83:16:ff:0e:dc:cc:61:8a:90:6e:4e:ae:4d:74 # SHA256 Fingerprint: c7:41:f7:0f:4b:2a:8d:88:bf:2e:71:c1:41:22:ef:53:ef:10:eb:a0:cf:a5:e6:4c:fa:20:f4:18:85:30:73:e0 -----BEGIN CERTIFICATE----- MIIFqDCCA5CgAwIBAgIQHtOXCV/YtLNHcB6qvn9FszANBgkqhkiG9w0BAQwFADBl MQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYw NAYDVQQDEy1NaWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 IDIwMTcwHhcNMTkxMjE4MjI1MTIyWhcNNDIwNzE4MjMwMDIzWjBlMQswCQYDVQQG EwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1N aWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwggIi MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKW76UM4wplZEWCpW9R2LBifOZ Nt9GkMml7Xhqb0eRaPgnZ1AzHaGm++DlQ6OEAlcBXZxIQIJTELy/xztokLaCLeX0 ZdDMbRnMlfl7rEqUrQ7eS0MdhweSE5CAg2Q1OQT85elss7YfUJQ4ZVBcF0a5toW1 HLUX6NZFndiyJrDKxHBKrmCk3bPZ7Pw71VdyvD/IybLeS2v4I2wDwAW9lcfNcztm gGTjGqwu+UcF8ga2m3P1eDNbx6H7JyqhtJqRjJHTOoI+dkC0zVJhUXAoP8XFWvLJ jEm7FFtNyP9nTUwSlq31/niol4fX/V4ggNyhSyL71Imtus5Hl0dVe49FyGcohJUc aDDv70ngNXtk55iwlNpNhTs+VcQor1fznhPbRiefHqJeRIOkpcrVE7NLP8TjwuaG YaRSMLl6IE9vDzhTyzMMEyuP1pq9KsgtsRx9S1HKR9FIJ3Jdh+vVReZIZZ2vUpC6 W6IYZVcSn2i51BVrlMRpIpj0M+Dt+VGOQVDJNE92kKz8OMHY4Xu54+OU4UZpyw4K UGsTuqwPN1q3ErWQgR5WrlcihtnJ0tHXUeOrO8ZV/R4O03QK0dqq6mm4lyiPSMQH +FJDOvTKVTUssKZqwJz58oHhEmrARdlns87/I6KJClTUFLkqqNfs+avNJVgyeY+Q W5g5xAgGwax/Dj0ApQIDAQABo1QwUjAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/ BAUwAwEB/zAdBgNVHQ4EFgQUCctZf4aycI8awznjwNnpv7tNsiMwEAYJKwYBBAGC NxUBBAMCAQAwDQYJKoZIhvcNAQEMBQADggIBAKyvPl3CEZaJjqPnktaXFbgToqZC LgLNFgVZJ8og6Lq46BrsTaiXVq5lQ7GPAJtSzVXNUzltYkyLDVt8LkS/gxCP81OC gMNPOsduET/m4xaRhPtthH80dK2Jp86519efhGSSvpWhrQlTM93uCupKUY5vVau6 tZRGrox/2KJQJWVggEbbMwSubLWYdFQl3JPk+ONVFT24bcMKpBLBaYVu32TxU5nh SnUgnZUP5NbcA/FZGOhHibJXWpS2qdgXKxdJ5XbLwVaZOjex/2kskZGT4d9Mozd2 TaGf+G0eHdP67Pv0RR0Tbc/3WeUiJ3IrhvNXuzDtJE3cfVa7o7P4NHmJweDyAmH3 pvwPuxwXC65B2Xy9J6P9LjrRk5Sxcx0ki69bIImtt2dmefU6xqaWM/5TkshGsRGR xpl/j8nWZjEgQRCHLQzWwa80mMpkg/sTV9HB8Dx6jKXB/ZUhoHHBk2dxEuqPiApp GWSZI1b7rCoucL5mxAyE7+WL85MB+GqQk2dLsmijtWKP6T+MejteD+eMuMZ87zf9 dOLITzNy4ZQ5bb0Sr74MTnB8G2+NszKTc0QWbej09+CVgI+WXTik9KveCjCHk9hN AHFiRSdLOkKEW39lt2c0Ui2cFmuqqNh7o0JMcccMyj6D5KbvtwEwXlGjefVwaaZB RA+GsCyRxj3qrg+E -----END CERTIFICATE----- # Issuer: CN=e-Szigno Root CA 2017 O=Microsec Ltd. # Subject: CN=e-Szigno Root CA 2017 O=Microsec Ltd. # Label: "e-Szigno Root CA 2017" # Serial: 411379200276854331539784714 # MD5 Fingerprint: de:1f:f6:9e:84:ae:a7:b4:21:ce:1e:58:7d:d1:84:98 # SHA1 Fingerprint: 89:d4:83:03:4f:9e:9a:48:80:5f:72:37:d4:a9:a6:ef:cb:7c:1f:d1 # SHA256 Fingerprint: be:b0:0b:30:83:9b:9b:c3:2c:32:e4:44:79:05:95:06:41:f2:64:21:b1:5e:d0:89:19:8b:51:8a:e2:ea:1b:99 -----BEGIN CERTIFICATE----- MIICQDCCAeWgAwIBAgIMAVRI7yH9l1kN9QQKMAoGCCqGSM49BAMCMHExCzAJBgNV BAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRk LjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25vIFJv b3QgQ0EgMjAxNzAeFw0xNzA4MjIxMjA3MDZaFw00MjA4MjIxMjA3MDZaMHExCzAJ BgNVBAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMg THRkLjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25v IFJvb3QgQ0EgMjAxNzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJbcPYrYsHtv xie+RJCxs1YVe45DJH0ahFnuY2iyxl6H0BVIHqiQrb1TotreOpCmYF9oMrWGQd+H Wyx7xf58etqjYzBhMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G A1UdDgQWBBSHERUI0arBeAyxr87GyZDvvzAEwDAfBgNVHSMEGDAWgBSHERUI0arB eAyxr87GyZDvvzAEwDAKBggqhkjOPQQDAgNJADBGAiEAtVfd14pVCzbhhkT61Nlo jbjcI4qKDdQvfepz7L9NbKgCIQDLpbQS+ue16M9+k/zzNY9vTlp8tLxOsvxyqltZ +efcMQ== -----END CERTIFICATE----- # Issuer: O=CERTSIGN SA OU=certSIGN ROOT CA G2 # Subject: O=CERTSIGN SA OU=certSIGN ROOT CA G2 # Label: "certSIGN Root CA G2" # Serial: 313609486401300475190 # MD5 Fingerprint: 8c:f1:75:8a:c6:19:cf:94:b7:f7:65:20:87:c3:97:c7 # SHA1 Fingerprint: 26:f9:93:b4:ed:3d:28:27:b0:b9:4b:a7:e9:15:1d:a3:8d:92:e5:32 # SHA256 Fingerprint: 65:7c:fe:2f:a7:3f:aa:38:46:25:71:f3:32:a2:36:3a:46:fc:e7:02:09:51:71:07:02:cd:fb:b6:ee:da:33:05 -----BEGIN CERTIFICATE----- MIIFRzCCAy+gAwIBAgIJEQA0tk7GNi02MA0GCSqGSIb3DQEBCwUAMEExCzAJBgNV BAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJR04g Uk9PVCBDQSBHMjAeFw0xNzAyMDYwOTI3MzVaFw00MjAyMDYwOTI3MzVaMEExCzAJ BgNVBAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJ R04gUk9PVCBDQSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDF dRmRfUR0dIf+DjuW3NgBFszuY5HnC2/OOwppGnzC46+CjobXXo9X69MhWf05N0Iw vlDqtg+piNguLWkh59E3GE59kdUWX2tbAMI5Qw02hVK5U2UPHULlj88F0+7cDBrZ uIt4ImfkabBoxTzkbFpG583H+u/E7Eu9aqSs/cwoUe+StCmrqzWaTOTECMYmzPhp n+Sc8CnTXPnGFiWeI8MgwT0PPzhAsP6CRDiqWhqKa2NYOLQV07YRaXseVO6MGiKs cpc/I1mbySKEwQdPzH/iV8oScLumZfNpdWO9lfsbl83kqK/20U6o2YpxJM02PbyW xPFsqa7lzw1uKA2wDrXKUXt4FMMgL3/7FFXhEZn91QqhngLjYl/rNUssuHLoPj1P rCy7Lobio3aP5ZMqz6WryFyNSwb/EkaseMsUBzXgqd+L6a8VTxaJW732jcZZroiF DsGJ6x9nxUWO/203Nit4ZoORUSs9/1F3dmKh7Gc+PoGD4FapUB8fepmrY7+EF3fx DTvf95xhszWYijqy7DwaNz9+j5LP2RIUZNoQAhVB/0/E6xyjyfqZ90bp4RjZsbgy LcsUDFDYg2WD7rlcz8sFWkz6GZdr1l0T08JcVLwyc6B49fFtHsufpaafItzRUZ6C eWRgKRM+o/1Pcmqr4tTluCRVLERLiohEnMqE0yo7AgMBAAGjQjBAMA8GA1UdEwEB /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSCIS1mxteg4BXrzkwJ d8RgnlRuAzANBgkqhkiG9w0BAQsFAAOCAgEAYN4auOfyYILVAzOBywaK8SJJ6ejq kX/GM15oGQOGO0MBzwdw5AgeZYWR5hEit/UCI46uuR59H35s5r0l1ZUa8gWmr4UC b6741jH/JclKyMeKqdmfS0mbEVeZkkMR3rYzpMzXjWR91M08KCy0mpbqTfXERMQl qiCA2ClV9+BB/AYm/7k29UMUA2Z44RGx2iBfRgB4ACGlHgAoYXhvqAEBj500mv/0 OJD7uNGzcgbJceaBxXntC6Z58hMLnPddDnskk7RI24Zf3lCGeOdA5jGokHZwYa+c NywRtYK3qq4kNFtyDGkNzVmf9nGvnAvRCjj5BiKDUyUM/FHE5r7iOZULJK2v0ZXk ltd0ZGtxTgI8qoXzIKNDOXZbbFD+mpwUHmUUihW9o4JFWklWatKcsWMy5WHgUyIO pwpJ6st+H6jiYoD2EEVSmAYY3qXNL3+q1Ok+CHLsIwMCPKaq2LxndD0UF/tUSxfj 03k9bWtJySgOLnRQvwzZRjoQhsmnP+mg7H/rpXdYaXHmgwo38oZJar55CJD2AhZk PuXaTH4MNMn5X7azKFGnpyuqSfqNZSlO42sTp5SjLVFteAxEy9/eCG/Oo2Sr05WE 1LlSVHJ7liXMvGnjSG4N0MedJ5qq+BOS3R7fY581qRY27Iy4g/Q9iY/NtBde17MX QRBdJ3NghVdJIgc= -----END CERTIFICATE----- # Issuer: CN=Trustwave Global Certification Authority O=Trustwave Holdings, Inc. # Subject: CN=Trustwave Global Certification Authority O=Trustwave Holdings, Inc. # Label: "Trustwave Global Certification Authority" # Serial: 1846098327275375458322922162 # MD5 Fingerprint: f8:1c:18:2d:2f:ba:5f:6d:a1:6c:bc:c7:ab:91:c7:0e # SHA1 Fingerprint: 2f:8f:36:4f:e1:58:97:44:21:59:87:a5:2a:9a:d0:69:95:26:7f:b5 # SHA256 Fingerprint: 97:55:20:15:f5:dd:fc:3c:87:88:c0:06:94:45:55:40:88:94:45:00:84:f1:00:86:70:86:bc:1a:2b:b5:8d:c8 -----BEGIN CERTIFICATE----- MIIF2jCCA8KgAwIBAgIMBfcOhtpJ80Y1LrqyMA0GCSqGSIb3DQEBCwUAMIGIMQsw CQYDVQQGEwJVUzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28x ITAfBgNVBAoMGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1 c3R3YXZlIEdsb2JhbCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMx OTM0MTJaFw00MjA4MjMxOTM0MTJaMIGIMQswCQYDVQQGEwJVUzERMA8GA1UECAwI SWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2ZSBI b2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1c3R3YXZlIEdsb2JhbCBDZXJ0aWZp Y2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB ALldUShLPDeS0YLOvR29zd24q88KPuFd5dyqCblXAj7mY2Hf8g+CY66j96xz0Xzn swuvCAAJWX/NKSqIk4cXGIDtiLK0thAfLdZfVaITXdHG6wZWiYj+rDKd/VzDBcdu 7oaJuogDnXIhhpCujwOl3J+IKMujkkkP7NAP4m1ET4BqstTnoApTAbqOl5F2brz8 1Ws25kCI1nsvXwXoLG0R8+eyvpJETNKXpP7ScoFDB5zpET71ixpZfR9oWN0EACyW 80OzfpgZdNmcc9kYvkHHNHnZ9GLCQ7mzJ7Aiy/k9UscwR7PJPrhq4ufogXBeQotP JqX+OsIgbrv4Fo7NDKm0G2x2EOFYeUY+VM6AqFcJNykbmROPDMjWLBz7BegIlT1l RtzuzWniTY+HKE40Cz7PFNm73bZQmq131BnW2hqIyE4bJ3XYsgjxroMwuREOzYfw hI0Vcnyh78zyiGG69Gm7DIwLdVcEuE4qFC49DxweMqZiNu5m4iK4BUBjECLzMx10 coos9TkpoNPnG4CELcU9402x/RpvumUHO1jsQkUm+9jaJXLE9gCxInm943xZYkqc BW89zubWR2OZxiRvchLIrH+QtAuRcOi35hYQcRfO3gZPSEF9NUqjifLJS3tBEW1n twiYTOURGa5CgNz7kAXU+FDKvuStx8KU1xad5hePrzb7AgMBAAGjQjBAMA8GA1Ud EwEB/wQFMAMBAf8wHQYDVR0OBBYEFJngGWcNYtt2s9o9uFvo/ULSMQ6HMA4GA1Ud DwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAmHNw4rDT7TnsTGDZqRKGFx6W 0OhUKDtkLSGm+J1WE2pIPU/HPinbbViDVD2HfSMF1OQc3Og4ZYbFdada2zUFvXfe uyk3QAUHw5RSn8pk3fEbK9xGChACMf1KaA0HZJDmHvUqoai7PF35owgLEQzxPy0Q lG/+4jSHg9bP5Rs1bdID4bANqKCqRieCNqcVtgimQlRXtpla4gt5kNdXElE1GYhB aCXUNxeEFfsBctyV3lImIJgm4nb1J2/6ADtKYdkNy1GTKv0WBpanI5ojSP5RvbbE sLFUzt5sQa0WZ37b/TjNuThOssFgy50X31ieemKyJo90lZvkWx3SD92YHJtZuSPT MaCm/zjdzyBP6VhWOmfD0faZmZ26NraAL4hHT4a/RDqA5Dccprrql5gR0IRiR2Qe qu5AvzSxnI9O4fKSTx+O856X3vOmeWqJcU9LJxdI/uz0UA9PSX3MReO9ekDFQdxh VicGaeVyQYHTtgGJoC86cnn+OjC/QezHYj6RS8fZMXZC+fc8Y+wmjHMMfRod6qh8 h6jCJ3zhM0EPz8/8AKAigJ5Kp28AsEFFtyLKaEjFQqKu3R3y4G5OBVixwJAWKqQ9 EEC+j2Jjg6mcgn0tAumDMHzLJ8n9HmYAsC7TIS+OMxZsmO0QqAfWzJPP29FpHOTK yeC2nOnOcXHebD8WpHk= -----END CERTIFICATE----- # Issuer: CN=Trustwave Global ECC P256 Certification Authority O=Trustwave Holdings, Inc. # Subject: CN=Trustwave Global ECC P256 Certification Authority O=Trustwave Holdings, Inc. # Label: "Trustwave Global ECC P256 Certification Authority" # Serial: 4151900041497450638097112925 # MD5 Fingerprint: 5b:44:e3:8d:5d:36:86:26:e8:0d:05:d2:59:a7:83:54 # SHA1 Fingerprint: b4:90:82:dd:45:0c:be:8b:5b:b1:66:d3:e2:a4:08:26:cd:ed:42:cf # SHA256 Fingerprint: 94:5b:bc:82:5e:a5:54:f4:89:d1:fd:51:a7:3d:df:2e:a6:24:ac:70:19:a0:52:05:22:5c:22:a7:8c:cf:a8:b4 -----BEGIN CERTIFICATE----- MIICYDCCAgegAwIBAgIMDWpfCD8oXD5Rld9dMAoGCCqGSM49BAMCMIGRMQswCQYD VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAf BgNVBAoTGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3 YXZlIEdsb2JhbCBFQ0MgUDI1NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0x NzA4MjMxOTM1MTBaFw00MjA4MjMxOTM1MTBaMIGRMQswCQYDVQQGEwJVUzERMA8G A1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0 d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBF Q0MgUDI1NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTBZMBMGByqGSM49AgEGCCqG SM49AwEHA0IABH77bOYj43MyCMpg5lOcunSNGLB4kFKA3TjASh3RqMyTpJcGOMoN FWLGjgEqZZ2q3zSRLoHB5DOSMcT9CTqmP62jQzBBMA8GA1UdEwEB/wQFMAMBAf8w DwYDVR0PAQH/BAUDAwcGADAdBgNVHQ4EFgQUo0EGrJBt0UrrdaVKEJmzsaGLSvcw CgYIKoZIzj0EAwIDRwAwRAIgB+ZU2g6gWrKuEZ+Hxbb/ad4lvvigtwjzRM4q3wgh DDcCIC0mA6AFvWvR9lz4ZcyGbbOcNEhjhAnFjXca4syc4XR7 -----END CERTIFICATE----- # Issuer: CN=Trustwave Global ECC P384 Certification Authority O=Trustwave Holdings, Inc. # Subject: CN=Trustwave Global ECC P384 Certification Authority O=Trustwave Holdings, Inc. # Label: "Trustwave Global ECC P384 Certification Authority" # Serial: 2704997926503831671788816187 # MD5 Fingerprint: ea:cf:60:c4:3b:b9:15:29:40:a1:97:ed:78:27:93:d6 # SHA1 Fingerprint: e7:f3:a3:c8:cf:6f:c3:04:2e:6d:0e:67:32:c5:9e:68:95:0d:5e:d2 # SHA256 Fingerprint: 55:90:38:59:c8:c0:c3:eb:b8:75:9e:ce:4e:25:57:22:5f:f5:75:8b:bd:38:eb:d4:82:76:60:1e:1b:d5:80:97 -----BEGIN CERTIFICATE----- MIICnTCCAiSgAwIBAgIMCL2Fl2yZJ6SAaEc7MAoGCCqGSM49BAMDMIGRMQswCQYD VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAf BgNVBAoTGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3 YXZlIEdsb2JhbCBFQ0MgUDM4NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0x NzA4MjMxOTM2NDNaFw00MjA4MjMxOTM2NDNaMIGRMQswCQYDVQQGEwJVUzERMA8G A1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0 d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBF Q0MgUDM4NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTB2MBAGByqGSM49AgEGBSuB BAAiA2IABGvaDXU1CDFHBa5FmVXxERMuSvgQMSOjfoPTfygIOiYaOs+Xgh+AtycJ j9GOMMQKmw6sWASr9zZ9lCOkmwqKi6vr/TklZvFe/oyujUF5nQlgziip04pt89ZF 1PKYhDhloKNDMEEwDwYDVR0TAQH/BAUwAwEB/zAPBgNVHQ8BAf8EBQMDBwYAMB0G A1UdDgQWBBRVqYSJ0sEyvRjLbKYHTsjnnb6CkDAKBggqhkjOPQQDAwNnADBkAjA3 AZKXRRJ+oPM+rRk6ct30UJMDEr5E0k9BpIycnR+j9sKS50gU/k6bpZFXrsY3crsC MGclCrEMXu6pY5Jv5ZAL/mYiykf9ijH3g/56vxC+GCsej/YpHpRZ744hN8tRmKVu Sw== -----END CERTIFICATE----- # Issuer: CN=NAVER Global Root Certification Authority O=NAVER BUSINESS PLATFORM Corp. # Subject: CN=NAVER Global Root Certification Authority O=NAVER BUSINESS PLATFORM Corp. # Label: "NAVER Global Root Certification Authority" # Serial: 9013692873798656336226253319739695165984492813 # MD5 Fingerprint: c8:7e:41:f6:25:3b:f5:09:b3:17:e8:46:3d:bf:d0:9b # SHA1 Fingerprint: 8f:6b:f2:a9:27:4a:da:14:a0:c4:f4:8e:61:27:f9:c0:1e:78:5d:d1 # SHA256 Fingerprint: 88:f4:38:dc:f8:ff:d1:fa:8f:42:91:15:ff:e5:f8:2a:e1:e0:6e:0c:70:c3:75:fa:ad:71:7b:34:a4:9e:72:65 -----BEGIN CERTIFICATE----- MIIFojCCA4qgAwIBAgIUAZQwHqIL3fXFMyqxQ0Rx+NZQTQ0wDQYJKoZIhvcNAQEM BQAwaTELMAkGA1UEBhMCS1IxJjAkBgNVBAoMHU5BVkVSIEJVU0lORVNTIFBMQVRG T1JNIENvcnAuMTIwMAYDVQQDDClOQVZFUiBHbG9iYWwgUm9vdCBDZXJ0aWZpY2F0 aW9uIEF1dGhvcml0eTAeFw0xNzA4MTgwODU4NDJaFw0zNzA4MTgyMzU5NTlaMGkx CzAJBgNVBAYTAktSMSYwJAYDVQQKDB1OQVZFUiBCVVNJTkVTUyBQTEFURk9STSBD b3JwLjEyMDAGA1UEAwwpTkFWRVIgR2xvYmFsIFJvb3QgQ2VydGlmaWNhdGlvbiBB dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC21PGTXLVA iQqrDZBbUGOukJR0F0Vy1ntlWilLp1agS7gvQnXp2XskWjFlqxcX0TM62RHcQDaH 38dq6SZeWYp34+hInDEW+j6RscrJo+KfziFTowI2MMtSAuXaMl3Dxeb57hHHi8lE HoSTGEq0n+USZGnQJoViAbbJAh2+g1G7XNr4rRVqmfeSVPc0W+m/6imBEtRTkZaz kVrd/pBzKPswRrXKCAfHcXLJZtM0l/aM9BhK4dA9WkW2aacp+yPOiNgSnABIqKYP szuSjXEOdMWLyEz59JuOuDxp7W87UC9Y7cSw0BwbagzivESq2M0UXZR4Yb8Obtoq vC8MC3GmsxY/nOb5zJ9TNeIDoKAYv7vxvvTWjIcNQvcGufFt7QSUqP620wbGQGHf nZ3zVHbOUzoBppJB7ASjjw2i1QnK1sua8e9DXcCrpUHPXFNwcMmIpi3Ua2FzUCaG YQ5fG8Ir4ozVu53BA0K6lNpfqbDKzE0K70dpAy8i+/Eozr9dUGWokG2zdLAIx6yo 0es+nPxdGoMuK8u180SdOqcXYZaicdNwlhVNt0xz7hlcxVs+Qf6sdWA7G2POAN3a CJBitOUt7kinaxeZVL6HSuOpXgRM6xBtVNbv8ejyYhbLgGvtPe31HzClrkvJE+2K AQHJuFFYwGY6sWZLxNUxAmLpdIQM201GLQIDAQABo0IwQDAdBgNVHQ4EFgQU0p+I 36HNLL3s9TsBAZMzJ7LrYEswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMB Af8wDQYJKoZIhvcNAQEMBQADggIBADLKgLOdPVQG3dLSLvCkASELZ0jKbY7gyKoN qo0hV4/GPnrK21HUUrPUloSlWGB/5QuOH/XcChWB5Tu2tyIvCZwTFrFsDDUIbatj cu3cvuzHV+YwIHHW1xDBE1UBjCpD5EHxzzp6U5LOogMFDTjfArsQLtk70pt6wKGm +LUx5vR1yblTmXVHIloUFcd4G7ad6Qz4G3bxhYTeodoS76TiEJd6eN4MUZeoIUCL hr0N8F5OSza7OyAfikJW4Qsav3vQIkMsRIz75Sq0bBwcupTgE34h5prCy8VCZLQe lHsIJchxzIdFV4XTnyliIoNRlwAYl3dqmJLJfGBs32x9SuRwTMKeuB330DTHD8z7 p/8Dvq1wkNoL3chtl1+afwkyQf3NosxabUzyqkn+Zvjp2DXrDige7kgvOtB5CTh8 piKCk5XQA76+AqAF3SAi428diDRgxuYKuQl1C/AH6GmWNcf7I4GOODm4RStDeKLR LBT/DShycpWbXgnbiUSYqqFJu3FS8r/2/yehNq+4tneI3TqkbZs0kNwUXTC/t+sX 5Ie3cdCh13cV1ELX8vMxmV2b3RZtP+oGI/hGoiLtk/bdmuYqh7GYVPEi92tF4+KO dh2ajcQGjTa3FPOdVGm3jjzVpG2Tgbet9r1ke8LJaDmgkpzNNIaRkPpkUZ3+/uul 9XXeifdy -----END CERTIFICATE----- # Issuer: CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS O=FNMT-RCM OU=Ceres # Subject: CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS O=FNMT-RCM OU=Ceres # Label: "AC RAIZ FNMT-RCM SERVIDORES SEGUROS" # Serial: 131542671362353147877283741781055151509 # MD5 Fingerprint: 19:36:9c:52:03:2f:d2:d1:bb:23:cc:dd:1e:12:55:bb # SHA1 Fingerprint: 62:ff:d9:9e:c0:65:0d:03:ce:75:93:d2:ed:3f:2d:32:c9:e3:e5:4a # SHA256 Fingerprint: 55:41:53:b1:3d:2c:f9:dd:b7:53:bf:be:1a:4e:0a:e0:8d:0a:a4:18:70:58:fe:60:a2:b8:62:b2:e4:b8:7b:cb -----BEGIN CERTIFICATE----- MIICbjCCAfOgAwIBAgIQYvYybOXE42hcG2LdnC6dlTAKBggqhkjOPQQDAzB4MQsw CQYDVQQGEwJFUzERMA8GA1UECgwIRk5NVC1SQ00xDjAMBgNVBAsMBUNlcmVzMRgw FgYDVQRhDA9WQVRFUy1RMjgyNjAwNEoxLDAqBgNVBAMMI0FDIFJBSVogRk5NVC1S Q00gU0VSVklET1JFUyBTRUdVUk9TMB4XDTE4MTIyMDA5MzczM1oXDTQzMTIyMDA5 MzczM1oweDELMAkGA1UEBhMCRVMxETAPBgNVBAoMCEZOTVQtUkNNMQ4wDAYDVQQL DAVDZXJlczEYMBYGA1UEYQwPVkFURVMtUTI4MjYwMDRKMSwwKgYDVQQDDCNBQyBS QUlaIEZOTVQtUkNNIFNFUlZJRE9SRVMgU0VHVVJPUzB2MBAGByqGSM49AgEGBSuB BAAiA2IABPa6V1PIyqvfNkpSIeSX0oNnnvBlUdBeh8dHsVnyV0ebAAKTRBdp20LH sbI6GA60XYyzZl2hNPk2LEnb80b8s0RpRBNm/dfF/a82Tc4DTQdxz69qBdKiQ1oK Um8BA06Oi6NCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD VR0OBBYEFAG5L++/EYZg8k/QQW6rcx/n0m5JMAoGCCqGSM49BAMDA2kAMGYCMQCu SuMrQMN0EfKVrRYj3k4MGuZdpSRea0R7/DjiT8ucRRcRTBQnJlU5dUoDzBOQn5IC MQD6SmxgiHPz7riYYqnOK8LZiqZwMR2vsJRM60/G49HzYqc8/5MuB1xJAWdpEgJy v+c= -----END CERTIFICATE----- # Issuer: CN=GlobalSign Root R46 O=GlobalSign nv-sa # Subject: CN=GlobalSign Root R46 O=GlobalSign nv-sa # Label: "GlobalSign Root R46" # Serial: 1552617688466950547958867513931858518042577 # MD5 Fingerprint: c4:14:30:e4:fa:66:43:94:2a:6a:1b:24:5f:19:d0:ef # SHA1 Fingerprint: 53:a2:b0:4b:ca:6b:d6:45:e6:39:8a:8e:c4:0d:d2:bf:77:c3:a2:90 # SHA256 Fingerprint: 4f:a3:12:6d:8d:3a:11:d1:c4:85:5a:4f:80:7c:ba:d6:cf:91:9d:3a:5a:88:b0:3b:ea:2c:63:72:d9:3c:40:c9 -----BEGIN CERTIFICATE----- MIIFWjCCA0KgAwIBAgISEdK7udcjGJ5AXwqdLdDfJWfRMA0GCSqGSIb3DQEBDAUA MEYxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYD VQQDExNHbG9iYWxTaWduIFJvb3QgUjQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMy MDAwMDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYt c2ExHDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBSNDYwggIiMA0GCSqGSIb3DQEB AQUAA4ICDwAwggIKAoICAQCsrHQy6LNl5brtQyYdpokNRbopiLKkHWPd08EsCVeJ OaFV6Wc0dwxu5FUdUiXSE2te4R2pt32JMl8Nnp8semNgQB+msLZ4j5lUlghYruQG vGIFAha/r6gjA7aUD7xubMLL1aa7DOn2wQL7Id5m3RerdELv8HQvJfTqa1VbkNud 316HCkD7rRlr+/fKYIje2sGP1q7Vf9Q8g+7XFkyDRTNrJ9CG0Bwta/OrffGFqfUo 0q3v84RLHIf8E6M6cqJaESvWJ3En7YEtbWaBkoe0G1h6zD8K+kZPTXhc+CtI4wSE y132tGqzZfxCnlEmIyDLPRT5ge1lFgBPGmSXZgjPjHvjK8Cd+RTyG/FWaha/LIWF zXg4mutCagI0GIMXTpRW+LaCtfOW3T3zvn8gdz57GSNrLNRyc0NXfeD412lPFzYE +cCQYDdF3uYM2HSNrpyibXRdQr4G9dlkbgIQrImwTDsHTUB+JMWKmIJ5jqSngiCN I/onccnfxkF0oE32kRbcRoxfKWMxWXEM2G/CtjJ9++ZdU6Z+Ffy7dXxd7Pj2Fxzs x2sZy/N78CsHpdlseVR2bJ0cpm4O6XkMqCNqo98bMDGfsVR7/mrLZqrcZdCinkqa ByFrgY/bxFn63iLABJzjqls2k+g9vXqhnQt2sQvHnf3PmKgGwvgqo6GDoLclcqUC 4wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV HQ4EFgQUA1yrc4GHqMywptWU4jaWSf8FmSwwDQYJKoZIhvcNAQEMBQADggIBAHx4 7PYCLLtbfpIrXTncvtgdokIzTfnvpCo7RGkerNlFo048p9gkUbJUHJNOxO97k4Vg JuoJSOD1u8fpaNK7ajFxzHmuEajwmf3lH7wvqMxX63bEIaZHU1VNaL8FpO7XJqti 2kM3S+LGteWygxk6x9PbTZ4IevPuzz5i+6zoYMzRx6Fcg0XERczzF2sUyQQCPtIk pnnpHs6i58FZFZ8d4kuaPp92CC1r2LpXFNqD6v6MVenQTqnMdzGxRBF6XLE+0xRF FRhiJBPSy03OXIPBNvIQtQ6IbbjhVp+J3pZmOUdkLG5NrmJ7v2B0GbhWrJKsFjLt rWhV/pi60zTe9Mlhww6G9kuEYO4Ne7UyWHmRVSyBQ7N0H3qqJZ4d16GLuc1CLgSk ZoNNiTW2bKg2SnkheCLQQrzRQDGQob4Ez8pn7fXwgNNgyYMqIgXQBztSvwyeqiv5 u+YfjyW6hY0XHgL+XVAEV8/+LbzvXMAaq7afJMbfc2hIkCwU9D9SGuTSyxTDYWnP 4vkYxboznxSjBF25cfe1lNj2M8FawTSLfJvdkzrnE6JwYZ+vj+vYxXX4M2bUdGc6 N3ec592kD3ZDZopD8p/7DEJ4Y9HiD2971KE9dJeFt0g5QdYg/NA6s/rob8SKunE3 vouXsXgxT7PntgMTzlSdriVZzH81Xwj3QEUxeCp6 -----END CERTIFICATE----- # Issuer: CN=GlobalSign Root E46 O=GlobalSign nv-sa # Subject: CN=GlobalSign Root E46 O=GlobalSign nv-sa # Label: "GlobalSign Root E46" # Serial: 1552617690338932563915843282459653771421763 # MD5 Fingerprint: b5:b8:66:ed:de:08:83:e3:c9:e2:01:34:06:ac:51:6f # SHA1 Fingerprint: 39:b4:6c:d5:fe:80:06:eb:e2:2f:4a:bb:08:33:a0:af:db:b9:dd:84 # SHA256 Fingerprint: cb:b9:c4:4d:84:b8:04:3e:10:50:ea:31:a6:9f:51:49:55:d7:bf:d2:e2:c6:b4:93:01:01:9a:d6:1d:9f:50:58 -----BEGIN CERTIFICATE----- MIICCzCCAZGgAwIBAgISEdK7ujNu1LzmJGjFDYQdmOhDMAoGCCqGSM49BAMDMEYx CzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQD ExNHbG9iYWxTaWduIFJvb3QgRTQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMyMDAw MDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2Ex HDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUrgQQA IgNiAAScDrHPt+ieUnd1NPqlRqetMhkytAepJ8qUuwzSChDH2omwlwxwEwkBjtjq R+q+soArzfwoDdusvKSGN+1wCAB16pMLey5SnCNoIwZD7JIvU4Tb+0cUB+hflGdd yXqBPCCjQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud DgQWBBQxCpCPtsad0kRLgLWi5h+xEk8blTAKBggqhkjOPQQDAwNoADBlAjEA31SQ 7Zvvi5QCkxeCmb6zniz2C5GMn0oUsfZkvLtoURMMA/cVi4RguYv/Uo7njLwcAjA8 +RHUjE7AwWHCFUyqqx0LMV87HOIAl0Qx5v5zli/altP+CAezNIm8BZ/3Hobui3A= -----END CERTIFICATE----- # Issuer: CN=ANF Secure Server Root CA O=ANF Autoridad de Certificacion OU=ANF CA Raiz # Subject: CN=ANF Secure Server Root CA O=ANF Autoridad de Certificacion OU=ANF CA Raiz # Label: "ANF Secure Server Root CA" # Serial: 996390341000653745 # MD5 Fingerprint: 26:a6:44:5a:d9:af:4e:2f:b2:1d:b6:65:b0:4e:e8:96 # SHA1 Fingerprint: 5b:6e:68:d0:cc:15:b6:a0:5f:1e:c1:5f:ae:02:fc:6b:2f:5d:6f:74 # SHA256 Fingerprint: fb:8f:ec:75:91:69:b9:10:6b:1e:51:16:44:c6:18:c5:13:04:37:3f:6c:06:43:08:8d:8b:ef:fd:1b:99:75:99 -----BEGIN CERTIFICATE----- MIIF7zCCA9egAwIBAgIIDdPjvGz5a7EwDQYJKoZIhvcNAQELBQAwgYQxEjAQBgNV BAUTCUc2MzI4NzUxMDELMAkGA1UEBhMCRVMxJzAlBgNVBAoTHkFORiBBdXRvcmlk YWQgZGUgQ2VydGlmaWNhY2lvbjEUMBIGA1UECxMLQU5GIENBIFJhaXoxIjAgBgNV BAMTGUFORiBTZWN1cmUgU2VydmVyIFJvb3QgQ0EwHhcNMTkwOTA0MTAwMDM4WhcN MzkwODMwMTAwMDM4WjCBhDESMBAGA1UEBRMJRzYzMjg3NTEwMQswCQYDVQQGEwJF UzEnMCUGA1UEChMeQU5GIEF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uMRQwEgYD VQQLEwtBTkYgQ0EgUmFpejEiMCAGA1UEAxMZQU5GIFNlY3VyZSBTZXJ2ZXIgUm9v dCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANvrayvmZFSVgpCj cqQZAZ2cC4Ffc0m6p6zzBE57lgvsEeBbphzOG9INgxwruJ4dfkUyYA8H6XdYfp9q yGFOtibBTI3/TO80sh9l2Ll49a2pcbnvT1gdpd50IJeh7WhM3pIXS7yr/2WanvtH 2Vdy8wmhrnZEE26cLUQ5vPnHO6RYPUG9tMJJo8gN0pcvB2VSAKduyK9o7PQUlrZX H1bDOZ8rbeTzPvY1ZNoMHKGESy9LS+IsJJ1tk0DrtSOOMspvRdOoiXsezx76W0OL zc2oD2rKDF65nkeP8Nm2CgtYZRczuSPkdxl9y0oukntPLxB3sY0vaJxizOBQ+OyR p1RMVwnVdmPF6GUe7m1qzwmd+nxPrWAI/VaZDxUse6mAq4xhj0oHdkLePfTdsiQz W7i1o0TJrH93PB0j7IKppuLIBkwC/qxcmZkLLxCKpvR/1Yd0DVlJRfbwcVw5Kda/ SiOL9V8BY9KHcyi1Swr1+KuCLH5zJTIdC2MKF4EA/7Z2Xue0sUDKIbvVgFHlSFJn LNJhiQcND85Cd8BEc5xEUKDbEAotlRyBr+Qc5RQe8TZBAQIvfXOn3kLMTOmJDVb3 n5HUA8ZsyY/b2BzgQJhdZpmYgG4t/wHFzstGH6wCxkPmrqKEPMVOHj1tyRRM4y5B u8o5vzY8KhmqQYdOpc5LMnndkEl/AgMBAAGjYzBhMB8GA1UdIwQYMBaAFJxf0Gxj o1+TypOYCK2Mh6UsXME3MB0GA1UdDgQWBBScX9BsY6Nfk8qTmAitjIelLFzBNzAO BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC AgEATh65isagmD9uw2nAalxJUqzLK114OMHVVISfk/CHGT0sZonrDUL8zPB1hT+L 9IBdeeUXZ701guLyPI59WzbLWoAAKfLOKyzxj6ptBZNscsdW699QIyjlRRA96Gej rw5VD5AJYu9LWaL2U/HANeQvwSS9eS9OICI7/RogsKQOLHDtdD+4E5UGUcjohybK pFtqFiGS3XNgnhAY3jyB6ugYw3yJ8otQPr0R4hUDqDZ9MwFsSBXXiJCZBMXM5gf0 vPSQ7RPi6ovDj6MzD8EpTBNO2hVWcXNyglD2mjN8orGoGjR0ZVzO0eurU+AagNjq OknkJjCb5RyKqKkVMoaZkgoQI1YS4PbOTOK7vtuNknMBZi9iPrJyJ0U27U1W45eZ /zo1PqVUSlJZS2Db7v54EX9K3BR5YLZrZAPbFYPhor72I5dQ8AkzNqdxliXzuUJ9 2zg/LFis6ELhDtjTO0wugumDLmsx2d1Hhk9tl5EuT+IocTUW0fJz/iUrB0ckYyfI +PbZa/wSMVYIwFNCr5zQM378BvAxRAMU8Vjq8moNqRGyg77FGr8H6lnco4g175x2 MjxNBiLOFeXdntiP2t7SxDnlF4HPOEfrf4htWRvfn0IUrn7PqLBmZdo3r5+qPeoo tt7VMVgWglvquxl1AnMaykgaIZOQCo6ThKd9OyMYkomgjaw= -----END CERTIFICATE----- # Issuer: CN=Certum EC-384 CA O=Asseco Data Systems S.A. OU=Certum Certification Authority # Subject: CN=Certum EC-384 CA O=Asseco Data Systems S.A. OU=Certum Certification Authority # Label: "Certum EC-384 CA" # Serial: 160250656287871593594747141429395092468 # MD5 Fingerprint: b6:65:b3:96:60:97:12:a1:ec:4e:e1:3d:a3:c6:c9:f1 # SHA1 Fingerprint: f3:3e:78:3c:ac:df:f4:a2:cc:ac:67:55:69:56:d7:e5:16:3c:e1:ed # SHA256 Fingerprint: 6b:32:80:85:62:53:18:aa:50:d1:73:c9:8d:8b:da:09:d5:7e:27:41:3d:11:4c:f7:87:a0:f5:d0:6c:03:0c:f6 -----BEGIN CERTIFICATE----- MIICZTCCAeugAwIBAgIQeI8nXIESUiClBNAt3bpz9DAKBggqhkjOPQQDAzB0MQsw CQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScw JQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAXBgNVBAMT EENlcnR1bSBFQy0zODQgQ0EwHhcNMTgwMzI2MDcyNDU0WhcNNDMwMzI2MDcyNDU0 WjB0MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBT LkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAX BgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATE KI6rGFtqvm5kN2PkzeyrOvfMobgOgknXhimfoZTy42B4mIF4Bk3y7JoOV2CDn7Tm Fy8as10CW4kjPMIRBSqniBMY81CE1700LCeJVf/OTOffph8oxPBUw7l8t1Ot68Kj QjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI0GZnQkdjrzife81r1HfS+8 EF9LMA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNoADBlAjADVS2m5hjEfO/J UG7BJw+ch69u1RsIGL2SKcHvlJF40jocVYli5RsJHrpka/F2tNQCMQC0QoSZ/6vn nvuRlydd3LBbMHHOXjgaatkl5+r3YZJW+OraNsKHZZYuciUvf9/DE8k= -----END CERTIFICATE----- # Issuer: CN=Certum Trusted Root CA O=Asseco Data Systems S.A. OU=Certum Certification Authority # Subject: CN=Certum Trusted Root CA O=Asseco Data Systems S.A. OU=Certum Certification Authority # Label: "Certum Trusted Root CA" # Serial: 40870380103424195783807378461123655149 # MD5 Fingerprint: 51:e1:c2:e7:fe:4c:84:af:59:0e:2f:f4:54:6f:ea:29 # SHA1 Fingerprint: c8:83:44:c0:18:ae:9f:cc:f1:87:b7:8f:22:d1:c5:d7:45:84:ba:e5 # SHA256 Fingerprint: fe:76:96:57:38:55:77:3e:37:a9:5e:7a:d4:d9:cc:96:c3:01:57:c1:5d:31:76:5b:a9:b1:57:04:e1:ae:78:fd -----BEGIN CERTIFICATE----- MIIFwDCCA6igAwIBAgIQHr9ZULjJgDdMBvfrVU+17TANBgkqhkiG9w0BAQ0FADB6 MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEu MScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxHzAdBgNV BAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwHhcNMTgwMzE2MTIxMDEzWhcNNDMw MzE2MTIxMDEzWjB6MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEg U3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRo b3JpdHkxHzAdBgNVBAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwggIiMA0GCSqG SIb3DQEBAQUAA4ICDwAwggIKAoICAQDRLY67tzbqbTeRn06TpwXkKQMlzhyC93yZ n0EGze2jusDbCSzBfN8pfktlL5On1AFrAygYo9idBcEq2EXxkd7fO9CAAozPOA/q p1x4EaTByIVcJdPTsuclzxFUl6s1wB52HO8AU5853BSlLCIls3Jy/I2z5T4IHhQq NwuIPMqw9MjCoa68wb4pZ1Xi/K1ZXP69VyywkI3C7Te2fJmItdUDmj0VDT06qKhF 8JVOJVkdzZhpu9PMMsmN74H+rX2Ju7pgE8pllWeg8xn2A1bUatMn4qGtg/BKEiJ3 HAVz4hlxQsDsdUaakFjgao4rpUYwBI4Zshfjvqm6f1bxJAPXsiEodg42MEx51UGa mqi4NboMOvJEGyCI98Ul1z3G4z5D3Yf+xOr1Uz5MZf87Sst4WmsXXw3Hw09Omiqi 7VdNIuJGmj8PkTQkfVXjjJU30xrwCSss0smNtA0Aq2cpKNgB9RkEth2+dv5yXMSF ytKAQd8FqKPVhJBPC/PgP5sZ0jeJP/J7UhyM9uH3PAeXjA6iWYEMspA90+NZRu0P qafegGtaqge2Gcu8V/OXIXoMsSt0Puvap2ctTMSYnjYJdmZm/Bo/6khUHL4wvYBQ v3y1zgD2DGHZ5yQD4OMBgQ692IU0iL2yNqh7XAjlRICMb/gv1SHKHRzQ+8S1h9E6 Tsd2tTVItQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSM+xx1 vALTn04uSNn5YFSqxLNP+jAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQENBQAD ggIBAEii1QALLtA/vBzVtVRJHlpr9OTy4EA34MwUe7nJ+jW1dReTagVphZzNTxl4 WxmB82M+w85bj/UvXgF2Ez8sALnNllI5SW0ETsXpD4YN4fqzX4IS8TrOZgYkNCvo zMrnadyHncI013nR03e4qllY/p0m+jiGPp2Kh2RX5Rc64vmNueMzeMGQ2Ljdt4NR 5MTMI9UGfOZR0800McD2RrsLrfw9EAUqO0qRJe6M1ISHgCq8CYyqOhNf6DR5UMEQ GfnTKB7U0VEwKbOukGfWHwpjscWpxkIxYxeU72nLL/qMFH3EQxiJ2fAyQOaA4kZf 5ePBAFmo+eggvIksDkc0C+pXwlM2/KfUrzHN/gLldfq5Jwn58/U7yn2fqSLLiMmq 0Uc9NneoWWRrJ8/vJ8HjJLWG965+Mk2weWjROeiQWMODvA8s1pfrzgzhIMfatz7D P78v3DSk+yshzWePS/Tj6tQ/50+6uaWTRRxmHyH6ZF5v4HaUMst19W7l9o/HuKTM qJZ9ZPskWkoDbGs4xugDQ5r3V7mzKWmTOPQD8rv7gmsHINFSH5pkAnuYZttcTVoP 0ISVoDwUQwbKytu4QTbaakRnh6+v40URFWkIsr4WOZckbxJF0WddCajJFdr60qZf E2Efv4WstK2tBZQIgx51F9NxO5NQI1mg7TyRVJ12AMXDuDjb -----END CERTIFICATE----- # Issuer: CN=TunTrust Root CA O=Agence Nationale de Certification Electronique # Subject: CN=TunTrust Root CA O=Agence Nationale de Certification Electronique # Label: "TunTrust Root CA" # Serial: 108534058042236574382096126452369648152337120275 # MD5 Fingerprint: 85:13:b9:90:5b:36:5c:b6:5e:b8:5a:f8:e0:31:57:b4 # SHA1 Fingerprint: cf:e9:70:84:0f:e0:73:0f:9d:f6:0c:7f:2c:4b:ee:20:46:34:9c:bb # SHA256 Fingerprint: 2e:44:10:2a:b5:8c:b8:54:19:45:1c:8e:19:d9:ac:f3:66:2c:af:bc:61:4b:6a:53:96:0a:30:f7:d0:e2:eb:41 -----BEGIN CERTIFICATE----- MIIFszCCA5ugAwIBAgIUEwLV4kBMkkaGFmddtLu7sms+/BMwDQYJKoZIhvcNAQEL BQAwYTELMAkGA1UEBhMCVE4xNzA1BgNVBAoMLkFnZW5jZSBOYXRpb25hbGUgZGUg Q2VydGlmaWNhdGlvbiBFbGVjdHJvbmlxdWUxGTAXBgNVBAMMEFR1blRydXN0IFJv b3QgQ0EwHhcNMTkwNDI2MDg1NzU2WhcNNDQwNDI2MDg1NzU2WjBhMQswCQYDVQQG EwJUTjE3MDUGA1UECgwuQWdlbmNlIE5hdGlvbmFsZSBkZSBDZXJ0aWZpY2F0aW9u IEVsZWN0cm9uaXF1ZTEZMBcGA1UEAwwQVHVuVHJ1c3QgUm9vdCBDQTCCAiIwDQYJ KoZIhvcNAQEBBQADggIPADCCAgoCggIBAMPN0/y9BFPdDCA61YguBUtB9YOCfvdZ n56eY+hz2vYGqU8ftPkLHzmMmiDQfgbU7DTZhrx1W4eI8NLZ1KMKsmwb60ksPqxd 2JQDoOw05TDENX37Jk0bbjBU2PWARZw5rZzJJQRNmpA+TkBuimvNKWfGzC3gdOgF VwpIUPp6Q9p+7FuaDmJ2/uqdHYVy7BG7NegfJ7/Boce7SBbdVtfMTqDhuazb1YMZ GoXRlJfXyqNlC/M4+QKu3fZnz8k/9YosRxqZbwUN/dAdgjH8KcwAWJeRTIAAHDOF li/LQcKLEITDCSSJH7UP2dl3RxiSlGBcx5kDPP73lad9UKGAwqmDrViWVSHbhlnU r8a83YFuB9tgYv7sEG7aaAH0gxupPqJbI9dkxt/con3YS7qC0lH4Zr8GRuR5KiY2 eY8fTpkdso8MDhz/yV3A/ZAQprE38806JG60hZC/gLkMjNWb1sjxVj8agIl6qeIb MlEsPvLfe/ZdeikZjuXIvTZxi11Mwh0/rViizz1wTaZQmCXcI/m4WEEIcb9PuISg jwBUFfyRbVinljvrS5YnzWuioYasDXxU5mZMZl+QviGaAkYt5IPCgLnPSz7ofzwB 7I9ezX/SKEIBlYrilz0QIX32nRzFNKHsLA4KUiwSVXAkPcvCFDVDXSdOvsC9qnyW 5/yeYa1E0wCXAgMBAAGjYzBhMB0GA1UdDgQWBBQGmpsfU33x9aTI04Y+oXNZtPdE ITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFAaamx9TffH1pMjThj6hc1m0 90QhMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAqgVutt0Vyb+z xiD2BkewhpMl0425yAA/l/VSJ4hxyXT968pk21vvHl26v9Hr7lxpuhbI87mP0zYu QEkHDVneixCwSQXi/5E/S7fdAo74gShczNxtr18UnH1YeA32gAm56Q6XKRm4t+v4 FstVEuTGfbvE7Pi1HE4+Z7/FXxttbUcoqgRYYdZ2vyJ/0Adqp2RT8JeNnYA/u8EH 22Wv5psymsNUk8QcCMNE+3tjEUPRahphanltkE8pjkcFwRJpadbGNjHh/PqAulxP xOu3Mqz4dWEX1xAZufHSCe96Qp1bWgvUxpVOKs7/B9dPfhgGiPEZtdmYu65xxBzn dFlY7wyJz4sfdZMaBBSSSFCp61cpABbjNhzI+L/wM9VBD8TMPN3pM0MBkRArHtG5 Xc0yGYuPjCB31yLEQtyEFpslbei0VXF/sHyz03FJuc9SpAQ/3D2gu68zngowYI7b nV2UqL1g52KAdoGDDIzMMEZJ4gzSqK/rYXHv5yJiqfdcZGyfFoxnNidF9Ql7v/YQ CvGwjVRDjAS6oz/v4jXH+XTgbzRB0L9zZVcg+ZtnemZoJE6AZb0QmQZZ8mWvuMZH u/2QeItBcy6vVR/cO5JyboTT0GFMDcx2V+IthSIVNg3rAZ3r2OvEhJn7wAzMMujj d9qDRIueVSjAi1jTkD5OGwDxFa2DK5o= -----END CERTIFICATE----- # Issuer: CN=HARICA TLS RSA Root CA 2021 O=Hellenic Academic and Research Institutions CA # Subject: CN=HARICA TLS RSA Root CA 2021 O=Hellenic Academic and Research Institutions CA # Label: "HARICA TLS RSA Root CA 2021" # Serial: 76817823531813593706434026085292783742 # MD5 Fingerprint: 65:47:9b:58:86:dd:2c:f0:fc:a2:84:1f:1e:96:c4:91 # SHA1 Fingerprint: 02:2d:05:82:fa:88:ce:14:0c:06:79:de:7f:14:10:e9:45:d7:a5:6d # SHA256 Fingerprint: d9:5d:0e:8e:da:79:52:5b:f9:be:b1:1b:14:d2:10:0d:32:94:98:5f:0c:62:d9:fa:bd:9c:d9:99:ec:cb:7b:1d -----BEGIN CERTIFICATE----- MIIFpDCCA4ygAwIBAgIQOcqTHO9D88aOk8f0ZIk4fjANBgkqhkiG9w0BAQsFADBs MQswCQYDVQQGEwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl c2VhcmNoIEluc3RpdHV0aW9ucyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBSU0Eg Um9vdCBDQSAyMDIxMB4XDTIxMDIxOTEwNTUzOFoXDTQ1MDIxMzEwNTUzN1owbDEL MAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl YXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgUlNBIFJv b3QgQ0EgMjAyMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIvC569l mwVnlskNJLnQDmT8zuIkGCyEf3dRywQRNrhe7Wlxp57kJQmXZ8FHws+RFjZiPTgE 4VGC/6zStGndLuwRo0Xua2s7TL+MjaQenRG56Tj5eg4MmOIjHdFOY9TnuEFE+2uv a9of08WRiFukiZLRgeaMOVig1mlDqa2YUlhu2wr7a89o+uOkXjpFc5gH6l8Cct4M pbOfrqkdtx2z/IpZ525yZa31MJQjB/OCFks1mJxTuy/K5FrZx40d/JiZ+yykgmvw Kh+OC19xXFyuQnspiYHLA6OZyoieC0AJQTPb5lh6/a6ZcMBaD9YThnEvdmn8kN3b LW7R8pv1GmuebxWMevBLKKAiOIAkbDakO/IwkfN4E8/BPzWr8R0RI7VDIp4BkrcY AuUR0YLbFQDMYTfBKnya4dC6s1BG7oKsnTH4+yPiAwBIcKMJJnkVU2DzOFytOOqB AGMUuTNe3QvboEUHGjMJ+E20pwKmafTCWQWIZYVWrkvL4N48fS0ayOn7H6NhStYq E613TBoYm5EPWNgGVMWX+Ko/IIqmhaZ39qb8HOLubpQzKoNQhArlT4b4UEV4AIHr W2jjJo3Me1xR9BQsQL4aYB16cmEdH2MtiKrOokWQCPxrvrNQKlr9qEgYRtaQQJKQ CoReaDH46+0N0x3GfZkYVVYnZS6NRcUk7M7jAgMBAAGjQjBAMA8GA1UdEwEB/wQF MAMBAf8wHQYDVR0OBBYEFApII6ZgpJIKM+qTW8VX6iVNvRLuMA4GA1UdDwEB/wQE AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAPpBIqm5iFSVmewzVjIuJndftTgfvnNAU X15QvWiWkKQUEapobQk1OUAJ2vQJLDSle1mESSmXdMgHHkdt8s4cUCbjnj1AUz/3 f5Z2EMVGpdAgS1D0NTsY9FVqQRtHBmg8uwkIYtlfVUKqrFOFrJVWNlar5AWMxaja H6NpvVMPxP/cyuN+8kyIhkdGGvMA9YCRotxDQpSbIPDRzbLrLFPCU3hKTwSUQZqP JzLB5UkZv/HywouoCjkxKLR9YjYsTewfM7Z+d21+UPCfDtcRj88YxeMn/ibvBZ3P zzfF0HvaO7AWhAw6k9a+F9sPPg4ZeAnHqQJyIkv3N3a6dcSFA1pj1bF1BcK5vZSt jBWZp5N99sXzqnTPBIWUmAD04vnKJGW/4GKvyMX6ssmeVkjaef2WdhW+o45WxLM0 /L5H9MG0qPzVMIho7suuyWPEdr6sOBjhXlzPrjoiUevRi7PzKzMHVIf6tLITe7pT BGIBnfHAT+7hOtSLIBD6Alfm78ELt5BGnBkpjNxvoEppaZS3JGWg/6w/zgH7IS79 aPib8qXPMThcFarmlwDB31qlpzmq6YR/PFGoOtmUW4y/Twhx5duoXNTSpv4Ao8YW xw/ogM4cKGR0GQjTQuPOAF1/sdwTsOEFy9EgqoZ0njnnkf3/W9b3raYvAwtt41dU 63ZTGI0RmLo= -----END CERTIFICATE----- # Issuer: CN=HARICA TLS ECC Root CA 2021 O=Hellenic Academic and Research Institutions CA # Subject: CN=HARICA TLS ECC Root CA 2021 O=Hellenic Academic and Research Institutions CA # Label: "HARICA TLS ECC Root CA 2021" # Serial: 137515985548005187474074462014555733966 # MD5 Fingerprint: ae:f7:4c:e5:66:35:d1:b7:9b:8c:22:93:74:d3:4b:b0 # SHA1 Fingerprint: bc:b0:c1:9d:e9:98:92:70:19:38:57:e9:8d:a7:b4:5d:6e:ee:01:48 # SHA256 Fingerprint: 3f:99:cc:47:4a:cf:ce:4d:fe:d5:87:94:66:5e:47:8d:15:47:73:9f:2e:78:0f:1b:b4:ca:9b:13:30:97:d4:01 -----BEGIN CERTIFICATE----- MIICVDCCAdugAwIBAgIQZ3SdjXfYO2rbIvT/WeK/zjAKBggqhkjOPQQDAzBsMQsw CQYDVQQGEwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2Vh cmNoIEluc3RpdHV0aW9ucyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBFQ0MgUm9v dCBDQSAyMDIxMB4XDTIxMDIxOTExMDExMFoXDTQ1MDIxMzExMDEwOVowbDELMAkG A1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj aCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgRUNDIFJvb3Qg Q0EgMjAyMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABDgI/rGgltJ6rK9JOtDA4MM7 KKrxcm1lAEeIhPyaJmuqS7psBAqIXhfyVYf8MLA04jRYVxqEU+kw2anylnTDUR9Y STHMmE5gEYd103KUkE+bECUqqHgtvpBBWJAVcqeht6NCMEAwDwYDVR0TAQH/BAUw AwEB/zAdBgNVHQ4EFgQUyRtTgRL+BNUW0aq8mm+3oJUZbsowDgYDVR0PAQH/BAQD AgGGMAoGCCqGSM49BAMDA2cAMGQCMBHervjcToiwqfAircJRQO9gcS3ujwLEXQNw SaSS6sUUiHCm0w2wqsosQJz76YJumgIwK0eaB8bRwoF8yguWGEEbo/QwCZ61IygN nxS2PFOiTAZpffpskcYqSUXm7LcT4Tps -----END CERTIFICATE----- # Issuer: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 # Subject: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 # Label: "Autoridad de Certificacion Firmaprofesional CIF A62634068" # Serial: 1977337328857672817 # MD5 Fingerprint: 4e:6e:9b:54:4c:ca:b7:fa:48:e4:90:b1:15:4b:1c:a3 # SHA1 Fingerprint: 0b:be:c2:27:22:49:cb:39:aa:db:35:5c:53:e3:8c:ae:78:ff:b6:fe # SHA256 Fingerprint: 57:de:05:83:ef:d2:b2:6e:03:61:da:99:da:9d:f4:64:8d:ef:7e:e8:44:1c:3b:72:8a:fa:9b:cd:e0:f9:b2:6a -----BEGIN CERTIFICATE----- MIIGFDCCA/ygAwIBAgIIG3Dp0v+ubHEwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UE BhMCRVMxQjBABgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1h cHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODAeFw0xNDA5MjMxNTIyMDdaFw0zNjA1 MDUxNTIyMDdaMFExCzAJBgNVBAYTAkVTMUIwQAYDVQQDDDlBdXRvcmlkYWQgZGUg Q2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBBNjI2MzQwNjgwggIi MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDDUtd9 thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQM cas9UX4PB99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefG L9ItWY16Ck6WaVICqjaY7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15i NA9wBj4gGFrO93IbJWyTdBSTo3OxDqqHECNZXyAFGUftaI6SEspd/NYrspI8IM/h X68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyIplD9amML9ZMWGxmPsu2b m8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctXMbScyJCy Z/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirja EbsXLZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/T KI8xWVvTyQKmtFLKbpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF 6NkBiDkal4ZkQdU7hwxu+g/GvUgUvzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVh OSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMB0GA1UdDgQWBBRlzeurNR4APn7VdMAc tHNHDhpkLzASBgNVHRMBAf8ECDAGAQH/AgEBMIGmBgNVHSAEgZ4wgZswgZgGBFUd IAAwgY8wLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuZmlybWFwcm9mZXNpb25hbC5j b20vY3BzMFwGCCsGAQUFBwICMFAeTgBQAGEAcwBlAG8AIABkAGUAIABsAGEAIABC AG8AbgBhAG4AbwB2AGEAIAA0ADcAIABCAGEAcgBjAGUAbABvAG4AYQAgADAAOAAw ADEANzAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQELBQADggIBAHSHKAIrdx9m iWTtj3QuRhy7qPj4Cx2Dtjqn6EWKB7fgPiDL4QjbEwj4KKE1soCzC1HA01aajTNF Sa9J8OA9B3pFE1r/yJfY0xgsfZb43aJlQ3CTkBW6kN/oGbDbLIpgD7dvlAceHabJ hfa9NPhAeGIQcDq+fUs5gakQ1JZBu/hfHAsdCPKxsIl68veg4MSPi3i1O1ilI45P Vf42O+AMt8oqMEEgtIDNrvx2ZnOorm7hfNoD6JQg5iKj0B+QXSBTFCZX2lSX3xZE EAEeiGaPcjiT3SC3NL7X8e5jjkd5KAb881lFJWAiMxujX6i6KtoaPc1A6ozuBRWV 1aUsIC+nmCjuRfzxuIgALI9C2lHVnOUTaHFFQ4ueCyE8S1wF3BqfmI7avSKecs2t CsvMo2ebKHTEm9caPARYpoKdrcd7b/+Alun4jWq9GJAd/0kakFI3ky88Al2CdgtR 5xbHV/g4+afNmyJU72OwFW1TZQNKXkqgsqeOSQBZONXH9IBk9W6VULgRfhVwOEqw f9DEMnDAGf/JOC0ULGb0QkTmVXYbgBVX/8Cnp6o5qtjTcNAuuuuUavpfNIbnYrX9 ivAwhZTJryQCL2/W3Wf+47BVTwSYT6RBVuKT0Gro1vP7ZeDOdcQxWQzugsgMYDNK GbqEZycPvEJdvSRUDewdcAZfpLz6IHxV -----END CERTIFICATE----- # Issuer: CN=vTrus ECC Root CA O=iTrusChina Co.,Ltd. # Subject: CN=vTrus ECC Root CA O=iTrusChina Co.,Ltd. # Label: "vTrus ECC Root CA" # Serial: 630369271402956006249506845124680065938238527194 # MD5 Fingerprint: de:4b:c1:f5:52:8c:9b:43:e1:3e:8f:55:54:17:8d:85 # SHA1 Fingerprint: f6:9c:db:b0:fc:f6:02:13:b6:52:32:a6:a3:91:3f:16:70:da:c3:e1 # SHA256 Fingerprint: 30:fb:ba:2c:32:23:8e:2a:98:54:7a:f9:79:31:e5:50:42:8b:9b:3f:1c:8e:eb:66:33:dc:fa:86:c5:b2:7d:d3 -----BEGIN CERTIFICATE----- MIICDzCCAZWgAwIBAgIUbmq8WapTvpg5Z6LSa6Q75m0c1towCgYIKoZIzj0EAwMw RzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4xGjAY BgNVBAMTEXZUcnVzIEVDQyBSb290IENBMB4XDTE4MDczMTA3MjY0NFoXDTQzMDcz MTA3MjY0NFowRzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28u LEx0ZC4xGjAYBgNVBAMTEXZUcnVzIEVDQyBSb290IENBMHYwEAYHKoZIzj0CAQYF K4EEACIDYgAEZVBKrox5lkqqHAjDo6LN/llWQXf9JpRCux3NCNtzslt188+cToL0 v/hhJoVs1oVbcnDS/dtitN9Ti72xRFhiQgnH+n9bEOf+QP3A2MMrMudwpremIFUd e4BdS49nTPEQo0IwQDAdBgNVHQ4EFgQUmDnNvtiyjPeyq+GtJK97fKHbH88wDwYD VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwCgYIKoZIzj0EAwMDaAAwZQIw V53dVvHH4+m4SVBrm2nDb+zDfSXkV5UTQJtS0zvzQBm8JsctBp61ezaf9SXUY2sA AjEA6dPGnlaaKsyh2j/IZivTWJwghfqrkYpwcBE4YGQLYgmRWAD5Tfs0aNoJrSEG GJTO -----END CERTIFICATE----- # Issuer: CN=vTrus Root CA O=iTrusChina Co.,Ltd. # Subject: CN=vTrus Root CA O=iTrusChina Co.,Ltd. # Label: "vTrus Root CA" # Serial: 387574501246983434957692974888460947164905180485 # MD5 Fingerprint: b8:c9:37:df:fa:6b:31:84:64:c5:ea:11:6a:1b:75:fc # SHA1 Fingerprint: 84:1a:69:fb:f5:cd:1a:25:34:13:3d:e3:f8:fc:b8:99:d0:c9:14:b7 # SHA256 Fingerprint: 8a:71:de:65:59:33:6f:42:6c:26:e5:38:80:d0:0d:88:a1:8d:a4:c6:a9:1f:0d:cb:61:94:e2:06:c5:c9:63:87 -----BEGIN CERTIFICATE----- MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQEL BQAwQzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4x FjAUBgNVBAMTDXZUcnVzIFJvb3QgQ0EwHhcNMTgwNzMxMDcyNDA1WhcNNDMwNzMx MDcyNDA1WjBDMQswCQYDVQQGEwJDTjEcMBoGA1UEChMTaVRydXNDaGluYSBDby4s THRkLjEWMBQGA1UEAxMNdlRydXMgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQAD ggIPADCCAgoCggIBAL1VfGHTuB0EYgWgrmy3cLRB6ksDXhA/kFocizuwZotsSKYc IrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykU AyyNJJrIZIO1aqwTLDPxn9wsYTwaP3BVm60AUn/PBLn+NvqcwBauYv6WTEN+VRS+ GrPSbcKvdmaVayqwlHeFXgQPYh1jdfdr58tbmnDsPmcF8P4HCIDPKNsFxhQnL4Z9 8Cfe/+Z+M0jnCx5Y0ScrUw5XSmXX+6KAYPxMvDVTAWqXcoKv8R1w6Jz1717CbMdH flqUhSZNO7rrTOiwCcJlwp2dCZtOtZcFrPUGoPc2BX70kLJrxLT5ZOrpGgrIDajt J8nU57O5q4IikCc9Kuh8kO+8T/3iCiSn3mUkpF3qwHYw03dQ+A0Em5Q2AXPKBlim 0zvc+gRGE1WKyURHuFE5Gi7oNOJ5y1lKCn+8pu8fA2dqWSslYpPZUxlmPCdiKYZN pGvu/9ROutW04o5IWgAZCfEF2c6Rsffr6TlP9m8EQ5pV9T4FFL2/s1m02I4zhKOQ UqqzApVg+QxMaPnu1RcN+HFXtSXkKe5lXa/R7jwXC1pDxaWG6iSe4gUH3DRCEpHW OXSuTEGC2/KmSNGzm/MzqvOmwMVO9fSddmPmAsYiS8GVP1BkLFTltvA8Kc9XAgMB AAGjQjBAMB0GA1UdDgQWBBRUYnBj8XWEQ1iO0RYgscasGrz2iTAPBgNVHRMBAf8E BTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAKbqSSaet 8PFww+SX8J+pJdVrnjT+5hpk9jprUrIQeBqfTNqK2uwcN1LgQkv7bHbKJAs5EhWd nxEt/Hlk3ODg9d3gV8mlsnZwUKT+twpw1aA08XXXTUm6EdGz2OyC/+sOxL9kLX1j bhd47F18iMjrjld22VkE+rxSH0Ws8HqA7Oxvdq6R2xCOBNyS36D25q5J08FsEhvM Kar5CKXiNxTKsbhm7xqC5PD48acWabfbqWE8n/Uxy+QARsIvdLGx14HuqCaVvIiv TDUHKgLKeBRtRytAVunLKmChZwOgzoy8sHJnxDHO2zTlJQNgJXtxmOTAGytfdELS S8VZCAeHvsXDf+eW2eHcKJfWjwXj9ZtOyh1QRwVTsMo554WgicEFOwE30z9J4nfr I8iIZjs9OXYhRvHsXyO466JmdXTBQPfYaJqT4i2pLr0cox7IdMakLXogqzu4sEb9 b91fUlV1YvCXoHzXOP0l382gmxDPi7g4Xl7FtKYCNqEeXxzP4padKar9mK5S4fNB UvupLnKWnyfjqnN9+BojZns7q2WwMgFLFT49ok8MKzWixtlnEjUwzXYuFrOZnk1P Ti07NEPhmg4NpGaXutIcSkwsKouLgU9xGqndXHt7CMUADTdA43x7VF8vhV929ven sBxXVsFy6K2ir40zSbofitzmdHxghm+Hl3s= -----END CERTIFICATE----- # Issuer: CN=ISRG Root X2 O=Internet Security Research Group # Subject: CN=ISRG Root X2 O=Internet Security Research Group # Label: "ISRG Root X2" # Serial: 87493402998870891108772069816698636114 # MD5 Fingerprint: d3:9e:c4:1e:23:3c:a6:df:cf:a3:7e:6d:e0:14:e6:e5 # SHA1 Fingerprint: bd:b1:b9:3c:d5:97:8d:45:c6:26:14:55:f8:db:95:c7:5a:d1:53:af # SHA256 Fingerprint: 69:72:9b:8e:15:a8:6e:fc:17:7a:57:af:b7:17:1d:fc:64:ad:d2:8c:2f:ca:8c:f1:50:7e:34:45:3c:cb:14:70 -----BEGIN CERTIFICATE----- MIICGzCCAaGgAwIBAgIQQdKd0XLq7qeAwSxs6S+HUjAKBggqhkjOPQQDAzBPMQsw CQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2gg R3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMjAeFw0yMDA5MDQwMDAwMDBaFw00 MDA5MTcxNjAwMDBaME8xCzAJBgNVBAYTAlVTMSkwJwYDVQQKEyBJbnRlcm5ldCBT ZWN1cml0eSBSZXNlYXJjaCBHcm91cDEVMBMGA1UEAxMMSVNSRyBSb290IFgyMHYw EAYHKoZIzj0CAQYFK4EEACIDYgAEzZvVn4CDCuwJSvMWSj5cz3es3mcFDR0HttwW +1qLFNvicWDEukWVEYmO6gbf9yoWHKS5xcUy4APgHoIYOIvXRdgKam7mAHf7AlF9 ItgKbppbd9/w+kHsOdx1ymgHDB/qo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0T AQH/BAUwAwEB/zAdBgNVHQ4EFgQUfEKWrt5LSDv6kviejM9ti6lyN5UwCgYIKoZI zj0EAwMDaAAwZQIwe3lORlCEwkSHRhtFcP9Ymd70/aTSVaYgLXTWNLxBo1BfASdW tL4ndQavEi51mI38AjEAi/V3bNTIZargCyzuFJ0nN6T5U6VR5CmD1/iQMVtCnwr1 /q4AaOeMSQ+2b1tbFfLn -----END CERTIFICATE----- # Issuer: CN=HiPKI Root CA - G1 O=Chunghwa Telecom Co., Ltd. # Subject: CN=HiPKI Root CA - G1 O=Chunghwa Telecom Co., Ltd. # Label: "HiPKI Root CA - G1" # Serial: 60966262342023497858655262305426234976 # MD5 Fingerprint: 69:45:df:16:65:4b:e8:68:9a:8f:76:5f:ff:80:9e:d3 # SHA1 Fingerprint: 6a:92:e4:a8:ee:1b:ec:96:45:37:e3:29:57:49:cd:96:e3:e5:d2:60 # SHA256 Fingerprint: f0:15:ce:3c:c2:39:bf:ef:06:4b:e9:f1:d2:c4:17:e1:a0:26:4a:0a:94:be:1f:0c:8d:12:18:64:eb:69:49:cc -----BEGIN CERTIFICATE----- MIIFajCCA1KgAwIBAgIQLd2szmKXlKFD6LDNdmpeYDANBgkqhkiG9w0BAQsFADBP MQswCQYDVQQGEwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0 ZC4xGzAZBgNVBAMMEkhpUEtJIFJvb3QgQ0EgLSBHMTAeFw0xOTAyMjIwOTQ2MDRa Fw0zNzEyMzExNTU5NTlaME8xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3 YSBUZWxlY29tIENvLiwgTHRkLjEbMBkGA1UEAwwSSGlQS0kgUm9vdCBDQSAtIEcx MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA9B5/UnMyDHPkvRN0o9Qw qNCuS9i233VHZvR85zkEHmpwINJaR3JnVfSl6J3VHiGh8Ge6zCFovkRTv4354twv Vcg3Px+kwJyz5HdcoEb+d/oaoDjq7Zpy3iu9lFc6uux55199QmQ5eiY29yTw1S+6 lZgRZq2XNdZ1AYDgr/SEYYwNHl98h5ZeQa/rh+r4XfEuiAU+TCK72h8q3VJGZDnz Qs7ZngyzsHeXZJzA9KMuH5UHsBffMNsAGJZMoYFL3QRtU6M9/Aes1MU3guvklQgZ KILSQjqj2FPseYlgSGDIcpJQ3AOPgz+yQlda22rpEZfdhSi8MEyr48KxRURHH+CK FgeW0iEPU8DtqX7UTuybCeyvQqww1r/REEXgphaypcXTT3OUM3ECoWqj1jOXTyFj HluP2cFeRXF3D4FdXyGarYPM+l7WjSNfGz1BryB1ZlpK9p/7qxj3ccC2HTHsOyDr y+K49a6SsvfhhEvyovKTmiKe0xRvNlS9H15ZFblzqMF8b3ti6RZsR1pl8w4Rm0bZ /W3c1pzAtH2lsN0/Vm+h+fbkEkj9Bn8SV7apI09bA8PgcSojt/ewsTu8mL3WmKgM a/aOEmem8rJY5AIJEzypuxC00jBF8ez3ABHfZfjcK0NVvxaXxA/VLGGEqnKG/uY6 fsI/fe78LxQ+5oXdUG+3Se0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNV HQ4EFgQU8ncX+l6o/vY9cdVouslGDDjYr7AwDgYDVR0PAQH/BAQDAgGGMA0GCSqG SIb3DQEBCwUAA4ICAQBQUfB13HAE4/+qddRxosuej6ip0691x1TPOhwEmSKsxBHi 7zNKpiMdDg1H2DfHb680f0+BazVP6XKlMeJ45/dOlBhbQH3PayFUhuaVevvGyuqc SE5XCV0vrPSltJczWNWseanMX/mF+lLFjfiRFOs6DRfQUsJ748JzjkZ4Bjgs6Fza ZsT0pPBWGTMpWmWSBUdGSquEwx4noR8RkpkndZMPvDY7l1ePJlsMu5wP1G4wB9Tc XzZoZjmDlicmisjEOf6aIW/Vcobpf2Lll07QJNBAsNB1CI69aO4I1258EHBGG3zg iLKecoaZAeO/n0kZtCW+VmWuF2PlHt/o/0elv+EmBYTksMCv5wiZqAxeJoBF1Pho L5aPruJKHJwWDBNvOIf2u8g0X5IDUXlwpt/L9ZlNec1OvFefQ05rLisY+GpzjLrF Ne85akEez3GoorKGB1s6yeHvP2UEgEcyRHCVTjFnanRbEEV16rCf0OY1/k6fi8wr kkVbbiVghUbN0aqwdmaTd5a+g744tiROJgvM7XpWGuDpWsZkrUx6AEhEL7lAuxM+ vhV4nYWBSipX3tUZQ9rbyltHhoMLP7YNdnhzeSJesYAfz77RP1YQmCuVh6EfnWQU YDksswBVLuT1sw5XxJFBAJw/6KXf6vb/yPCtbVKoF6ubYfwSUTXkJf2vqmqGOQ== -----END CERTIFICATE----- # Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R4 # Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R4 # Label: "GlobalSign ECC Root CA - R4" # Serial: 159662223612894884239637590694 # MD5 Fingerprint: 26:29:f8:6d:e1:88:bf:a2:65:7f:aa:c4:cd:0f:7f:fc # SHA1 Fingerprint: 6b:a0:b0:98:e1:71:ef:5a:ad:fe:48:15:80:77:10:f4:bd:6f:0b:28 # SHA256 Fingerprint: b0:85:d7:0b:96:4f:19:1a:73:e4:af:0d:54:ae:7a:0e:07:aa:fd:af:9b:71:dd:08:62:13:8a:b7:32:5a:24:a2 -----BEGIN CERTIFICATE----- MIIB3DCCAYOgAwIBAgINAgPlfvU/k/2lCSGypjAKBggqhkjOPQQDAjBQMSQwIgYD VQQLExtHbG9iYWxTaWduIEVDQyBSb290IENBIC0gUjQxEzARBgNVBAoTCkdsb2Jh bFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMTIxMTEzMDAwMDAwWhcNMzgw MTE5MDMxNDA3WjBQMSQwIgYDVQQLExtHbG9iYWxTaWduIEVDQyBSb290IENBIC0g UjQxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wWTAT BgcqhkjOPQIBBggqhkjOPQMBBwNCAAS4xnnTj2wlDp8uORkcA6SumuU5BwkWymOx uYb4ilfBV85C+nOh92VC/x7BALJucw7/xyHlGKSq2XE/qNS5zowdo0IwQDAOBgNV HQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVLB7rUW44kB/ +wpu+74zyTyjhNUwCgYIKoZIzj0EAwIDRwAwRAIgIk90crlgr/HmnKAWBVBfw147 bmF0774BxL4YSFlhgjICICadVGNA3jdgUM/I2O2dgq43mLyjj0xMqTQrbO/7lZsm -----END CERTIFICATE----- # Issuer: CN=GTS Root R1 O=Google Trust Services LLC # Subject: CN=GTS Root R1 O=Google Trust Services LLC # Label: "GTS Root R1" # Serial: 159662320309726417404178440727 # MD5 Fingerprint: 05:fe:d0:bf:71:a8:a3:76:63:da:01:e0:d8:52:dc:40 # SHA1 Fingerprint: e5:8c:1c:c4:91:3b:38:63:4b:e9:10:6e:e3:ad:8e:6b:9d:d9:81:4a # SHA256 Fingerprint: d9:47:43:2a:bd:e7:b7:fa:90:fc:2e:6b:59:10:1b:12:80:e0:e1:c7:e4:e4:0f:a3:c6:88:7f:ff:57:a7:f4:cf -----BEGIN CERTIFICATE----- MIIFVzCCAz+gAwIBAgINAgPlk28xsBNJiGuiFzANBgkqhkiG9w0BAQwFADBHMQsw CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU MBIGA1UEAxMLR1RTIFJvb3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUA A4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx9vaMf/vo 27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7w Cl7raKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjw TcLCeoiKu7rPWRnWr4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0Pfybl qAj+lug8aJRT7oM6iCsVlgmy4HqMLnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaH szVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly4cpk9+aCEI3oncKKiPo4Zor8 Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr06zqkUspzBmk MiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92 wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70p aDPvOmbsB4om3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrN VjzRlwW5y0vtOUucxD/SVRNuJLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQID AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E FgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEMBQADggIBAJ+qQibb C5u+/x6Wki4+omVKapi6Ist9wTrYggoGxval3sBOh2Z5ofmmWJyq+bXmYOfg6LEe QkEzCzc9zolwFcq1JKjPa7XSQCGYzyI0zzvFIoTgxQ6KfF2I5DUkzps+GlQebtuy h6f88/qBVRRiClmpIgUxPoLW7ttXNLwzldMXG+gnoot7TiYaelpkttGsN/H9oPM4 7HLwEXWdyzRSjeZ2axfG34arJ45JK3VmgRAhpuo+9K4l/3wV3s6MJT/KYnAK9y8J ZgfIPxz88NtFMN9iiMG1D53Dn0reWVlHxYciNuaCp+0KueIHoI17eko8cdLiA6Ef MgfdG+RCzgwARWGAtQsgWSl4vflVy2PFPEz0tv/bal8xa5meLMFrUKTX5hgUvYU/ Z6tGn6D/Qqc6f1zLXbBwHSs09dR2CQzreExZBfMzQsNhFRAbd03OIozUhfJFfbdT 6u9AWpQKXCBfTkBdYiJ23//OYb2MI3jSNwLgjt7RETeJ9r/tSQdirpLsQBqvFAnZ 0E6yove+7u7Y/9waLd64NnHi/Hm3lCXRSHNboTXns5lndcEZOitHTtNCjv0xyBZm 2tIMPNuzjsmhDYAPexZ3FL//2wmUspO8IFgV6dtxQ/PeEMMA3KgqlbbC1j+Qa3bb bP6MvPJwNQzcmRk13NfIRmPVNnGuV/u3gm3c -----END CERTIFICATE----- # Issuer: CN=GTS Root R2 O=Google Trust Services LLC # Subject: CN=GTS Root R2 O=Google Trust Services LLC # Label: "GTS Root R2" # Serial: 159662449406622349769042896298 # MD5 Fingerprint: 1e:39:c0:53:e6:1e:29:82:0b:ca:52:55:36:5d:57:dc # SHA1 Fingerprint: 9a:44:49:76:32:db:de:fa:d0:bc:fb:5a:7b:17:bd:9e:56:09:24:94 # SHA256 Fingerprint: 8d:25:cd:97:22:9d:bf:70:35:6b:da:4e:b3:cc:73:40:31:e2:4c:f0:0f:af:cf:d3:2d:c7:6e:b5:84:1c:7e:a8 -----BEGIN CERTIFICATE----- MIIFVzCCAz+gAwIBAgINAgPlrsWNBCUaqxElqjANBgkqhkiG9w0BAQwFADBHMQsw CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU MBIGA1UEAxMLR1RTIFJvb3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUA A4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTukk3LvCvpt nfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY 6Dlo7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAu MC6C/Pq8tBcKSOWIm8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7k RXuJVfeKH2JShBKzwkCX44ofR5GmdFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWg f9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbuak7MkogwTZq9TwtImoS1mKPV +3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscszcTJGr61K8Yzo dDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKa G73VululycslaVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCq gc7dGtxRcw1PcOnlthYhGXmy5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwID AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E FgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEMBQADggIBAB/Kzt3H vqGf2SdMC9wXmBFqiN495nFWcrKeGk6c1SuYJF2ba3uwM4IJvd8lRuqYnrYb/oM8 0mJhwQTtzuDFycgTE1XnqGOtjHsB/ncw4c5omwX4Eu55MaBBRTUoCnGkJE+M3DyC B19m3H0Q/gxhswWV7uGugQ+o+MePTagjAiZrHYNSVc61LwDKgEDg4XSsYPWHgJ2u NmSRXbBoGOqKYcl3qJfEycel/FVL8/B/uWU9J2jQzGv6U53hkRrJXRqWbTKH7QMg yALOWr7Z6v2yTcQvG99fevX4i8buMTolUVVnjWQye+mew4K6Ki3pHrTgSAai/Gev HyICc/sgCq+dVEuhzf9gR7A/Xe8bVr2XIZYtCtFenTgCR2y59PYjJbigapordwj6 xLEokCZYCDzifqrXPW+6MYgKBesntaFJ7qBFVHvmJ2WZICGoo7z7GJa7Um8M7YNR TOlZ4iBgxcJlkoKM8xAfDoqXvneCbT+PHV28SSe9zE8P4c52hgQjxcCMElv924Sg JPFI/2R80L5cFtHvma3AH/vLrrw4IgYmZNralw4/KBVEqE8AyvCazM90arQ+POuV 7LXTWtiBmelDGDfrs7vRWGJB82bSj6p4lVQgw1oudCvV0b4YacCs1aTPObpRhANl 6WLAYv7YTVWW4tAR+kg0Eeye7QUd5MjWHYbL -----END CERTIFICATE----- # Issuer: CN=GTS Root R3 O=Google Trust Services LLC # Subject: CN=GTS Root R3 O=Google Trust Services LLC # Label: "GTS Root R3" # Serial: 159662495401136852707857743206 # MD5 Fingerprint: 3e:e7:9d:58:02:94:46:51:94:e5:e0:22:4a:8b:e7:73 # SHA1 Fingerprint: ed:e5:71:80:2b:c8:92:b9:5b:83:3c:d2:32:68:3f:09:cd:a0:1e:46 # SHA256 Fingerprint: 34:d8:a7:3e:e2:08:d9:bc:db:0d:95:65:20:93:4b:4e:40:e6:94:82:59:6e:8b:6f:73:c8:42:6b:01:0a:6f:48 -----BEGIN CERTIFICATE----- MIICCTCCAY6gAwIBAgINAgPluILrIPglJ209ZjAKBggqhkjOPQQDAzBHMQswCQYD VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG A1UEAxMLR1RTIFJvb3QgUjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcqhkjOPQIBBgUrgQQAIgNi AAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUURout736G jOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL2 4CejQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW BBTB8Sa6oC2uhYHP0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEA9uEglRR7 VKOQFhG/hMjqb2sXnh5GmCCbn9MN2azTL818+FsuVbu/3ZL3pAzcMeGiAjEA/Jdm ZuVDFhOD3cffL74UOO0BzrEXGhF16b0DjyZ+hOXJYKaV11RZt+cRLInUue4X -----END CERTIFICATE----- # Issuer: CN=GTS Root R4 O=Google Trust Services LLC # Subject: CN=GTS Root R4 O=Google Trust Services LLC # Label: "GTS Root R4" # Serial: 159662532700760215368942768210 # MD5 Fingerprint: 43:96:83:77:19:4d:76:b3:9d:65:52:e4:1d:22:a5:e8 # SHA1 Fingerprint: 77:d3:03:67:b5:e0:0c:15:f6:0c:38:61:df:7c:e1:3b:92:46:4d:47 # SHA256 Fingerprint: 34:9d:fa:40:58:c5:e2:63:12:3b:39:8a:e7:95:57:3c:4e:13:13:c8:3f:e6:8f:93:55:6c:d5:e8:03:1b:3c:7d -----BEGIN CERTIFICATE----- MIICCTCCAY6gAwIBAgINAgPlwGjvYxqccpBQUjAKBggqhkjOPQQDAzBHMQswCQYD VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG A1UEAxMLR1RTIFJvb3QgUjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcqhkjOPQIBBgUrgQQAIgNi AATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa6zzuhXyi QHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvR HYqjQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW BBSATNbrdP9JNqPV2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNpADBmAjEA6ED/g94D 9J+uHXqnLrmvT/aDHQ4thQEd0dlq7A/Cr8deVl5c1RxYIigL9zC2L7F8AjEA8GE8 p/SgguMh1YQdc4acLa/KNJvxn7kjNuK8YAOdgLOaVsjh4rsUecrNIdSUtUlD -----END CERTIFICATE----- # Issuer: CN=Telia Root CA v2 O=Telia Finland Oyj # Subject: CN=Telia Root CA v2 O=Telia Finland Oyj # Label: "Telia Root CA v2" # Serial: 7288924052977061235122729490515358 # MD5 Fingerprint: 0e:8f:ac:aa:82:df:85:b1:f4:dc:10:1c:fc:99:d9:48 # SHA1 Fingerprint: b9:99:cd:d1:73:50:8a:c4:47:05:08:9c:8c:88:fb:be:a0:2b:40:cd # SHA256 Fingerprint: 24:2b:69:74:2f:cb:1e:5b:2a:bf:98:89:8b:94:57:21:87:54:4e:5b:4d:99:11:78:65:73:62:1f:6a:74:b8:2c -----BEGIN CERTIFICATE----- MIIFdDCCA1ygAwIBAgIPAWdfJ9b+euPkrL4JWwWeMA0GCSqGSIb3DQEBCwUAMEQx CzAJBgNVBAYTAkZJMRowGAYDVQQKDBFUZWxpYSBGaW5sYW5kIE95ajEZMBcGA1UE AwwQVGVsaWEgUm9vdCBDQSB2MjAeFw0xODExMjkxMTU1NTRaFw00MzExMjkxMTU1 NTRaMEQxCzAJBgNVBAYTAkZJMRowGAYDVQQKDBFUZWxpYSBGaW5sYW5kIE95ajEZ MBcGA1UEAwwQVGVsaWEgUm9vdCBDQSB2MjCCAiIwDQYJKoZIhvcNAQEBBQADggIP ADCCAgoCggIBALLQPwe84nvQa5n44ndp586dpAO8gm2h/oFlH0wnrI4AuhZ76zBq AMCzdGh+sq/H1WKzej9Qyow2RCRj0jbpDIX2Q3bVTKFgcmfiKDOlyzG4OiIjNLh9 vVYiQJ3q9HsDrWj8soFPmNB06o3lfc1jw6P23pLCWBnglrvFxKk9pXSW/q/5iaq9 lRdU2HhE8Qx3FZLgmEKnpNaqIJLNwaCzlrI6hEKNfdWV5Nbb6WLEWLN5xYzTNTOD n3WhUidhOPFZPY5Q4L15POdslv5e2QJltI5c0BE0312/UqeBAMN/mUWZFdUXyApT 7GPzmX3MaRKGwhfwAZ6/hLzRUssbkmbOpFPlob/E2wnW5olWK8jjfN7j/4nlNW4o 6GwLI1GpJQXrSPjdscr6bAhR77cYbETKJuFzxokGgeWKrLDiKca5JLNrRBH0pUPC TEPlcDaMtjNXepUugqD0XBCzYYP2AgWGLnwtbNwDRm41k9V6lS/eINhbfpSQBGq6 WT0EBXWdN6IOLj3rwaRSg/7Qa9RmjtzG6RJOHSpXqhC8fF6CfaamyfItufUXJ63R DolUK5X6wK0dmBR4M0KGCqlztft0DbcbMBnEWg4cJ7faGND/isgFuvGqHKI3t+ZI pEYslOqodmJHixBTB0hXbOKSTbauBcvcwUpej6w9GU7C7WB1K9vBykLVAgMBAAGj YzBhMB8GA1UdIwQYMBaAFHKs5DN5qkWH9v2sHZ7Wxy+G2CQ5MB0GA1UdDgQWBBRy rOQzeapFh/b9rB2e1scvhtgkOTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw AwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAoDtZpwmUPjaE0n4vOaWWl/oRrfxn83EJ 8rKJhGdEr7nv7ZbsnGTbMjBvZ5qsfl+yqwE2foH65IRe0qw24GtixX1LDoJt0nZi 0f6X+J8wfBj5tFJ3gh1229MdqfDBmgC9bXXYfef6xzijnHDoRnkDry5023X4blMM A8iZGok1GTzTyVR8qPAs5m4HeW9q4ebqkYJpCh3DflminmtGFZhb069GHWLIzoBS SRE/yQQSwxN8PzuKlts8oB4KtItUsiRnDe+Cy748fdHif64W1lZYudogsYMVoe+K TTJvQS8TUoKU1xrBeKJR3Stwbbca+few4GeXVtt8YVMJAygCQMez2P2ccGrGKMOF 6eLtGpOg3kuYooQ+BXcBlj37tCAPnHICehIv1aO6UXivKitEZU61/Qrowc15h2Er 3oBXRb9n8ZuRXqWk7FlIEA04x7D6w0RtBPV4UBySllva9bguulvP5fBqnUsvWHMt Ty3EHD70sz+rFQ47GUGKpMFXEmZxTPpT41frYpUJnlTd0cI8Vzy9OK2YZLe4A5pT VmBds9hCG1xLEooc6+t9xnppxyd/pPiL8uSUZodL6ZQHCRJ5irLrdATczvREWeAW ysUsWNc8e89ihmpQfTU2Zqf7N+cox9jQraVplI/owd8k+BsHMYeB2F326CjYSlKA rBPuUBQemMc= -----END CERTIFICATE----- # Issuer: CN=D-TRUST BR Root CA 1 2020 O=D-Trust GmbH # Subject: CN=D-TRUST BR Root CA 1 2020 O=D-Trust GmbH # Label: "D-TRUST BR Root CA 1 2020" # Serial: 165870826978392376648679885835942448534 # MD5 Fingerprint: b5:aa:4b:d5:ed:f7:e3:55:2e:8f:72:0a:f3:75:b8:ed # SHA1 Fingerprint: 1f:5b:98:f0:e3:b5:f7:74:3c:ed:e6:b0:36:7d:32:cd:f4:09:41:67 # SHA256 Fingerprint: e5:9a:aa:81:60:09:c2:2b:ff:5b:25:ba:d3:7d:f3:06:f0:49:79:7c:1f:81:d8:5a:b0:89:e6:57:bd:8f:00:44 -----BEGIN CERTIFICATE----- MIIC2zCCAmCgAwIBAgIQfMmPK4TX3+oPyWWa00tNljAKBggqhkjOPQQDAzBIMQsw CQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRS VVNUIEJSIFJvb3QgQ0EgMSAyMDIwMB4XDTIwMDIxMTA5NDUwMFoXDTM1MDIxMTA5 NDQ1OVowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEiMCAG A1UEAxMZRC1UUlVTVCBCUiBSb290IENBIDEgMjAyMDB2MBAGByqGSM49AgEGBSuB BAAiA2IABMbLxyjR+4T1mu9CFCDhQ2tuda38KwOE1HaTJddZO0Flax7mNCq7dPYS zuht56vkPE4/RAiLzRZxy7+SmfSk1zxQVFKQhYN4lGdnoxwJGT11NIXe7WB9xwy0 QVK5buXuQqOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFHOREKv/ VbNafAkl1bK6CKBrqx9tMA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6g PKA6hjhodHRwOi8vY3JsLmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X2JyX3Jvb3Rf Y2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVjdG9yeS5kLXRydXN0Lm5l dC9DTj1ELVRSVVNUJTIwQlIlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxPPUQtVHJ1 c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjO PQQDAwNpADBmAjEAlJAtE/rhY/hhY+ithXhUkZy4kzg+GkHaQBZTQgjKL47xPoFW wKrY7RjEsK70PvomAjEA8yjixtsrmfu3Ubgko6SUeho/5jbiA1czijDLgsfWFBHV dWNbFJWcHwHP2NVypw87 -----END CERTIFICATE----- # Issuer: CN=D-TRUST EV Root CA 1 2020 O=D-Trust GmbH # Subject: CN=D-TRUST EV Root CA 1 2020 O=D-Trust GmbH # Label: "D-TRUST EV Root CA 1 2020" # Serial: 126288379621884218666039612629459926992 # MD5 Fingerprint: 8c:2d:9d:70:9f:48:99:11:06:11:fb:e9:cb:30:c0:6e # SHA1 Fingerprint: 61:db:8c:21:59:69:03:90:d8:7c:9c:12:86:54:cf:9d:3d:f4:dd:07 # SHA256 Fingerprint: 08:17:0d:1a:a3:64:53:90:1a:2f:95:92:45:e3:47:db:0c:8d:37:ab:aa:bc:56:b8:1a:a1:00:dc:95:89:70:db -----BEGIN CERTIFICATE----- MIIC2zCCAmCgAwIBAgIQXwJB13qHfEwDo6yWjfv/0DAKBggqhkjOPQQDAzBIMQsw CQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRS VVNUIEVWIFJvb3QgQ0EgMSAyMDIwMB4XDTIwMDIxMTEwMDAwMFoXDTM1MDIxMTA5 NTk1OVowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEiMCAG A1UEAxMZRC1UUlVTVCBFViBSb290IENBIDEgMjAyMDB2MBAGByqGSM49AgEGBSuB BAAiA2IABPEL3YZDIBnfl4XoIkqbz52Yv7QFJsnL46bSj8WeeHsxiamJrSc8ZRCC /N/DnU7wMyPE0jL1HLDfMxddxfCxivnvubcUyilKwg+pf3VlSSowZ/Rk99Yad9rD wpdhQntJraOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFH8QARY3 OqQo5FD4pPfsazK2/umLMA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6g PKA6hjhodHRwOi8vY3JsLmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X2V2X3Jvb3Rf Y2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVjdG9yeS5kLXRydXN0Lm5l dC9DTj1ELVRSVVNUJTIwRVYlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxPPUQtVHJ1 c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjO PQQDAwNpADBmAjEAyjzGKnXCXnViOTYAYFqLwZOZzNnbQTs7h5kXO9XMT8oi96CA y/m0sRtW9XLS/BnRAjEAkfcwkz8QRitxpNA7RJvAKQIFskF3UfN5Wp6OFKBOQtJb gfM0agPnIjhQW+0ZT0MW -----END CERTIFICATE----- # Issuer: CN=DigiCert TLS ECC P384 Root G5 O=DigiCert, Inc. # Subject: CN=DigiCert TLS ECC P384 Root G5 O=DigiCert, Inc. # Label: "DigiCert TLS ECC P384 Root G5" # Serial: 13129116028163249804115411775095713523 # MD5 Fingerprint: d3:71:04:6a:43:1c:db:a6:59:e1:a8:a3:aa:c5:71:ed # SHA1 Fingerprint: 17:f3:de:5e:9f:0f:19:e9:8e:f6:1f:32:26:6e:20:c4:07:ae:30:ee # SHA256 Fingerprint: 01:8e:13:f0:77:25:32:cf:80:9b:d1:b1:72:81:86:72:83:fc:48:c6:e1:3b:e9:c6:98:12:85:4a:49:0c:1b:05 -----BEGIN CERTIFICATE----- MIICGTCCAZ+gAwIBAgIQCeCTZaz32ci5PhwLBCou8zAKBggqhkjOPQQDAzBOMQsw CQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJjAkBgNVBAMTHURp Z2lDZXJ0IFRMUyBFQ0MgUDM4NCBSb290IEc1MB4XDTIxMDExNTAwMDAwMFoXDTQ2 MDExNDIzNTk1OVowTjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJ bmMuMSYwJAYDVQQDEx1EaWdpQ2VydCBUTFMgRUNDIFAzODQgUm9vdCBHNTB2MBAG ByqGSM49AgEGBSuBBAAiA2IABMFEoc8Rl1Ca3iOCNQfN0MsYndLxf3c1TzvdlHJS 7cI7+Oz6e2tYIOyZrsn8aLN1udsJ7MgT9U7GCh1mMEy7H0cKPGEQQil8pQgO4CLp 0zVozptjn4S1mU1YoI71VOeVyaNCMEAwHQYDVR0OBBYEFMFRRVBZqz7nLFr6ICIS B4CIfBFqMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49 BAMDA2gAMGUCMQCJao1H5+z8blUD2WdsJk6Dxv3J+ysTvLd6jLRl0mlpYxNjOyZQ LgGheQaRnUi/wr4CMEfDFXuxoJGZSZOoPHzoRgaLLPIxAJSdYsiJvRmEFOml+wG4 DXZDjC5Ty3zfDBeWUA== -----END CERTIFICATE----- # Issuer: CN=DigiCert TLS RSA4096 Root G5 O=DigiCert, Inc. # Subject: CN=DigiCert TLS RSA4096 Root G5 O=DigiCert, Inc. # Label: "DigiCert TLS RSA4096 Root G5" # Serial: 11930366277458970227240571539258396554 # MD5 Fingerprint: ac:fe:f7:34:96:a9:f2:b3:b4:12:4b:e4:27:41:6f:e1 # SHA1 Fingerprint: a7:88:49:dc:5d:7c:75:8c:8c:de:39:98:56:b3:aa:d0:b2:a5:71:35 # SHA256 Fingerprint: 37:1a:00:dc:05:33:b3:72:1a:7e:eb:40:e8:41:9e:70:79:9d:2b:0a:0f:2c:1d:80:69:31:65:f7:ce:c4:ad:75 -----BEGIN CERTIFICATE----- MIIFZjCCA06gAwIBAgIQCPm0eKj6ftpqMzeJ3nzPijANBgkqhkiG9w0BAQwFADBN MQswCQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJTAjBgNVBAMT HERpZ2lDZXJ0IFRMUyBSU0E0MDk2IFJvb3QgRzUwHhcNMjEwMTE1MDAwMDAwWhcN NDYwMTE0MjM1OTU5WjBNMQswCQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQs IEluYy4xJTAjBgNVBAMTHERpZ2lDZXJ0IFRMUyBSU0E0MDk2IFJvb3QgRzUwggIi MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz0PTJeRGd/fxmgefM1eS87IE+ ajWOLrfn3q/5B03PMJ3qCQuZvWxX2hhKuHisOjmopkisLnLlvevxGs3npAOpPxG0 2C+JFvuUAT27L/gTBaF4HI4o4EXgg/RZG5Wzrn4DReW+wkL+7vI8toUTmDKdFqgp wgscONyfMXdcvyej/Cestyu9dJsXLfKB2l2w4SMXPohKEiPQ6s+d3gMXsUJKoBZM pG2T6T867jp8nVid9E6P/DsjyG244gXazOvswzH016cpVIDPRFtMbzCe88zdH5RD nU1/cHAN1DrRN/BsnZvAFJNY781BOHW8EwOVfH/jXOnVDdXifBBiqmvwPXbzP6Po sMH976pXTayGpxi0KcEsDr9kvimM2AItzVwv8n/vFfQMFawKsPHTDU9qTXeXAaDx Zre3zu/O7Oyldcqs4+Fj97ihBMi8ez9dLRYiVu1ISf6nL3kwJZu6ay0/nTvEF+cd Lvvyz6b84xQslpghjLSR6Rlgg/IwKwZzUNWYOwbpx4oMYIwo+FKbbuH2TbsGJJvX KyY//SovcfXWJL5/MZ4PbeiPT02jP/816t9JXkGPhvnxd3lLG7SjXi/7RgLQZhNe XoVPzthwiHvOAbWWl9fNff2C+MIkwcoBOU+NosEUQB+cZtUMCUbW8tDRSHZWOkPL tgoRObqME2wGtZ7P6wIDAQABo0IwQDAdBgNVHQ4EFgQUUTMc7TZArxfTJc1paPKv TiM+s0EwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcN AQEMBQADggIBAGCmr1tfV9qJ20tQqcQjNSH/0GEwhJG3PxDPJY7Jv0Y02cEhJhxw GXIeo8mH/qlDZJY6yFMECrZBu8RHANmfGBg7sg7zNOok992vIGCukihfNudd5N7H PNtQOa27PShNlnx2xlv0wdsUpasZYgcYQF+Xkdycx6u1UQ3maVNVzDl92sURVXLF O4uJ+DQtpBflF+aZfTCIITfNMBc9uPK8qHWgQ9w+iUuQrm0D4ByjoJYJu32jtyoQ REtGBzRj7TG5BO6jm5qu5jF49OokYTurWGT/u4cnYiWB39yhL/btp/96j1EuMPik AdKFOV8BmZZvWltwGUb+hmA+rYAQCd05JS9Yf7vSdPD3Rh9GOUrYU9DzLjtxpdRv /PNn5AeP3SYZ4Y1b+qOTEZvpyDrDVWiakuFSdjjo4bq9+0/V77PnSIMx8IIh47a+ p6tv75/fTM8BuGJqIz3nCU2AG3swpMPdB380vqQmsvZB6Akd4yCYqjdP//fx4ilw MUc/dNAUFvohigLVigmUdy7yWSiLfFCSCmZ4OIN1xLVaqBHG5cGdZlXPU8Sv13WF qUITVuwhd4GTWgzqltlJyqEI8pc7bZsEGCREjnwB8twl2F6GmrE52/WRMmrRpnCK ovfepEWFJqgejF0pW8hL2JpqA15w8oVPbEtoL8pU9ozaMv7Da4M/OMZ+ -----END CERTIFICATE----- # Issuer: CN=Certainly Root R1 O=Certainly # Subject: CN=Certainly Root R1 O=Certainly # Label: "Certainly Root R1" # Serial: 188833316161142517227353805653483829216 # MD5 Fingerprint: 07:70:d4:3e:82:87:a0:fa:33:36:13:f4:fa:33:e7:12 # SHA1 Fingerprint: a0:50:ee:0f:28:71:f4:27:b2:12:6d:6f:50:96:25:ba:cc:86:42:af # SHA256 Fingerprint: 77:b8:2c:d8:64:4c:43:05:f7:ac:c5:cb:15:6b:45:67:50:04:03:3d:51:c6:0c:62:02:a8:e0:c3:34:67:d3:a0 -----BEGIN CERTIFICATE----- MIIFRzCCAy+gAwIBAgIRAI4P+UuQcWhlM1T01EQ5t+AwDQYJKoZIhvcNAQELBQAw PTELMAkGA1UEBhMCVVMxEjAQBgNVBAoTCUNlcnRhaW5seTEaMBgGA1UEAxMRQ2Vy dGFpbmx5IFJvb3QgUjEwHhcNMjEwNDAxMDAwMDAwWhcNNDYwNDAxMDAwMDAwWjA9 MQswCQYDVQQGEwJVUzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0 YWlubHkgUm9vdCBSMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANA2 1B/q3avk0bbm+yLA3RMNansiExyXPGhjZjKcA7WNpIGD2ngwEc/csiu+kr+O5MQT vqRoTNoCaBZ0vrLdBORrKt03H2As2/X3oXyVtwxwhi7xOu9S98zTm/mLvg7fMbed aFySpvXl8wo0tf97ouSHocavFwDvA5HtqRxOcT3Si2yJ9HiG5mpJoM610rCrm/b0 1C7jcvk2xusVtyWMOvwlDbMicyF0yEqWYZL1LwsYpfSt4u5BvQF5+paMjRcCMLT5 r3gajLQ2EBAHBXDQ9DGQilHFhiZ5shGIXsXwClTNSaa/ApzSRKft43jvRl5tcdF5 cBxGX1HpyTfcX35pe0HfNEXgO4T0oYoKNp43zGJS4YkNKPl6I7ENPT2a/Z2B7yyQ wHtETrtJ4A5KVpK8y7XdeReJkd5hiXSSqOMyhb5OhaRLWcsrxXiOcVTQAjeZjOVJ 6uBUcqQRBi8LjMFbvrWhsFNunLhgkR9Za/kt9JQKl7XsxXYDVBtlUrpMklZRNaBA 2CnbrlJ2Oy0wQJuK0EJWtLeIAaSHO1OWzaMWj/Nmqhexx2DgwUMFDO6bW2BvBlyH Wyf5QBGenDPBt+U1VwV/J84XIIwc/PH72jEpSe31C4SnT8H2TsIonPru4K8H+zMR eiFPCyEQtkA6qyI6BJyLm4SGcprSp6XEtHWRqSsjAgMBAAGjQjBAMA4GA1UdDwEB /wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTgqj8ljZ9EXME66C6u d0yEPmcM9DANBgkqhkiG9w0BAQsFAAOCAgEAuVevuBLaV4OPaAszHQNTVfSVcOQr PbA56/qJYv331hgELyE03fFo8NWWWt7CgKPBjcZq91l3rhVkz1t5BXdm6ozTaw3d 8VkswTOlMIAVRQdFGjEitpIAq5lNOo93r6kiyi9jyhXWx8bwPWz8HA2YEGGeEaIi 1wrykXprOQ4vMMM2SZ/g6Q8CRFA3lFV96p/2O7qUpUzpvD5RtOjKkjZUbVwlKNrd rRT90+7iIgXr0PK3aBLXWopBGsaSpVo7Y0VPv+E6dyIvXL9G+VoDhRNCX8reU9di taY1BMJH/5n9hN9czulegChB8n3nHpDYT3Y+gjwN/KUD+nsa2UUeYNrEjvn8K8l7 lcUq/6qJ34IxD3L/DCfXCh5WAFAeDJDBlrXYFIW7pw0WwfgHJBu6haEaBQmAupVj yTrsJZ9/nbqkRxWbRHDxakvWOF5D8xh+UG7pWijmZeZ3Gzr9Hb4DJqPb1OG7fpYn Kx3upPvaJVQTA945xsMfTZDsjxtK0hzthZU4UHlG1sGQUDGpXJpuHfUzVounmdLy yCwzk5Iwx06MZTMQZBf9JBeW0Y3COmor6xOLRPIh80oat3df1+2IpHLlOR+Vnb5n wXARPbv0+Em34yaXOp/SX3z7wJl8OSngex2/DaeP0ik0biQVy96QXr8axGbqwua6 OV+KmalBWQewLK8= -----END CERTIFICATE----- # Issuer: CN=Certainly Root E1 O=Certainly # Subject: CN=Certainly Root E1 O=Certainly # Label: "Certainly Root E1" # Serial: 8168531406727139161245376702891150584 # MD5 Fingerprint: 0a:9e:ca:cd:3e:52:50:c6:36:f3:4b:a3:ed:a7:53:e9 # SHA1 Fingerprint: f9:e1:6d:dc:01:89:cf:d5:82:45:63:3e:c5:37:7d:c2:eb:93:6f:2b # SHA256 Fingerprint: b4:58:5f:22:e4:ac:75:6a:4e:86:12:a1:36:1c:5d:9d:03:1a:93:fd:84:fe:bb:77:8f:a3:06:8b:0f:c4:2d:c2 -----BEGIN CERTIFICATE----- MIIB9zCCAX2gAwIBAgIQBiUzsUcDMydc+Y2aub/M+DAKBggqhkjOPQQDAzA9MQsw CQYDVQQGEwJVUzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0YWlu bHkgUm9vdCBFMTAeFw0yMTA0MDEwMDAwMDBaFw00NjA0MDEwMDAwMDBaMD0xCzAJ BgNVBAYTAlVTMRIwEAYDVQQKEwlDZXJ0YWlubHkxGjAYBgNVBAMTEUNlcnRhaW5s eSBSb290IEUxMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE3m/4fxzf7flHh4axpMCK +IKXgOqPyEpeKn2IaKcBYhSRJHpcnqMXfYqGITQYUBsQ3tA3SybHGWCA6TS9YBk2 QNYphwk8kXr2vBMj3VlOBF7PyAIcGFPBMdjaIOlEjeR2o0IwQDAOBgNVHQ8BAf8E BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU8ygYy2R17ikq6+2uI1g4 hevIIgcwCgYIKoZIzj0EAwMDaAAwZQIxALGOWiDDshliTd6wT99u0nCK8Z9+aozm ut6Dacpps6kFtZaSF4fC0urQe87YQVt8rgIwRt7qy12a7DLCZRawTDBcMPPaTnOG BtjOiQRINzf43TNRnXCve1XYAS59BWQOhriR -----END CERTIFICATE----- # Issuer: CN=Security Communication ECC RootCA1 O=SECOM Trust Systems CO.,LTD. # Subject: CN=Security Communication ECC RootCA1 O=SECOM Trust Systems CO.,LTD. # Label: "Security Communication ECC RootCA1" # Serial: 15446673492073852651 # MD5 Fingerprint: 7e:43:b0:92:68:ec:05:43:4c:98:ab:5d:35:2e:7e:86 # SHA1 Fingerprint: b8:0e:26:a9:bf:d2:b2:3b:c0:ef:46:c9:ba:c7:bb:f6:1d:0d:41:41 # SHA256 Fingerprint: e7:4f:bd:a5:5b:d5:64:c4:73:a3:6b:44:1a:a7:99:c8:a6:8e:07:74:40:e8:28:8b:9f:a1:e5:0e:4b:ba:ca:11 -----BEGIN CERTIFICATE----- MIICODCCAb6gAwIBAgIJANZdm7N4gS7rMAoGCCqGSM49BAMDMGExCzAJBgNVBAYT AkpQMSUwIwYDVQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMSswKQYD VQQDEyJTZWN1cml0eSBDb21tdW5pY2F0aW9uIEVDQyBSb290Q0ExMB4XDTE2MDYx NjA1MTUyOFoXDTM4MDExODA1MTUyOFowYTELMAkGA1UEBhMCSlAxJTAjBgNVBAoT HFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKzApBgNVBAMTIlNlY3VyaXR5 IENvbW11bmljYXRpb24gRUNDIFJvb3RDQTEwdjAQBgcqhkjOPQIBBgUrgQQAIgNi AASkpW9gAwPDvTH00xecK4R1rOX9PVdu12O/5gSJko6BnOPpR27KkBLIE+Cnnfdl dB9sELLo5OnvbYUymUSxXv3MdhDYW72ixvnWQuRXdtyQwjWpS4g8EkdtXP9JTxpK ULGjQjBAMB0GA1UdDgQWBBSGHOf+LaVKiwj+KBH6vqNm+GBZLzAOBgNVHQ8BAf8E BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjAVXUI9/Lbu 9zuxNuie9sRGKEkz0FhDKmMpzE2xtHqiuQ04pV1IKv3LsnNdo4gIxwwCMQDAqy0O be0YottT6SXbVQjgUMzfRGEWgqtJsLKB7HOHeLRMsmIbEvoWTSVLY70eN9k= -----END CERTIFICATE----- # Issuer: CN=BJCA Global Root CA1 O=BEIJING CERTIFICATE AUTHORITY # Subject: CN=BJCA Global Root CA1 O=BEIJING CERTIFICATE AUTHORITY # Label: "BJCA Global Root CA1" # Serial: 113562791157148395269083148143378328608 # MD5 Fingerprint: 42:32:99:76:43:33:36:24:35:07:82:9b:28:f9:d0:90 # SHA1 Fingerprint: d5:ec:8d:7b:4c:ba:79:f4:e7:e8:cb:9d:6b:ae:77:83:10:03:21:6a # SHA256 Fingerprint: f3:89:6f:88:fe:7c:0a:88:27:66:a7:fa:6a:d2:74:9f:b5:7a:7f:3e:98:fb:76:9c:1f:a7:b0:9c:2c:44:d5:ae -----BEGIN CERTIFICATE----- MIIFdDCCA1ygAwIBAgIQVW9l47TZkGobCdFsPsBsIDANBgkqhkiG9w0BAQsFADBU MQswCQYDVQQGEwJDTjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRI T1JJVFkxHTAbBgNVBAMMFEJKQ0EgR2xvYmFsIFJvb3QgQ0ExMB4XDTE5MTIxOTAz MTYxN1oXDTQ0MTIxMjAzMTYxN1owVDELMAkGA1UEBhMCQ04xJjAkBgNVBAoMHUJF SUpJTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQDDBRCSkNBIEdsb2Jh bCBSb290IENBMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAPFmCL3Z xRVhy4QEQaVpN3cdwbB7+sN3SJATcmTRuHyQNZ0YeYjjlwE8R4HyDqKYDZ4/N+AZ spDyRhySsTphzvq3Rp4Dhtczbu33RYx2N95ulpH3134rhxfVizXuhJFyV9xgw8O5 58dnJCNPYwpj9mZ9S1WnP3hkSWkSl+BMDdMJoDIwOvqfwPKcxRIqLhy1BDPapDgR at7GGPZHOiJBhyL8xIkoVNiMpTAK+BcWyqw3/XmnkRd4OJmtWO2y3syJfQOcs4ll 5+M7sSKGjwZteAf9kRJ/sGsciQ35uMt0WwfCyPQ10WRjeulumijWML3mG90Vr4Tq nMfK9Q7q8l0ph49pczm+LiRvRSGsxdRpJQaDrXpIhRMsDQa4bHlW/KNnMoH1V6XK V0Jp6VwkYe/iMBhORJhVb3rCk9gZtt58R4oRTklH2yiUAguUSiz5EtBP6DF+bHq/ pj+bOT0CFqMYs2esWz8sgytnOYFcuX6U1WTdno9uruh8W7TXakdI136z1C2OVnZO z2nxbkRs1CTqjSShGL+9V/6pmTW12xB3uD1IutbB5/EjPtffhZ0nPNRAvQoMvfXn jSXWgXSHRtQpdaJCbPdzied9v3pKH9MiyRVVz99vfFXQpIsHETdfg6YmV6YBW37+ WGgHqel62bno/1Afq8K0wM7o6v0PvY1NuLxxAgMBAAGjQjBAMB0GA1UdDgQWBBTF 7+3M2I0hxkjk49cULqcWk+WYATAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE AwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAUoKsITQfI/Ki2Pm4rzc2IInRNwPWaZ+4 YRC6ojGYWUfo0Q0lHhVBDOAqVdVXUsv45Mdpox1NcQJeXyFFYEhcCY5JEMEE3Kli awLwQ8hOnThJdMkycFRtwUf8jrQ2ntScvd0g1lPJGKm1Vrl2i5VnZu69mP6u775u +2D2/VnGKhs/I0qUJDAnyIm860Qkmss9vk/Ves6OF8tiwdneHg56/0OGNFK8YT88 X7vZdrRTvJez/opMEi4r89fO4aL/3Xtw+zuhTaRjAv04l5U/BXCga99igUOLtFkN SoxUnMW7gZ/NfaXvCyUeOiDbHPwfmGcCCtRzRBPbUYQaVQNW4AB+dAb/OMRyHdOo P2gxXdMJxy6MW2Pg6Nwe0uxhHvLe5e/2mXZgLR6UcnHGCyoyx5JO1UbXHfmpGQrI +pXObSOYqgs4rZpWDW+N8TEAiMEXnM0ZNjX+VVOg4DwzX5Ze4jLp3zO7Bkqp2IRz znfSxqxx4VyjHQy7Ct9f4qNx2No3WqB4K/TUfet27fJhcKVlmtOJNBir+3I+17Q9 eVzYH6Eze9mCUAyTF6ps3MKCuwJXNq+YJyo5UOGwifUll35HaBC07HPKs5fRJNz2 YqAo07WjuGS3iGJCz51TzZm+ZGiPTx4SSPfSKcOYKMryMguTjClPPGAyzQWWYezy r/6zcCwupvI= -----END CERTIFICATE----- # Issuer: CN=BJCA Global Root CA2 O=BEIJING CERTIFICATE AUTHORITY # Subject: CN=BJCA Global Root CA2 O=BEIJING CERTIFICATE AUTHORITY # Label: "BJCA Global Root CA2" # Serial: 58605626836079930195615843123109055211 # MD5 Fingerprint: 5e:0a:f6:47:5f:a6:14:e8:11:01:95:3f:4d:01:eb:3c # SHA1 Fingerprint: f4:27:86:eb:6e:b8:6d:88:31:67:02:fb:ba:66:a4:53:00:aa:7a:a6 # SHA256 Fingerprint: 57:4d:f6:93:1e:27:80:39:66:7b:72:0a:fd:c1:60:0f:c2:7e:b6:6d:d3:09:29:79:fb:73:85:64:87:21:28:82 -----BEGIN CERTIFICATE----- MIICJTCCAaugAwIBAgIQLBcIfWQqwP6FGFkGz7RK6zAKBggqhkjOPQQDAzBUMQsw CQYDVQQGEwJDTjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRIT1JJ VFkxHTAbBgNVBAMMFEJKQ0EgR2xvYmFsIFJvb3QgQ0EyMB4XDTE5MTIxOTAzMTgy MVoXDTQ0MTIxMjAzMTgyMVowVDELMAkGA1UEBhMCQ04xJjAkBgNVBAoMHUJFSUpJ TkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQDDBRCSkNBIEdsb2JhbCBS b290IENBMjB2MBAGByqGSM49AgEGBSuBBAAiA2IABJ3LgJGNU2e1uVCxA/jlSR9B IgmwUVJY1is0j8USRhTFiy8shP8sbqjV8QnjAyEUxEM9fMEsxEtqSs3ph+B99iK+ +kpRuDCK/eHeGBIK9ke35xe/J4rUQUyWPGCWwf0VHKNCMEAwHQYDVR0OBBYEFNJK sVF/BvDRgh9Obl+rg/xI1LCRMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD AgEGMAoGCCqGSM49BAMDA2gAMGUCMBq8W9f+qdJUDkpd0m2xQNz0Q9XSSpkZElaA 94M04TVOSG0ED1cxMDAtsaqdAzjbBgIxAMvMh1PLet8gUXOQwKhbYdDFUDn9hf7B 43j4ptZLvZuHjw/l1lOWqzzIQNph91Oj9w== -----END CERTIFICATE----- # Issuer: CN=Sectigo Public Server Authentication Root E46 O=Sectigo Limited # Subject: CN=Sectigo Public Server Authentication Root E46 O=Sectigo Limited # Label: "Sectigo Public Server Authentication Root E46" # Serial: 88989738453351742415770396670917916916 # MD5 Fingerprint: 28:23:f8:b2:98:5c:37:16:3b:3e:46:13:4e:b0:b3:01 # SHA1 Fingerprint: ec:8a:39:6c:40:f0:2e:bc:42:75:d4:9f:ab:1c:1a:5b:67:be:d2:9a # SHA256 Fingerprint: c9:0f:26:f0:fb:1b:40:18:b2:22:27:51:9b:5c:a2:b5:3e:2c:a5:b3:be:5c:f1:8e:fe:1b:ef:47:38:0c:53:83 -----BEGIN CERTIFICATE----- MIICOjCCAcGgAwIBAgIQQvLM2htpN0RfFf51KBC49DAKBggqhkjOPQQDAzBfMQsw CQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1T ZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwHhcN MjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5WjBfMQswCQYDVQQGEwJHQjEYMBYG A1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1YmxpYyBT ZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUrgQQA IgNiAAR2+pmpbiDt+dd34wc7qNs9Xzjoq1WmVk/WSOrsfy2qw7LFeeyZYX8QeccC WvkEN/U0NSt3zn8gj1KjAIns1aeibVvjS5KToID1AZTc8GgHHs3u/iVStSBDHBv+ 6xnOQ6OjQjBAMB0GA1UdDgQWBBTRItpMWfFLXyY4qp3W7usNw/upYTAOBgNVHQ8B Af8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNnADBkAjAn7qRa qCG76UeXlImldCBteU/IvZNeWBj7LRoAasm4PdCkT0RHlAFWovgzJQxC36oCMB3q 4S6ILuH5px0CMk7yn2xVdOOurvulGu7t0vzCAxHrRVxgED1cf5kDW21USAGKcw== -----END CERTIFICATE----- # Issuer: CN=Sectigo Public Server Authentication Root R46 O=Sectigo Limited # Subject: CN=Sectigo Public Server Authentication Root R46 O=Sectigo Limited # Label: "Sectigo Public Server Authentication Root R46" # Serial: 156256931880233212765902055439220583700 # MD5 Fingerprint: 32:10:09:52:00:d5:7e:6c:43:df:15:c0:b1:16:93:e5 # SHA1 Fingerprint: ad:98:f9:f3:e4:7d:75:3b:65:d4:82:b3:a4:52:17:bb:6e:f5:e4:38 # SHA256 Fingerprint: 7b:b6:47:a6:2a:ee:ac:88:bf:25:7a:a5:22:d0:1f:fe:a3:95:e0:ab:45:c7:3f:93:f6:56:54:ec:38:f2:5a:06 -----BEGIN CERTIFICATE----- MIIFijCCA3KgAwIBAgIQdY39i658BwD6qSWn4cetFDANBgkqhkiG9w0BAQwFADBf MQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQD Ey1TZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYw HhcNMjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5WjBfMQswCQYDVQQGEwJHQjEY MBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1Ymxp YyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYwggIiMA0GCSqGSIb3DQEB AQUAA4ICDwAwggIKAoICAQCTvtU2UnXYASOgHEdCSe5jtrch/cSV1UgrJnwUUxDa ef0rty2k1Cz66jLdScK5vQ9IPXtamFSvnl0xdE8H/FAh3aTPaE8bEmNtJZlMKpnz SDBh+oF8HqcIStw+KxwfGExxqjWMrfhu6DtK2eWUAtaJhBOqbchPM8xQljeSM9xf iOefVNlI8JhD1mb9nxc4Q8UBUQvX4yMPFF1bFOdLvt30yNoDN9HWOaEhUTCDsG3X ME6WW5HwcCSrv0WBZEMNvSE6Lzzpng3LILVCJ8zab5vuZDCQOc2TZYEhMbUjUDM3 IuM47fgxMMxF/mL50V0yeUKH32rMVhlATc6qu/m1dkmU8Sf4kaWD5QazYw6A3OAS VYCmO2a0OYctyPDQ0RTp5A1NDvZdV3LFOxxHVp3i1fuBYYzMTYCQNFu31xR13NgE SJ/AwSiItOkcyqex8Va3e0lMWeUgFaiEAin6OJRpmkkGj80feRQXEgyDet4fsZfu +Zd4KKTIRJLpfSYFplhym3kT2BFfrsU4YjRosoYwjviQYZ4ybPUHNs2iTG7sijbt 8uaZFURww3y8nDnAtOFr94MlI1fZEoDlSfB1D++N6xybVCi0ITz8fAr/73trdf+L HaAZBav6+CuBQug4urv7qv094PPK306Xlynt8xhW6aWWrL3DkJiy4Pmi1KZHQ3xt zwIDAQABo0IwQDAdBgNVHQ4EFgQUVnNYZJX5khqwEioEYnmhQBWIIUkwDgYDVR0P AQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAC9c mTz8Bl6MlC5w6tIyMY208FHVvArzZJ8HXtXBc2hkeqK5Duj5XYUtqDdFqij0lgVQ YKlJfp/imTYpE0RHap1VIDzYm/EDMrraQKFz6oOht0SmDpkBm+S8f74TlH7Kph52 gDY9hAaLMyZlbcp+nv4fjFg4exqDsQ+8FxG75gbMY/qB8oFM2gsQa6H61SilzwZA Fv97fRheORKkU55+MkIQpiGRqRxOF3yEvJ+M0ejf5lG5Nkc/kLnHvALcWxxPDkjB JYOcCj+esQMzEhonrPcibCTRAUH4WAP+JWgiH5paPHxsnnVI84HxZmduTILA7rpX DhjvLpr3Etiga+kFpaHpaPi8TD8SHkXoUsCjvxInebnMMTzD9joiFgOgyY9mpFui TdaBJQbpdqQACj7LzTWb4OE4y2BThihCQRxEV+ioratF4yUQvNs+ZUH7G6aXD+u5 dHn5HrwdVw1Hr8Mvn4dGp+smWg9WY7ViYG4A++MnESLn/pmPNPW56MORcr3Ywx65 LvKRRFHQV80MNNVIIb/bE/FmJUNS0nAiNs2fxBx1IK1jcmMGDw4nztJqDby1ORrp 0XZ60Vzk50lJLVU3aPAaOpg+VBeHVOmmJ1CJeyAvP/+/oYtKR5j/K3tJPsMpRmAY QqszKbrAKbkTidOIijlBO8n9pu0f9GBj39ItVQGL -----END CERTIFICATE----- # Issuer: CN=SSL.com TLS RSA Root CA 2022 O=SSL Corporation # Subject: CN=SSL.com TLS RSA Root CA 2022 O=SSL Corporation # Label: "SSL.com TLS RSA Root CA 2022" # Serial: 148535279242832292258835760425842727825 # MD5 Fingerprint: d8:4e:c6:59:30:d8:fe:a0:d6:7a:5a:2c:2c:69:78:da # SHA1 Fingerprint: ec:2c:83:40:72:af:26:95:10:ff:0e:f2:03:ee:31:70:f6:78:9d:ca # SHA256 Fingerprint: 8f:af:7d:2e:2c:b4:70:9b:b8:e0:b3:36:66:bf:75:a5:dd:45:b5:de:48:0f:8e:a8:d4:bf:e6:be:bc:17:f2:ed -----BEGIN CERTIFICATE----- MIIFiTCCA3GgAwIBAgIQb77arXO9CEDii02+1PdbkTANBgkqhkiG9w0BAQsFADBO MQswCQYDVQQGEwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQD DBxTU0wuY29tIFRMUyBSU0EgUm9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzQyMloX DTQ2MDgxOTE2MzQyMVowTjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD1NTTCBDb3Jw b3JhdGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgUlNBIFJvb3QgQ0EgMjAyMjCC AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANCkCXJPQIgSYT41I57u9nTP L3tYPc48DRAokC+X94xI2KDYJbFMsBFMF3NQ0CJKY7uB0ylu1bUJPiYYf7ISf5OY t6/wNr/y7hienDtSxUcZXXTzZGbVXcdotL8bHAajvI9AI7YexoS9UcQbOcGV0ins S657Lb85/bRi3pZ7QcacoOAGcvvwB5cJOYF0r/c0WRFXCsJbwST0MXMwgsadugL3 PnxEX4MN8/HdIGkWCVDi1FW24IBydm5MR7d1VVm0U3TZlMZBrViKMWYPHqIbKUBO L9975hYsLfy/7PO0+r4Y9ptJ1O4Fbtk085zx7AGL0SDGD6C1vBdOSHtRwvzpXGk3 R2azaPgVKPC506QVzFpPulJwoxJF3ca6TvvC0PeoUidtbnm1jPx7jMEWTO6Af77w dr5BUxIzrlo4QqvXDz5BjXYHMtWrifZOZ9mxQnUjbvPNQrL8VfVThxc7wDNY8VLS +YCk8OjwO4s4zKTGkH8PnP2L0aPP2oOnaclQNtVcBdIKQXTbYxE3waWglksejBYS d66UNHsef8JmAOSqg+qKkK3ONkRN0VHpvB/zagX9wHQfJRlAUW7qglFA35u5CCoG AtUjHBPW6dvbxrB6y3snm/vg1UYk7RBLY0ulBY+6uB0rpvqR4pJSvezrZ5dtmi2f gTIFZzL7SAg/2SW4BCUvAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0j BBgwFoAU+y437uOEeicuzRk1sTN8/9REQrkwHQYDVR0OBBYEFPsuN+7jhHonLs0Z NbEzfP/UREK5MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAjYlt hEUY8U+zoO9opMAdrDC8Z2awms22qyIZZtM7QbUQnRC6cm4pJCAcAZli05bg4vsM QtfhWsSWTVTNj8pDU/0quOr4ZcoBwq1gaAafORpR2eCNJvkLTqVTJXojpBzOCBvf R4iyrT7gJ4eLSYwfqUdYe5byiB0YrrPRpgqU+tvT5TgKa3kSM/tKWTcWQA673vWJ DPFs0/dRa1419dvAJuoSc06pkZCmF8NsLzjUo3KUQyxi4U5cMj29TH0ZR6LDSeeW P4+a0zvkEdiLA9z2tmBVGKaBUfPhqBVq6+AL8BQx1rmMRTqoENjwuSfr98t67wVy lrXEj5ZzxOhWc5y8aVFjvO9nHEMaX3cZHxj4HCUp+UmZKbaSPaKDN7EgkaibMOlq bLQjk2UEqxHzDh1TJElTHaE/nUiSEeJ9DU/1172iWD54nR4fK/4huxoTtrEoZP2w AgDHbICivRZQIA9ygV/MlP+7mea6kMvq+cYMwq7FGc4zoWtcu358NFcXrfA/rs3q r5nsLFR+jM4uElZI7xc7P0peYNLcdDa8pUNjyw9bowJWCZ4kLOGGgYz+qxcs+sji Mho6/4UIyYOf8kpIEFR3N+2ivEC+5BB09+Rbu7nzifmPQdjH5FCQNYA+HLhNkNPU 98OwoX6EyneSMSy4kLGCenROmxMmtNVQZlR4rmA= -----END CERTIFICATE----- # Issuer: CN=SSL.com TLS ECC Root CA 2022 O=SSL Corporation # Subject: CN=SSL.com TLS ECC Root CA 2022 O=SSL Corporation # Label: "SSL.com TLS ECC Root CA 2022" # Serial: 26605119622390491762507526719404364228 # MD5 Fingerprint: 99:d7:5c:f1:51:36:cc:e9:ce:d9:19:2e:77:71:56:c5 # SHA1 Fingerprint: 9f:5f:d9:1a:54:6d:f5:0c:71:f0:ee:7a:bd:17:49:98:84:73:e2:39 # SHA256 Fingerprint: c3:2f:fd:9f:46:f9:36:d1:6c:36:73:99:09:59:43:4b:9a:d6:0a:af:bb:9e:7c:f3:36:54:f1:44:cc:1b:a1:43 -----BEGIN CERTIFICATE----- MIICOjCCAcCgAwIBAgIQFAP1q/s3ixdAW+JDsqXRxDAKBggqhkjOPQQDAzBOMQsw CQYDVQQGEwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQDDBxT U0wuY29tIFRMUyBFQ0MgUm9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzM0OFoXDTQ2 MDgxOTE2MzM0N1owTjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD1NTTCBDb3Jwb3Jh dGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgRUNDIFJvb3QgQ0EgMjAyMjB2MBAG ByqGSM49AgEGBSuBBAAiA2IABEUpNXP6wrgjzhR9qLFNoFs27iosU8NgCTWyJGYm acCzldZdkkAZDsalE3D07xJRKF3nzL35PIXBz5SQySvOkkJYWWf9lCcQZIxPBLFN SeR7T5v15wj4A4j3p8OSSxlUgaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSME GDAWgBSJjy+j6CugFFR781a4Jl9nOAuc0DAdBgNVHQ4EFgQUiY8vo+groBRUe/NW uCZfZzgLnNAwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2gAMGUCMFXjIlbp 15IkWE8elDIPDAI2wv2sdDJO4fscgIijzPvX6yv/N33w7deedWo1dlJF4AIxAMeN b0Igj762TVntd00pxCAgRWSGOlDGxK0tk/UYfXLtqc/ErFc2KAhl3zx5Zn6g6g== -----END CERTIFICATE----- # Issuer: CN=Atos TrustedRoot Root CA ECC TLS 2021 O=Atos # Subject: CN=Atos TrustedRoot Root CA ECC TLS 2021 O=Atos # Label: "Atos TrustedRoot Root CA ECC TLS 2021" # Serial: 81873346711060652204712539181482831616 # MD5 Fingerprint: 16:9f:ad:f1:70:ad:79:d6:ed:29:b4:d1:c5:79:70:a8 # SHA1 Fingerprint: 9e:bc:75:10:42:b3:02:f3:81:f4:f7:30:62:d4:8f:c3:a7:51:b2:dd # SHA256 Fingerprint: b2:fa:e5:3e:14:cc:d7:ab:92:12:06:47:01:ae:27:9c:1d:89:88:fa:cb:77:5f:a8:a0:08:91:4e:66:39:88:a8 -----BEGIN CERTIFICATE----- MIICFTCCAZugAwIBAgIQPZg7pmY9kGP3fiZXOATvADAKBggqhkjOPQQDAzBMMS4w LAYDVQQDDCVBdG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgRUNDIFRMUyAyMDIxMQ0w CwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0yMTA0MjIwOTI2MjNaFw00MTA0 MTcwOTI2MjJaMEwxLjAsBgNVBAMMJUF0b3MgVHJ1c3RlZFJvb3QgUm9vdCBDQSBF Q0MgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNVBAYTAkRFMHYwEAYHKoZI zj0CAQYFK4EEACIDYgAEloZYKDcKZ9Cg3iQZGeHkBQcfl+3oZIK59sRxUM6KDP/X tXa7oWyTbIOiaG6l2b4siJVBzV3dscqDY4PMwL502eCdpO5KTlbgmClBk1IQ1SQ4 AjJn8ZQSb+/Xxd4u/RmAo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR2 KCXWfeBmmnoJsmo7jjPXNtNPojAOBgNVHQ8BAf8EBAMCAYYwCgYIKoZIzj0EAwMD aAAwZQIwW5kp85wxtolrbNa9d+F851F+uDrNozZffPc8dz7kUK2o59JZDCaOMDtu CCrCp1rIAjEAmeMM56PDr9NJLkaCI2ZdyQAUEv049OGYa3cpetskz2VAv9LcjBHo 9H1/IISpQuQo -----END CERTIFICATE----- # Issuer: CN=Atos TrustedRoot Root CA RSA TLS 2021 O=Atos # Subject: CN=Atos TrustedRoot Root CA RSA TLS 2021 O=Atos # Label: "Atos TrustedRoot Root CA RSA TLS 2021" # Serial: 111436099570196163832749341232207667876 # MD5 Fingerprint: d4:d3:46:b8:9a:c0:9c:76:5d:9e:3a:c3:b9:99:31:d2 # SHA1 Fingerprint: 18:52:3b:0d:06:37:e4:d6:3a:df:23:e4:98:fb:5b:16:fb:86:74:48 # SHA256 Fingerprint: 81:a9:08:8e:a5:9f:b3:64:c5:48:a6:f8:55:59:09:9b:6f:04:05:ef:bf:18:e5:32:4e:c9:f4:57:ba:00:11:2f -----BEGIN CERTIFICATE----- MIIFZDCCA0ygAwIBAgIQU9XP5hmTC/srBRLYwiqipDANBgkqhkiG9w0BAQwFADBM MS4wLAYDVQQDDCVBdG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgUlNBIFRMUyAyMDIx MQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0yMTA0MjIwOTIxMTBaFw00 MTA0MTcwOTIxMDlaMEwxLjAsBgNVBAMMJUF0b3MgVHJ1c3RlZFJvb3QgUm9vdCBD QSBSU0EgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNVBAYTAkRFMIICIjAN BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtoAOxHm9BYx9sKOdTSJNy/BBl01Z 4NH+VoyX8te9j2y3I49f1cTYQcvyAh5x5en2XssIKl4w8i1mx4QbZFc4nXUtVsYv Ye+W/CBGvevUez8/fEc4BKkbqlLfEzfTFRVOvV98r61jx3ncCHvVoOX3W3WsgFWZ kmGbzSoXfduP9LVq6hdKZChmFSlsAvFr1bqjM9xaZ6cF4r9lthawEO3NUDPJcFDs GY6wx/J0W2tExn2WuZgIWWbeKQGb9Cpt0xU6kGpn8bRrZtkh68rZYnxGEFzedUln nkL5/nWpo63/dgpnQOPF943HhZpZnmKaau1Fh5hnstVKPNe0OwANwI8f4UDErmwh 3El+fsqyjW22v5MvoVw+j8rtgI5Y4dtXz4U2OLJxpAmMkokIiEjxQGMYsluMWuPD 0xeqqxmjLBvk1cbiZnrXghmmOxYsL3GHX0WelXOTwkKBIROW1527k2gV+p2kHYzy geBYBr3JtuP2iV2J+axEoctr+hbxx1A9JNr3w+SH1VbxT5Aw+kUJWdo0zuATHAR8 ANSbhqRAvNncTFd+rrcztl524WWLZt+NyteYr842mIycg5kDcPOvdO3GDjbnvezB c6eUWsuSZIKmAMFwoW4sKeFYV+xafJlrJaSQOoD0IJ2azsct+bJLKZWD6TWNp0lI pw9MGZHQ9b8Q4HECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU dEmZ0f+0emhFdcN+tNzMzjkz2ggwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB DAUAA4ICAQAjQ1MkYlxt/T7Cz1UAbMVWiLkO3TriJQ2VSpfKgInuKs1l+NsW4AmS 4BjHeJi78+xCUvuppILXTdiK/ORO/auQxDh1MoSf/7OwKwIzNsAQkG8dnK/haZPs o0UvFJ/1TCplQ3IM98P4lYsU84UgYt1UU90s3BiVaU+DR3BAM1h3Egyi61IxHkzJ qM7F78PRreBrAwA0JrRUITWXAdxfG/F851X6LWh3e9NpzNMOa7pNdkTWwhWaJuyw xfW70Xp0wmzNxbVe9kzmWy2B27O3Opee7c9GslA9hGCZcbUztVdF5kJHdWoOsAgM rr3e97sPWD2PAzHoPYJQyi9eDF20l74gNAf0xBLh7tew2VktafcxBPTy+av5EzH4 AXcOPUIjJsyacmdRIXrMPIWo6iFqO9taPKU0nprALN+AnCng33eU0aKAQv9qTFsR 0PXNor6uzFFcw9VUewyu1rkGd4Di7wcaaMxZUa1+XGdrudviB0JbuAEFWDlN5LuY o7Ey7Nmj1m+UI/87tyll5gfp77YZ6ufCOB0yiJA8EytuzO+rdwY0d4RPcuSBhPm5 dDTedk+SKlOxJTnbPP/lPqYO5Wue/9vsL3SD3460s6neFE3/MaNFcyT6lSnMEpcE oji2jbDwN/zIIX8/syQbPYtuzE2wFg2WHYMfRsCbvUOZ58SWLs5fyQ== -----END CERTIFICATE----- # Issuer: CN=TrustAsia Global Root CA G3 O=TrustAsia Technologies, Inc. # Subject: CN=TrustAsia Global Root CA G3 O=TrustAsia Technologies, Inc. # Label: "TrustAsia Global Root CA G3" # Serial: 576386314500428537169965010905813481816650257167 # MD5 Fingerprint: 30:42:1b:b7:bb:81:75:35:e4:16:4f:53:d2:94:de:04 # SHA1 Fingerprint: 63:cf:b6:c1:27:2b:56:e4:88:8e:1c:23:9a:b6:2e:81:47:24:c3:c7 # SHA256 Fingerprint: e0:d3:22:6a:eb:11:63:c2:e4:8f:f9:be:3b:50:b4:c6:43:1b:e7:bb:1e:ac:c5:c3:6b:5d:5e:c5:09:03:9a:08 -----BEGIN CERTIFICATE----- MIIFpTCCA42gAwIBAgIUZPYOZXdhaqs7tOqFhLuxibhxkw8wDQYJKoZIhvcNAQEM BQAwWjELMAkGA1UEBhMCQ04xJTAjBgNVBAoMHFRydXN0QXNpYSBUZWNobm9sb2dp ZXMsIEluYy4xJDAiBgNVBAMMG1RydXN0QXNpYSBHbG9iYWwgUm9vdCBDQSBHMzAe Fw0yMTA1MjAwMjEwMTlaFw00NjA1MTkwMjEwMTlaMFoxCzAJBgNVBAYTAkNOMSUw IwYDVQQKDBxUcnVzdEFzaWEgVGVjaG5vbG9naWVzLCBJbmMuMSQwIgYDVQQDDBtU cnVzdEFzaWEgR2xvYmFsIFJvb3QgQ0EgRzMwggIiMA0GCSqGSIb3DQEBAQUAA4IC DwAwggIKAoICAQDAMYJhkuSUGwoqZdC+BqmHO1ES6nBBruL7dOoKjbmzTNyPtxNS T1QY4SxzlZHFZjtqz6xjbYdT8PfxObegQ2OwxANdV6nnRM7EoYNl9lA+sX4WuDqK AtCWHwDNBSHvBm3dIZwZQ0WhxeiAysKtQGIXBsaqvPPW5vxQfmZCHzyLpnl5hkA1 nyDvP+uLRx+PjsXUjrYsyUQE49RDdT/VP68czH5GX6zfZBCK70bwkPAPLfSIC7Ep qq+FqklYqL9joDiR5rPmd2jE+SoZhLsO4fWvieylL1AgdB4SQXMeJNnKziyhWTXA yB1GJ2Faj/lN03J5Zh6fFZAhLf3ti1ZwA0pJPn9pMRJpxx5cynoTi+jm9WAPzJMs hH/x/Gr8m0ed262IPfN2dTPXS6TIi/n1Q1hPy8gDVI+lhXgEGvNz8teHHUGf59gX zhqcD0r83ERoVGjiQTz+LISGNzzNPy+i2+f3VANfWdP3kXjHi3dqFuVJhZBFcnAv kV34PmVACxmZySYgWmjBNb9Pp1Hx2BErW+Canig7CjoKH8GB5S7wprlppYiU5msT f9FkPz2ccEblooV7WIQn3MSAPmeamseaMQ4w7OYXQJXZRe0Blqq/DPNL0WP3E1jA uPP6Z92bfW1K/zJMtSU7/xxnD4UiWQWRkUF3gdCFTIcQcf+eQxuulXUtgQIDAQAB o2MwYTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFEDk5PIj7zjKsK5Xf/Ih MBY027ySMB0GA1UdDgQWBBRA5OTyI+84yrCuV3/yITAWNNu8kjAOBgNVHQ8BAf8E BAMCAQYwDQYJKoZIhvcNAQEMBQADggIBACY7UeFNOPMyGLS0XuFlXsSUT9SnYaP4 wM8zAQLpw6o1D/GUE3d3NZ4tVlFEbuHGLige/9rsR82XRBf34EzC4Xx8MnpmyFq2 XFNFV1pF1AWZLy4jVe5jaN/TG3inEpQGAHUNcoTpLrxaatXeL1nHo+zSh2bbt1S1 JKv0Q3jbSwTEb93mPmY+KfJLaHEih6D4sTNjduMNhXJEIlU/HHzp/LgV6FL6qj6j ITk1dImmasI5+njPtqzn59ZW/yOSLlALqbUHM/Q4X6RJpstlcHboCoWASzY9M/eV VHUl2qzEc4Jl6VL1XP04lQJqaTDFHApXB64ipCz5xUG3uOyfT0gA+QEEVcys+TIx xHWVBqB/0Y0n3bOppHKH/lmLmnp0Ft0WpWIp6zqW3IunaFnT63eROfjXy9mPX1on AX1daBli2MjN9LdyR75bl87yraKZk62Uy5P2EgmVtqvXO9A/EcswFi55gORngS1d 7XB4tmBZrOFdRWOPyN9yaFvqHbgB8X7754qz41SgOAngPN5C8sLtLpvzHzW2Ntjj gKGLzZlkD8Kqq7HK9W+eQ42EVJmzbsASZthwEPEGNTNDqJwuuhQxzhB/HIbjj9LV +Hfsm6vxL2PZQl/gZ4FkkfGXL/xuJvYz+NO1+MRiqzFRJQJ6+N1rZdVtTTDIZbpo FGWsJwt0ivKH -----END CERTIFICATE----- # Issuer: CN=TrustAsia Global Root CA G4 O=TrustAsia Technologies, Inc. # Subject: CN=TrustAsia Global Root CA G4 O=TrustAsia Technologies, Inc. # Label: "TrustAsia Global Root CA G4" # Serial: 451799571007117016466790293371524403291602933463 # MD5 Fingerprint: 54:dd:b2:d7:5f:d8:3e:ed:7c:e0:0b:2e:cc:ed:eb:eb # SHA1 Fingerprint: 57:73:a5:61:5d:80:b2:e6:ac:38:82:fc:68:07:31:ac:9f:b5:92:5a # SHA256 Fingerprint: be:4b:56:cb:50:56:c0:13:6a:52:6d:f4:44:50:8d:aa:36:a0:b5:4f:42:e4:ac:38:f7:2a:f4:70:e4:79:65:4c -----BEGIN CERTIFICATE----- MIICVTCCAdygAwIBAgIUTyNkuI6XY57GU4HBdk7LKnQV1tcwCgYIKoZIzj0EAwMw WjELMAkGA1UEBhMCQ04xJTAjBgNVBAoMHFRydXN0QXNpYSBUZWNobm9sb2dpZXMs IEluYy4xJDAiBgNVBAMMG1RydXN0QXNpYSBHbG9iYWwgUm9vdCBDQSBHNDAeFw0y MTA1MjAwMjEwMjJaFw00NjA1MTkwMjEwMjJaMFoxCzAJBgNVBAYTAkNOMSUwIwYD VQQKDBxUcnVzdEFzaWEgVGVjaG5vbG9naWVzLCBJbmMuMSQwIgYDVQQDDBtUcnVz dEFzaWEgR2xvYmFsIFJvb3QgQ0EgRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATx s8045CVD5d4ZCbuBeaIVXxVjAd7Cq92zphtnS4CDr5nLrBfbK5bKfFJV4hrhPVbw LxYI+hW8m7tH5j/uqOFMjPXTNvk4XatwmkcN4oFBButJ+bAp3TPsUKV/eSm4IJij YzBhMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUpbtKl86zK3+kMd6Xg1mD pm9xy94wHQYDVR0OBBYEFKW7SpfOsyt/pDHel4NZg6ZvccveMA4GA1UdDwEB/wQE AwIBBjAKBggqhkjOPQQDAwNnADBkAjBe8usGzEkxn0AAbbd+NvBNEU/zy4k6LHiR UKNbwMp1JvK/kF0LgoxgKJ/GcJpo5PECMFxYDlZ2z1jD1xCMuo6u47xkdUfFVZDj /bpV6wfEU6s3qe4hsiFbYI89MvHVI5TWWA== -----END CERTIFICATE----- # Issuer: CN=Telekom Security TLS ECC Root 2020 O=Deutsche Telekom Security GmbH # Subject: CN=Telekom Security TLS ECC Root 2020 O=Deutsche Telekom Security GmbH # Label: "Telekom Security TLS ECC Root 2020" # Serial: 72082518505882327255703894282316633856 # MD5 Fingerprint: c1:ab:fe:6a:10:2c:03:8d:bc:1c:22:32:c0:85:a7:fd # SHA1 Fingerprint: c0:f8:96:c5:a9:3b:01:06:21:07:da:18:42:48:bc:e9:9d:88:d5:ec # SHA256 Fingerprint: 57:8a:f4:de:d0:85:3f:4e:59:98:db:4a:ea:f9:cb:ea:8d:94:5f:60:b6:20:a3:8d:1a:3c:13:b2:bc:7b:a8:e1 -----BEGIN CERTIFICATE----- MIICQjCCAcmgAwIBAgIQNjqWjMlcsljN0AFdxeVXADAKBggqhkjOPQQDAzBjMQsw CQYDVQQGEwJERTEnMCUGA1UECgweRGV1dHNjaGUgVGVsZWtvbSBTZWN1cml0eSBH bWJIMSswKQYDVQQDDCJUZWxla29tIFNlY3VyaXR5IFRMUyBFQ0MgUm9vdCAyMDIw MB4XDTIwMDgyNTA3NDgyMFoXDTQ1MDgyNTIzNTk1OVowYzELMAkGA1UEBhMCREUx JzAlBgNVBAoMHkRldXRzY2hlIFRlbGVrb20gU2VjdXJpdHkgR21iSDErMCkGA1UE AwwiVGVsZWtvbSBTZWN1cml0eSBUTFMgRUNDIFJvb3QgMjAyMDB2MBAGByqGSM49 AgEGBSuBBAAiA2IABM6//leov9Wq9xCazbzREaK9Z0LMkOsVGJDZos0MKiXrPk/O tdKPD/M12kOLAoC+b1EkHQ9rK8qfwm9QMuU3ILYg/4gND21Ju9sGpIeQkpT0CdDP f8iAC8GXs7s1J8nCG6NCMEAwHQYDVR0OBBYEFONyzG6VmUex5rNhTNHLq+O6zd6f MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMDA2cA MGQCMHVSi7ekEE+uShCLsoRbQuHmKjYC2qBuGT8lv9pZMo7k+5Dck2TOrbRBR2Di z6fLHgIwN0GMZt9Ba9aDAEH9L1r3ULRn0SyocddDypwnJJGDSA3PzfdUga/sf+Rn 27iQ7t0l -----END CERTIFICATE----- # Issuer: CN=Telekom Security TLS RSA Root 2023 O=Deutsche Telekom Security GmbH # Subject: CN=Telekom Security TLS RSA Root 2023 O=Deutsche Telekom Security GmbH # Label: "Telekom Security TLS RSA Root 2023" # Serial: 44676229530606711399881795178081572759 # MD5 Fingerprint: bf:5b:eb:54:40:cd:48:71:c4:20:8d:7d:de:0a:42:f2 # SHA1 Fingerprint: 54:d3:ac:b3:bd:57:56:f6:85:9d:ce:e5:c3:21:e2:d4:ad:83:d0:93 # SHA256 Fingerprint: ef:c6:5c:ad:bb:59:ad:b6:ef:e8:4d:a2:23:11:b3:56:24:b7:1b:3b:1e:a0:da:8b:66:55:17:4e:c8:97:86:46 -----BEGIN CERTIFICATE----- MIIFszCCA5ugAwIBAgIQIZxULej27HF3+k7ow3BXlzANBgkqhkiG9w0BAQwFADBj MQswCQYDVQQGEwJERTEnMCUGA1UECgweRGV1dHNjaGUgVGVsZWtvbSBTZWN1cml0 eSBHbWJIMSswKQYDVQQDDCJUZWxla29tIFNlY3VyaXR5IFRMUyBSU0EgUm9vdCAy MDIzMB4XDTIzMDMyODEyMTY0NVoXDTQ4MDMyNzIzNTk1OVowYzELMAkGA1UEBhMC REUxJzAlBgNVBAoMHkRldXRzY2hlIFRlbGVrb20gU2VjdXJpdHkgR21iSDErMCkG A1UEAwwiVGVsZWtvbSBTZWN1cml0eSBUTFMgUlNBIFJvb3QgMjAyMzCCAiIwDQYJ KoZIhvcNAQEBBQADggIPADCCAgoCggIBAO01oYGA88tKaVvC+1GDrib94W7zgRJ9 cUD/h3VCKSHtgVIs3xLBGYSJwb3FKNXVS2xE1kzbB5ZKVXrKNoIENqil/Cf2SfHV cp6R+SPWcHu79ZvB7JPPGeplfohwoHP89v+1VmLhc2o0mD6CuKyVU/QBoCcHcqMA U6DksquDOFczJZSfvkgdmOGjup5czQRxUX11eKvzWarE4GC+j4NSuHUaQTXtvPM6 Y+mpFEXX5lLRbtLevOP1Czvm4MS9Q2QTps70mDdsipWol8hHD/BeEIvnHRz+sTug BTNoBUGCwQMrAcjnj02r6LX2zWtEtefdi+zqJbQAIldNsLGyMcEWzv/9FIS3R/qy 8XDe24tsNlikfLMR0cN3f1+2JeANxdKz+bi4d9s3cXFH42AYTyS2dTd4uaNir73J co4vzLuu2+QVUhkHM/tqty1LkCiCc/4YizWN26cEar7qwU02OxY2kTLvtkCJkUPg 8qKrBC7m8kwOFjQgrIfBLX7JZkcXFBGk8/ehJImr2BrIoVyxo/eMbcgByU/J7MT8 rFEz0ciD0cmfHdRHNCk+y7AO+oMLKFjlKdw/fKifybYKu6boRhYPluV75Gp6SG12 mAWl3G0eQh5C2hrgUve1g8Aae3g1LDj1H/1Joy7SWWO/gLCMk3PLNaaZlSJhZQNg +y+TS/qanIA7AgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtqeX gj10hZv3PJ+TmpV5dVKMbUcwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS2 p5eCPXSFm/c8n5OalXl1UoxtRzANBgkqhkiG9w0BAQwFAAOCAgEAqMxhpr51nhVQ pGv7qHBFfLp+sVr8WyP6Cnf4mHGCDG3gXkaqk/QeoMPhk9tLrbKmXauw1GLLXrtm 9S3ul0A8Yute1hTWjOKWi0FpkzXmuZlrYrShF2Y0pmtjxrlO8iLpWA1WQdH6DErw M807u20hOq6OcrXDSvvpfeWxm4bu4uB9tPcy/SKE8YXJN3nptT+/XOR0so8RYgDd GGah2XsjX/GO1WfoVNpbOms2b/mBsTNHM3dA+VKq3dSDz4V4mZqTuXNnQkYRIer+ CqkbGmVps4+uFrb2S1ayLfmlyOw7YqPta9BO1UAJpB+Y1zqlklkg5LB9zVtzaL1t xKITDmcZuI1CfmwMmm6gJC3VRRvcxAIU/oVbZZfKTpBQCHpCNfnqwmbU+AGuHrS+ w6jv/naaoqYfRvaE7fzbzsQCzndILIyy7MMAo+wsVRjBfhnu4S/yrYObnqsZ38aK L4x35bcF7DvB7L6Gs4a8wPfc5+pbrrLMtTWGS9DiP7bY+A4A7l3j941Y/8+LN+lj X273CXE2whJdV/LItM3z7gLfEdxquVeEHVlNjM7IDiPCtyaaEBRx/pOyiriA8A4Q ntOoUAw3gi/q4Iqd4Sw5/7W0cwDk90imc6y/st53BIe0o82bNSQ3+pCTE4FCxpgm dTdmQRCsu/WU48IxK63nI1bMNSWSs1A= -----END CERTIFICATE----- # Issuer: CN=FIRMAPROFESIONAL CA ROOT-A WEB O=Firmaprofesional SA # Subject: CN=FIRMAPROFESIONAL CA ROOT-A WEB O=Firmaprofesional SA # Label: "FIRMAPROFESIONAL CA ROOT-A WEB" # Serial: 65916896770016886708751106294915943533 # MD5 Fingerprint: 82:b2:ad:45:00:82:b0:66:63:f8:5f:c3:67:4e:ce:a3 # SHA1 Fingerprint: a8:31:11:74:a6:14:15:0d:ca:77:dd:0e:e4:0c:5d:58:fc:a0:72:a5 # SHA256 Fingerprint: be:f2:56:da:f2:6e:9c:69:bd:ec:16:02:35:97:98:f3:ca:f7:18:21:a0:3e:01:82:57:c5:3c:65:61:7f:3d:4a -----BEGIN CERTIFICATE----- MIICejCCAgCgAwIBAgIQMZch7a+JQn81QYehZ1ZMbTAKBggqhkjOPQQDAzBuMQsw CQYDVQQGEwJFUzEcMBoGA1UECgwTRmlybWFwcm9mZXNpb25hbCBTQTEYMBYGA1UE YQwPVkFURVMtQTYyNjM0MDY4MScwJQYDVQQDDB5GSVJNQVBST0ZFU0lPTkFMIENB IFJPT1QtQSBXRUIwHhcNMjIwNDA2MDkwMTM2WhcNNDcwMzMxMDkwMTM2WjBuMQsw CQYDVQQGEwJFUzEcMBoGA1UECgwTRmlybWFwcm9mZXNpb25hbCBTQTEYMBYGA1UE YQwPVkFURVMtQTYyNjM0MDY4MScwJQYDVQQDDB5GSVJNQVBST0ZFU0lPTkFMIENB IFJPT1QtQSBXRUIwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARHU+osEaR3xyrq89Zf e9MEkVz6iMYiuYMQYneEMy3pA4jU4DP37XcsSmDq5G+tbbT4TIqk5B/K6k84Si6C cyvHZpsKjECcfIr28jlgst7L7Ljkb+qbXbdTkBgyVcUgt5SjYzBhMA8GA1UdEwEB /wQFMAMBAf8wHwYDVR0jBBgwFoAUk+FDY1w8ndYn81LsF7Kpryz3dvgwHQYDVR0O BBYEFJPhQ2NcPJ3WJ/NS7Beyqa8s93b4MA4GA1UdDwEB/wQEAwIBBjAKBggqhkjO PQQDAwNoADBlAjAdfKR7w4l1M+E7qUW/Runpod3JIha3RxEL2Jq68cgLcFBTApFw hVmpHqTm6iMxoAACMQD94vizrxa5HnPEluPBMBnYfubDl94cT7iJLzPrSA8Z94dG XSaQpYXFuXqUPoeovQA= -----END CERTIFICATE----- # Issuer: CN=TWCA CYBER Root CA O=TAIWAN-CA OU=Root CA # Subject: CN=TWCA CYBER Root CA O=TAIWAN-CA OU=Root CA # Label: "TWCA CYBER Root CA" # Serial: 85076849864375384482682434040119489222 # MD5 Fingerprint: 0b:33:a0:97:52:95:d4:a9:fd:bb:db:6e:a3:55:5b:51 # SHA1 Fingerprint: f6:b1:1c:1a:83:38:e9:7b:db:b3:a8:c8:33:24:e0:2d:9c:7f:26:66 # SHA256 Fingerprint: 3f:63:bb:28:14:be:17:4e:c8:b6:43:9c:f0:8d:6d:56:f0:b7:c4:05:88:3a:56:48:a3:34:42:4d:6b:3e:c5:58 -----BEGIN CERTIFICATE----- MIIFjTCCA3WgAwIBAgIQQAE0jMIAAAAAAAAAATzyxjANBgkqhkiG9w0BAQwFADBQ MQswCQYDVQQGEwJUVzESMBAGA1UEChMJVEFJV0FOLUNBMRAwDgYDVQQLEwdSb290 IENBMRswGQYDVQQDExJUV0NBIENZQkVSIFJvb3QgQ0EwHhcNMjIxMTIyMDY1NDI5 WhcNNDcxMTIyMTU1OTU5WjBQMQswCQYDVQQGEwJUVzESMBAGA1UEChMJVEFJV0FO LUNBMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJUV0NBIENZQkVSIFJvb3Qg Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDG+Moe2Qkgfh1sTs6P 40czRJzHyWmqOlt47nDSkvgEs1JSHWdyKKHfi12VCv7qze33Kc7wb3+szT3vsxxF avcokPFhV8UMxKNQXd7UtcsZyoC5dc4pztKFIuwCY8xEMCDa6pFbVuYdHNWdZsc/ 34bKS1PE2Y2yHer43CdTo0fhYcx9tbD47nORxc5zb87uEB8aBs/pJ2DFTxnk684i JkXXYJndzk834H/nY62wuFm40AZoNWDTNq5xQwTxaWV4fPMf88oon1oglWa0zbfu j3ikRRjpJi+NmykosaS3Om251Bw4ckVYsV7r8Cibt4LK/c/WMw+f+5eesRycnupf Xtuq3VTpMCEobY5583WSjCb+3MX2w7DfRFlDo7YDKPYIMKoNM+HvnKkHIuNZW0CP 2oi3aQiotyMuRAlZN1vH4xfyIutuOVLF3lSnmMlLIJXcRolftBL5hSmO68gnFSDA S9TMfAxsNAwmmyYxpjyn9tnQS6Jk/zuZQXLB4HCX8SS7K8R0IrGsayIyJNN4KsDA oS/xUgXJP+92ZuJF2A09rZXIx4kmyA+upwMu+8Ff+iDhcK2wZSA3M2Cw1a/XDBzC kHDXShi8fgGwsOsVHkQGzaRP6AzRwyAQ4VRlnrZR0Bp2a0JaWHY06rc3Ga4udfmW 5cFZ95RXKSWNOkyrTZpB0F8mAwIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYD VR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBSdhWEUfMFib5do5E83QOGt4A1WNzAd BgNVHQ4EFgQUnYVhFHzBYm+XaORPN0DhreANVjcwDQYJKoZIhvcNAQEMBQADggIB AGSPesRiDrWIzLjHhg6hShbNcAu3p4ULs3a2D6f/CIsLJc+o1IN1KriWiLb73y0t tGlTITVX1olNc79pj3CjYcya2x6a4CD4bLubIp1dhDGaLIrdaqHXKGnK/nZVekZn 68xDiBaiA9a5F/gZbG0jAn/xX9AKKSM70aoK7akXJlQKTcKlTfjF/biBzysseKNn TKkHmvPfXvt89YnNdJdhEGoHK4Fa0o635yDRIG4kqIQnoVesqlVYL9zZyvpoBJ7t RCT5dEA7IzOrg1oYJkK2bVS1FmAwbLGg+LhBoF1JSdJlBTrq/p1hvIbZv97Tujqx f36SNI7JAG7cmL3c7IAFrQI932XtCwP39xaEBDG6k5TY8hL4iuO/Qq+n1M0RFxbI Qh0UqEL20kCGoE8jypZFVmAGzbdVAaYBlGX+bgUJurSkquLvWL69J1bY73NxW0Qz 8ppy6rBePm6pUlvscG21h483XjyMnM7k8M4MZ0HMzvaAq07MTFb1wWFZk7Q+ptq4 NxKfKjLji7gh7MMrZQzvIt6IKTtM1/r+t+FHvpw+PoP7UV31aPcuIYXcv/Fa4nzX xeSDwWrruoBa3lwtcHb4yOWHh8qgnaHlIhInD0Q9HWzq1MKLL295q39QpsQZp6F6 t5b5wR9iWqJDB0BeJsas7a5wFsWqynKKTbDPAYsDP27X -----END CERTIFICATE----- # Issuer: CN=SecureSign Root CA12 O=Cybertrust Japan Co., Ltd. # Subject: CN=SecureSign Root CA12 O=Cybertrust Japan Co., Ltd. # Label: "SecureSign Root CA12" # Serial: 587887345431707215246142177076162061960426065942 # MD5 Fingerprint: c6:89:ca:64:42:9b:62:08:49:0b:1e:7f:e9:07:3d:e8 # SHA1 Fingerprint: 7a:22:1e:3d:de:1b:06:ac:9e:c8:47:70:16:8e:3c:e5:f7:6b:06:f4 # SHA256 Fingerprint: 3f:03:4b:b5:70:4d:44:b2:d0:85:45:a0:20:57:de:93:eb:f3:90:5f:ce:72:1a:cb:c7:30:c0:6d:da:ee:90:4e -----BEGIN CERTIFICATE----- MIIDcjCCAlqgAwIBAgIUZvnHwa/swlG07VOX5uaCwysckBYwDQYJKoZIhvcNAQEL BQAwUTELMAkGA1UEBhMCSlAxIzAhBgNVBAoTGkN5YmVydHJ1c3QgSmFwYW4gQ28u LCBMdGQuMR0wGwYDVQQDExRTZWN1cmVTaWduIFJvb3QgQ0ExMjAeFw0yMDA0MDgw NTM2NDZaFw00MDA0MDgwNTM2NDZaMFExCzAJBgNVBAYTAkpQMSMwIQYDVQQKExpD eWJlcnRydXN0IEphcGFuIENvLiwgTHRkLjEdMBsGA1UEAxMUU2VjdXJlU2lnbiBS b290IENBMTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6OcE3emhF KxS06+QT61d1I02PJC0W6K6OyX2kVzsqdiUzg2zqMoqUm048luT9Ub+ZyZN+v/mt p7JIKwccJ/VMvHASd6SFVLX9kHrko+RRWAPNEHl57muTH2SOa2SroxPjcf59q5zd J1M3s6oYwlkm7Fsf0uZlfO+TvdhYXAvA42VvPMfKWeP+bl+sg779XSVOKik71gur FzJ4pOE+lEa+Ym6b3kaosRbnhW70CEBFEaCeVESE99g2zvVQR9wsMJvuwPWW0v4J hscGWa5Pro4RmHvzC1KqYiaqId+OJTN5lxZJjfU+1UefNzFJM3IFTQy2VYzxV4+K h9GtxRESOaCtAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD AgEGMB0GA1UdDgQWBBRXNPN0zwRL1SXm8UC2LEzZLemgrTANBgkqhkiG9w0BAQsF AAOCAQEAPrvbFxbS8hQBICw4g0utvsqFepq2m2um4fylOqyttCg6r9cBg0krY6Ld mmQOmFxv3Y67ilQiLUoT865AQ9tPkbeGGuwAtEGBpE/6aouIs3YIcipJQMPTw4WJ mBClnW8Zt7vPemVV2zfrPIpyMpcemik+rY3moxtt9XUa5rBouVui7mlHJzWhhpmA 8zNL4WukJsPvdFlseqJkth5Ew1DgDzk9qTPxpfPSvWKErI4cqc1avTc7bgoitPQV 55FYxTpE05Uo2cBl6XLK0A+9H7MV2anjpEcJnuDLN/v9vZfVvhgaaaI5gdka9at/ yOPiZwud9AzqVN/Ssq+xIvEg37xEHA== -----END CERTIFICATE----- # Issuer: CN=SecureSign Root CA14 O=Cybertrust Japan Co., Ltd. # Subject: CN=SecureSign Root CA14 O=Cybertrust Japan Co., Ltd. # Label: "SecureSign Root CA14" # Serial: 575790784512929437950770173562378038616896959179 # MD5 Fingerprint: 71:0d:72:fa:92:19:65:5e:89:04:ac:16:33:f0:bc:d5 # SHA1 Fingerprint: dd:50:c0:f7:79:b3:64:2e:74:a2:b8:9d:9f:d3:40:dd:bb:f0:f2:4f # SHA256 Fingerprint: 4b:00:9c:10:34:49:4f:9a:b5:6b:ba:3b:a1:d6:27:31:fc:4d:20:d8:95:5a:dc:ec:10:a9:25:60:72:61:e3:38 -----BEGIN CERTIFICATE----- MIIFcjCCA1qgAwIBAgIUZNtaDCBO6Ncpd8hQJ6JaJ90t8sswDQYJKoZIhvcNAQEM BQAwUTELMAkGA1UEBhMCSlAxIzAhBgNVBAoTGkN5YmVydHJ1c3QgSmFwYW4gQ28u LCBMdGQuMR0wGwYDVQQDExRTZWN1cmVTaWduIFJvb3QgQ0ExNDAeFw0yMDA0MDgw NzA2MTlaFw00NTA0MDgwNzA2MTlaMFExCzAJBgNVBAYTAkpQMSMwIQYDVQQKExpD eWJlcnRydXN0IEphcGFuIENvLiwgTHRkLjEdMBsGA1UEAxMUU2VjdXJlU2lnbiBS b290IENBMTQwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDF0nqh1oq/ FjHQmNE6lPxauG4iwWL3pwon71D2LrGeaBLwbCRjOfHw3xDG3rdSINVSW0KZnvOg vlIfX8xnbacuUKLBl422+JX1sLrcneC+y9/3OPJH9aaakpUqYllQC6KxNedlsmGy 6pJxaeQp8E+BgQQ8sqVb1MWoWWd7VRxJq3qdwudzTe/NCcLEVxLbAQ4jeQkHO6Lo /IrPj8BGJJw4J+CDnRugv3gVEOuGTgpa/d/aLIJ+7sr2KeH6caH3iGicnPCNvg9J kdjqOvn90Ghx2+m1K06Ckm9mH+Dw3EzsytHqunQG+bOEkJTRX45zGRBdAuVwpcAQ 0BB8b8VYSbSwbprafZX1zNoCr7gsfXmPvkPx+SgojQlD+Ajda8iLLCSxjVIHvXib y8posqTdDEx5YMaZ0ZPxMBoH064iwurO8YQJzOAUbn8/ftKChazcqRZOhaBgy/ac 18izju3Gm5h1DVXoX+WViwKkrkMpKBGk5hIwAUt1ax5mnXkvpXYvHUC0bcl9eQjs 0Wq2XSqypWa9a4X0dFbD9ed1Uigspf9mR6XU/v6eVL9lfgHWMI+lNpyiUBzuOIAB SMbHdPTGrMNASRZhdCyvjG817XsYAFs2PJxQDcqSMxDxJklt33UkN4Ii1+iW/RVL ApY+B3KVfqs9TC7XyvDf4Fg/LS8EmjijAQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUBpOjCl4oaTeqYR3r6/wtbyPk 86AwDQYJKoZIhvcNAQEMBQADggIBAJaAcgkGfpzMkwQWu6A6jZJOtxEaCnFxEM0E rX+lRVAQZk5KQaID2RFPeje5S+LGjzJmdSX7684/AykmjbgWHfYfM25I5uj4V7Ib ed87hwriZLoAymzvftAj63iP/2SbNDefNWWipAA9EiOWWF3KY4fGoweITedpdopT zfFP7ELyk+OZpDc8h7hi2/DsHzc/N19DzFGdtfCXwreFamgLRB7lUe6TzktuhsHS DCRZNhqfLJGP4xjblJUK7ZGqDpncllPjYYPGFrojutzdfhrGe0K22VoF3Jpf1d+4 2kd92jjbrDnVHmtsKheMYc2xbXIBw8MgAGJoFjHVdqqGuw6qnsb58Nn4DSEC5MUo FlkRudlpcyqSeLiSV5sI8jrlL5WwWLdrIBRtFO8KvH7YVdiI2i/6GaX7i+B/OfVy K4XELKzvGUWSTLNhB9xNH27SgRNcmvMSZ4PPmz+Ln52kuaiWA3rF7iDeM9ovnhp6 dB7h7sxaOgTdsxoEqBRjrLdHEoOabPXm6RUVkRqEGQ6UROcSjiVbgGcZ3GOTEAtl Lor6CZpO2oYofaphNdgOpygau1LgePhsumywbrmHXumZNTfxPWQrqaA0k89jL9WB 365jJ6UeTo3cKXhZ+PmhIIynJkBugnLNeLLIjzwec+fBH7/PzqUqm9tEZDKgu39c JRNItX+S -----END CERTIFICATE----- # Issuer: CN=SecureSign Root CA15 O=Cybertrust Japan Co., Ltd. # Subject: CN=SecureSign Root CA15 O=Cybertrust Japan Co., Ltd. # Label: "SecureSign Root CA15" # Serial: 126083514594751269499665114766174399806381178503 # MD5 Fingerprint: 13:30:fc:c4:62:a6:a9:de:b5:c1:68:af:b5:d2:31:47 # SHA1 Fingerprint: cb:ba:83:c8:c1:5a:5d:f1:f9:73:6f:ca:d7:ef:28:13:06:4a:07:7d # SHA256 Fingerprint: e7:78:f0:f0:95:fe:84:37:29:cd:1a:00:82:17:9e:53:14:a9:c2:91:44:28:05:e1:fb:1d:8f:b6:b8:88:6c:3a -----BEGIN CERTIFICATE----- MIICIzCCAamgAwIBAgIUFhXHw9hJp75pDIqI7fBw+d23PocwCgYIKoZIzj0EAwMw UTELMAkGA1UEBhMCSlAxIzAhBgNVBAoTGkN5YmVydHJ1c3QgSmFwYW4gQ28uLCBM dGQuMR0wGwYDVQQDExRTZWN1cmVTaWduIFJvb3QgQ0ExNTAeFw0yMDA0MDgwODMy NTZaFw00NTA0MDgwODMyNTZaMFExCzAJBgNVBAYTAkpQMSMwIQYDVQQKExpDeWJl cnRydXN0IEphcGFuIENvLiwgTHRkLjEdMBsGA1UEAxMUU2VjdXJlU2lnbiBSb290 IENBMTUwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQLUHSNZDKZmbPSYAi4Io5GdCx4 wCtELW1fHcmuS1Iggz24FG1Th2CeX2yF2wYUleDHKP+dX+Sq8bOLbe1PL0vJSpSR ZHX+AezB2Ot6lHhWGENfa4HL9rzatAy2KZMIaY+jQjBAMA8GA1UdEwEB/wQFMAMB Af8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTrQciu/NWeUUj1vYv0hyCTQSvT 9DAKBggqhkjOPQQDAwNoADBlAjEA2S6Jfl5OpBEHvVnCB96rMjhTKkZEBhd6zlHp 4P9mLQlO4E/0BdGF9jVg3PVys0Z9AjBEmEYagoUeYWmJSwdLZrWeqrqgHkHZAXQ6 bkU6iYAZezKYVWOr62Nuk22rGwlgMU4= -----END CERTIFICATE----- # Issuer: CN=D-TRUST BR Root CA 2 2023 O=D-Trust GmbH # Subject: CN=D-TRUST BR Root CA 2 2023 O=D-Trust GmbH # Label: "D-TRUST BR Root CA 2 2023" # Serial: 153168538924886464690566649552453098598 # MD5 Fingerprint: e1:09:ed:d3:60:d4:56:1b:47:1f:b7:0c:5f:1b:5f:85 # SHA1 Fingerprint: 2d:b0:70:ee:71:94:af:69:68:17:db:79:ce:58:9f:a0:6b:96:f7:87 # SHA256 Fingerprint: 05:52:e6:f8:3f:df:65:e8:fa:96:70:e6:66:df:28:a4:e2:13:40:b5:10:cb:e5:25:66:f9:7c:4f:b9:4b:2b:d1 -----BEGIN CERTIFICATE----- MIIFqTCCA5GgAwIBAgIQczswBEhb2U14LnNLyaHcZjANBgkqhkiG9w0BAQ0FADBI MQswCQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlE LVRSVVNUIEJSIFJvb3QgQ0EgMiAyMDIzMB4XDTIzMDUwOTA4NTYzMVoXDTM4MDUw OTA4NTYzMFowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEi MCAGA1UEAxMZRC1UUlVTVCBCUiBSb290IENBIDIgMjAyMzCCAiIwDQYJKoZIhvcN AQEBBQADggIPADCCAgoCggIBAK7/CVmRgApKaOYkP7in5Mg6CjoWzckjYaCTcfKr i3OPoGdlYNJUa2NRb0kz4HIHE304zQaSBylSa053bATTlfrdTIzZXcFhfUvnKLNE gXtRr90zsWh81k5M/itoucpmacTsXld/9w3HnDY25QdgrMBM6ghs7wZ8T1soegj8 k12b9py0i4a6Ibn08OhZWiihNIQaJZG2tY/vsvmA+vk9PBFy2OMvhnbFeSzBqZCT Rphny4NqoFAjpzv2gTng7fC5v2Xx2Mt6++9zA84A9H3X4F07ZrjcjrqDy4d2A/wl 2ecjbwb9Z/Pg/4S8R7+1FhhGaRTMBffb00msa8yr5LULQyReS2tNZ9/WtT5PeB+U cSTq3nD88ZP+npNa5JRal1QMNXtfbO4AHyTsA7oC9Xb0n9Sa7YUsOCIvx9gvdhFP /Wxc6PWOJ4d/GUohR5AdeY0cW/jPSoXk7bNbjb7EZChdQcRurDhaTyN0dKkSw/bS uREVMweR2Ds3OmMwBtHFIjYoYiMQ4EbMl6zWK11kJNXuHA7e+whadSr2Y23OC0K+ 0bpwHJwh5Q8xaRfX/Aq03u2AnMuStIv13lmiWAmlY0cL4UEyNEHZmrHZqLAbWt4N DfTisl01gLmB1IRpkQLLddCNxbU9CZEJjxShFHR5PtbJFR2kWVki3PaKRT08EtY+ XTIvAgMBAAGjgY4wgYswDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUZ5Dw1t61 GNVGKX5cq/ieCLxklRAwDgYDVR0PAQH/BAQDAgEGMEkGA1UdHwRCMEAwPqA8oDqG OGh0dHA6Ly9jcmwuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3RfYnJfcm9vdF9jYV8y XzIwMjMuY3JsMA0GCSqGSIb3DQEBDQUAA4ICAQA097N3U9swFrktpSHxQCF16+tI FoE9c+CeJyrrd6kTpGoKWloUMz1oH4Guaf2Mn2VsNELZLdB/eBaxOqwjMa1ef67n riv6uvw8l5VAk1/DLQOj7aRvU9f6QA4w9QAgLABMjDu0ox+2v5Eyq6+SmNMW5tTR VFxDWy6u71cqqLRvpO8NVhTaIasgdp4D/Ca4nj8+AybmTNudX0KEPUUDAxxZiMrc LmEkWqTqJwtzEr5SswrPMhfiHocaFpVIbVrg0M8JkiZmkdijYQ6qgYF/6FKC0ULn 4B0Y+qSFNueG4A3rvNTJ1jxD8V1Jbn6Bm2m1iWKPiFLY1/4nwSPFyysCu7Ff/vtD hQNGvl3GyiEm/9cCnnRK3PgTFbGBVzbLZVzRHTF36SXDw7IyN9XxmAnkbWOACKsG koHU6XCPpz+y7YaMgmo1yEJagtFSGkUPFaUA8JR7ZSdXOUPPfH/mvTWze/EZTN46 ls/pdu4D58JDUjxqgejBWoC9EV2Ta/vH5mQ/u2kc6d0li690yVRAysuTEwrt+2aS Ecr1wPrYg1UDfNPFIkZ1cGt5SAYqgpq/5usWDiJFAbzdNpQ0qTUmiteXue4Icr80 knCDgKs4qllo3UCkGJCy89UDyibK79XH4I9TjvAA46jtn/mtd+ArY0+ew+43u3gJ hJ65bvspmZDogNOfJA== -----END CERTIFICATE----- # Issuer: CN=TrustAsia TLS ECC Root CA O=TrustAsia Technologies, Inc. # Subject: CN=TrustAsia TLS ECC Root CA O=TrustAsia Technologies, Inc. # Label: "TrustAsia TLS ECC Root CA" # Serial: 310892014698942880364840003424242768478804666567 # MD5 Fingerprint: 09:48:04:77:d2:fc:65:93:71:66:b1:11:95:4f:06:8c # SHA1 Fingerprint: b5:ec:39:f3:a1:66:37:ae:c3:05:94:57:e2:be:11:be:b7:a1:7f:36 # SHA256 Fingerprint: c0:07:6b:9e:f0:53:1f:b1:a6:56:d6:7c:4e:be:97:cd:5d:ba:a4:1e:f4:45:98:ac:c2:48:98:78:c9:2d:87:11 -----BEGIN CERTIFICATE----- MIICMTCCAbegAwIBAgIUNnThTXxlE8msg1UloD5Sfi9QaMcwCgYIKoZIzj0EAwMw WDELMAkGA1UEBhMCQ04xJTAjBgNVBAoTHFRydXN0QXNpYSBUZWNobm9sb2dpZXMs IEluYy4xIjAgBgNVBAMTGVRydXN0QXNpYSBUTFMgRUNDIFJvb3QgQ0EwHhcNMjQw NTE1MDU0MTU2WhcNNDQwNTE1MDU0MTU1WjBYMQswCQYDVQQGEwJDTjElMCMGA1UE ChMcVHJ1c3RBc2lhIFRlY2hub2xvZ2llcywgSW5jLjEiMCAGA1UEAxMZVHJ1c3RB c2lhIFRMUyBFQ0MgUm9vdCBDQTB2MBAGByqGSM49AgEGBSuBBAAiA2IABLh/pVs/ AT598IhtrimY4ZtcU5nb9wj/1WrgjstEpvDBjL1P1M7UiFPoXlfXTr4sP/MSpwDp guMqWzJ8S5sUKZ74LYO1644xST0mYekdcouJtgq7nDM1D9rs3qlKH8kzsaNCMEAw DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQULIVTu7FDzTLqnqOH/qKYqKaT6RAw DgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMDA2gAMGUCMFRH18MtYYZI9HlaVQ01 L18N9mdsd0AaRuf4aFtOJx24mH1/k78ITcTaRTChD15KeAIxAKORh/IRM4PDwYqR OkwrULG9IpRdNYlzg8WbGf60oenUoWa2AaU2+dhoYSi3dOGiMQ== -----END CERTIFICATE----- # Issuer: CN=TrustAsia TLS RSA Root CA O=TrustAsia Technologies, Inc. # Subject: CN=TrustAsia TLS RSA Root CA O=TrustAsia Technologies, Inc. # Label: "TrustAsia TLS RSA Root CA" # Serial: 160405846464868906657516898462547310235378010780 # MD5 Fingerprint: 3b:9e:c3:86:0f:34:3c:6b:c5:46:c4:8e:1d:e7:19:12 # SHA1 Fingerprint: a5:46:50:c5:62:ea:95:9a:1a:a7:04:6f:17:58:c7:29:53:3d:03:fa # SHA256 Fingerprint: 06:c0:8d:7d:af:d8:76:97:1e:b1:12:4f:e6:7f:84:7e:c0:c7:a1:58:d3:ea:53:cb:e9:40:e2:ea:97:91:f4:c3 -----BEGIN CERTIFICATE----- MIIFgDCCA2igAwIBAgIUHBjYz+VTPyI1RlNUJDxsR9FcSpwwDQYJKoZIhvcNAQEM BQAwWDELMAkGA1UEBhMCQ04xJTAjBgNVBAoTHFRydXN0QXNpYSBUZWNobm9sb2dp ZXMsIEluYy4xIjAgBgNVBAMTGVRydXN0QXNpYSBUTFMgUlNBIFJvb3QgQ0EwHhcN MjQwNTE1MDU0MTU3WhcNNDQwNTE1MDU0MTU2WjBYMQswCQYDVQQGEwJDTjElMCMG A1UEChMcVHJ1c3RBc2lhIFRlY2hub2xvZ2llcywgSW5jLjEiMCAGA1UEAxMZVHJ1 c3RBc2lhIFRMUyBSU0EgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCC AgoCggIBAMMWuBtqpERz5dZO9LnPWwvB0ZqB9WOwj0PBuwhaGnrhB3YmH49pVr7+ NmDQDIPNlOrnxS1cLwUWAp4KqC/lYCZUlviYQB2srp10Zy9U+5RjmOMmSoPGlbYJ Q1DNDX3eRA5gEk9bNb2/mThtfWza4mhzH/kxpRkQcwUqwzIZheo0qt1CHjCNP561 HmHVb70AcnKtEj+qpklz8oYVlQwQX1Fkzv93uMltrOXVmPGZLmzjyUT5tUMnCE32 ft5EebuyjBza00tsLtbDeLdM1aTk2tyKjg7/D8OmYCYozza/+lcK7Fs/6TAWe8Tb xNRkoDD75f0dcZLdKY9BWN4ArTr9PXwaqLEX8E40eFgl1oUh63kd0Nyrz2I8sMeX i9bQn9P+PN7F4/w6g3CEIR0JwqH8uyghZVNgepBtljhb//HXeltt08lwSUq6HTrQ UNoyIBnkiz/r1RYmNzz7dZ6wB3C4FGB33PYPXFIKvF1tjVEK2sUYyJtt3LCDs3+j TnhMmCWr8n4uIF6CFabW2I+s5c0yhsj55NqJ4js+k8UTav/H9xj8Z7XvGCxUq0DT bE3txci3OE9kxJRMT6DNrqXGJyV1J23G2pyOsAWZ1SgRxSHUuPzHlqtKZFlhaxP8 S8ySpg+kUb8OWJDZgoM5pl+z+m6Ss80zDoWo8SnTq1mt1tve1CuBAgMBAAGjQjBA MA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFLgHkXlcBvRG/XtZylomkadFK/hT MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQwFAAOCAgEAIZtqBSBdGBanEqT3 Rz/NyjuujsCCztxIJXgXbODgcMTWltnZ9r96nBO7U5WS/8+S4PPFJzVXqDuiGev4 iqME3mmL5Dw8veWv0BIb5Ylrc5tvJQJLkIKvQMKtuppgJFqBTQUYo+IzeXoLH5Pt 7DlK9RME7I10nYEKqG/odv6LTytpEoYKNDbdgptvT+Bz3Ul/KD7JO6NXBNiT2Twp 2xIQaOHEibgGIOcberyxk2GaGUARtWqFVwHxtlotJnMnlvm5P1vQiJ3koP26TpUJ g3933FEFlJ0gcXax7PqJtZwuhfG5WyRasQmr2soaB82G39tp27RIGAAtvKLEiUUj pQ7hRGU+isFqMB3iYPg6qocJQrmBktwliJiJ8Xw18WLK7nn4GS/+X/jbh87qqA8M pugLoDzga5SYnH+tBuYc6kIQX+ImFTw3OffXvO645e8D7r0i+yiGNFjEWn9hongP XvPKnbwbPKfILfanIhHKA9jnZwqKDss1jjQ52MjqjZ9k4DewbNfFj8GQYSbbJIwe SsCI3zWQzj8C9GRh3sfIB5XeMhg6j6JCQCTl1jNdfK7vsU1P1FeQNWrcrgSXSYk0 ly4wBOeY99sLAZDBHwo/+ML+TvrbmnNzFrwFuHnYWa8G5z9nODmxfKuU4CkUpijy 323imttUQ/hHWKNddBWcwauwxzQ= -----END CERTIFICATE----- # Issuer: CN=D-TRUST EV Root CA 2 2023 O=D-Trust GmbH # Subject: CN=D-TRUST EV Root CA 2 2023 O=D-Trust GmbH # Label: "D-TRUST EV Root CA 2 2023" # Serial: 139766439402180512324132425437959641711 # MD5 Fingerprint: 96:b4:78:09:f0:09:cb:77:eb:bb:1b:4d:6f:36:bc:b6 # SHA1 Fingerprint: a5:5b:d8:47:6c:8f:19:f7:4c:f4:6d:6b:b6:c2:79:82:22:df:54:8b # SHA256 Fingerprint: 8e:82:21:b2:e7:d4:00:78:36:a1:67:2f:0d:cc:29:9c:33:bc:07:d3:16:f1:32:fa:1a:20:6d:58:71:50:f1:ce -----BEGIN CERTIFICATE----- MIIFqTCCA5GgAwIBAgIQaSYJfoBLTKCnjHhiU19abzANBgkqhkiG9w0BAQ0FADBI MQswCQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlE LVRSVVNUIEVWIFJvb3QgQ0EgMiAyMDIzMB4XDTIzMDUwOTA5MTAzM1oXDTM4MDUw OTA5MTAzMlowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEi MCAGA1UEAxMZRC1UUlVTVCBFViBSb290IENBIDIgMjAyMzCCAiIwDQYJKoZIhvcN AQEBBQADggIPADCCAgoCggIBANiOo4mAC7JXUtypU0w3uX9jFxPvp1sjW2l1sJkK F8GLxNuo4MwxusLyzV3pt/gdr2rElYfXR8mV2IIEUD2BCP/kPbOx1sWy/YgJ25yE 7CUXFId/MHibaljJtnMoPDT3mfd/06b4HEV8rSyMlD/YZxBTfiLNTiVR8CUkNRFe EMbsh2aJgWi6zCudR3Mfvc2RpHJqnKIbGKBv7FD0fUDCqDDPvXPIEysQEx6Lmqg6 lHPTGGkKSv/BAQP/eX+1SH977ugpbzZMlWGG2Pmic4ruri+W7mjNPU0oQvlFKzIb RlUWaqZLKfm7lVa/Rh3sHZMdwGWyH6FDrlaeoLGPaxK3YG14C8qKXO0elg6DpkiV jTujIcSuWMYAsoS0I6SWhjW42J7YrDRJmGOVxcttSEfi8i4YHtAxq9107PncjLgc jmgjutDzUNzPZY9zOjLHfP7KgiJPvo5iR2blzYfi6NUPGJ/lBHJLRjwQ8kTCZFZx TnXonMkmdMV9WdEKWw9t/p51HBjGGjp82A0EzM23RWV6sY+4roRIPrN6TagD4uJ+ ARZZaBhDM7DS3LAaQzXupdqpRlyuhoFBAUp0JuyfBr/CBTdkdXgpaP3F9ev+R/nk hbDhezGdpn9yo7nELC7MmVcOIQxFAZRl62UJxmMiCzNJkkg8/M3OsD6Onov4/knF NXJHAgMBAAGjgY4wgYswDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUqvyREBuH kV8Wub9PS5FeAByxMoAwDgYDVR0PAQH/BAQDAgEGMEkGA1UdHwRCMEAwPqA8oDqG OGh0dHA6Ly9jcmwuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3RfZXZfcm9vdF9jYV8y XzIwMjMuY3JsMA0GCSqGSIb3DQEBDQUAA4ICAQCTy6UfmRHsmg1fLBWTxj++EI14 QvBukEdHjqOSMo1wj/Zbjb6JzkcBahsgIIlbyIIQbODnmaprxiqgYzWRaoUlrRc4 pZt+UPJ26oUFKidBK7GB0aL2QHWpDsvxVUjY7NHss+jOFKE17MJeNRqrphYBBo7q 3C+jisosketSjl8MmxfPy3MHGcRqwnNU73xDUmPBEcrCRbH0O1P1aa4846XerOhU t7KR/aypH/KH5BfGSah82ApB9PI+53c0BFLd6IHyTS9URZ0V4U/M5d40VxDJI3IX cI1QcB9WbMy5/zpaT2N6w25lBx2Eof+pDGOJbbJAiDnXH3dotfyc1dZnaVuodNv8 ifYbMvekJKZ2t0dT741Jj6m2g1qllpBFYfXeA08mD6iL8AOWsKwV0HFaanuU5nCT 2vFp4LJiTZ6P/4mdm13NRemUAiKN4DV/6PEEeXFsVIP4M7kFMhtYVRFP0OUnR3Hs 7dpn1mKmS00PaaLJvOwiS5THaJQXfuKOKD62xur1NGyfN4gHONuGcfrNlUhDbqNP gofXNJhuS5N5YHVpD/Aa1VP6IQzCP+k/HxiMkl14p3ZnGbuy6n/pcAlWVqOwDAst Nl7F6cTVg8uGF5csbBNvh1qvSaYd2804BC5f4ko1Di1L+KIkBI3Y4WNeApI02phh XBxvWHZks/wCuPWdCg== -----END CERTIFICATE----- # Issuer: CN=SwissSign RSA TLS Root CA 2022 - 1 O=SwissSign AG # Subject: CN=SwissSign RSA TLS Root CA 2022 - 1 O=SwissSign AG # Label: "SwissSign RSA TLS Root CA 2022 - 1" # Serial: 388078645722908516278762308316089881486363258315 # MD5 Fingerprint: 16:2e:e4:19:76:81:85:ba:8e:91:58:f1:15:ef:72:39 # SHA1 Fingerprint: 81:34:0a:be:4c:cd:ce:cc:e7:7d:cc:8a:d4:57:e2:45:a0:77:5d:ce # SHA256 Fingerprint: 19:31:44:f4:31:e0:fd:db:74:07:17:d4:de:92:6a:57:11:33:88:4b:43:60:d3:0e:27:29:13:cb:e6:60:ce:41 -----BEGIN CERTIFICATE----- MIIFkzCCA3ugAwIBAgIUQ/oMX04bgBhE79G0TzUfRPSA7cswDQYJKoZIhvcNAQEL BQAwUTELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzErMCkGA1UE AxMiU3dpc3NTaWduIFJTQSBUTFMgUm9vdCBDQSAyMDIyIC0gMTAeFw0yMjA2MDgx MTA4MjJaFw00NzA2MDgxMTA4MjJaMFExCzAJBgNVBAYTAkNIMRUwEwYDVQQKEwxT d2lzc1NpZ24gQUcxKzApBgNVBAMTIlN3aXNzU2lnbiBSU0EgVExTIFJvb3QgQ0Eg MjAyMiAtIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDLKmjiC8NX vDVjvHClO/OMPE5Xlm7DTjak9gLKHqquuN6orx122ro10JFwB9+zBvKK8i5VUXu7 LCTLf5ImgKO0lPaCoaTo+nUdWfMHamFk4saMla+ju45vVs9xzF6BYQ1t8qsCLqSX 5XH8irCRIFucdFJtrhUnWXjyCcplDn/L9Ovn3KlMd/YrFgSVrpxxpT8q2kFC5zyE EPThPYxr4iuRR1VPuFa+Rd4iUU1OKNlfGUEGjw5NBuBwQCMBauTLE5tzrE0USJIt /m2n+IdreXXhvhCxqohAWVTXz8TQm0SzOGlkjIHRI36qOTw7D59Ke4LKa2/KIj4x 0LDQKhySio/YGZxH5D4MucLNvkEM+KRHBdvBFzA4OmnczcNpI/2aDwLOEGrOyvi5 KaM2iYauC8BPY7kGWUleDsFpswrzd34unYyzJ5jSmY0lpx+Gs6ZUcDj8fV3oT4MM 0ZPlEuRU2j7yrTrePjxF8CgPBrnh25d7mUWe3f6VWQQvdT/TromZhqwUtKiE+shd OxtYk8EXlFXIC+OCeYSf8wCENO7cMdWP8vpPlkwGqnj73mSiI80fPsWMvDdUDrta clXvyFu1cvh43zcgTFeRc5JzrBh3Q4IgaezprClG5QtO+DdziZaKHG29777YtvTK wP1H8K4LWCDFyB02rpeNUIMmJCn3nTsPBQIDAQABo2MwYTAPBgNVHRMBAf8EBTAD AQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBRvjmKLk0Ow4UD2p8P98Q+4 DxU4pTAdBgNVHQ4EFgQUb45ii5NDsOFA9qfD/fEPuA8VOKUwDQYJKoZIhvcNAQEL BQADggIBAKwsKUF9+lz1GpUYvyypiqkkVHX1uECry6gkUSsYP2OprphWKwVDIqO3 10aewCoSPY6WlkDfDDOLazeROpW7OSltwAJsipQLBwJNGD77+3v1dj2b9l4wBlgz Hqp41eZUBDqyggmNzhYzWUUo8aWjlw5DI/0LIICQ/+Mmz7hkkeUFjxOgdg3XNwwQ iJb0Pr6VvfHDffCjw3lHC1ySFWPtUnWK50Zpy1FVCypM9fJkT6lc/2cyjlUtMoIc gC9qkfjLvH4YoiaoLqNTKIftV+Vlek4ASltOU8liNr3CjlvrzG4ngRhZi0Rjn9UM ZfQpZX+RLOV/fuiJz48gy20HQhFRJjKKLjpHE7iNvUcNCfAWpO2Whi4Z2L6MOuhF LhG6rlrnub+xzI/goP+4s9GFe3lmozm1O2bYQL7Pt2eLSMkZJVX8vY3PXtpOpvJp zv1/THfQwUY1mFwjmwJFQ5Ra3bxHrSL+ul4vkSkphnsh3m5kt8sNjzdbowhq6/Td Ao9QAwKxuDdollDruF/UKIqlIgyKhPBZLtU30WHlQnNYKoH3dtvi4k0NX/a3vgW0 rk4N3hY9A4GzJl5LuEsAz/+MF7psYC0nhzck5npgL7XTgwSqT0N1osGDsieYK7EO gLrAhV5Cud+xYJHT6xh+cHiudoO+cVrQkOPKwRYlZ0rwtnu64ZzZ -----END CERTIFICATE----- # Issuer: CN=OISTE Server Root ECC G1 O=OISTE Foundation # Subject: CN=OISTE Server Root ECC G1 O=OISTE Foundation # Label: "OISTE Server Root ECC G1" # Serial: 47819833811561661340092227008453318557 # MD5 Fingerprint: 42:a7:d2:35:ae:02:92:db:19:76:08:de:2f:05:b4:d4 # SHA1 Fingerprint: 3b:f6:8b:09:ae:2a:92:7b:ba:e3:8d:3f:11:95:d9:e6:44:0c:45:e2 # SHA256 Fingerprint: ee:c9:97:c0:c3:0f:21:6f:7e:3b:8b:30:7d:2b:ae:42:41:2d:75:3f:c8:21:9d:af:d1:52:0b:25:72:85:0f:49 -----BEGIN CERTIFICATE----- MIICNTCCAbqgAwIBAgIQI/nD1jWvjyhLH/BU6n6XnTAKBggqhkjOPQQDAzBLMQsw CQYDVQQGEwJDSDEZMBcGA1UECgwQT0lTVEUgRm91bmRhdGlvbjEhMB8GA1UEAwwY T0lTVEUgU2VydmVyIFJvb3QgRUNDIEcxMB4XDTIzMDUzMTE0NDIyOFoXDTQ4MDUy NDE0NDIyN1owSzELMAkGA1UEBhMCQ0gxGTAXBgNVBAoMEE9JU1RFIEZvdW5kYXRp b24xITAfBgNVBAMMGE9JU1RFIFNlcnZlciBSb290IEVDQyBHMTB2MBAGByqGSM49 AgEGBSuBBAAiA2IABBcv+hK8rBjzCvRE1nZCnrPoH7d5qVi2+GXROiFPqOujvqQy cvO2Ackr/XeFblPdreqqLiWStukhEaivtUwL85Zgmjvn6hp4LrQ95SjeHIC6XG4N 2xml4z+cKrhAS93mT6NjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBQ3 TYhlz/w9itWj8UnATgwQb0K0nDAdBgNVHQ4EFgQUN02IZc/8PYrVo/FJwE4MEG9C tJwwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2kAMGYCMQCpKjAd0MKfkFFR QD6VVCHNFmb3U2wIFjnQEnx/Yxvf4zgAOdktUyBFCxxgZzFDJe0CMQCSia7pXGKD YmH5LVerVrkR3SW+ak5KGoJr3M/TvEqzPNcum9v4KGm8ay3sMaE641c= -----END CERTIFICATE----- # Issuer: CN=OISTE Server Root RSA G1 O=OISTE Foundation # Subject: CN=OISTE Server Root RSA G1 O=OISTE Foundation # Label: " OISTE Server Root RSA G1" # Serial: 113845518112613905024960613408179309848 # MD5 Fingerprint: 23:a7:9e:d4:70:b8:b9:14:57:41:8a:7e:44:59:e2:68 # SHA1 Fingerprint: f7:00:34:25:94:88:68:31:e4:34:87:3f:70:fe:86:b3:86:9f:f0:6e # SHA256 Fingerprint: 9a:e3:62:32:a5:18:9f:fd:db:35:3d:fd:26:52:0c:01:53:95:d2:27:77:da:c5:9d:b5:7b:98:c0:89:a6:51:e6 -----BEGIN CERTIFICATE----- MIIFgzCCA2ugAwIBAgIQVaXZZ5Qoxu0M+ifdWwFNGDANBgkqhkiG9w0BAQwFADBL MQswCQYDVQQGEwJDSDEZMBcGA1UECgwQT0lTVEUgRm91bmRhdGlvbjEhMB8GA1UE AwwYT0lTVEUgU2VydmVyIFJvb3QgUlNBIEcxMB4XDTIzMDUzMTE0MzcxNloXDTQ4 MDUyNDE0MzcxNVowSzELMAkGA1UEBhMCQ0gxGTAXBgNVBAoMEE9JU1RFIEZvdW5k YXRpb24xITAfBgNVBAMMGE9JU1RFIFNlcnZlciBSb290IFJTQSBHMTCCAiIwDQYJ KoZIhvcNAQEBBQADggIPADCCAgoCggIBAKqu9KuCz/vlNwvn1ZatkOhLKdxVYOPM vLO8LZK55KN68YG0nnJyQ98/qwsmtO57Gmn7KNByXEptaZnwYx4M0rH/1ow00O7b rEi56rAUjtgHqSSY3ekJvqgiG1k50SeH3BzN+Puz6+mTeO0Pzjd8JnduodgsIUzk ik/HEzxux9UTl7Ko2yRpg1bTacuCErudG/L4NPKYKyqOBGf244ehHa1uzjZ0Dl4z O8vbUZeUapU8zhhabkvG/AePLhq5SvdkNCncpo1Q4Y2LS+VIG24ugBA/5J8bZT8R tOpXaZ+0AOuFJJkk9SGdl6r7NH8CaxWQrbueWhl/pIzY+m0o/DjH40ytas7ZTpOS jswMZ78LS5bOZmdTaMsXEY5Z96ycG7mOaES3GK/m5Q9l3JUJsJMStR8+lKXHiHUh sd4JJCpM4rzsTGdHwimIuQq6+cF0zowYJmXa92/GjHtoXAvuY8BeS/FOzJ8vD+Ho mnqT8eDI278n5mUpezbgMxVz8p1rhAhoKzYHKyfMeNhqhw5HdPSqoBNdZH702xSu +zrkL8Fl47l6QGzwBrd7KJvX4V84c5Ss2XCTLdyEr0YconosP4EmQufU2MVshGYR i3drVByjtdgQ8K4p92cIiBdcuJd5z+orKu5YM+Vt6SmqZQENghPsJQtdLEByFSnT kCz3GkPVavBpAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAU 8snBDw1jALvsRQ5KH7WxszbNDo0wHQYDVR0OBBYEFPLJwQ8NYwC77EUOSh+1sbM2 zQ6NMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQwFAAOCAgEANGd5sjrG5T33 I3K5Ce+SrScfoE4KsvXaFwyihdJ+klH9FWXXXGtkFu6KRcoMQzZENdl//nk6HOjG 5D1rd9QhEOP28yBOqb6J8xycqd+8MDoX0TJD0KqKchxRKEzdNsjkLWd9kYccnbz8 qyiWXmFcuCIzGEgWUOrKL+mlSdx/PKQZvDatkuK59EvV6wit53j+F8Bdh3foZ3dP AGav9LEDOr4SfEE15fSmG0eLy3n31r8Xbk5l8PjaV8GUgeV6Vg27Rn9vkf195hfk gSe7BYhW3SCl95gtkRlpMV+bMPKZrXJAlszYd2abtNUOshD+FKrDgHGdPY3ofRRs YWSGRqbXVMW215AWRqWFyp464+YTFrYVI8ypKVL9AMb2kI5Wj4kI3Zaq5tNqqYY1 9tVFeEJKRvwDyF7YZvZFZSS0vod7VSCd9521Kvy5YhnLbDuv0204bKt7ph6N/Ome /msVuduCmsuY33OhkKCgxeDoAaijFJzIwZqsFVAzje18KotzlUBDJvyBpCpfOZC3 J8tRd/iWkx7P8nd9H0aTolkelUTFLXVksNb54Dxp6gS1HAviRkRNQzuXSXERvSS2 wq1yVAb+axj5d9spLFKebXd7Yv0PTY6YMjAwcRLWJTXjn/hvnLXrahut6hDTlhZy BiElxky8j3C7DOReIoMt0r7+hVu05L0= -----END CERTIFICATE----- ================================================ FILE: src/pip/_vendor/certifi/core.py ================================================ """ certifi.py ~~~~~~~~~~ This module returns the installation location of cacert.pem or its contents. """ import sys import atexit def exit_cacert_ctx() -> None: _CACERT_CTX.__exit__(None, None, None) # type: ignore[union-attr] if sys.version_info >= (3, 11): from importlib.resources import as_file, files _CACERT_CTX = None _CACERT_PATH = None def where() -> str: # This is slightly terrible, but we want to delay extracting the file # in cases where we're inside of a zipimport situation until someone # actually calls where(), but we don't want to re-extract the file # on every call of where(), so we'll do it once then store it in a # global variable. global _CACERT_CTX global _CACERT_PATH if _CACERT_PATH is None: # This is slightly janky, the importlib.resources API wants you to # manage the cleanup of this file, so it doesn't actually return a # path, it returns a context manager that will give you the path # when you enter it and will do any cleanup when you leave it. In # the common case of not needing a temporary file, it will just # return the file system location and the __exit__() is a no-op. # # We also have to hold onto the actual context manager, because # it will do the cleanup whenever it gets garbage collected, so # we will also store that at the global level as well. _CACERT_CTX = as_file(files("pip._vendor.certifi").joinpath("cacert.pem")) _CACERT_PATH = str(_CACERT_CTX.__enter__()) atexit.register(exit_cacert_ctx) return _CACERT_PATH def contents() -> str: return files("pip._vendor.certifi").joinpath("cacert.pem").read_text(encoding="ascii") else: from importlib.resources import path as get_path, read_text _CACERT_CTX = None _CACERT_PATH = None def where() -> str: # This is slightly terrible, but we want to delay extracting the # file in cases where we're inside of a zipimport situation until # someone actually calls where(), but we don't want to re-extract # the file on every call of where(), so we'll do it once then store # it in a global variable. global _CACERT_CTX global _CACERT_PATH if _CACERT_PATH is None: # This is slightly janky, the importlib.resources API wants you # to manage the cleanup of this file, so it doesn't actually # return a path, it returns a context manager that will give # you the path when you enter it and will do any cleanup when # you leave it. In the common case of not needing a temporary # file, it will just return the file system location and the # __exit__() is a no-op. # # We also have to hold onto the actual context manager, because # it will do the cleanup whenever it gets garbage collected, so # we will also store that at the global level as well. _CACERT_CTX = get_path("pip._vendor.certifi", "cacert.pem") _CACERT_PATH = str(_CACERT_CTX.__enter__()) atexit.register(exit_cacert_ctx) return _CACERT_PATH def contents() -> str: return read_text("pip._vendor.certifi", "cacert.pem", encoding="ascii") ================================================ FILE: src/pip/_vendor/certifi/py.typed ================================================ ================================================ FILE: src/pip/_vendor/dependency_groups/LICENSE.txt ================================================ MIT License Copyright (c) 2024-present Stephen Rosen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: src/pip/_vendor/dependency_groups/__init__.py ================================================ from ._implementation import ( CyclicDependencyError, DependencyGroupInclude, DependencyGroupResolver, resolve, ) __all__ = ( "CyclicDependencyError", "DependencyGroupInclude", "DependencyGroupResolver", "resolve", ) ================================================ FILE: src/pip/_vendor/dependency_groups/__main__.py ================================================ import argparse import sys from ._implementation import resolve from ._toml_compat import tomllib def main() -> None: if tomllib is None: print( "Usage error: dependency-groups CLI requires tomli or Python 3.11+", file=sys.stderr, ) raise SystemExit(2) parser = argparse.ArgumentParser( description=( "A dependency-groups CLI. Prints out a resolved group, newline-delimited." ) ) parser.add_argument( "GROUP_NAME", nargs="*", help="The dependency group(s) to resolve." ) parser.add_argument( "-f", "--pyproject-file", default="pyproject.toml", help="The pyproject.toml file. Defaults to trying in the current directory.", ) parser.add_argument( "-o", "--output", help="An output file. Defaults to stdout.", ) parser.add_argument( "-l", "--list", action="store_true", help="List the available dependency groups", ) args = parser.parse_args() with open(args.pyproject_file, "rb") as fp: pyproject = tomllib.load(fp) dependency_groups_raw = pyproject.get("dependency-groups", {}) if args.list: print(*dependency_groups_raw.keys()) return if not args.GROUP_NAME: print("A GROUP_NAME is required", file=sys.stderr) raise SystemExit(3) content = "\n".join(resolve(dependency_groups_raw, *args.GROUP_NAME)) if args.output is None or args.output == "-": print(content) else: with open(args.output, "w", encoding="utf-8") as fp: print(content, file=fp) if __name__ == "__main__": main() ================================================ FILE: src/pip/_vendor/dependency_groups/_implementation.py ================================================ from __future__ import annotations import dataclasses import re from collections.abc import Mapping from pip._vendor.packaging.requirements import Requirement def _normalize_name(name: str) -> str: return re.sub(r"[-_.]+", "-", name).lower() def _normalize_group_names( dependency_groups: Mapping[str, str | Mapping[str, str]], ) -> Mapping[str, str | Mapping[str, str]]: original_names: dict[str, list[str]] = {} normalized_groups = {} for group_name, value in dependency_groups.items(): normed_group_name = _normalize_name(group_name) original_names.setdefault(normed_group_name, []).append(group_name) normalized_groups[normed_group_name] = value errors = [] for normed_name, names in original_names.items(): if len(names) > 1: errors.append(f"{normed_name} ({', '.join(names)})") if errors: raise ValueError(f"Duplicate dependency group names: {', '.join(errors)}") return normalized_groups @dataclasses.dataclass class DependencyGroupInclude: include_group: str class CyclicDependencyError(ValueError): """ An error representing the detection of a cycle. """ def __init__(self, requested_group: str, group: str, include_group: str) -> None: self.requested_group = requested_group self.group = group self.include_group = include_group if include_group == group: reason = f"{group} includes itself" else: reason = f"{include_group} -> {group}, {group} -> {include_group}" super().__init__( "Cyclic dependency group include while resolving " f"{requested_group}: {reason}" ) class DependencyGroupResolver: """ A resolver for Dependency Group data. This class handles caching, name normalization, cycle detection, and other parsing requirements. There are only two public methods for exploring the data: ``lookup()`` and ``resolve()``. :param dependency_groups: A mapping, as provided via pyproject ``[dependency-groups]``. """ def __init__( self, dependency_groups: Mapping[str, str | Mapping[str, str]], ) -> None: if not isinstance(dependency_groups, Mapping): raise TypeError("Dependency Groups table is not a mapping") self.dependency_groups = _normalize_group_names(dependency_groups) # a map of group names to parsed data self._parsed_groups: dict[ str, tuple[Requirement | DependencyGroupInclude, ...] ] = {} # a map of group names to their ancestors, used for cycle detection self._include_graph_ancestors: dict[str, tuple[str, ...]] = {} # a cache of completed resolutions to Requirement lists self._resolve_cache: dict[str, tuple[Requirement, ...]] = {} def lookup(self, group: str) -> tuple[Requirement | DependencyGroupInclude, ...]: """ Lookup a group name, returning the parsed dependency data for that group. This will not resolve includes. :param group: the name of the group to lookup :raises ValueError: if the data does not appear to be valid dependency group data :raises TypeError: if the data is not a string :raises LookupError: if group name is absent :raises packaging.requirements.InvalidRequirement: if a specifier is not valid """ if not isinstance(group, str): raise TypeError("Dependency group name is not a str") group = _normalize_name(group) return self._parse_group(group) def resolve(self, group: str) -> tuple[Requirement, ...]: """ Resolve a dependency group to a list of requirements. :param group: the name of the group to resolve :raises TypeError: if the inputs appear to be the wrong types :raises ValueError: if the data does not appear to be valid dependency group data :raises LookupError: if group name is absent :raises packaging.requirements.InvalidRequirement: if a specifier is not valid """ if not isinstance(group, str): raise TypeError("Dependency group name is not a str") group = _normalize_name(group) return self._resolve(group, group) def _parse_group( self, group: str ) -> tuple[Requirement | DependencyGroupInclude, ...]: # short circuit -- never do the work twice if group in self._parsed_groups: return self._parsed_groups[group] if group not in self.dependency_groups: raise LookupError(f"Dependency group '{group}' not found") raw_group = self.dependency_groups[group] if not isinstance(raw_group, list): raise TypeError(f"Dependency group '{group}' is not a list") elements: list[Requirement | DependencyGroupInclude] = [] for item in raw_group: if isinstance(item, str): # packaging.requirements.Requirement parsing ensures that this is a # valid PEP 508 Dependency Specifier # raises InvalidRequirement on failure elements.append(Requirement(item)) elif isinstance(item, dict): if tuple(item.keys()) != ("include-group",): raise ValueError(f"Invalid dependency group item: {item}") include_group = next(iter(item.values())) elements.append(DependencyGroupInclude(include_group=include_group)) else: raise ValueError(f"Invalid dependency group item: {item}") self._parsed_groups[group] = tuple(elements) return self._parsed_groups[group] def _resolve(self, group: str, requested_group: str) -> tuple[Requirement, ...]: """ This is a helper for cached resolution to strings. :param group: The name of the group to resolve. :param requested_group: The group which was used in the original, user-facing request. """ if group in self._resolve_cache: return self._resolve_cache[group] parsed = self._parse_group(group) resolved_group = [] for item in parsed: if isinstance(item, Requirement): resolved_group.append(item) elif isinstance(item, DependencyGroupInclude): include_group = _normalize_name(item.include_group) if include_group in self._include_graph_ancestors.get(group, ()): raise CyclicDependencyError( requested_group, group, item.include_group ) self._include_graph_ancestors[include_group] = ( *self._include_graph_ancestors.get(group, ()), group, ) resolved_group.extend(self._resolve(include_group, requested_group)) else: # unreachable raise NotImplementedError( f"Invalid dependency group item after parse: {item}" ) self._resolve_cache[group] = tuple(resolved_group) return self._resolve_cache[group] def resolve( dependency_groups: Mapping[str, str | Mapping[str, str]], /, *groups: str ) -> tuple[str, ...]: """ Resolve a dependency group to a tuple of requirements, as strings. :param dependency_groups: the parsed contents of the ``[dependency-groups]`` table from ``pyproject.toml`` :param groups: the name of the group(s) to resolve :raises TypeError: if the inputs appear to be the wrong types :raises ValueError: if the data does not appear to be valid dependency group data :raises LookupError: if group name is absent :raises packaging.requirements.InvalidRequirement: if a specifier is not valid """ resolver = DependencyGroupResolver(dependency_groups) return tuple(str(r) for group in groups for r in resolver.resolve(group)) ================================================ FILE: src/pip/_vendor/dependency_groups/_lint_dependency_groups.py ================================================ from __future__ import annotations import argparse import sys from ._implementation import DependencyGroupResolver from ._toml_compat import tomllib def main(*, argv: list[str] | None = None) -> None: if tomllib is None: print( "Usage error: dependency-groups CLI requires tomli or Python 3.11+", file=sys.stderr, ) raise SystemExit(2) parser = argparse.ArgumentParser( description=( "Lint Dependency Groups for validity. " "This will eagerly load and check all of your Dependency Groups." ) ) parser.add_argument( "-f", "--pyproject-file", default="pyproject.toml", help="The pyproject.toml file. Defaults to trying in the current directory.", ) args = parser.parse_args(argv if argv is not None else sys.argv[1:]) with open(args.pyproject_file, "rb") as fp: pyproject = tomllib.load(fp) dependency_groups_raw = pyproject.get("dependency-groups", {}) errors: list[str] = [] try: resolver = DependencyGroupResolver(dependency_groups_raw) except (ValueError, TypeError) as e: errors.append(f"{type(e).__name__}: {e}") else: for groupname in resolver.dependency_groups: try: resolver.resolve(groupname) except (LookupError, ValueError, TypeError) as e: errors.append(f"{type(e).__name__}: {e}") if errors: print("errors encountered while examining dependency groups:") for msg in errors: print(f" {msg}") sys.exit(1) else: print("ok") sys.exit(0) if __name__ == "__main__": main() ================================================ FILE: src/pip/_vendor/dependency_groups/_pip_wrapper.py ================================================ from __future__ import annotations import argparse import subprocess import sys from ._implementation import DependencyGroupResolver from ._toml_compat import tomllib def _invoke_pip(deps: list[str]) -> None: subprocess.check_call([sys.executable, "-m", "pip", "install", *deps]) def main(*, argv: list[str] | None = None) -> None: if tomllib is None: print( "Usage error: dependency-groups CLI requires tomli or Python 3.11+", file=sys.stderr, ) raise SystemExit(2) parser = argparse.ArgumentParser(description="Install Dependency Groups.") parser.add_argument( "DEPENDENCY_GROUP", nargs="+", help="The dependency groups to install." ) parser.add_argument( "-f", "--pyproject-file", default="pyproject.toml", help="The pyproject.toml file. Defaults to trying in the current directory.", ) args = parser.parse_args(argv if argv is not None else sys.argv[1:]) with open(args.pyproject_file, "rb") as fp: pyproject = tomllib.load(fp) dependency_groups_raw = pyproject.get("dependency-groups", {}) errors: list[str] = [] resolved: list[str] = [] try: resolver = DependencyGroupResolver(dependency_groups_raw) except (ValueError, TypeError) as e: errors.append(f"{type(e).__name__}: {e}") else: for groupname in args.DEPENDENCY_GROUP: try: resolved.extend(str(r) for r in resolver.resolve(groupname)) except (LookupError, ValueError, TypeError) as e: errors.append(f"{type(e).__name__}: {e}") if errors: print("errors encountered while examining dependency groups:") for msg in errors: print(f" {msg}") sys.exit(1) _invoke_pip(resolved) if __name__ == "__main__": main() ================================================ FILE: src/pip/_vendor/dependency_groups/_toml_compat.py ================================================ try: import tomllib except ImportError: try: from pip._vendor import tomli as tomllib # type: ignore[no-redef, unused-ignore] except ModuleNotFoundError: # pragma: no cover tomllib = None # type: ignore[assignment, unused-ignore] __all__ = ("tomllib",) ================================================ FILE: src/pip/_vendor/dependency_groups/py.typed ================================================ ================================================ FILE: src/pip/_vendor/distlib/LICENSE.txt ================================================ A. HISTORY OF THE SOFTWARE ========================== Python was created in the early 1990s by Guido van Rossum at Stichting Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands as a successor of a language called ABC. Guido remains Python's principal author, although it includes many contributions from others. In 1995, Guido continued his work on Python at the Corporation for National Research Initiatives (CNRI, see http://www.cnri.reston.va.us) in Reston, Virginia where he released several versions of the software. In May 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. In October of the same year, the PythonLabs team moved to Digital Creations (now Zope Corporation, see http://www.zope.com). In 2001, the Python Software Foundation (PSF, see http://www.python.org/psf/) was formed, a non-profit organization created specifically to own Python-related Intellectual Property. Zope Corporation is a sponsoring member of the PSF. All Python releases are Open Source (see http://www.opensource.org for the Open Source Definition). Historically, most, but not all, Python releases have also been GPL-compatible; the table below summarizes the various releases. Release Derived Year Owner GPL- from compatible? (1) 0.9.0 thru 1.2 1991-1995 CWI yes 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes 1.6 1.5.2 2000 CNRI no 2.0 1.6 2000 BeOpen.com no 1.6.1 1.6 2001 CNRI yes (2) 2.1 2.0+1.6.1 2001 PSF no 2.0.1 2.0+1.6.1 2001 PSF yes 2.1.1 2.1+2.0.1 2001 PSF yes 2.2 2.1.1 2001 PSF yes 2.1.2 2.1.1 2002 PSF yes 2.1.3 2.1.2 2002 PSF yes 2.2.1 2.2 2002 PSF yes 2.2.2 2.2.1 2002 PSF yes 2.2.3 2.2.2 2003 PSF yes 2.3 2.2.2 2002-2003 PSF yes 2.3.1 2.3 2002-2003 PSF yes 2.3.2 2.3.1 2002-2003 PSF yes 2.3.3 2.3.2 2002-2003 PSF yes 2.3.4 2.3.3 2004 PSF yes 2.3.5 2.3.4 2005 PSF yes 2.4 2.3 2004 PSF yes 2.4.1 2.4 2005 PSF yes 2.4.2 2.4.1 2005 PSF yes 2.4.3 2.4.2 2006 PSF yes 2.4.4 2.4.3 2006 PSF yes 2.5 2.4 2006 PSF yes 2.5.1 2.5 2007 PSF yes 2.5.2 2.5.1 2008 PSF yes 2.5.3 2.5.2 2008 PSF yes 2.6 2.5 2008 PSF yes 2.6.1 2.6 2008 PSF yes 2.6.2 2.6.1 2009 PSF yes 2.6.3 2.6.2 2009 PSF yes 2.6.4 2.6.3 2009 PSF yes 2.6.5 2.6.4 2010 PSF yes 3.0 2.6 2008 PSF yes 3.0.1 3.0 2009 PSF yes 3.1 3.0.1 2009 PSF yes 3.1.1 3.1 2009 PSF yes 3.1.2 3.1 2010 PSF yes 3.2 3.1 2010 PSF yes Footnotes: (1) GPL-compatible doesn't mean that we're distributing Python under the GPL. All Python licenses, unlike the GPL, let you distribute a modified version without making your changes open source. The GPL-compatible licenses make it possible to combine Python with other software that is released under the GPL; the others don't. (2) According to Richard Stallman, 1.6.1 is not GPL-compatible, because its license has a choice of law clause. According to CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1 is "not incompatible" with the GPL. Thanks to the many outside volunteers who have worked under Guido's direction to make these releases possible. B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON =============================================================== PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 -------------------------------------------- 1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and otherwise using this software ("Python") in source or binary form and its associated documentation. 2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python. 4. PSF is making Python available to Licensee on an "AS IS" basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 6. This License Agreement will automatically terminate upon a material breach of its terms and conditions. 7. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between PSF and Licensee. This License Agreement does not grant permission to use PSF trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party. 8. By copying, installing or otherwise using Python, Licensee agrees to be bound by the terms and conditions of this License Agreement. BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 ------------------------------------------- BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the Individual or Organization ("Licensee") accessing and otherwise using this software in source or binary form and its associated documentation ("the Software"). 2. Subject to the terms and conditions of this BeOpen Python License Agreement, BeOpen hereby grants Licensee a non-exclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use the Software alone or in any derivative version, provided, however, that the BeOpen Python License is retained in the Software, alone or in any derivative version prepared by Licensee. 3. BeOpen is making the Software available to Licensee on an "AS IS" basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 5. This License Agreement will automatically terminate upon a material breach of its terms and conditions. 6. This License Agreement shall be governed by and interpreted in all respects by the law of the State of California, excluding conflict of law provisions. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between BeOpen and Licensee. This License Agreement does not grant permission to use BeOpen trademarks or trade names in a trademark sense to endorse or promote products or services of Licensee, or any third party. As an exception, the "BeOpen Python" logos available at http://www.pythonlabs.com/logos.html may be used according to the permissions granted on that web page. 7. By copying, installing or otherwise using the software, Licensee agrees to be bound by the terms and conditions of this License Agreement. CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 --------------------------------------- 1. This LICENSE AGREEMENT is between the Corporation for National Research Initiatives, having an office at 1895 Preston White Drive, Reston, VA 20191 ("CNRI"), and the Individual or Organization ("Licensee") accessing and otherwise using Python 1.6.1 software in source or binary form and its associated documentation. 2. Subject to the terms and conditions of this License Agreement, CNRI hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python 1.6.1 alone or in any derivative version, provided, however, that CNRI's License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) 1995-2001 Corporation for National Research Initiatives; All Rights Reserved" are retained in Python 1.6.1 alone or in any derivative version prepared by Licensee. Alternately, in lieu of CNRI's License Agreement, Licensee may substitute the following text (omitting the quotes): "Python 1.6.1 is made available subject to the terms and conditions in CNRI's License Agreement. This Agreement together with Python 1.6.1 may be located on the Internet using the following unique, persistent identifier (known as a handle): 1895.22/1013. This Agreement may also be obtained from a proxy server on the Internet using the following URL: http://hdl.handle.net/1895.22/1013". 3. In the event Licensee prepares a derivative work that is based on or incorporates Python 1.6.1 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python 1.6.1. 4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 6. This License Agreement will automatically terminate upon a material breach of its terms and conditions. 7. This License Agreement shall be governed by the federal intellectual property law of the United States, including without limitation the federal copyright law, and, to the extent such U.S. federal law does not apply, by the law of the Commonwealth of Virginia, excluding Virginia's conflict of law provisions. Notwithstanding the foregoing, with regard to derivative works based on Python 1.6.1 that incorporate non-separable material that was previously distributed under the GNU General Public License (GPL), the law of the Commonwealth of Virginia shall govern this License Agreement only as to issues arising under or with respect to Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between CNRI and Licensee. This License Agreement does not grant permission to use CNRI trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party. 8. By clicking on the "ACCEPT" button where indicated, or by copying, installing or otherwise using Python 1.6.1, Licensee agrees to be bound by the terms and conditions of this License Agreement. ACCEPT CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 -------------------------------------------------- Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, The Netherlands. All rights reserved. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Stichting Mathematisch Centrum or CWI not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ================================================ FILE: src/pip/_vendor/distlib/__init__.py ================================================ # -*- coding: utf-8 -*- # # Copyright (C) 2012-2024 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import logging __version__ = '0.4.0' class DistlibException(Exception): pass try: from logging import NullHandler except ImportError: # pragma: no cover class NullHandler(logging.Handler): def handle(self, record): pass def emit(self, record): pass def createLock(self): self.lock = None logger = logging.getLogger(__name__) logger.addHandler(NullHandler()) ================================================ FILE: src/pip/_vendor/distlib/compat.py ================================================ # -*- coding: utf-8 -*- # # Copyright (C) 2013-2017 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # from __future__ import absolute_import import os import re import shutil import sys try: import ssl except ImportError: # pragma: no cover ssl = None if sys.version_info[0] < 3: # pragma: no cover from StringIO import StringIO string_types = basestring, text_type = unicode from types import FileType as file_type import __builtin__ as builtins import ConfigParser as configparser from urlparse import urlparse, urlunparse, urljoin, urlsplit, urlunsplit from urllib import (urlretrieve, quote as _quote, unquote, url2pathname, pathname2url, ContentTooShortError, splittype) def quote(s): if isinstance(s, unicode): s = s.encode('utf-8') return _quote(s) import urllib2 from urllib2 import (Request, urlopen, URLError, HTTPError, HTTPBasicAuthHandler, HTTPPasswordMgr, HTTPHandler, HTTPRedirectHandler, build_opener) if ssl: from urllib2 import HTTPSHandler import httplib import xmlrpclib import Queue as queue from HTMLParser import HTMLParser import htmlentitydefs raw_input = raw_input from itertools import ifilter as filter from itertools import ifilterfalse as filterfalse # Leaving this around for now, in case it needs resurrecting in some way # _userprog = None # def splituser(host): # """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.""" # global _userprog # if _userprog is None: # import re # _userprog = re.compile('^(.*)@(.*)$') # match = _userprog.match(host) # if match: return match.group(1, 2) # return None, host else: # pragma: no cover from io import StringIO string_types = str, text_type = str from io import TextIOWrapper as file_type import builtins import configparser from urllib.parse import (urlparse, urlunparse, urljoin, quote, unquote, urlsplit, urlunsplit, splittype) from urllib.request import (urlopen, urlretrieve, Request, url2pathname, pathname2url, HTTPBasicAuthHandler, HTTPPasswordMgr, HTTPHandler, HTTPRedirectHandler, build_opener) if ssl: from urllib.request import HTTPSHandler from urllib.error import HTTPError, URLError, ContentTooShortError import http.client as httplib import urllib.request as urllib2 import xmlrpc.client as xmlrpclib import queue from html.parser import HTMLParser import html.entities as htmlentitydefs raw_input = input from itertools import filterfalse filter = filter try: from ssl import match_hostname, CertificateError except ImportError: # pragma: no cover class CertificateError(ValueError): pass def _dnsname_match(dn, hostname, max_wildcards=1): """Matching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3 """ pats = [] if not dn: return False parts = dn.split('.') leftmost, remainder = parts[0], parts[1:] wildcards = leftmost.count('*') if wildcards > max_wildcards: # Issue #17980: avoid denials of service by refusing more # than one wildcard per fragment. A survey of established # policy among SSL implementations showed it to be a # reasonable choice. raise CertificateError( "too many wildcards in certificate DNS name: " + repr(dn)) # speed up common case w/o wildcards if not wildcards: return dn.lower() == hostname.lower() # RFC 6125, section 6.4.3, subitem 1. # The client SHOULD NOT attempt to match a presented identifier in which # the wildcard character comprises a label other than the left-most label. if leftmost == '*': # When '*' is a fragment by itself, it matches a non-empty dotless # fragment. pats.append('[^.]+') elif leftmost.startswith('xn--') or hostname.startswith('xn--'): # RFC 6125, section 6.4.3, subitem 3. # The client SHOULD NOT attempt to match a presented identifier # where the wildcard character is embedded within an A-label or # U-label of an internationalized domain name. pats.append(re.escape(leftmost)) else: # Otherwise, '*' matches any dotless string, e.g. www* pats.append(re.escape(leftmost).replace(r'\*', '[^.]*')) # add the remaining fragments, ignore any wildcards for frag in remainder: pats.append(re.escape(frag)) pat = re.compile(r'\A' + r'\.'.join(pats) + r'\Z', re.IGNORECASE) return pat.match(hostname) def match_hostname(cert, hostname): """Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function returns nothing. """ if not cert: raise ValueError("empty or no certificate, match_hostname needs a " "SSL socket or SSL context with either " "CERT_OPTIONAL or CERT_REQUIRED") dnsnames = [] san = cert.get('subjectAltName', ()) for key, value in san: if key == 'DNS': if _dnsname_match(value, hostname): return dnsnames.append(value) if not dnsnames: # The subject is only checked when there is no dNSName entry # in subjectAltName for sub in cert.get('subject', ()): for key, value in sub: # XXX according to RFC 2818, the most specific Common Name # must be used. if key == 'commonName': if _dnsname_match(value, hostname): return dnsnames.append(value) if len(dnsnames) > 1: raise CertificateError("hostname %r " "doesn't match either of %s" % (hostname, ', '.join(map(repr, dnsnames)))) elif len(dnsnames) == 1: raise CertificateError("hostname %r " "doesn't match %r" % (hostname, dnsnames[0])) else: raise CertificateError("no appropriate commonName or " "subjectAltName fields were found") try: from types import SimpleNamespace as Container except ImportError: # pragma: no cover class Container(object): """ A generic container for when multiple values need to be returned """ def __init__(self, **kwargs): self.__dict__.update(kwargs) try: from shutil import which except ImportError: # pragma: no cover # Implementation from Python 3.3 def which(cmd, mode=os.F_OK | os.X_OK, path=None): """Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. """ # Check that a given file can be accessed with the correct mode. # Additionally check that `file` is not a directory, as on Windows # directories pass the os.access check. def _access_check(fn, mode): return (os.path.exists(fn) and os.access(fn, mode) and not os.path.isdir(fn)) # If we're given a path with a directory part, look it up directly rather # than referring to PATH directories. This includes checking relative to the # current directory, e.g. ./script if os.path.dirname(cmd): if _access_check(cmd, mode): return cmd return None if path is None: path = os.environ.get("PATH", os.defpath) if not path: return None path = path.split(os.pathsep) if sys.platform == "win32": # The current directory takes precedence on Windows. if os.curdir not in path: path.insert(0, os.curdir) # PATHEXT is necessary to check on Windows. pathext = os.environ.get("PATHEXT", "").split(os.pathsep) # See if the given file matches any of the expected path extensions. # This will allow us to short circuit when given "python.exe". # If it does match, only test that one, otherwise we have to try # others. if any(cmd.lower().endswith(ext.lower()) for ext in pathext): files = [cmd] else: files = [cmd + ext for ext in pathext] else: # On other platforms you don't have things like PATHEXT to tell you # what file suffixes are executable, so just pass on cmd as-is. files = [cmd] seen = set() for dir in path: normdir = os.path.normcase(dir) if normdir not in seen: seen.add(normdir) for thefile in files: name = os.path.join(dir, thefile) if _access_check(name, mode): return name return None # ZipFile is a context manager in 2.7, but not in 2.6 from zipfile import ZipFile as BaseZipFile if hasattr(BaseZipFile, '__enter__'): # pragma: no cover ZipFile = BaseZipFile else: # pragma: no cover from zipfile import ZipExtFile as BaseZipExtFile class ZipExtFile(BaseZipExtFile): def __init__(self, base): self.__dict__.update(base.__dict__) def __enter__(self): return self def __exit__(self, *exc_info): self.close() # return None, so if an exception occurred, it will propagate class ZipFile(BaseZipFile): def __enter__(self): return self def __exit__(self, *exc_info): self.close() # return None, so if an exception occurred, it will propagate def open(self, *args, **kwargs): base = BaseZipFile.open(self, *args, **kwargs) return ZipExtFile(base) try: from platform import python_implementation except ImportError: # pragma: no cover def python_implementation(): """Return a string identifying the Python implementation.""" if 'PyPy' in sys.version: return 'PyPy' if os.name == 'java': return 'Jython' if sys.version.startswith('IronPython'): return 'IronPython' return 'CPython' import sysconfig try: callable = callable except NameError: # pragma: no cover from collections.abc import Callable def callable(obj): return isinstance(obj, Callable) try: fsencode = os.fsencode fsdecode = os.fsdecode except AttributeError: # pragma: no cover # Issue #99: on some systems (e.g. containerised), # sys.getfilesystemencoding() returns None, and we need a real value, # so fall back to utf-8. From the CPython 2.7 docs relating to Unix and # sys.getfilesystemencoding(): the return value is "the user’s preference # according to the result of nl_langinfo(CODESET), or None if the # nl_langinfo(CODESET) failed." _fsencoding = sys.getfilesystemencoding() or 'utf-8' if _fsencoding == 'mbcs': _fserrors = 'strict' else: _fserrors = 'surrogateescape' def fsencode(filename): if isinstance(filename, bytes): return filename elif isinstance(filename, text_type): return filename.encode(_fsencoding, _fserrors) else: raise TypeError("expect bytes or str, not %s" % type(filename).__name__) def fsdecode(filename): if isinstance(filename, text_type): return filename elif isinstance(filename, bytes): return filename.decode(_fsencoding, _fserrors) else: raise TypeError("expect bytes or str, not %s" % type(filename).__name__) try: from tokenize import detect_encoding except ImportError: # pragma: no cover from codecs import BOM_UTF8, lookup cookie_re = re.compile(r"coding[:=]\s*([-\w.]+)") def _get_normal_name(orig_enc): """Imitates get_normal_name in tokenizer.c.""" # Only care about the first 12 characters. enc = orig_enc[:12].lower().replace("_", "-") if enc == "utf-8" or enc.startswith("utf-8-"): return "utf-8" if enc in ("latin-1", "iso-8859-1", "iso-latin-1") or \ enc.startswith(("latin-1-", "iso-8859-1-", "iso-latin-1-")): return "iso-8859-1" return orig_enc def detect_encoding(readline): """ The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. """ try: filename = readline.__self__.name except AttributeError: filename = None bom_found = False encoding = None default = 'utf-8' def read_or_stop(): try: return readline() except StopIteration: return b'' def find_cookie(line): try: # Decode as UTF-8. Either the line is an encoding declaration, # in which case it should be pure ASCII, or it must be UTF-8 # per default encoding. line_string = line.decode('utf-8') except UnicodeDecodeError: msg = "invalid or missing encoding declaration" if filename is not None: msg = '{} for {!r}'.format(msg, filename) raise SyntaxError(msg) matches = cookie_re.findall(line_string) if not matches: return None encoding = _get_normal_name(matches[0]) try: codec = lookup(encoding) except LookupError: # This behaviour mimics the Python interpreter if filename is None: msg = "unknown encoding: " + encoding else: msg = "unknown encoding for {!r}: {}".format( filename, encoding) raise SyntaxError(msg) if bom_found: if codec.name != 'utf-8': # This behaviour mimics the Python interpreter if filename is None: msg = 'encoding problem: utf-8' else: msg = 'encoding problem for {!r}: utf-8'.format( filename) raise SyntaxError(msg) encoding += '-sig' return encoding first = read_or_stop() if first.startswith(BOM_UTF8): bom_found = True first = first[3:] default = 'utf-8-sig' if not first: return default, [] encoding = find_cookie(first) if encoding: return encoding, [first] second = read_or_stop() if not second: return default, [first] encoding = find_cookie(second) if encoding: return encoding, [first, second] return default, [first, second] # For converting & <-> & etc. try: from html import escape except ImportError: from cgi import escape if sys.version_info[:2] < (3, 4): unescape = HTMLParser().unescape else: from html import unescape try: from collections import ChainMap except ImportError: # pragma: no cover from collections import MutableMapping try: from reprlib import recursive_repr as _recursive_repr except ImportError: def _recursive_repr(fillvalue='...'): ''' Decorator to make a repr function return fillvalue for a recursive call ''' def decorating_function(user_function): repr_running = set() def wrapper(self): key = id(self), get_ident() if key in repr_running: return fillvalue repr_running.add(key) try: result = user_function(self) finally: repr_running.discard(key) return result # Can't use functools.wraps() here because of bootstrap issues wrapper.__module__ = getattr(user_function, '__module__') wrapper.__doc__ = getattr(user_function, '__doc__') wrapper.__name__ = getattr(user_function, '__name__') wrapper.__annotations__ = getattr(user_function, '__annotations__', {}) return wrapper return decorating_function class ChainMap(MutableMapping): ''' A ChainMap groups multiple dicts (or other mappings) together to create a single, updateable view. The underlying mappings are stored in a list. That list is public and can accessed or updated using the *maps* attribute. There is no other state. Lookups search the underlying mappings successively until a key is found. In contrast, writes, updates, and deletions only operate on the first mapping. ''' def __init__(self, *maps): '''Initialize a ChainMap by setting *maps* to the given mappings. If no mappings are provided, a single empty dictionary is used. ''' self.maps = list(maps) or [{}] # always at least one map def __missing__(self, key): raise KeyError(key) def __getitem__(self, key): for mapping in self.maps: try: return mapping[ key] # can't use 'key in mapping' with defaultdict except KeyError: pass return self.__missing__( key) # support subclasses that define __missing__ def get(self, key, default=None): return self[key] if key in self else default def __len__(self): return len(set().union( *self.maps)) # reuses stored hash values if possible def __iter__(self): return iter(set().union(*self.maps)) def __contains__(self, key): return any(key in m for m in self.maps) def __bool__(self): return any(self.maps) @_recursive_repr() def __repr__(self): return '{0.__class__.__name__}({1})'.format( self, ', '.join(map(repr, self.maps))) @classmethod def fromkeys(cls, iterable, *args): 'Create a ChainMap with a single dict created from the iterable.' return cls(dict.fromkeys(iterable, *args)) def copy(self): 'New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]' return self.__class__(self.maps[0].copy(), *self.maps[1:]) __copy__ = copy def new_child(self): # like Django's Context.push() 'New ChainMap with a new dict followed by all previous maps.' return self.__class__({}, *self.maps) @property def parents(self): # like Django's Context.pop() 'New ChainMap from maps[1:].' return self.__class__(*self.maps[1:]) def __setitem__(self, key, value): self.maps[0][key] = value def __delitem__(self, key): try: del self.maps[0][key] except KeyError: raise KeyError( 'Key not found in the first mapping: {!r}'.format(key)) def popitem(self): 'Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.' try: return self.maps[0].popitem() except KeyError: raise KeyError('No keys found in the first mapping.') def pop(self, key, *args): 'Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].' try: return self.maps[0].pop(key, *args) except KeyError: raise KeyError( 'Key not found in the first mapping: {!r}'.format(key)) def clear(self): 'Clear maps[0], leaving maps[1:] intact.' self.maps[0].clear() try: from importlib.util import cache_from_source # Python >= 3.4 except ImportError: # pragma: no cover def cache_from_source(path, debug_override=None): assert path.endswith('.py') if debug_override is None: debug_override = __debug__ if debug_override: suffix = 'c' else: suffix = 'o' return path + suffix try: from collections import OrderedDict except ImportError: # pragma: no cover # {{{ http://code.activestate.com/recipes/576693/ (r9) # Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy. # Passes Python2.7's test suite and incorporates all the latest updates. try: from thread import get_ident as _get_ident except ImportError: from dummy_thread import get_ident as _get_ident try: from _abcoll import KeysView, ValuesView, ItemsView except ImportError: pass class OrderedDict(dict): 'Dictionary that remembers insertion order' # An inherited dict maps keys to values. # The inherited dict provides __getitem__, __len__, __contains__, and get. # The remaining methods are order-aware. # Big-O running times for all methods are the same as for regular dictionaries. # The internal self.__map dictionary maps keys to links in a doubly linked list. # The circular doubly linked list starts and ends with a sentinel element. # The sentinel element never gets deleted (this simplifies the algorithm). # Each link is stored as a list of length three: [PREV, NEXT, KEY]. def __init__(self, *args, **kwds): '''Initialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. ''' if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) try: self.__root except AttributeError: self.__root = root = [] # sentinel node root[:] = [root, root, None] self.__map = {} self.__update(*args, **kwds) def __setitem__(self, key, value, dict_setitem=dict.__setitem__): 'od.__setitem__(i, y) <==> od[i]=y' # Setting a new item creates a new link which goes at the end of the linked # list, and the inherited dictionary is updated with the new key/value pair. if key not in self: root = self.__root last = root[0] last[1] = root[0] = self.__map[key] = [last, root, key] dict_setitem(self, key, value) def __delitem__(self, key, dict_delitem=dict.__delitem__): 'od.__delitem__(y) <==> del od[y]' # Deleting an existing item uses self.__map to find the link which is # then removed by updating the links in the predecessor and successor nodes. dict_delitem(self, key) link_prev, link_next, key = self.__map.pop(key) link_prev[1] = link_next link_next[0] = link_prev def __iter__(self): 'od.__iter__() <==> iter(od)' root = self.__root curr = root[1] while curr is not root: yield curr[2] curr = curr[1] def __reversed__(self): 'od.__reversed__() <==> reversed(od)' root = self.__root curr = root[0] while curr is not root: yield curr[2] curr = curr[0] def clear(self): 'od.clear() -> None. Remove all items from od.' try: for node in self.__map.itervalues(): del node[:] root = self.__root root[:] = [root, root, None] self.__map.clear() except AttributeError: pass dict.clear(self) def popitem(self, last=True): '''od.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. ''' if not self: raise KeyError('dictionary is empty') root = self.__root if last: link = root[0] link_prev = link[0] link_prev[1] = root root[0] = link_prev else: link = root[1] link_next = link[1] root[1] = link_next link_next[0] = root key = link[2] del self.__map[key] value = dict.pop(self, key) return key, value # -- the following methods do not depend on the internal structure -- def keys(self): 'od.keys() -> list of keys in od' return list(self) def values(self): 'od.values() -> list of values in od' return [self[key] for key in self] def items(self): 'od.items() -> list of (key, value) pairs in od' return [(key, self[key]) for key in self] def iterkeys(self): 'od.iterkeys() -> an iterator over the keys in od' return iter(self) def itervalues(self): 'od.itervalues -> an iterator over the values in od' for k in self: yield self[k] def iteritems(self): 'od.iteritems -> an iterator over the (key, value) items in od' for k in self: yield (k, self[k]) def update(*args, **kwds): '''od.update(E, **F) -> None. Update od from dict/iterable E and F. If E is a dict instance, does: for k in E: od[k] = E[k] If E has a .keys() method, does: for k in E.keys(): od[k] = E[k] Or if E is an iterable of items, does: for k, v in E: od[k] = v In either case, this is followed by: for k, v in F.items(): od[k] = v ''' if len(args) > 2: raise TypeError('update() takes at most 2 positional ' 'arguments (%d given)' % (len(args), )) elif not args: raise TypeError('update() takes at least 1 argument (0 given)') self = args[0] # Make progressively weaker assumptions about "other" other = () if len(args) == 2: other = args[1] if isinstance(other, dict): for key in other: self[key] = other[key] elif hasattr(other, 'keys'): for key in other.keys(): self[key] = other[key] else: for key, value in other: self[key] = value for key, value in kwds.items(): self[key] = value __update = update # let subclasses override update without breaking __init__ __marker = object() def pop(self, key, default=__marker): '''od.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. ''' if key in self: result = self[key] del self[key] return result if default is self.__marker: raise KeyError(key) return default def setdefault(self, key, default=None): 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od' if key in self: return self[key] self[key] = default return default def __repr__(self, _repr_running=None): 'od.__repr__() <==> repr(od)' if not _repr_running: _repr_running = {} call_key = id(self), _get_ident() if call_key in _repr_running: return '...' _repr_running[call_key] = 1 try: if not self: return '%s()' % (self.__class__.__name__, ) return '%s(%r)' % (self.__class__.__name__, self.items()) finally: del _repr_running[call_key] def __reduce__(self): 'Return state information for pickling' items = [[k, self[k]] for k in self] inst_dict = vars(self).copy() for k in vars(OrderedDict()): inst_dict.pop(k, None) if inst_dict: return (self.__class__, (items, ), inst_dict) return self.__class__, (items, ) def copy(self): 'od.copy() -> a shallow copy of od' return self.__class__(self) @classmethod def fromkeys(cls, iterable, value=None): '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S and values equal to v (which defaults to None). ''' d = cls() for key in iterable: d[key] = value return d def __eq__(self, other): '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. ''' if isinstance(other, OrderedDict): return len(self) == len( other) and self.items() == other.items() return dict.__eq__(self, other) def __ne__(self, other): return not self == other # -- the following methods are only used in Python 2.7 -- def viewkeys(self): "od.viewkeys() -> a set-like object providing a view on od's keys" return KeysView(self) def viewvalues(self): "od.viewvalues() -> an object providing a view on od's values" return ValuesView(self) def viewitems(self): "od.viewitems() -> a set-like object providing a view on od's items" return ItemsView(self) try: from logging.config import BaseConfigurator, valid_ident except ImportError: # pragma: no cover IDENTIFIER = re.compile('^[a-z_][a-z0-9_]*$', re.I) def valid_ident(s): m = IDENTIFIER.match(s) if not m: raise ValueError('Not a valid Python identifier: %r' % s) return True # The ConvertingXXX classes are wrappers around standard Python containers, # and they serve to convert any suitable values in the container. The # conversion converts base dicts, lists and tuples to their wrapped # equivalents, whereas strings which match a conversion format are converted # appropriately. # # Each wrapper should have a configurator attribute holding the actual # configurator to use for conversion. class ConvertingDict(dict): """A converting dictionary wrapper.""" def __getitem__(self, key): value = dict.__getitem__(self, key) result = self.configurator.convert(value) # If the converted value is different, save for next time if value is not result: self[key] = result if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result def get(self, key, default=None): value = dict.get(self, key, default) result = self.configurator.convert(value) # If the converted value is different, save for next time if value is not result: self[key] = result if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result def pop(self, key, default=None): value = dict.pop(self, key, default) result = self.configurator.convert(value) if value is not result: if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result class ConvertingList(list): """A converting list wrapper.""" def __getitem__(self, key): value = list.__getitem__(self, key) result = self.configurator.convert(value) # If the converted value is different, save for next time if value is not result: self[key] = result if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result def pop(self, idx=-1): value = list.pop(self, idx) result = self.configurator.convert(value) if value is not result: if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self return result class ConvertingTuple(tuple): """A converting tuple wrapper.""" def __getitem__(self, key): value = tuple.__getitem__(self, key) result = self.configurator.convert(value) if value is not result: if type(result) in (ConvertingDict, ConvertingList, ConvertingTuple): result.parent = self result.key = key return result class BaseConfigurator(object): """ The configurator base class which defines some useful defaults. """ CONVERT_PATTERN = re.compile(r'^(?P[a-z]+)://(?P.*)$') WORD_PATTERN = re.compile(r'^\s*(\w+)\s*') DOT_PATTERN = re.compile(r'^\.\s*(\w+)\s*') INDEX_PATTERN = re.compile(r'^\[\s*(\w+)\s*\]\s*') DIGIT_PATTERN = re.compile(r'^\d+$') value_converters = { 'ext': 'ext_convert', 'cfg': 'cfg_convert', } # We might want to use a different one, e.g. importlib importer = staticmethod(__import__) def __init__(self, config): self.config = ConvertingDict(config) self.config.configurator = self def resolve(self, s): """ Resolve strings to objects using standard import and attribute syntax. """ name = s.split('.') used = name.pop(0) try: found = self.importer(used) for frag in name: used += '.' + frag try: found = getattr(found, frag) except AttributeError: self.importer(used) found = getattr(found, frag) return found except ImportError: e, tb = sys.exc_info()[1:] v = ValueError('Cannot resolve %r: %s' % (s, e)) v.__cause__, v.__traceback__ = e, tb raise v def ext_convert(self, value): """Default converter for the ext:// protocol.""" return self.resolve(value) def cfg_convert(self, value): """Default converter for the cfg:// protocol.""" rest = value m = self.WORD_PATTERN.match(rest) if m is None: raise ValueError("Unable to convert %r" % value) else: rest = rest[m.end():] d = self.config[m.groups()[0]] while rest: m = self.DOT_PATTERN.match(rest) if m: d = d[m.groups()[0]] else: m = self.INDEX_PATTERN.match(rest) if m: idx = m.groups()[0] if not self.DIGIT_PATTERN.match(idx): d = d[idx] else: try: n = int( idx ) # try as number first (most likely) d = d[n] except TypeError: d = d[idx] if m: rest = rest[m.end():] else: raise ValueError('Unable to convert ' '%r at %r' % (value, rest)) # rest should be empty return d def convert(self, value): """ Convert values to an appropriate type. dicts, lists and tuples are replaced by their converting alternatives. Strings are checked to see if they have a conversion format and are converted if they do. """ if not isinstance(value, ConvertingDict) and isinstance( value, dict): value = ConvertingDict(value) value.configurator = self elif not isinstance(value, ConvertingList) and isinstance( value, list): value = ConvertingList(value) value.configurator = self elif not isinstance(value, ConvertingTuple) and isinstance(value, tuple): value = ConvertingTuple(value) value.configurator = self elif isinstance(value, string_types): m = self.CONVERT_PATTERN.match(value) if m: d = m.groupdict() prefix = d['prefix'] converter = self.value_converters.get(prefix, None) if converter: suffix = d['suffix'] converter = getattr(self, converter) value = converter(suffix) return value def configure_custom(self, config): """Configure an object with a user-supplied factory.""" c = config.pop('()') if not callable(c): c = self.resolve(c) props = config.pop('.', None) # Check for valid identifiers kwargs = dict([(k, config[k]) for k in config if valid_ident(k)]) result = c(**kwargs) if props: for name, value in props.items(): setattr(result, name, value) return result def as_tuple(self, value): """Utility function which converts lists to tuples.""" if isinstance(value, list): value = tuple(value) return value ================================================ FILE: src/pip/_vendor/distlib/resources.py ================================================ # -*- coding: utf-8 -*- # # Copyright (C) 2013-2017 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # from __future__ import unicode_literals import bisect import io import logging import os import pkgutil import sys import types import zipimport from . import DistlibException from .util import cached_property, get_cache_base, Cache logger = logging.getLogger(__name__) cache = None # created when needed class ResourceCache(Cache): def __init__(self, base=None): if base is None: # Use native string to avoid issues on 2.x: see Python #20140. base = os.path.join(get_cache_base(), str('resource-cache')) super(ResourceCache, self).__init__(base) def is_stale(self, resource, path): """ Is the cache stale for the given resource? :param resource: The :class:`Resource` being cached. :param path: The path of the resource in the cache. :return: True if the cache is stale. """ # Cache invalidation is a hard problem :-) return True def get(self, resource): """ Get a resource into the cache, :param resource: A :class:`Resource` instance. :return: The pathname of the resource in the cache. """ prefix, path = resource.finder.get_cache_info(resource) if prefix is None: result = path else: result = os.path.join(self.base, self.prefix_to_dir(prefix), path) dirname = os.path.dirname(result) if not os.path.isdir(dirname): os.makedirs(dirname) if not os.path.exists(result): stale = True else: stale = self.is_stale(resource, path) if stale: # write the bytes of the resource to the cache location with open(result, 'wb') as f: f.write(resource.bytes) return result class ResourceBase(object): def __init__(self, finder, name): self.finder = finder self.name = name class Resource(ResourceBase): """ A class representing an in-package resource, such as a data file. This is not normally instantiated by user code, but rather by a :class:`ResourceFinder` which manages the resource. """ is_container = False # Backwards compatibility def as_stream(self): """ Get the resource as a stream. This is not a property to make it obvious that it returns a new stream each time. """ return self.finder.get_stream(self) @cached_property def file_path(self): global cache if cache is None: cache = ResourceCache() return cache.get(self) @cached_property def bytes(self): return self.finder.get_bytes(self) @cached_property def size(self): return self.finder.get_size(self) class ResourceContainer(ResourceBase): is_container = True # Backwards compatibility @cached_property def resources(self): return self.finder.get_resources(self) class ResourceFinder(object): """ Resource finder for file system resources. """ if sys.platform.startswith('java'): skipped_extensions = ('.pyc', '.pyo', '.class') else: skipped_extensions = ('.pyc', '.pyo') def __init__(self, module): self.module = module self.loader = getattr(module, '__loader__', None) self.base = os.path.dirname(getattr(module, '__file__', '')) def _adjust_path(self, path): return os.path.realpath(path) def _make_path(self, resource_name): # Issue #50: need to preserve type of path on Python 2.x # like os.path._get_sep if isinstance(resource_name, bytes): # should only happen on 2.x sep = b'/' else: sep = '/' parts = resource_name.split(sep) parts.insert(0, self.base) result = os.path.join(*parts) return self._adjust_path(result) def _find(self, path): return os.path.exists(path) def get_cache_info(self, resource): return None, resource.path def find(self, resource_name): path = self._make_path(resource_name) if not self._find(path): result = None else: if self._is_directory(path): result = ResourceContainer(self, resource_name) else: result = Resource(self, resource_name) result.path = path return result def get_stream(self, resource): return open(resource.path, 'rb') def get_bytes(self, resource): with open(resource.path, 'rb') as f: return f.read() def get_size(self, resource): return os.path.getsize(resource.path) def get_resources(self, resource): def allowed(f): return (f != '__pycache__' and not f.endswith(self.skipped_extensions)) return set([f for f in os.listdir(resource.path) if allowed(f)]) def is_container(self, resource): return self._is_directory(resource.path) _is_directory = staticmethod(os.path.isdir) def iterator(self, resource_name): resource = self.find(resource_name) if resource is not None: todo = [resource] while todo: resource = todo.pop(0) yield resource if resource.is_container: rname = resource.name for name in resource.resources: if not rname: new_name = name else: new_name = '/'.join([rname, name]) child = self.find(new_name) if child.is_container: todo.append(child) else: yield child class ZipResourceFinder(ResourceFinder): """ Resource finder for resources in .zip files. """ def __init__(self, module): super(ZipResourceFinder, self).__init__(module) archive = self.loader.archive self.prefix_len = 1 + len(archive) # PyPy doesn't have a _files attr on zipimporter, and you can't set one if hasattr(self.loader, '_files'): self._files = self.loader._files else: self._files = zipimport._zip_directory_cache[archive] self.index = sorted(self._files) def _adjust_path(self, path): return path def _find(self, path): path = path[self.prefix_len:] if path in self._files: result = True else: if path and path[-1] != os.sep: path = path + os.sep i = bisect.bisect(self.index, path) try: result = self.index[i].startswith(path) except IndexError: result = False if not result: logger.debug('_find failed: %r %r', path, self.loader.prefix) else: logger.debug('_find worked: %r %r', path, self.loader.prefix) return result def get_cache_info(self, resource): prefix = self.loader.archive path = resource.path[1 + len(prefix):] return prefix, path def get_bytes(self, resource): return self.loader.get_data(resource.path) def get_stream(self, resource): return io.BytesIO(self.get_bytes(resource)) def get_size(self, resource): path = resource.path[self.prefix_len:] return self._files[path][3] def get_resources(self, resource): path = resource.path[self.prefix_len:] if path and path[-1] != os.sep: path += os.sep plen = len(path) result = set() i = bisect.bisect(self.index, path) while i < len(self.index): if not self.index[i].startswith(path): break s = self.index[i][plen:] result.add(s.split(os.sep, 1)[0]) # only immediate children i += 1 return result def _is_directory(self, path): path = path[self.prefix_len:] if path and path[-1] != os.sep: path += os.sep i = bisect.bisect(self.index, path) try: result = self.index[i].startswith(path) except IndexError: result = False return result _finder_registry = { type(None): ResourceFinder, zipimport.zipimporter: ZipResourceFinder } try: # In Python 3.6, _frozen_importlib -> _frozen_importlib_external try: import _frozen_importlib_external as _fi except ImportError: import _frozen_importlib as _fi _finder_registry[_fi.SourceFileLoader] = ResourceFinder _finder_registry[_fi.FileFinder] = ResourceFinder # See issue #146 _finder_registry[_fi.SourcelessFileLoader] = ResourceFinder del _fi except (ImportError, AttributeError): pass def register_finder(loader, finder_maker): _finder_registry[type(loader)] = finder_maker _finder_cache = {} def finder(package): """ Return a resource finder for a package. :param package: The name of the package. :return: A :class:`ResourceFinder` instance for the package. """ if package in _finder_cache: result = _finder_cache[package] else: if package not in sys.modules: __import__(package) module = sys.modules[package] path = getattr(module, '__path__', None) if path is None: raise DistlibException('You cannot get a finder for a module, ' 'only for a package') loader = getattr(module, '__loader__', None) finder_maker = _finder_registry.get(type(loader)) if finder_maker is None: raise DistlibException('Unable to locate finder for %r' % package) result = finder_maker(module) _finder_cache[package] = result return result _dummy_module = types.ModuleType(str('__dummy__')) def finder_for_path(path): """ Return a resource finder for a path, which should represent a container. :param path: The path. :return: A :class:`ResourceFinder` instance for the path. """ result = None # calls any path hooks, gets importer into cache pkgutil.get_importer(path) loader = sys.path_importer_cache.get(path) finder = _finder_registry.get(type(loader)) if finder: module = _dummy_module module.__file__ = os.path.join(path, '') module.__loader__ = loader result = finder(module) return result ================================================ FILE: src/pip/_vendor/distlib/scripts.py ================================================ # -*- coding: utf-8 -*- # # Copyright (C) 2013-2023 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # from io import BytesIO import logging import os import re import struct import sys import time from zipfile import ZipInfo from .compat import sysconfig, detect_encoding, ZipFile from .resources import finder from .util import (FileOperator, get_export_entry, convert_path, get_executable, get_platform, in_venv) logger = logging.getLogger(__name__) _DEFAULT_MANIFEST = ''' '''.strip() # check if Python is called on the first line with this expression FIRST_LINE_RE = re.compile(b'^#!.*pythonw?[0-9.]*([ \t].*)?$') SCRIPT_TEMPLATE = r'''# -*- coding: utf-8 -*- import re import sys if __name__ == '__main__': from %(module)s import %(import_name)s sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(%(func)s()) ''' # Pre-fetch the contents of all executable wrapper stubs. # This is to address https://github.com/pypa/pip/issues/12666. # When updating pip, we rename the old pip in place before installing the # new version. If we try to fetch a wrapper *after* that rename, the finder # machinery will be confused as the package is no longer available at the # location where it was imported from. So we load everything into memory in # advance. if os.name == 'nt' or (os.name == 'java' and os._name == 'nt'): # Issue 31: don't hardcode an absolute package name, but # determine it relative to the current package DISTLIB_PACKAGE = __name__.rsplit('.', 1)[0] WRAPPERS = { r.name: r.bytes for r in finder(DISTLIB_PACKAGE).iterator("") if r.name.endswith(".exe") } def enquote_executable(executable): if ' ' in executable: # make sure we quote only the executable in case of env # for example /usr/bin/env "/dir with spaces/bin/jython" # instead of "/usr/bin/env /dir with spaces/bin/jython" # otherwise whole if executable.startswith('/usr/bin/env '): env, _executable = executable.split(' ', 1) if ' ' in _executable and not _executable.startswith('"'): executable = '%s "%s"' % (env, _executable) else: if not executable.startswith('"'): executable = '"%s"' % executable return executable # Keep the old name around (for now), as there is at least one project using it! _enquote_executable = enquote_executable class ScriptMaker(object): """ A class to copy or create scripts from source scripts or callable specifications. """ script_template = SCRIPT_TEMPLATE executable = None # for shebangs def __init__(self, source_dir, target_dir, add_launchers=True, dry_run=False, fileop=None): self.source_dir = source_dir self.target_dir = target_dir self.add_launchers = add_launchers self.force = False self.clobber = False # It only makes sense to set mode bits on POSIX. self.set_mode = (os.name == 'posix') or (os.name == 'java' and os._name == 'posix') self.variants = set(('', 'X.Y')) self._fileop = fileop or FileOperator(dry_run) self._is_nt = os.name == 'nt' or (os.name == 'java' and os._name == 'nt') self.version_info = sys.version_info def _get_alternate_executable(self, executable, options): if options.get('gui', False) and self._is_nt: # pragma: no cover dn, fn = os.path.split(executable) fn = fn.replace('python', 'pythonw') executable = os.path.join(dn, fn) return executable if sys.platform.startswith('java'): # pragma: no cover def _is_shell(self, executable): """ Determine if the specified executable is a script (contains a #! line) """ try: with open(executable) as fp: return fp.read(2) == '#!' except (OSError, IOError): logger.warning('Failed to open %s', executable) return False def _fix_jython_executable(self, executable): if self._is_shell(executable): # Workaround for Jython is not needed on Linux systems. import java if java.lang.System.getProperty('os.name') == 'Linux': return executable elif executable.lower().endswith('jython.exe'): # Use wrapper exe for Jython on Windows return executable return '/usr/bin/env %s' % executable def _build_shebang(self, executable, post_interp): """ Build a shebang line. In the simple case (on Windows, or a shebang line which is not too long or contains spaces) use a simple formulation for the shebang. Otherwise, use /bin/sh as the executable, with a contrived shebang which allows the script to run either under Python or sh, using suitable quoting. Thanks to Harald Nordgren for his input. See also: http://www.in-ulm.de/~mascheck/various/shebang/#length https://hg.mozilla.org/mozilla-central/file/tip/mach """ if os.name != 'posix': simple_shebang = True elif getattr(sys, "cross_compiling", False): # In a cross-compiling environment, the shebang will likely be a # script; this *must* be invoked with the "safe" version of the # shebang, or else using os.exec() to run the entry script will # fail, raising "OSError 8 [Errno 8] Exec format error". simple_shebang = False else: # Add 3 for '#!' prefix and newline suffix. shebang_length = len(executable) + len(post_interp) + 3 if sys.platform == 'darwin': max_shebang_length = 512 else: max_shebang_length = 127 simple_shebang = ((b' ' not in executable) and (shebang_length <= max_shebang_length)) if simple_shebang: result = b'#!' + executable + post_interp + b'\n' else: result = b'#!/bin/sh\n' result += b"'''exec' " + executable + post_interp + b' "$0" "$@"\n' result += b"' '''\n" return result def _get_shebang(self, encoding, post_interp=b'', options=None): enquote = True if self.executable: executable = self.executable enquote = False # assume this will be taken care of elif not sysconfig.is_python_build(): executable = get_executable() elif in_venv(): # pragma: no cover executable = os.path.join(sysconfig.get_path('scripts'), 'python%s' % sysconfig.get_config_var('EXE')) else: # pragma: no cover if os.name == 'nt': # for Python builds from source on Windows, no Python executables with # a version suffix are created, so we use python.exe executable = os.path.join(sysconfig.get_config_var('BINDIR'), 'python%s' % (sysconfig.get_config_var('EXE'))) else: executable = os.path.join( sysconfig.get_config_var('BINDIR'), 'python%s%s' % (sysconfig.get_config_var('VERSION'), sysconfig.get_config_var('EXE'))) if options: executable = self._get_alternate_executable(executable, options) if sys.platform.startswith('java'): # pragma: no cover executable = self._fix_jython_executable(executable) # Normalise case for Windows - COMMENTED OUT # executable = os.path.normcase(executable) # N.B. The normalising operation above has been commented out: See # issue #124. Although paths in Windows are generally case-insensitive, # they aren't always. For example, a path containing a ẞ (which is a # LATIN CAPITAL LETTER SHARP S - U+1E9E) is normcased to ß (which is a # LATIN SMALL LETTER SHARP S' - U+00DF). The two are not considered by # Windows as equivalent in path names. # If the user didn't specify an executable, it may be necessary to # cater for executable paths with spaces (not uncommon on Windows) if enquote: executable = enquote_executable(executable) # Issue #51: don't use fsencode, since we later try to # check that the shebang is decodable using utf-8. executable = executable.encode('utf-8') # in case of IronPython, play safe and enable frames support if (sys.platform == 'cli' and '-X:Frames' not in post_interp and '-X:FullFrames' not in post_interp): # pragma: no cover post_interp += b' -X:Frames' shebang = self._build_shebang(executable, post_interp) # Python parser starts to read a script using UTF-8 until # it gets a #coding:xxx cookie. The shebang has to be the # first line of a file, the #coding:xxx cookie cannot be # written before. So the shebang has to be decodable from # UTF-8. try: shebang.decode('utf-8') except UnicodeDecodeError: # pragma: no cover raise ValueError('The shebang (%r) is not decodable from utf-8' % shebang) # If the script is encoded to a custom encoding (use a # #coding:xxx cookie), the shebang has to be decodable from # the script encoding too. if encoding != 'utf-8': try: shebang.decode(encoding) except UnicodeDecodeError: # pragma: no cover raise ValueError('The shebang (%r) is not decodable ' 'from the script encoding (%r)' % (shebang, encoding)) return shebang def _get_script_text(self, entry): return self.script_template % dict( module=entry.prefix, import_name=entry.suffix.split('.')[0], func=entry.suffix) manifest = _DEFAULT_MANIFEST def get_manifest(self, exename): base = os.path.basename(exename) return self.manifest % base def _write_script(self, names, shebang, script_bytes, filenames, ext): use_launcher = self.add_launchers and self._is_nt if not use_launcher: script_bytes = shebang + script_bytes else: # pragma: no cover if ext == 'py': launcher = self._get_launcher('t') else: launcher = self._get_launcher('w') stream = BytesIO() with ZipFile(stream, 'w') as zf: source_date_epoch = os.environ.get('SOURCE_DATE_EPOCH') if source_date_epoch: date_time = time.gmtime(int(source_date_epoch))[:6] zinfo = ZipInfo(filename='__main__.py', date_time=date_time) zf.writestr(zinfo, script_bytes) else: zf.writestr('__main__.py', script_bytes) zip_data = stream.getvalue() script_bytes = launcher + shebang + zip_data for name in names: outname = os.path.join(self.target_dir, name) if use_launcher: # pragma: no cover n, e = os.path.splitext(outname) if e.startswith('.py'): outname = n outname = '%s.exe' % outname try: self._fileop.write_binary_file(outname, script_bytes) except Exception: # Failed writing an executable - it might be in use. logger.warning('Failed to write executable - trying to ' 'use .deleteme logic') dfname = '%s.deleteme' % outname if os.path.exists(dfname): os.remove(dfname) # Not allowed to fail here os.rename(outname, dfname) # nor here self._fileop.write_binary_file(outname, script_bytes) logger.debug('Able to replace executable using ' '.deleteme logic') try: os.remove(dfname) except Exception: pass # still in use - ignore error else: if self._is_nt and not outname.endswith('.' + ext): # pragma: no cover outname = '%s.%s' % (outname, ext) if os.path.exists(outname) and not self.clobber: logger.warning('Skipping existing file %s', outname) continue self._fileop.write_binary_file(outname, script_bytes) if self.set_mode: self._fileop.set_executable_mode([outname]) filenames.append(outname) variant_separator = '-' def get_script_filenames(self, name): result = set() if '' in self.variants: result.add(name) if 'X' in self.variants: result.add('%s%s' % (name, self.version_info[0])) if 'X.Y' in self.variants: result.add('%s%s%s.%s' % (name, self.variant_separator, self.version_info[0], self.version_info[1])) return result def _make_script(self, entry, filenames, options=None): post_interp = b'' if options: args = options.get('interpreter_args', []) if args: args = ' %s' % ' '.join(args) post_interp = args.encode('utf-8') shebang = self._get_shebang('utf-8', post_interp, options=options) script = self._get_script_text(entry).encode('utf-8') scriptnames = self.get_script_filenames(entry.name) if options and options.get('gui', False): ext = 'pyw' else: ext = 'py' self._write_script(scriptnames, shebang, script, filenames, ext) def _copy_script(self, script, filenames): adjust = False script = os.path.join(self.source_dir, convert_path(script)) outname = os.path.join(self.target_dir, os.path.basename(script)) if not self.force and not self._fileop.newer(script, outname): logger.debug('not copying %s (up-to-date)', script) return # Always open the file, but ignore failures in dry-run mode -- # that way, we'll get accurate feedback if we can read the # script. try: f = open(script, 'rb') except IOError: # pragma: no cover if not self.dry_run: raise f = None else: first_line = f.readline() if not first_line: # pragma: no cover logger.warning('%s is an empty file (skipping)', script) return match = FIRST_LINE_RE.match(first_line.replace(b'\r\n', b'\n')) if match: adjust = True post_interp = match.group(1) or b'' if not adjust: if f: f.close() self._fileop.copy_file(script, outname) if self.set_mode: self._fileop.set_executable_mode([outname]) filenames.append(outname) else: logger.info('copying and adjusting %s -> %s', script, self.target_dir) if not self._fileop.dry_run: encoding, lines = detect_encoding(f.readline) f.seek(0) shebang = self._get_shebang(encoding, post_interp) if b'pythonw' in first_line: # pragma: no cover ext = 'pyw' else: ext = 'py' n = os.path.basename(outname) self._write_script([n], shebang, f.read(), filenames, ext) if f: f.close() @property def dry_run(self): return self._fileop.dry_run @dry_run.setter def dry_run(self, value): self._fileop.dry_run = value if os.name == 'nt' or (os.name == 'java' and os._name == 'nt'): # pragma: no cover # Executable launcher support. # Launchers are from https://bitbucket.org/vinay.sajip/simple_launcher/ def _get_launcher(self, kind): if struct.calcsize('P') == 8: # 64-bit bits = '64' else: bits = '32' platform_suffix = '-arm' if get_platform() == 'win-arm64' else '' name = '%s%s%s.exe' % (kind, bits, platform_suffix) if name not in WRAPPERS: msg = ('Unable to find resource %s in package %s' % (name, DISTLIB_PACKAGE)) raise ValueError(msg) return WRAPPERS[name] # Public API follows def make(self, specification, options=None): """ Make a script. :param specification: The specification, which is either a valid export entry specification (to make a script from a callable) or a filename (to make a script by copying from a source location). :param options: A dictionary of options controlling script generation. :return: A list of all absolute pathnames written to. """ filenames = [] entry = get_export_entry(specification) if entry is None: self._copy_script(specification, filenames) else: self._make_script(entry, filenames, options=options) return filenames def make_multiple(self, specifications, options=None): """ Take a list of specifications and make scripts from them, :param specifications: A list of specifications. :return: A list of all absolute pathnames written to, """ filenames = [] for specification in specifications: filenames.extend(self.make(specification, options)) return filenames ================================================ FILE: src/pip/_vendor/distlib/util.py ================================================ # # Copyright (C) 2012-2023 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket try: import ssl except ImportError: # pragma: no cover ssl = None import subprocess import sys import tarfile import tempfile import textwrap try: import threading except ImportError: # pragma: no cover import dummy_threading as threading import time from . import DistlibException from .compat import (string_types, text_type, shutil, raw_input, StringIO, cache_from_source, urlopen, urljoin, httplib, xmlrpclib, HTTPHandler, BaseConfigurator, valid_ident, Container, configparser, URLError, ZipFile, fsdecode, unquote, urlparse) logger = logging.getLogger(__name__) # # Requirement parsing code as per PEP 508 # IDENTIFIER = re.compile(r'^([\w\.-]+)\s*') VERSION_IDENTIFIER = re.compile(r'^([\w\.*+-]+)\s*') COMPARE_OP = re.compile(r'^(<=?|>=?|={2,3}|[~!]=)\s*') MARKER_OP = re.compile(r'^((<=?)|(>=?)|={2,3}|[~!]=|in|not\s+in)\s*') OR = re.compile(r'^or\b\s*') AND = re.compile(r'^and\b\s*') NON_SPACE = re.compile(r'(\S+)\s*') STRING_CHUNK = re.compile(r'([\s\w\.{}()*+#:;,/?!~`@$%^&=|<>\[\]-]+)') def parse_marker(marker_string): """ Parse a marker string and return a dictionary containing a marker expression. The dictionary will contain keys "op", "lhs" and "rhs" for non-terminals in the expression grammar, or strings. A string contained in quotes is to be interpreted as a literal string, and a string not contained in quotes is a variable (such as os_name). """ def marker_var(remaining): # either identifier, or literal string m = IDENTIFIER.match(remaining) if m: result = m.groups()[0] remaining = remaining[m.end():] elif not remaining: raise SyntaxError('unexpected end of input') else: q = remaining[0] if q not in '\'"': raise SyntaxError('invalid expression: %s' % remaining) oq = '\'"'.replace(q, '') remaining = remaining[1:] parts = [q] while remaining: # either a string chunk, or oq, or q to terminate if remaining[0] == q: break elif remaining[0] == oq: parts.append(oq) remaining = remaining[1:] else: m = STRING_CHUNK.match(remaining) if not m: raise SyntaxError('error in string literal: %s' % remaining) parts.append(m.groups()[0]) remaining = remaining[m.end():] else: s = ''.join(parts) raise SyntaxError('unterminated string: %s' % s) parts.append(q) result = ''.join(parts) remaining = remaining[1:].lstrip() # skip past closing quote return result, remaining def marker_expr(remaining): if remaining and remaining[0] == '(': result, remaining = marker(remaining[1:].lstrip()) if remaining[0] != ')': raise SyntaxError('unterminated parenthesis: %s' % remaining) remaining = remaining[1:].lstrip() else: lhs, remaining = marker_var(remaining) while remaining: m = MARKER_OP.match(remaining) if not m: break op = m.groups()[0] remaining = remaining[m.end():] rhs, remaining = marker_var(remaining) lhs = {'op': op, 'lhs': lhs, 'rhs': rhs} result = lhs return result, remaining def marker_and(remaining): lhs, remaining = marker_expr(remaining) while remaining: m = AND.match(remaining) if not m: break remaining = remaining[m.end():] rhs, remaining = marker_expr(remaining) lhs = {'op': 'and', 'lhs': lhs, 'rhs': rhs} return lhs, remaining def marker(remaining): lhs, remaining = marker_and(remaining) while remaining: m = OR.match(remaining) if not m: break remaining = remaining[m.end():] rhs, remaining = marker_and(remaining) lhs = {'op': 'or', 'lhs': lhs, 'rhs': rhs} return lhs, remaining return marker(marker_string) def parse_requirement(req): """ Parse a requirement passed in as a string. Return a Container whose attributes contain the various parts of the requirement. """ remaining = req.strip() if not remaining or remaining.startswith('#'): return None m = IDENTIFIER.match(remaining) if not m: raise SyntaxError('name expected: %s' % remaining) distname = m.groups()[0] remaining = remaining[m.end():] extras = mark_expr = versions = uri = None if remaining and remaining[0] == '[': i = remaining.find(']', 1) if i < 0: raise SyntaxError('unterminated extra: %s' % remaining) s = remaining[1:i] remaining = remaining[i + 1:].lstrip() extras = [] while s: m = IDENTIFIER.match(s) if not m: raise SyntaxError('malformed extra: %s' % s) extras.append(m.groups()[0]) s = s[m.end():] if not s: break if s[0] != ',': raise SyntaxError('comma expected in extras: %s' % s) s = s[1:].lstrip() if not extras: extras = None if remaining: if remaining[0] == '@': # it's a URI remaining = remaining[1:].lstrip() m = NON_SPACE.match(remaining) if not m: raise SyntaxError('invalid URI: %s' % remaining) uri = m.groups()[0] t = urlparse(uri) # there are issues with Python and URL parsing, so this test # is a bit crude. See bpo-20271, bpo-23505. Python doesn't # always parse invalid URLs correctly - it should raise # exceptions for malformed URLs if not (t.scheme and t.netloc): raise SyntaxError('Invalid URL: %s' % uri) remaining = remaining[m.end():].lstrip() else: def get_versions(ver_remaining): """ Return a list of operator, version tuples if any are specified, else None. """ m = COMPARE_OP.match(ver_remaining) versions = None if m: versions = [] while True: op = m.groups()[0] ver_remaining = ver_remaining[m.end():] m = VERSION_IDENTIFIER.match(ver_remaining) if not m: raise SyntaxError('invalid version: %s' % ver_remaining) v = m.groups()[0] versions.append((op, v)) ver_remaining = ver_remaining[m.end():] if not ver_remaining or ver_remaining[0] != ',': break ver_remaining = ver_remaining[1:].lstrip() # Some packages have a trailing comma which would break things # See issue #148 if not ver_remaining: break m = COMPARE_OP.match(ver_remaining) if not m: raise SyntaxError('invalid constraint: %s' % ver_remaining) if not versions: versions = None return versions, ver_remaining if remaining[0] != '(': versions, remaining = get_versions(remaining) else: i = remaining.find(')', 1) if i < 0: raise SyntaxError('unterminated parenthesis: %s' % remaining) s = remaining[1:i] remaining = remaining[i + 1:].lstrip() # As a special diversion from PEP 508, allow a version number # a.b.c in parentheses as a synonym for ~= a.b.c (because this # is allowed in earlier PEPs) if COMPARE_OP.match(s): versions, _ = get_versions(s) else: m = VERSION_IDENTIFIER.match(s) if not m: raise SyntaxError('invalid constraint: %s' % s) v = m.groups()[0] s = s[m.end():].lstrip() if s: raise SyntaxError('invalid constraint: %s' % s) versions = [('~=', v)] if remaining: if remaining[0] != ';': raise SyntaxError('invalid requirement: %s' % remaining) remaining = remaining[1:].lstrip() mark_expr, remaining = parse_marker(remaining) if remaining and remaining[0] != '#': raise SyntaxError('unexpected trailing data: %s' % remaining) if not versions: rs = distname else: rs = '%s %s' % (distname, ', '.join(['%s %s' % con for con in versions])) return Container(name=distname, extras=extras, constraints=versions, marker=mark_expr, url=uri, requirement=rs) def get_resources_dests(resources_root, rules): """Find destinations for resources files""" def get_rel_path(root, path): # normalizes and returns a lstripped-/-separated path root = root.replace(os.path.sep, '/') path = path.replace(os.path.sep, '/') assert path.startswith(root) return path[len(root):].lstrip('/') destinations = {} for base, suffix, dest in rules: prefix = os.path.join(resources_root, base) for abs_base in iglob(prefix): abs_glob = os.path.join(abs_base, suffix) for abs_path in iglob(abs_glob): resource_file = get_rel_path(resources_root, abs_path) if dest is None: # remove the entry if it was here destinations.pop(resource_file, None) else: rel_path = get_rel_path(abs_base, abs_path) rel_dest = dest.replace(os.path.sep, '/').rstrip('/') destinations[resource_file] = rel_dest + '/' + rel_path return destinations def in_venv(): if hasattr(sys, 'real_prefix'): # virtualenv venvs result = True else: # PEP 405 venvs result = sys.prefix != getattr(sys, 'base_prefix', sys.prefix) return result def get_executable(): # The __PYVENV_LAUNCHER__ dance is apparently no longer needed, as # changes to the stub launcher mean that sys.executable always points # to the stub on OS X # if sys.platform == 'darwin' and ('__PYVENV_LAUNCHER__' # in os.environ): # result = os.environ['__PYVENV_LAUNCHER__'] # else: # result = sys.executable # return result # Avoid normcasing: see issue #143 # result = os.path.normcase(sys.executable) result = sys.executable if not isinstance(result, text_type): result = fsdecode(result) return result def proceed(prompt, allowed_chars, error_prompt=None, default=None): p = prompt while True: s = raw_input(p) p = prompt if not s and default: s = default if s: c = s[0].lower() if c in allowed_chars: break if error_prompt: p = '%c: %s\n%s' % (c, error_prompt, prompt) return c def extract_by_key(d, keys): if isinstance(keys, string_types): keys = keys.split() result = {} for key in keys: if key in d: result[key] = d[key] return result def read_exports(stream): if sys.version_info[0] >= 3: # needs to be a text stream stream = codecs.getreader('utf-8')(stream) # Try to load as JSON, falling back on legacy format data = stream.read() stream = StringIO(data) try: jdata = json.load(stream) result = jdata['extensions']['python.exports']['exports'] for group, entries in result.items(): for k, v in entries.items(): s = '%s = %s' % (k, v) entry = get_export_entry(s) assert entry is not None entries[k] = entry return result except Exception: stream.seek(0, 0) def read_stream(cp, stream): if hasattr(cp, 'read_file'): cp.read_file(stream) else: cp.readfp(stream) cp = configparser.ConfigParser() try: read_stream(cp, stream) except configparser.MissingSectionHeaderError: stream.close() data = textwrap.dedent(data) stream = StringIO(data) read_stream(cp, stream) result = {} for key in cp.sections(): result[key] = entries = {} for name, value in cp.items(key): s = '%s = %s' % (name, value) entry = get_export_entry(s) assert entry is not None # entry.dist = self entries[name] = entry return result def write_exports(exports, stream): if sys.version_info[0] >= 3: # needs to be a text stream stream = codecs.getwriter('utf-8')(stream) cp = configparser.ConfigParser() for k, v in exports.items(): # TODO check k, v for valid values cp.add_section(k) for entry in v.values(): if entry.suffix is None: s = entry.prefix else: s = '%s:%s' % (entry.prefix, entry.suffix) if entry.flags: s = '%s [%s]' % (s, ', '.join(entry.flags)) cp.set(k, entry.name, s) cp.write(stream) @contextlib.contextmanager def tempdir(): td = tempfile.mkdtemp() try: yield td finally: shutil.rmtree(td) @contextlib.contextmanager def chdir(d): cwd = os.getcwd() try: os.chdir(d) yield finally: os.chdir(cwd) @contextlib.contextmanager def socket_timeout(seconds=15): cto = socket.getdefaulttimeout() try: socket.setdefaulttimeout(seconds) yield finally: socket.setdefaulttimeout(cto) class cached_property(object): def __init__(self, func): self.func = func # for attr in ('__name__', '__module__', '__doc__'): # setattr(self, attr, getattr(func, attr, None)) def __get__(self, obj, cls=None): if obj is None: return self value = self.func(obj) object.__setattr__(obj, self.func.__name__, value) # obj.__dict__[self.func.__name__] = value = self.func(obj) return value def convert_path(pathname): """Return 'pathname' as a name that will work on the native filesystem. The path is split on '/' and put back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. """ if os.sep == '/': return pathname if not pathname: return pathname if pathname[0] == '/': raise ValueError("path '%s' cannot be absolute" % pathname) if pathname[-1] == '/': raise ValueError("path '%s' cannot end with '/'" % pathname) paths = pathname.split('/') while os.curdir in paths: paths.remove(os.curdir) if not paths: return os.curdir return os.path.join(*paths) class FileOperator(object): def __init__(self, dry_run=False): self.dry_run = dry_run self.ensured = set() self._init_record() def _init_record(self): self.record = False self.files_written = set() self.dirs_created = set() def record_as_written(self, path): if self.record: self.files_written.add(path) def newer(self, source, target): """Tell if the target is newer than the source. Returns true if 'source' exists and is more recently modified than 'target', or if 'source' exists and 'target' doesn't. Returns false if both exist and 'target' is the same age or younger than 'source'. Raise PackagingFileError if 'source' does not exist. Note that this test is not very accurate: files created in the same second will have the same "age". """ if not os.path.exists(source): raise DistlibException("file '%r' does not exist" % os.path.abspath(source)) if not os.path.exists(target): return True return os.stat(source).st_mtime > os.stat(target).st_mtime def copy_file(self, infile, outfile, check=True): """Copy a file respecting dry-run and force flags. """ self.ensure_dir(os.path.dirname(outfile)) logger.info('Copying %s to %s', infile, outfile) if not self.dry_run: msg = None if check: if os.path.islink(outfile): msg = '%s is a symlink' % outfile elif os.path.exists(outfile) and not os.path.isfile(outfile): msg = '%s is a non-regular file' % outfile if msg: raise ValueError(msg + ' which would be overwritten') shutil.copyfile(infile, outfile) self.record_as_written(outfile) def copy_stream(self, instream, outfile, encoding=None): assert not os.path.isdir(outfile) self.ensure_dir(os.path.dirname(outfile)) logger.info('Copying stream %s to %s', instream, outfile) if not self.dry_run: if encoding is None: outstream = open(outfile, 'wb') else: outstream = codecs.open(outfile, 'w', encoding=encoding) try: shutil.copyfileobj(instream, outstream) finally: outstream.close() self.record_as_written(outfile) def write_binary_file(self, path, data): self.ensure_dir(os.path.dirname(path)) if not self.dry_run: if os.path.exists(path): os.remove(path) with open(path, 'wb') as f: f.write(data) self.record_as_written(path) def write_text_file(self, path, data, encoding): self.write_binary_file(path, data.encode(encoding)) def set_mode(self, bits, mask, files): if os.name == 'posix' or (os.name == 'java' and os._name == 'posix'): # Set the executable bits (owner, group, and world) on # all the files specified. for f in files: if self.dry_run: logger.info("changing mode of %s", f) else: mode = (os.stat(f).st_mode | bits) & mask logger.info("changing mode of %s to %o", f, mode) os.chmod(f, mode) set_executable_mode = lambda s, f: s.set_mode(0o555, 0o7777, f) def ensure_dir(self, path): path = os.path.abspath(path) if path not in self.ensured and not os.path.exists(path): self.ensured.add(path) d, f = os.path.split(path) self.ensure_dir(d) logger.info('Creating %s' % path) if not self.dry_run: os.mkdir(path) if self.record: self.dirs_created.add(path) def byte_compile(self, path, optimize=False, force=False, prefix=None, hashed_invalidation=False): dpath = cache_from_source(path, not optimize) logger.info('Byte-compiling %s to %s', path, dpath) if not self.dry_run: if force or self.newer(path, dpath): if not prefix: diagpath = None else: assert path.startswith(prefix) diagpath = path[len(prefix):] compile_kwargs = {} if hashed_invalidation and hasattr(py_compile, 'PycInvalidationMode'): if not isinstance(hashed_invalidation, py_compile.PycInvalidationMode): hashed_invalidation = py_compile.PycInvalidationMode.CHECKED_HASH compile_kwargs['invalidation_mode'] = hashed_invalidation py_compile.compile(path, dpath, diagpath, True, **compile_kwargs) # raise error self.record_as_written(dpath) return dpath def ensure_removed(self, path): if os.path.exists(path): if os.path.isdir(path) and not os.path.islink(path): logger.debug('Removing directory tree at %s', path) if not self.dry_run: shutil.rmtree(path) if self.record: if path in self.dirs_created: self.dirs_created.remove(path) else: if os.path.islink(path): s = 'link' else: s = 'file' logger.debug('Removing %s %s', s, path) if not self.dry_run: os.remove(path) if self.record: if path in self.files_written: self.files_written.remove(path) def is_writable(self, path): result = False while not result: if os.path.exists(path): result = os.access(path, os.W_OK) break parent = os.path.dirname(path) if parent == path: break path = parent return result def commit(self): """ Commit recorded changes, turn off recording, return changes. """ assert self.record result = self.files_written, self.dirs_created self._init_record() return result def rollback(self): if not self.dry_run: for f in list(self.files_written): if os.path.exists(f): os.remove(f) # dirs should all be empty now, except perhaps for # __pycache__ subdirs # reverse so that subdirs appear before their parents dirs = sorted(self.dirs_created, reverse=True) for d in dirs: flist = os.listdir(d) if flist: assert flist == ['__pycache__'] sd = os.path.join(d, flist[0]) os.rmdir(sd) os.rmdir(d) # should fail if non-empty self._init_record() def resolve(module_name, dotted_path): if module_name in sys.modules: mod = sys.modules[module_name] else: mod = __import__(module_name) if dotted_path is None: result = mod else: parts = dotted_path.split('.') result = getattr(mod, parts.pop(0)) for p in parts: result = getattr(result, p) return result class ExportEntry(object): def __init__(self, name, prefix, suffix, flags): self.name = name self.prefix = prefix self.suffix = suffix self.flags = flags @cached_property def value(self): return resolve(self.prefix, self.suffix) def __repr__(self): # pragma: no cover return '' % (self.name, self.prefix, self.suffix, self.flags) def __eq__(self, other): if not isinstance(other, ExportEntry): result = False else: result = (self.name == other.name and self.prefix == other.prefix and self.suffix == other.suffix and self.flags == other.flags) return result __hash__ = object.__hash__ ENTRY_RE = re.compile( r'''(?P([^\[]\S*)) \s*=\s*(?P(\w+)([:\.]\w+)*) \s*(\[\s*(?P[\w-]+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])? ''', re.VERBOSE) def get_export_entry(specification): m = ENTRY_RE.search(specification) if not m: result = None if '[' in specification or ']' in specification: raise DistlibException("Invalid specification " "'%s'" % specification) else: d = m.groupdict() name = d['name'] path = d['callable'] colons = path.count(':') if colons == 0: prefix, suffix = path, None else: if colons != 1: raise DistlibException("Invalid specification " "'%s'" % specification) prefix, suffix = path.split(':') flags = d['flags'] if flags is None: if '[' in specification or ']' in specification: raise DistlibException("Invalid specification " "'%s'" % specification) flags = [] else: flags = [f.strip() for f in flags.split(',')] result = ExportEntry(name, prefix, suffix, flags) return result def get_cache_base(suffix=None): """ Return the default base location for distlib caches. If the directory does not exist, it is created. Use the suffix provided for the base directory, and default to '.distlib' if it isn't provided. On Windows, if LOCALAPPDATA is defined in the environment, then it is assumed to be a directory, and will be the parent directory of the result. On POSIX, and on Windows if LOCALAPPDATA is not defined, the user's home directory - using os.expanduser('~') - will be the parent directory of the result. The result is just the directory '.distlib' in the parent directory as determined above, or with the name specified with ``suffix``. """ if suffix is None: suffix = '.distlib' if os.name == 'nt' and 'LOCALAPPDATA' in os.environ: result = os.path.expandvars('$localappdata') else: # Assume posix, or old Windows result = os.path.expanduser('~') # we use 'isdir' instead of 'exists', because we want to # fail if there's a file with that name if os.path.isdir(result): usable = os.access(result, os.W_OK) if not usable: logger.warning('Directory exists but is not writable: %s', result) else: try: os.makedirs(result) usable = True except OSError: logger.warning('Unable to create %s', result, exc_info=True) usable = False if not usable: result = tempfile.mkdtemp() logger.warning('Default location unusable, using %s', result) return os.path.join(result, suffix) def path_to_cache_dir(path, use_abspath=True): """ Convert an absolute path to a directory name for use in a cache. The algorithm used is: #. On Windows, any ``':'`` in the drive is replaced with ``'---'``. #. Any occurrence of ``os.sep`` is replaced with ``'--'``. #. ``'.cache'`` is appended. """ d, p = os.path.splitdrive(os.path.abspath(path) if use_abspath else path) if d: d = d.replace(':', '---') p = p.replace(os.sep, '--') return d + p + '.cache' def ensure_slash(s): if not s.endswith('/'): return s + '/' return s def parse_credentials(netloc): username = password = None if '@' in netloc: prefix, netloc = netloc.rsplit('@', 1) if ':' not in prefix: username = prefix else: username, password = prefix.split(':', 1) if username: username = unquote(username) if password: password = unquote(password) return username, password, netloc def get_process_umask(): result = os.umask(0o22) os.umask(result) return result def is_string_sequence(seq): result = True i = None for i, s in enumerate(seq): if not isinstance(s, string_types): result = False break assert i is not None return result PROJECT_NAME_AND_VERSION = re.compile('([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-' '([a-z0-9_.+-]+)', re.I) PYTHON_VERSION = re.compile(r'-py(\d\.?\d?)') def split_filename(filename, project_name=None): """ Extract name, version, python version from a filename (no extension) Return name, version, pyver or None """ result = None pyver = None filename = unquote(filename).replace(' ', '-') m = PYTHON_VERSION.search(filename) if m: pyver = m.group(1) filename = filename[:m.start()] if project_name and len(filename) > len(project_name) + 1: m = re.match(re.escape(project_name) + r'\b', filename) if m: n = m.end() result = filename[:n], filename[n + 1:], pyver if result is None: m = PROJECT_NAME_AND_VERSION.match(filename) if m: result = m.group(1), m.group(3), pyver return result # Allow spaces in name because of legacy dists like "Twisted Core" NAME_VERSION_RE = re.compile(r'(?P[\w .-]+)\s*' r'\(\s*(?P[^\s)]+)\)$') def parse_name_and_version(p): """ A utility method used to get name and version from a string. From e.g. a Provides-Dist value. :param p: A value in a form 'foo (1.0)' :return: The name and version as a tuple. """ m = NAME_VERSION_RE.match(p) if not m: raise DistlibException('Ill-formed name/version string: \'%s\'' % p) d = m.groupdict() return d['name'].strip().lower(), d['ver'] def get_extras(requested, available): result = set() requested = set(requested or []) available = set(available or []) if '*' in requested: requested.remove('*') result |= available for r in requested: if r == '-': result.add(r) elif r.startswith('-'): unwanted = r[1:] if unwanted not in available: logger.warning('undeclared extra: %s' % unwanted) if unwanted in result: result.remove(unwanted) else: if r not in available: logger.warning('undeclared extra: %s' % r) result.add(r) return result # # Extended metadata functionality # def _get_external_data(url): result = {} try: # urlopen might fail if it runs into redirections, # because of Python issue #13696. Fixed in locators # using a custom redirect handler. resp = urlopen(url) headers = resp.info() ct = headers.get('Content-Type') if not ct.startswith('application/json'): logger.debug('Unexpected response for JSON request: %s', ct) else: reader = codecs.getreader('utf-8')(resp) # data = reader.read().decode('utf-8') # result = json.loads(data) result = json.load(reader) except Exception as e: logger.exception('Failed to get external data for %s: %s', url, e) return result _external_data_base_url = 'https://www.red-dove.com/pypi/projects/' def get_project_data(name): url = '%s/%s/project.json' % (name[0].upper(), name) url = urljoin(_external_data_base_url, url) result = _get_external_data(url) return result def get_package_data(name, version): url = '%s/%s/package-%s.json' % (name[0].upper(), name, version) url = urljoin(_external_data_base_url, url) return _get_external_data(url) class Cache(object): """ A class implementing a cache for resources that need to live in the file system e.g. shared libraries. This class was moved from resources to here because it could be used by other modules, e.g. the wheel module. """ def __init__(self, base): """ Initialise an instance. :param base: The base directory where the cache should be located. """ # we use 'isdir' instead of 'exists', because we want to # fail if there's a file with that name if not os.path.isdir(base): # pragma: no cover os.makedirs(base) if (os.stat(base).st_mode & 0o77) != 0: logger.warning('Directory \'%s\' is not private', base) self.base = os.path.abspath(os.path.normpath(base)) def prefix_to_dir(self, prefix, use_abspath=True): """ Converts a resource prefix to a directory name in the cache. """ return path_to_cache_dir(prefix, use_abspath=use_abspath) def clear(self): """ Clear the cache. """ not_removed = [] for fn in os.listdir(self.base): fn = os.path.join(self.base, fn) try: if os.path.islink(fn) or os.path.isfile(fn): os.remove(fn) elif os.path.isdir(fn): shutil.rmtree(fn) except Exception: not_removed.append(fn) return not_removed class EventMixin(object): """ A very simple publish/subscribe system. """ def __init__(self): self._subscribers = {} def add(self, event, subscriber, append=True): """ Add a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be added (and called when the event is published). :param append: Whether to append or prepend the subscriber to an existing subscriber list for the event. """ subs = self._subscribers if event not in subs: subs[event] = deque([subscriber]) else: sq = subs[event] if append: sq.append(subscriber) else: sq.appendleft(subscriber) def remove(self, event, subscriber): """ Remove a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be removed. """ subs = self._subscribers if event not in subs: raise ValueError('No subscribers: %r' % event) subs[event].remove(subscriber) def get_subscribers(self, event): """ Return an iterator for the subscribers for an event. :param event: The event to return subscribers for. """ return iter(self._subscribers.get(event, ())) def publish(self, event, *args, **kwargs): """ Publish a event and return a list of values returned by its subscribers. :param event: The event to publish. :param args: The positional arguments to pass to the event's subscribers. :param kwargs: The keyword arguments to pass to the event's subscribers. """ result = [] for subscriber in self.get_subscribers(event): try: value = subscriber(event, *args, **kwargs) except Exception: logger.exception('Exception during event publication') value = None result.append(value) logger.debug('publish %s: args = %s, kwargs = %s, result = %s', event, args, kwargs, result) return result # # Simple sequencing # class Sequencer(object): def __init__(self): self._preds = {} self._succs = {} self._nodes = set() # nodes with no preds/succs def add_node(self, node): self._nodes.add(node) def remove_node(self, node, edges=False): if node in self._nodes: self._nodes.remove(node) if edges: for p in set(self._preds.get(node, ())): self.remove(p, node) for s in set(self._succs.get(node, ())): self.remove(node, s) # Remove empties for k, v in list(self._preds.items()): if not v: del self._preds[k] for k, v in list(self._succs.items()): if not v: del self._succs[k] def add(self, pred, succ): assert pred != succ self._preds.setdefault(succ, set()).add(pred) self._succs.setdefault(pred, set()).add(succ) def remove(self, pred, succ): assert pred != succ try: preds = self._preds[succ] succs = self._succs[pred] except KeyError: # pragma: no cover raise ValueError('%r not a successor of anything' % succ) try: preds.remove(pred) succs.remove(succ) except KeyError: # pragma: no cover raise ValueError('%r not a successor of %r' % (succ, pred)) def is_step(self, step): return (step in self._preds or step in self._succs or step in self._nodes) def get_steps(self, final): if not self.is_step(final): raise ValueError('Unknown: %r' % final) result = [] todo = [] seen = set() todo.append(final) while todo: step = todo.pop(0) if step in seen: # if a step was already seen, # move it to the end (so it will appear earlier # when reversed on return) ... but not for the # final step, as that would be confusing for # users if step != final: result.remove(step) result.append(step) else: seen.add(step) result.append(step) preds = self._preds.get(step, ()) todo.extend(preds) return reversed(result) @property def strong_connections(self): # http://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm index_counter = [0] stack = [] lowlinks = {} index = {} result = [] graph = self._succs def strongconnect(node): # set the depth index for this node to the smallest unused index index[node] = index_counter[0] lowlinks[node] = index_counter[0] index_counter[0] += 1 stack.append(node) # Consider successors try: successors = graph[node] except Exception: successors = [] for successor in successors: if successor not in lowlinks: # Successor has not yet been visited strongconnect(successor) lowlinks[node] = min(lowlinks[node], lowlinks[successor]) elif successor in stack: # the successor is in the stack and hence in the current # strongly connected component (SCC) lowlinks[node] = min(lowlinks[node], index[successor]) # If `node` is a root node, pop the stack and generate an SCC if lowlinks[node] == index[node]: connected_component = [] while True: successor = stack.pop() connected_component.append(successor) if successor == node: break component = tuple(connected_component) # storing the result result.append(component) for node in graph: if node not in lowlinks: strongconnect(node) return result @property def dot(self): result = ['digraph G {'] for succ in self._preds: preds = self._preds[succ] for pred in preds: result.append(' %s -> %s;' % (pred, succ)) for node in self._nodes: result.append(' %s;' % node) result.append('}') return '\n'.join(result) # # Unarchiving functionality for zip, tar, tgz, tbz, whl # ARCHIVE_EXTENSIONS = ('.tar.gz', '.tar.bz2', '.tar', '.zip', '.tgz', '.tbz', '.whl') def unarchive(archive_filename, dest_dir, format=None, check=True): def check_path(path): if not isinstance(path, text_type): path = path.decode('utf-8') p = os.path.abspath(os.path.join(dest_dir, path)) if not p.startswith(dest_dir) or p[plen] != os.sep: raise ValueError('path outside destination: %r' % p) dest_dir = os.path.abspath(dest_dir) plen = len(dest_dir) archive = None if format is None: if archive_filename.endswith(('.zip', '.whl')): format = 'zip' elif archive_filename.endswith(('.tar.gz', '.tgz')): format = 'tgz' mode = 'r:gz' elif archive_filename.endswith(('.tar.bz2', '.tbz')): format = 'tbz' mode = 'r:bz2' elif archive_filename.endswith('.tar'): format = 'tar' mode = 'r' else: # pragma: no cover raise ValueError('Unknown format for %r' % archive_filename) try: if format == 'zip': archive = ZipFile(archive_filename, 'r') if check: names = archive.namelist() for name in names: check_path(name) else: archive = tarfile.open(archive_filename, mode) if check: names = archive.getnames() for name in names: check_path(name) if format != 'zip' and sys.version_info[0] < 3: # See Python issue 17153. If the dest path contains Unicode, # tarfile extraction fails on Python 2.x if a member path name # contains non-ASCII characters - it leads to an implicit # bytes -> unicode conversion using ASCII to decode. for tarinfo in archive.getmembers(): if not isinstance(tarinfo.name, text_type): tarinfo.name = tarinfo.name.decode('utf-8') # Limit extraction of dangerous items, if this Python # allows it easily. If not, just trust the input. # See: https://docs.python.org/3/library/tarfile.html#extraction-filters def extraction_filter(member, path): """Run tarfile.tar_filter, but raise the expected ValueError""" # This is only called if the current Python has tarfile filters try: return tarfile.tar_filter(member, path) except tarfile.FilterError as exc: raise ValueError(str(exc)) archive.extraction_filter = extraction_filter archive.extractall(dest_dir) finally: if archive: archive.close() def zip_dir(directory): """zip a directory tree into a BytesIO object""" result = io.BytesIO() dlen = len(directory) with ZipFile(result, "w") as zf: for root, dirs, files in os.walk(directory): for name in files: full = os.path.join(root, name) rel = root[dlen:] dest = os.path.join(rel, name) zf.write(full, dest) return result # # Simple progress bar # UNITS = ('', 'K', 'M', 'G', 'T', 'P') class Progress(object): unknown = 'UNKNOWN' def __init__(self, minval=0, maxval=100): assert maxval is None or maxval >= minval self.min = self.cur = minval self.max = maxval self.started = None self.elapsed = 0 self.done = False def update(self, curval): assert self.min <= curval assert self.max is None or curval <= self.max self.cur = curval now = time.time() if self.started is None: self.started = now else: self.elapsed = now - self.started def increment(self, incr): assert incr >= 0 self.update(self.cur + incr) def start(self): self.update(self.min) return self def stop(self): if self.max is not None: self.update(self.max) self.done = True @property def maximum(self): return self.unknown if self.max is None else self.max @property def percentage(self): if self.done: result = '100 %' elif self.max is None: result = ' ?? %' else: v = 100.0 * (self.cur - self.min) / (self.max - self.min) result = '%3d %%' % v return result def format_duration(self, duration): if (duration <= 0) and self.max is None or self.cur == self.min: result = '??:??:??' # elif duration < 1: # result = '--:--:--' else: result = time.strftime('%H:%M:%S', time.gmtime(duration)) return result @property def ETA(self): if self.done: prefix = 'Done' t = self.elapsed # import pdb; pdb.set_trace() else: prefix = 'ETA ' if self.max is None: t = -1 elif self.elapsed == 0 or (self.cur == self.min): t = 0 else: # import pdb; pdb.set_trace() t = float(self.max - self.min) t /= self.cur - self.min t = (t - 1) * self.elapsed return '%s: %s' % (prefix, self.format_duration(t)) @property def speed(self): if self.elapsed == 0: result = 0.0 else: result = (self.cur - self.min) / self.elapsed for unit in UNITS: if result < 1000: break result /= 1000.0 return '%d %sB/s' % (result, unit) # # Glob functionality # RICH_GLOB = re.compile(r'\{([^}]*)\}') _CHECK_RECURSIVE_GLOB = re.compile(r'[^/\\,{]\*\*|\*\*[^/\\,}]') _CHECK_MISMATCH_SET = re.compile(r'^[^{]*\}|\{[^}]*$') def iglob(path_glob): """Extended globbing function that supports ** and {opt1,opt2,opt3}.""" if _CHECK_RECURSIVE_GLOB.search(path_glob): msg = """invalid glob %r: recursive glob "**" must be used alone""" raise ValueError(msg % path_glob) if _CHECK_MISMATCH_SET.search(path_glob): msg = """invalid glob %r: mismatching set marker '{' or '}'""" raise ValueError(msg % path_glob) return _iglob(path_glob) def _iglob(path_glob): rich_path_glob = RICH_GLOB.split(path_glob, 1) if len(rich_path_glob) > 1: assert len(rich_path_glob) == 3, rich_path_glob prefix, set, suffix = rich_path_glob for item in set.split(','): for path in _iglob(''.join((prefix, item, suffix))): yield path else: if '**' not in path_glob: for item in std_iglob(path_glob): yield item else: prefix, radical = path_glob.split('**', 1) if prefix == '': prefix = '.' if radical == '': radical = '*' else: # we support both radical = radical.lstrip('/') radical = radical.lstrip('\\') for path, dir, files in os.walk(prefix): path = os.path.normpath(path) for fn in _iglob(os.path.join(path, radical)): yield fn if ssl: from .compat import (HTTPSHandler as BaseHTTPSHandler, match_hostname, CertificateError) # # HTTPSConnection which verifies certificates/matches domains # class HTTPSConnection(httplib.HTTPSConnection): ca_certs = None # set this to the path to the certs file (.pem) check_domain = True # only used if ca_certs is not None # noinspection PyPropertyAccess def connect(self): sock = socket.create_connection((self.host, self.port), self.timeout) if getattr(self, '_tunnel_host', False): self.sock = sock self._tunnel() context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) if hasattr(ssl, 'OP_NO_SSLv2'): context.options |= ssl.OP_NO_SSLv2 if getattr(self, 'cert_file', None): context.load_cert_chain(self.cert_file, self.key_file) kwargs = {} if self.ca_certs: context.verify_mode = ssl.CERT_REQUIRED context.load_verify_locations(cafile=self.ca_certs) if getattr(ssl, 'HAS_SNI', False): kwargs['server_hostname'] = self.host self.sock = context.wrap_socket(sock, **kwargs) if self.ca_certs and self.check_domain: try: match_hostname(self.sock.getpeercert(), self.host) logger.debug('Host verified: %s', self.host) except CertificateError: # pragma: no cover self.sock.shutdown(socket.SHUT_RDWR) self.sock.close() raise class HTTPSHandler(BaseHTTPSHandler): def __init__(self, ca_certs, check_domain=True): BaseHTTPSHandler.__init__(self) self.ca_certs = ca_certs self.check_domain = check_domain def _conn_maker(self, *args, **kwargs): """ This is called to create a connection instance. Normally you'd pass a connection class to do_open, but it doesn't actually check for a class, and just expects a callable. As long as we behave just as a constructor would have, we should be OK. If it ever changes so that we *must* pass a class, we'll create an UnsafeHTTPSConnection class which just sets check_domain to False in the class definition, and choose which one to pass to do_open. """ result = HTTPSConnection(*args, **kwargs) if self.ca_certs: result.ca_certs = self.ca_certs result.check_domain = self.check_domain return result def https_open(self, req): try: return self.do_open(self._conn_maker, req) except URLError as e: if 'certificate verify failed' in str(e.reason): raise CertificateError('Unable to verify server certificate ' 'for %s' % req.host) else: raise # # To prevent against mixing HTTP traffic with HTTPS (examples: A Man-In-The- # Middle proxy using HTTP listens on port 443, or an index mistakenly serves # HTML containing a http://xyz link when it should be https://xyz), # you can use the following handler class, which does not allow HTTP traffic. # # It works by inheriting from HTTPHandler - so build_opener won't add a # handler for HTTP itself. # class HTTPSOnlyHandler(HTTPSHandler, HTTPHandler): def http_open(self, req): raise URLError('Unexpected HTTP request on what should be a secure ' 'connection: %s' % req) # # XML-RPC with timeouts # class Transport(xmlrpclib.Transport): def __init__(self, timeout, use_datetime=0): self.timeout = timeout xmlrpclib.Transport.__init__(self, use_datetime) def make_connection(self, host): h, eh, x509 = self.get_host_info(host) if not self._connection or host != self._connection[0]: self._extra_headers = eh self._connection = host, httplib.HTTPConnection(h) return self._connection[1] if ssl: class SafeTransport(xmlrpclib.SafeTransport): def __init__(self, timeout, use_datetime=0): self.timeout = timeout xmlrpclib.SafeTransport.__init__(self, use_datetime) def make_connection(self, host): h, eh, kwargs = self.get_host_info(host) if not kwargs: kwargs = {} kwargs['timeout'] = self.timeout if not self._connection or host != self._connection[0]: self._extra_headers = eh self._connection = host, httplib.HTTPSConnection(h, None, **kwargs) return self._connection[1] class ServerProxy(xmlrpclib.ServerProxy): def __init__(self, uri, **kwargs): self.timeout = timeout = kwargs.pop('timeout', None) # The above classes only come into play if a timeout # is specified if timeout is not None: # scheme = splittype(uri) # deprecated as of Python 3.8 scheme = urlparse(uri)[0] use_datetime = kwargs.get('use_datetime', 0) if scheme == 'https': tcls = SafeTransport else: tcls = Transport kwargs['transport'] = t = tcls(timeout, use_datetime=use_datetime) self.transport = t xmlrpclib.ServerProxy.__init__(self, uri, **kwargs) # # CSV functionality. This is provided because on 2.x, the csv module can't # handle Unicode. However, we need to deal with Unicode in e.g. RECORD files. # def _csv_open(fn, mode, **kwargs): if sys.version_info[0] < 3: mode += 'b' else: kwargs['newline'] = '' # Python 3 determines encoding from locale. Force 'utf-8' # file encoding to match other forced utf-8 encoding kwargs['encoding'] = 'utf-8' return open(fn, mode, **kwargs) class CSVBase(object): defaults = { 'delimiter': str(','), # The strs are used because we need native 'quotechar': str('"'), # str in the csv API (2.x won't take 'lineterminator': str('\n') # Unicode) } def __enter__(self): return self def __exit__(self, *exc_info): self.stream.close() class CSVReader(CSVBase): def __init__(self, **kwargs): if 'stream' in kwargs: stream = kwargs['stream'] if sys.version_info[0] >= 3: # needs to be a text stream stream = codecs.getreader('utf-8')(stream) self.stream = stream else: self.stream = _csv_open(kwargs['path'], 'r') self.reader = csv.reader(self.stream, **self.defaults) def __iter__(self): return self def next(self): result = next(self.reader) if sys.version_info[0] < 3: for i, item in enumerate(result): if not isinstance(item, text_type): result[i] = item.decode('utf-8') return result __next__ = next class CSVWriter(CSVBase): def __init__(self, fn, **kwargs): self.stream = _csv_open(fn, 'w') self.writer = csv.writer(self.stream, **self.defaults) def writerow(self, row): if sys.version_info[0] < 3: r = [] for item in row: if isinstance(item, text_type): item = item.encode('utf-8') r.append(item) row = r self.writer.writerow(row) # # Configurator functionality # class Configurator(BaseConfigurator): value_converters = dict(BaseConfigurator.value_converters) value_converters['inc'] = 'inc_convert' def __init__(self, config, base=None): super(Configurator, self).__init__(config) self.base = base or os.getcwd() def configure_custom(self, config): def convert(o): if isinstance(o, (list, tuple)): result = type(o)([convert(i) for i in o]) elif isinstance(o, dict): if '()' in o: result = self.configure_custom(o) else: result = {} for k in o: result[k] = convert(o[k]) else: result = self.convert(o) return result c = config.pop('()') if not callable(c): c = self.resolve(c) props = config.pop('.', None) # Check for valid identifiers args = config.pop('[]', ()) if args: args = tuple([convert(o) for o in args]) items = [(k, convert(config[k])) for k in config if valid_ident(k)] kwargs = dict(items) result = c(*args, **kwargs) if props: for n, v in props.items(): setattr(result, n, convert(v)) return result def __getitem__(self, key): result = self.config[key] if isinstance(result, dict) and '()' in result: self.config[key] = result = self.configure_custom(result) return result def inc_convert(self, value): """Default converter for the inc:// protocol.""" if not os.path.isabs(value): value = os.path.join(self.base, value) with codecs.open(value, 'r', encoding='utf-8') as f: result = json.load(f) return result class SubprocessMixin(object): """ Mixin for running subprocesses and capturing their output """ def __init__(self, verbose=False, progress=None): self.verbose = verbose self.progress = progress def reader(self, stream, context): """ Read lines from a subprocess' output stream and either pass to a progress callable (if specified) or write progress information to sys.stderr. """ progress = self.progress verbose = self.verbose while True: s = stream.readline() if not s: break if progress is not None: progress(s, context) else: if not verbose: sys.stderr.write('.') else: sys.stderr.write(s.decode('utf-8')) sys.stderr.flush() stream.close() def run_command(self, cmd, **kwargs): p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs) t1 = threading.Thread(target=self.reader, args=(p.stdout, 'stdout')) t1.start() t2 = threading.Thread(target=self.reader, args=(p.stderr, 'stderr')) t2.start() p.wait() t1.join() t2.join() if self.progress is not None: self.progress('done.', 'main') elif self.verbose: sys.stderr.write('done.\n') return p def normalize_name(name): """Normalize a python package name a la PEP 503""" # https://www.python.org/dev/peps/pep-0503/#normalized-names return re.sub('[-_.]+', '-', name).lower() # def _get_pypirc_command(): # """ # Get the distutils command for interacting with PyPI configurations. # :return: the command. # """ # from distutils.core import Distribution # from distutils.config import PyPIRCCommand # d = Distribution() # return PyPIRCCommand(d) class PyPIRCFile(object): DEFAULT_REPOSITORY = 'https://upload.pypi.org/legacy/' DEFAULT_REALM = 'pypi' def __init__(self, fn=None, url=None): if fn is None: fn = os.path.join(os.path.expanduser('~'), '.pypirc') self.filename = fn self.url = url def read(self): result = {} if os.path.exists(self.filename): repository = self.url or self.DEFAULT_REPOSITORY config = configparser.RawConfigParser() config.read(self.filename) sections = config.sections() if 'distutils' in sections: # let's get the list of servers index_servers = config.get('distutils', 'index-servers') _servers = [server.strip() for server in index_servers.split('\n') if server.strip() != ''] if _servers == []: # nothing set, let's try to get the default pypi if 'pypi' in sections: _servers = ['pypi'] else: for server in _servers: result = {'server': server} result['username'] = config.get(server, 'username') # optional params for key, default in (('repository', self.DEFAULT_REPOSITORY), ('realm', self.DEFAULT_REALM), ('password', None)): if config.has_option(server, key): result[key] = config.get(server, key) else: result[key] = default # work around people having "repository" for the "pypi" # section of their config set to the HTTP (rather than # HTTPS) URL if (server == 'pypi' and repository in (self.DEFAULT_REPOSITORY, 'pypi')): result['repository'] = self.DEFAULT_REPOSITORY elif (result['server'] != repository and result['repository'] != repository): result = {} elif 'server-login' in sections: # old format server = 'server-login' if config.has_option(server, 'repository'): repository = config.get(server, 'repository') else: repository = self.DEFAULT_REPOSITORY result = { 'username': config.get(server, 'username'), 'password': config.get(server, 'password'), 'repository': repository, 'server': server, 'realm': self.DEFAULT_REALM } return result def update(self, username, password): # import pdb; pdb.set_trace() config = configparser.RawConfigParser() fn = self.filename config.read(fn) if not config.has_section('pypi'): config.add_section('pypi') config.set('pypi', 'username', username) config.set('pypi', 'password', password) with open(fn, 'w') as f: config.write(f) def _load_pypirc(index): """ Read the PyPI access configuration as supported by distutils. """ return PyPIRCFile(url=index.url).read() def _store_pypirc(index): PyPIRCFile().update(index.username, index.password) # # get_platform()/get_host_platform() copied from Python 3.10.a0 source, with some minor # tweaks # def get_host_platform(): """Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information included depends on the OS; eg. on Linux, the kernel version isn't particularly important. Examples of returned values: linux-i586 linux-alpha (?) solaris-2.6-sun4u Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. """ if os.name == 'nt': if 'amd64' in sys.version.lower(): return 'win-amd64' if '(arm)' in sys.version.lower(): return 'win-arm32' if '(arm64)' in sys.version.lower(): return 'win-arm64' return sys.platform # Set for cross builds explicitly if "_PYTHON_HOST_PLATFORM" in os.environ: return os.environ["_PYTHON_HOST_PLATFORM"] if os.name != 'posix' or not hasattr(os, 'uname'): # XXX what about the architecture? NT is Intel or Alpha, # Mac OS is M68k or PPC, etc. return sys.platform # Try to distinguish various flavours of Unix (osname, host, release, version, machine) = os.uname() # Convert the OS name to lowercase, remove '/' characters, and translate # spaces (for "Power Macintosh") osname = osname.lower().replace('/', '') machine = machine.replace(' ', '_').replace('/', '-') if osname[:5] == 'linux': # At least on Linux/Intel, 'machine' is the processor -- # i386, etc. # XXX what about Alpha, SPARC, etc? return "%s-%s" % (osname, machine) elif osname[:5] == 'sunos': if release[0] >= '5': # SunOS 5 == Solaris 2 osname = 'solaris' release = '%d.%s' % (int(release[0]) - 3, release[2:]) # We can't use 'platform.architecture()[0]' because a # bootstrap problem. We use a dict to get an error # if some suspicious happens. bitness = {2147483647: '32bit', 9223372036854775807: '64bit'} machine += '.%s' % bitness[sys.maxsize] # fall through to standard osname-release-machine representation elif osname[:3] == 'aix': from _aix_support import aix_platform return aix_platform() elif osname[:6] == 'cygwin': osname = 'cygwin' rel_re = re.compile(r'[\d.]+', re.ASCII) m = rel_re.match(release) if m: release = m.group() elif osname[:6] == 'darwin': import _osx_support try: from distutils import sysconfig except ImportError: import sysconfig osname, release, machine = _osx_support.get_platform_osx(sysconfig.get_config_vars(), osname, release, machine) return '%s-%s-%s' % (osname, release, machine) _TARGET_TO_PLAT = { 'x86': 'win32', 'x64': 'win-amd64', 'arm': 'win-arm32', } def get_platform(): if os.name != 'nt': return get_host_platform() cross_compilation_target = os.environ.get('VSCMD_ARG_TGT_ARCH') if cross_compilation_target not in _TARGET_TO_PLAT: return get_host_platform() return _TARGET_TO_PLAT[cross_compilation_target] ================================================ FILE: src/pip/_vendor/distlib.pyi ================================================ from distlib import * ================================================ FILE: src/pip/_vendor/distro/LICENSE ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: src/pip/_vendor/distro/__init__.py ================================================ from .distro import ( NORMALIZED_DISTRO_ID, NORMALIZED_LSB_ID, NORMALIZED_OS_ID, LinuxDistribution, __version__, build_number, codename, distro_release_attr, distro_release_info, id, info, like, linux_distribution, lsb_release_attr, lsb_release_info, major_version, minor_version, name, os_release_attr, os_release_info, uname_attr, uname_info, version, version_parts, ) __all__ = [ "NORMALIZED_DISTRO_ID", "NORMALIZED_LSB_ID", "NORMALIZED_OS_ID", "LinuxDistribution", "build_number", "codename", "distro_release_attr", "distro_release_info", "id", "info", "like", "linux_distribution", "lsb_release_attr", "lsb_release_info", "major_version", "minor_version", "name", "os_release_attr", "os_release_info", "uname_attr", "uname_info", "version", "version_parts", ] __version__ = __version__ ================================================ FILE: src/pip/_vendor/distro/__main__.py ================================================ from .distro import main if __name__ == "__main__": main() ================================================ FILE: src/pip/_vendor/distro/distro.py ================================================ #!/usr/bin/env python # Copyright 2015-2021 Nir Cohen # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ The ``distro`` package (``distro`` stands for Linux Distribution) provides information about the Linux distribution it runs on, such as a reliable machine-readable distro ID, or version information. It is the recommended replacement for Python's original :py:func:`platform.linux_distribution` function, but it provides much more functionality. An alternative implementation became necessary because Python 3.5 deprecated this function, and Python 3.8 removed it altogether. Its predecessor function :py:func:`platform.dist` was already deprecated since Python 2.6 and removed in Python 3.8. Still, there are many cases in which access to OS distribution information is needed. See `Python issue 1322 `_ for more information. """ import argparse import json import logging import os import re import shlex import subprocess import sys import warnings from typing import ( Any, Callable, Dict, Iterable, Optional, Sequence, TextIO, Tuple, Type, ) try: from typing import TypedDict except ImportError: # Python 3.7 TypedDict = dict __version__ = "1.9.0" class VersionDict(TypedDict): major: str minor: str build_number: str class InfoDict(TypedDict): id: str version: str version_parts: VersionDict like: str codename: str _UNIXCONFDIR = os.environ.get("UNIXCONFDIR", "/etc") _UNIXUSRLIBDIR = os.environ.get("UNIXUSRLIBDIR", "/usr/lib") _OS_RELEASE_BASENAME = "os-release" #: Translation table for normalizing the "ID" attribute defined in os-release #: files, for use by the :func:`distro.id` method. #: #: * Key: Value as defined in the os-release file, translated to lower case, #: with blanks translated to underscores. #: #: * Value: Normalized value. NORMALIZED_OS_ID = { "ol": "oracle", # Oracle Linux "opensuse-leap": "opensuse", # Newer versions of OpenSuSE report as opensuse-leap } #: Translation table for normalizing the "Distributor ID" attribute returned by #: the lsb_release command, for use by the :func:`distro.id` method. #: #: * Key: Value as returned by the lsb_release command, translated to lower #: case, with blanks translated to underscores. #: #: * Value: Normalized value. NORMALIZED_LSB_ID = { "enterpriseenterpriseas": "oracle", # Oracle Enterprise Linux 4 "enterpriseenterpriseserver": "oracle", # Oracle Linux 5 "redhatenterpriseworkstation": "rhel", # RHEL 6, 7 Workstation "redhatenterpriseserver": "rhel", # RHEL 6, 7 Server "redhatenterprisecomputenode": "rhel", # RHEL 6 ComputeNode } #: Translation table for normalizing the distro ID derived from the file name #: of distro release files, for use by the :func:`distro.id` method. #: #: * Key: Value as derived from the file name of a distro release file, #: translated to lower case, with blanks translated to underscores. #: #: * Value: Normalized value. NORMALIZED_DISTRO_ID = { "redhat": "rhel", # RHEL 6.x, 7.x } # Pattern for content of distro release file (reversed) _DISTRO_RELEASE_CONTENT_REVERSED_PATTERN = re.compile( r"(?:[^)]*\)(.*)\()? *(?:STL )?([\d.+\-a-z]*\d) *(?:esaeler *)?(.+)" ) # Pattern for base file name of distro release file _DISTRO_RELEASE_BASENAME_PATTERN = re.compile(r"(\w+)[-_](release|version)$") # Base file names to be looked up for if _UNIXCONFDIR is not readable. _DISTRO_RELEASE_BASENAMES = [ "SuSE-release", "altlinux-release", "arch-release", "base-release", "centos-release", "fedora-release", "gentoo-release", "mageia-release", "mandrake-release", "mandriva-release", "mandrivalinux-release", "manjaro-release", "oracle-release", "redhat-release", "rocky-release", "sl-release", "slackware-version", ] # Base file names to be ignored when searching for distro release file _DISTRO_RELEASE_IGNORE_BASENAMES = ( "debian_version", "lsb-release", "oem-release", _OS_RELEASE_BASENAME, "system-release", "plesk-release", "iredmail-release", "board-release", "ec2_version", ) def linux_distribution(full_distribution_name: bool = True) -> Tuple[str, str, str]: """ .. deprecated:: 1.6.0 :func:`distro.linux_distribution()` is deprecated. It should only be used as a compatibility shim with Python's :py:func:`platform.linux_distribution()`. Please use :func:`distro.id`, :func:`distro.version` and :func:`distro.name` instead. Return information about the current OS distribution as a tuple ``(id_name, version, codename)`` with items as follows: * ``id_name``: If *full_distribution_name* is false, the result of :func:`distro.id`. Otherwise, the result of :func:`distro.name`. * ``version``: The result of :func:`distro.version`. * ``codename``: The extra item (usually in parentheses) after the os-release version number, or the result of :func:`distro.codename`. The interface of this function is compatible with the original :py:func:`platform.linux_distribution` function, supporting a subset of its parameters. The data it returns may not exactly be the same, because it uses more data sources than the original function, and that may lead to different data if the OS distribution is not consistent across multiple data sources it provides (there are indeed such distributions ...). Another reason for differences is the fact that the :func:`distro.id` method normalizes the distro ID string to a reliable machine-readable value for a number of popular OS distributions. """ warnings.warn( "distro.linux_distribution() is deprecated. It should only be used as a " "compatibility shim with Python's platform.linux_distribution(). Please use " "distro.id(), distro.version() and distro.name() instead.", DeprecationWarning, stacklevel=2, ) return _distro.linux_distribution(full_distribution_name) def id() -> str: """ Return the distro ID of the current distribution, as a machine-readable string. For a number of OS distributions, the returned distro ID value is *reliable*, in the sense that it is documented and that it does not change across releases of the distribution. This package maintains the following reliable distro ID values: ============== ========================================= Distro ID Distribution ============== ========================================= "ubuntu" Ubuntu "debian" Debian "rhel" RedHat Enterprise Linux "centos" CentOS "fedora" Fedora "sles" SUSE Linux Enterprise Server "opensuse" openSUSE "amzn" Amazon Linux "arch" Arch Linux "buildroot" Buildroot "cloudlinux" CloudLinux OS "exherbo" Exherbo Linux "gentoo" GenToo Linux "ibm_powerkvm" IBM PowerKVM "kvmibm" KVM for IBM z Systems "linuxmint" Linux Mint "mageia" Mageia "mandriva" Mandriva Linux "parallels" Parallels "pidora" Pidora "raspbian" Raspbian "oracle" Oracle Linux (and Oracle Enterprise Linux) "scientific" Scientific Linux "slackware" Slackware "xenserver" XenServer "openbsd" OpenBSD "netbsd" NetBSD "freebsd" FreeBSD "midnightbsd" MidnightBSD "rocky" Rocky Linux "aix" AIX "guix" Guix System "altlinux" ALT Linux ============== ========================================= If you have a need to get distros for reliable IDs added into this set, or if you find that the :func:`distro.id` function returns a different distro ID for one of the listed distros, please create an issue in the `distro issue tracker`_. **Lookup hierarchy and transformations:** First, the ID is obtained from the following sources, in the specified order. The first available and non-empty value is used: * the value of the "ID" attribute of the os-release file, * the value of the "Distributor ID" attribute returned by the lsb_release command, * the first part of the file name of the distro release file, The so determined ID value then passes the following transformations, before it is returned by this method: * it is translated to lower case, * blanks (which should not be there anyway) are translated to underscores, * a normalization of the ID is performed, based upon `normalization tables`_. The purpose of this normalization is to ensure that the ID is as reliable as possible, even across incompatible changes in the OS distributions. A common reason for an incompatible change is the addition of an os-release file, or the addition of the lsb_release command, with ID values that differ from what was previously determined from the distro release file name. """ return _distro.id() def name(pretty: bool = False) -> str: """ Return the name of the current OS distribution, as a human-readable string. If *pretty* is false, the name is returned without version or codename. (e.g. "CentOS Linux") If *pretty* is true, the version and codename are appended. (e.g. "CentOS Linux 7.1.1503 (Core)") **Lookup hierarchy:** The name is obtained from the following sources, in the specified order. The first available and non-empty value is used: * If *pretty* is false: - the value of the "NAME" attribute of the os-release file, - the value of the "Distributor ID" attribute returned by the lsb_release command, - the value of the "" field of the distro release file. * If *pretty* is true: - the value of the "PRETTY_NAME" attribute of the os-release file, - the value of the "Description" attribute returned by the lsb_release command, - the value of the "" field of the distro release file, appended with the value of the pretty version ("" and "" fields) of the distro release file, if available. """ return _distro.name(pretty) def version(pretty: bool = False, best: bool = False) -> str: """ Return the version of the current OS distribution, as a human-readable string. If *pretty* is false, the version is returned without codename (e.g. "7.0"). If *pretty* is true, the codename in parenthesis is appended, if the codename is non-empty (e.g. "7.0 (Maipo)"). Some distributions provide version numbers with different precisions in the different sources of distribution information. Examining the different sources in a fixed priority order does not always yield the most precise version (e.g. for Debian 8.2, or CentOS 7.1). Some other distributions may not provide this kind of information. In these cases, an empty string would be returned. This behavior can be observed with rolling releases distributions (e.g. Arch Linux). The *best* parameter can be used to control the approach for the returned version: If *best* is false, the first non-empty version number in priority order of the examined sources is returned. If *best* is true, the most precise version number out of all examined sources is returned. **Lookup hierarchy:** In all cases, the version number is obtained from the following sources. If *best* is false, this order represents the priority order: * the value of the "VERSION_ID" attribute of the os-release file, * the value of the "Release" attribute returned by the lsb_release command, * the version number parsed from the "" field of the first line of the distro release file, * the version number parsed from the "PRETTY_NAME" attribute of the os-release file, if it follows the format of the distro release files. * the version number parsed from the "Description" attribute returned by the lsb_release command, if it follows the format of the distro release files. """ return _distro.version(pretty, best) def version_parts(best: bool = False) -> Tuple[str, str, str]: """ Return the version of the current OS distribution as a tuple ``(major, minor, build_number)`` with items as follows: * ``major``: The result of :func:`distro.major_version`. * ``minor``: The result of :func:`distro.minor_version`. * ``build_number``: The result of :func:`distro.build_number`. For a description of the *best* parameter, see the :func:`distro.version` method. """ return _distro.version_parts(best) def major_version(best: bool = False) -> str: """ Return the major version of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The major version is the first part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.version` method. """ return _distro.major_version(best) def minor_version(best: bool = False) -> str: """ Return the minor version of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The minor version is the second part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.version` method. """ return _distro.minor_version(best) def build_number(best: bool = False) -> str: """ Return the build number of the current OS distribution, as a string, if provided. Otherwise, the empty string is returned. The build number is the third part of the dot-separated version string. For a description of the *best* parameter, see the :func:`distro.version` method. """ return _distro.build_number(best) def like() -> str: """ Return a space-separated list of distro IDs of distributions that are closely related to the current OS distribution in regards to packaging and programming interfaces, for example distributions the current distribution is a derivative from. **Lookup hierarchy:** This information item is only provided by the os-release file. For details, see the description of the "ID_LIKE" attribute in the `os-release man page `_. """ return _distro.like() def codename() -> str: """ Return the codename for the release of the current OS distribution, as a string. If the distribution does not have a codename, an empty string is returned. Note that the returned codename is not always really a codename. For example, openSUSE returns "x86_64". This function does not handle such cases in any special way and just returns the string it finds, if any. **Lookup hierarchy:** * the codename within the "VERSION" attribute of the os-release file, if provided, * the value of the "Codename" attribute returned by the lsb_release command, * the value of the "" field of the distro release file. """ return _distro.codename() def info(pretty: bool = False, best: bool = False) -> InfoDict: """ Return certain machine-readable information items about the current OS distribution in a dictionary, as shown in the following example: .. sourcecode:: python { 'id': 'rhel', 'version': '7.0', 'version_parts': { 'major': '7', 'minor': '0', 'build_number': '' }, 'like': 'fedora', 'codename': 'Maipo' } The dictionary structure and keys are always the same, regardless of which information items are available in the underlying data sources. The values for the various keys are as follows: * ``id``: The result of :func:`distro.id`. * ``version``: The result of :func:`distro.version`. * ``version_parts -> major``: The result of :func:`distro.major_version`. * ``version_parts -> minor``: The result of :func:`distro.minor_version`. * ``version_parts -> build_number``: The result of :func:`distro.build_number`. * ``like``: The result of :func:`distro.like`. * ``codename``: The result of :func:`distro.codename`. For a description of the *pretty* and *best* parameters, see the :func:`distro.version` method. """ return _distro.info(pretty, best) def os_release_info() -> Dict[str, str]: """ Return a dictionary containing key-value pairs for the information items from the os-release file data source of the current OS distribution. See `os-release file`_ for details about these information items. """ return _distro.os_release_info() def lsb_release_info() -> Dict[str, str]: """ Return a dictionary containing key-value pairs for the information items from the lsb_release command data source of the current OS distribution. See `lsb_release command output`_ for details about these information items. """ return _distro.lsb_release_info() def distro_release_info() -> Dict[str, str]: """ Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current OS distribution. See `distro release file`_ for details about these information items. """ return _distro.distro_release_info() def uname_info() -> Dict[str, str]: """ Return a dictionary containing key-value pairs for the information items from the distro release file data source of the current OS distribution. """ return _distro.uname_info() def os_release_attr(attribute: str) -> str: """ Return a single named information item from the os-release file data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the item does not exist. See `os-release file`_ for details about these information items. """ return _distro.os_release_attr(attribute) def lsb_release_attr(attribute: str) -> str: """ Return a single named information item from the lsb_release command output data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the item does not exist. See `lsb_release command output`_ for details about these information items. """ return _distro.lsb_release_attr(attribute) def distro_release_attr(attribute: str) -> str: """ Return a single named information item from the distro release file data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the item does not exist. See `distro release file`_ for details about these information items. """ return _distro.distro_release_attr(attribute) def uname_attr(attribute: str) -> str: """ Return a single named information item from the distro release file data source of the current OS distribution. Parameters: * ``attribute`` (string): Key of the information item. Returns: * (string): Value of the information item, if the item exists. The empty string, if the item does not exist. """ return _distro.uname_attr(attribute) try: from functools import cached_property except ImportError: # Python < 3.8 class cached_property: # type: ignore """A version of @property which caches the value. On access, it calls the underlying function and sets the value in `__dict__` so future accesses will not re-call the property. """ def __init__(self, f: Callable[[Any], Any]) -> None: self._fname = f.__name__ self._f = f def __get__(self, obj: Any, owner: Type[Any]) -> Any: assert obj is not None, f"call {self._fname} on an instance" ret = obj.__dict__[self._fname] = self._f(obj) return ret class LinuxDistribution: """ Provides information about a OS distribution. This package creates a private module-global instance of this class with default initialization arguments, that is used by the `consolidated accessor functions`_ and `single source accessor functions`_. By using default initialization arguments, that module-global instance returns data about the current OS distribution (i.e. the distro this package runs on). Normally, it is not necessary to create additional instances of this class. However, in situations where control is needed over the exact data sources that are used, instances of this class can be created with a specific distro release file, or a specific os-release file, or without invoking the lsb_release command. """ def __init__( self, include_lsb: Optional[bool] = None, os_release_file: str = "", distro_release_file: str = "", include_uname: Optional[bool] = None, root_dir: Optional[str] = None, include_oslevel: Optional[bool] = None, ) -> None: """ The initialization method of this class gathers information from the available data sources, and stores that in private instance attributes. Subsequent access to the information items uses these private instance attributes, so that the data sources are read only once. Parameters: * ``include_lsb`` (bool): Controls whether the `lsb_release command output`_ is included as a data source. If the lsb_release command is not available in the program execution path, the data source for the lsb_release command will be empty. * ``os_release_file`` (string): The path name of the `os-release file`_ that is to be used as a data source. An empty string (the default) will cause the default path name to be used (see `os-release file`_ for details). If the specified or defaulted os-release file does not exist, the data source for the os-release file will be empty. * ``distro_release_file`` (string): The path name of the `distro release file`_ that is to be used as a data source. An empty string (the default) will cause a default search algorithm to be used (see `distro release file`_ for details). If the specified distro release file does not exist, or if no default distro release file can be found, the data source for the distro release file will be empty. * ``include_uname`` (bool): Controls whether uname command output is included as a data source. If the uname command is not available in the program execution path the data source for the uname command will be empty. * ``root_dir`` (string): The absolute path to the root directory to use to find distro-related information files. Note that ``include_*`` parameters must not be enabled in combination with ``root_dir``. * ``include_oslevel`` (bool): Controls whether (AIX) oslevel command output is included as a data source. If the oslevel command is not available in the program execution path the data source will be empty. Public instance attributes: * ``os_release_file`` (string): The path name of the `os-release file`_ that is actually used as a data source. The empty string if no distro release file is used as a data source. * ``distro_release_file`` (string): The path name of the `distro release file`_ that is actually used as a data source. The empty string if no distro release file is used as a data source. * ``include_lsb`` (bool): The result of the ``include_lsb`` parameter. This controls whether the lsb information will be loaded. * ``include_uname`` (bool): The result of the ``include_uname`` parameter. This controls whether the uname information will be loaded. * ``include_oslevel`` (bool): The result of the ``include_oslevel`` parameter. This controls whether (AIX) oslevel information will be loaded. * ``root_dir`` (string): The result of the ``root_dir`` parameter. The absolute path to the root directory to use to find distro-related information files. Raises: * :py:exc:`ValueError`: Initialization parameters combination is not supported. * :py:exc:`OSError`: Some I/O issue with an os-release file or distro release file. * :py:exc:`UnicodeError`: A data source has unexpected characters or uses an unexpected encoding. """ self.root_dir = root_dir self.etc_dir = os.path.join(root_dir, "etc") if root_dir else _UNIXCONFDIR self.usr_lib_dir = ( os.path.join(root_dir, "usr/lib") if root_dir else _UNIXUSRLIBDIR ) if os_release_file: self.os_release_file = os_release_file else: etc_dir_os_release_file = os.path.join(self.etc_dir, _OS_RELEASE_BASENAME) usr_lib_os_release_file = os.path.join( self.usr_lib_dir, _OS_RELEASE_BASENAME ) # NOTE: The idea is to respect order **and** have it set # at all times for API backwards compatibility. if os.path.isfile(etc_dir_os_release_file) or not os.path.isfile( usr_lib_os_release_file ): self.os_release_file = etc_dir_os_release_file else: self.os_release_file = usr_lib_os_release_file self.distro_release_file = distro_release_file or "" # updated later is_root_dir_defined = root_dir is not None if is_root_dir_defined and (include_lsb or include_uname or include_oslevel): raise ValueError( "Including subprocess data sources from specific root_dir is disallowed" " to prevent false information" ) self.include_lsb = ( include_lsb if include_lsb is not None else not is_root_dir_defined ) self.include_uname = ( include_uname if include_uname is not None else not is_root_dir_defined ) self.include_oslevel = ( include_oslevel if include_oslevel is not None else not is_root_dir_defined ) def __repr__(self) -> str: """Return repr of all info""" return ( "LinuxDistribution(" "os_release_file={self.os_release_file!r}, " "distro_release_file={self.distro_release_file!r}, " "include_lsb={self.include_lsb!r}, " "include_uname={self.include_uname!r}, " "include_oslevel={self.include_oslevel!r}, " "root_dir={self.root_dir!r}, " "_os_release_info={self._os_release_info!r}, " "_lsb_release_info={self._lsb_release_info!r}, " "_distro_release_info={self._distro_release_info!r}, " "_uname_info={self._uname_info!r}, " "_oslevel_info={self._oslevel_info!r})".format(self=self) ) def linux_distribution( self, full_distribution_name: bool = True ) -> Tuple[str, str, str]: """ Return information about the OS distribution that is compatible with Python's :func:`platform.linux_distribution`, supporting a subset of its parameters. For details, see :func:`distro.linux_distribution`. """ return ( self.name() if full_distribution_name else self.id(), self.version(), self._os_release_info.get("release_codename") or self.codename(), ) def id(self) -> str: """Return the distro ID of the OS distribution, as a string. For details, see :func:`distro.id`. """ def normalize(distro_id: str, table: Dict[str, str]) -> str: distro_id = distro_id.lower().replace(" ", "_") return table.get(distro_id, distro_id) distro_id = self.os_release_attr("id") if distro_id: return normalize(distro_id, NORMALIZED_OS_ID) distro_id = self.lsb_release_attr("distributor_id") if distro_id: return normalize(distro_id, NORMALIZED_LSB_ID) distro_id = self.distro_release_attr("id") if distro_id: return normalize(distro_id, NORMALIZED_DISTRO_ID) distro_id = self.uname_attr("id") if distro_id: return normalize(distro_id, NORMALIZED_DISTRO_ID) return "" def name(self, pretty: bool = False) -> str: """ Return the name of the OS distribution, as a string. For details, see :func:`distro.name`. """ name = ( self.os_release_attr("name") or self.lsb_release_attr("distributor_id") or self.distro_release_attr("name") or self.uname_attr("name") ) if pretty: name = self.os_release_attr("pretty_name") or self.lsb_release_attr( "description" ) if not name: name = self.distro_release_attr("name") or self.uname_attr("name") version = self.version(pretty=True) if version: name = f"{name} {version}" return name or "" def version(self, pretty: bool = False, best: bool = False) -> str: """ Return the version of the OS distribution, as a string. For details, see :func:`distro.version`. """ versions = [ self.os_release_attr("version_id"), self.lsb_release_attr("release"), self.distro_release_attr("version_id"), self._parse_distro_release_content(self.os_release_attr("pretty_name")).get( "version_id", "" ), self._parse_distro_release_content( self.lsb_release_attr("description") ).get("version_id", ""), self.uname_attr("release"), ] if self.uname_attr("id").startswith("aix"): # On AIX platforms, prefer oslevel command output. versions.insert(0, self.oslevel_info()) elif self.id() == "debian" or "debian" in self.like().split(): # On Debian-like, add debian_version file content to candidates list. versions.append(self._debian_version) version = "" if best: # This algorithm uses the last version in priority order that has # the best precision. If the versions are not in conflict, that # does not matter; otherwise, using the last one instead of the # first one might be considered a surprise. for v in versions: if v.count(".") > version.count(".") or version == "": version = v else: for v in versions: if v != "": version = v break if pretty and version and self.codename(): version = f"{version} ({self.codename()})" return version def version_parts(self, best: bool = False) -> Tuple[str, str, str]: """ Return the version of the OS distribution, as a tuple of version numbers. For details, see :func:`distro.version_parts`. """ version_str = self.version(best=best) if version_str: version_regex = re.compile(r"(\d+)\.?(\d+)?\.?(\d+)?") matches = version_regex.match(version_str) if matches: major, minor, build_number = matches.groups() return major, minor or "", build_number or "" return "", "", "" def major_version(self, best: bool = False) -> str: """ Return the major version number of the current distribution. For details, see :func:`distro.major_version`. """ return self.version_parts(best)[0] def minor_version(self, best: bool = False) -> str: """ Return the minor version number of the current distribution. For details, see :func:`distro.minor_version`. """ return self.version_parts(best)[1] def build_number(self, best: bool = False) -> str: """ Return the build number of the current distribution. For details, see :func:`distro.build_number`. """ return self.version_parts(best)[2] def like(self) -> str: """ Return the IDs of distributions that are like the OS distribution. For details, see :func:`distro.like`. """ return self.os_release_attr("id_like") or "" def codename(self) -> str: """ Return the codename of the OS distribution. For details, see :func:`distro.codename`. """ try: # Handle os_release specially since distros might purposefully set # this to empty string to have no codename return self._os_release_info["codename"] except KeyError: return ( self.lsb_release_attr("codename") or self.distro_release_attr("codename") or "" ) def info(self, pretty: bool = False, best: bool = False) -> InfoDict: """ Return certain machine-readable information about the OS distribution. For details, see :func:`distro.info`. """ return InfoDict( id=self.id(), version=self.version(pretty, best), version_parts=VersionDict( major=self.major_version(best), minor=self.minor_version(best), build_number=self.build_number(best), ), like=self.like(), codename=self.codename(), ) def os_release_info(self) -> Dict[str, str]: """ Return a dictionary containing key-value pairs for the information items from the os-release file data source of the OS distribution. For details, see :func:`distro.os_release_info`. """ return self._os_release_info def lsb_release_info(self) -> Dict[str, str]: """ Return a dictionary containing key-value pairs for the information items from the lsb_release command data source of the OS distribution. For details, see :func:`distro.lsb_release_info`. """ return self._lsb_release_info def distro_release_info(self) -> Dict[str, str]: """ Return a dictionary containing key-value pairs for the information items from the distro release file data source of the OS distribution. For details, see :func:`distro.distro_release_info`. """ return self._distro_release_info def uname_info(self) -> Dict[str, str]: """ Return a dictionary containing key-value pairs for the information items from the uname command data source of the OS distribution. For details, see :func:`distro.uname_info`. """ return self._uname_info def oslevel_info(self) -> str: """ Return AIX' oslevel command output. """ return self._oslevel_info def os_release_attr(self, attribute: str) -> str: """ Return a single named information item from the os-release file data source of the OS distribution. For details, see :func:`distro.os_release_attr`. """ return self._os_release_info.get(attribute, "") def lsb_release_attr(self, attribute: str) -> str: """ Return a single named information item from the lsb_release command output data source of the OS distribution. For details, see :func:`distro.lsb_release_attr`. """ return self._lsb_release_info.get(attribute, "") def distro_release_attr(self, attribute: str) -> str: """ Return a single named information item from the distro release file data source of the OS distribution. For details, see :func:`distro.distro_release_attr`. """ return self._distro_release_info.get(attribute, "") def uname_attr(self, attribute: str) -> str: """ Return a single named information item from the uname command output data source of the OS distribution. For details, see :func:`distro.uname_attr`. """ return self._uname_info.get(attribute, "") @cached_property def _os_release_info(self) -> Dict[str, str]: """ Get the information items from the specified os-release file. Returns: A dictionary containing all information items. """ if os.path.isfile(self.os_release_file): with open(self.os_release_file, encoding="utf-8") as release_file: return self._parse_os_release_content(release_file) return {} @staticmethod def _parse_os_release_content(lines: TextIO) -> Dict[str, str]: """ Parse the lines of an os-release file. Parameters: * lines: Iterable through the lines in the os-release file. Each line must be a unicode string or a UTF-8 encoded byte string. Returns: A dictionary containing all information items. """ props = {} lexer = shlex.shlex(lines, posix=True) lexer.whitespace_split = True tokens = list(lexer) for token in tokens: # At this point, all shell-like parsing has been done (i.e. # comments processed, quotes and backslash escape sequences # processed, multi-line values assembled, trailing newlines # stripped, etc.), so the tokens are now either: # * variable assignments: var=value # * commands or their arguments (not allowed in os-release) # Ignore any tokens that are not variable assignments if "=" in token: k, v = token.split("=", 1) props[k.lower()] = v if "version" in props: # extract release codename (if any) from version attribute match = re.search(r"\((\D+)\)|,\s*(\D+)", props["version"]) if match: release_codename = match.group(1) or match.group(2) props["codename"] = props["release_codename"] = release_codename if "version_codename" in props: # os-release added a version_codename field. Use that in # preference to anything else Note that some distros purposefully # do not have code names. They should be setting # version_codename="" props["codename"] = props["version_codename"] elif "ubuntu_codename" in props: # Same as above but a non-standard field name used on older Ubuntus props["codename"] = props["ubuntu_codename"] return props @cached_property def _lsb_release_info(self) -> Dict[str, str]: """ Get the information items from the lsb_release command output. Returns: A dictionary containing all information items. """ if not self.include_lsb: return {} try: cmd = ("lsb_release", "-a") stdout = subprocess.check_output(cmd, stderr=subprocess.DEVNULL) # Command not found or lsb_release returned error except (OSError, subprocess.CalledProcessError): return {} content = self._to_str(stdout).splitlines() return self._parse_lsb_release_content(content) @staticmethod def _parse_lsb_release_content(lines: Iterable[str]) -> Dict[str, str]: """ Parse the output of the lsb_release command. Parameters: * lines: Iterable through the lines of the lsb_release output. Each line must be a unicode string or a UTF-8 encoded byte string. Returns: A dictionary containing all information items. """ props = {} for line in lines: kv = line.strip("\n").split(":", 1) if len(kv) != 2: # Ignore lines without colon. continue k, v = kv props.update({k.replace(" ", "_").lower(): v.strip()}) return props @cached_property def _uname_info(self) -> Dict[str, str]: if not self.include_uname: return {} try: cmd = ("uname", "-rs") stdout = subprocess.check_output(cmd, stderr=subprocess.DEVNULL) except OSError: return {} content = self._to_str(stdout).splitlines() return self._parse_uname_content(content) @cached_property def _oslevel_info(self) -> str: if not self.include_oslevel: return "" try: stdout = subprocess.check_output("oslevel", stderr=subprocess.DEVNULL) except (OSError, subprocess.CalledProcessError): return "" return self._to_str(stdout).strip() @cached_property def _debian_version(self) -> str: try: with open( os.path.join(self.etc_dir, "debian_version"), encoding="ascii" ) as fp: return fp.readline().rstrip() except FileNotFoundError: return "" @staticmethod def _parse_uname_content(lines: Sequence[str]) -> Dict[str, str]: if not lines: return {} props = {} match = re.search(r"^([^\s]+)\s+([\d\.]+)", lines[0].strip()) if match: name, version = match.groups() # This is to prevent the Linux kernel version from # appearing as the 'best' version on otherwise # identifiable distributions. if name == "Linux": return {} props["id"] = name.lower() props["name"] = name props["release"] = version return props @staticmethod def _to_str(bytestring: bytes) -> str: encoding = sys.getfilesystemencoding() return bytestring.decode(encoding) @cached_property def _distro_release_info(self) -> Dict[str, str]: """ Get the information items from the specified distro release file. Returns: A dictionary containing all information items. """ if self.distro_release_file: # If it was specified, we use it and parse what we can, even if # its file name or content does not match the expected pattern. distro_info = self._parse_distro_release_file(self.distro_release_file) basename = os.path.basename(self.distro_release_file) # The file name pattern for user-specified distro release files # is somewhat more tolerant (compared to when searching for the # file), because we want to use what was specified as best as # possible. match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename) else: try: basenames = [ basename for basename in os.listdir(self.etc_dir) if basename not in _DISTRO_RELEASE_IGNORE_BASENAMES and os.path.isfile(os.path.join(self.etc_dir, basename)) ] # We sort for repeatability in cases where there are multiple # distro specific files; e.g. CentOS, Oracle, Enterprise all # containing `redhat-release` on top of their own. basenames.sort() except OSError: # This may occur when /etc is not readable but we can't be # sure about the *-release files. Check common entries of # /etc for information. If they turn out to not be there the # error is handled in `_parse_distro_release_file()`. basenames = _DISTRO_RELEASE_BASENAMES for basename in basenames: match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename) if match is None: continue filepath = os.path.join(self.etc_dir, basename) distro_info = self._parse_distro_release_file(filepath) # The name is always present if the pattern matches. if "name" not in distro_info: continue self.distro_release_file = filepath break else: # the loop didn't "break": no candidate. return {} if match is not None: distro_info["id"] = match.group(1) # CloudLinux < 7: manually enrich info with proper id. if "cloudlinux" in distro_info.get("name", "").lower(): distro_info["id"] = "cloudlinux" return distro_info def _parse_distro_release_file(self, filepath: str) -> Dict[str, str]: """ Parse a distro release file. Parameters: * filepath: Path name of the distro release file. Returns: A dictionary containing all information items. """ try: with open(filepath, encoding="utf-8") as fp: # Only parse the first line. For instance, on SLES there # are multiple lines. We don't want them... return self._parse_distro_release_content(fp.readline()) except OSError: # Ignore not being able to read a specific, seemingly version # related file. # See https://github.com/python-distro/distro/issues/162 return {} @staticmethod def _parse_distro_release_content(line: str) -> Dict[str, str]: """ Parse a line from a distro release file. Parameters: * line: Line from the distro release file. Must be a unicode string or a UTF-8 encoded byte string. Returns: A dictionary containing all information items. """ matches = _DISTRO_RELEASE_CONTENT_REVERSED_PATTERN.match(line.strip()[::-1]) distro_info = {} if matches: # regexp ensures non-None distro_info["name"] = matches.group(3)[::-1] if matches.group(2): distro_info["version_id"] = matches.group(2)[::-1] if matches.group(1): distro_info["codename"] = matches.group(1)[::-1] elif line: distro_info["name"] = line.strip() return distro_info _distro = LinuxDistribution() def main() -> None: logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) logger.addHandler(logging.StreamHandler(sys.stdout)) parser = argparse.ArgumentParser(description="OS distro info tool") parser.add_argument( "--json", "-j", help="Output in machine readable format", action="store_true" ) parser.add_argument( "--root-dir", "-r", type=str, dest="root_dir", help="Path to the root filesystem directory (defaults to /)", ) args = parser.parse_args() if args.root_dir: dist = LinuxDistribution( include_lsb=False, include_uname=False, include_oslevel=False, root_dir=args.root_dir, ) else: dist = _distro if args.json: logger.info(json.dumps(dist.info(), indent=4, sort_keys=True)) else: logger.info("Name: %s", dist.name(pretty=True)) distribution_version = dist.version(pretty=True) logger.info("Version: %s", distribution_version) distribution_codename = dist.codename() logger.info("Codename: %s", distribution_codename) if __name__ == "__main__": main() ================================================ FILE: src/pip/_vendor/distro/py.typed ================================================ ================================================ FILE: src/pip/_vendor/idna/LICENSE.md ================================================ BSD 3-Clause License Copyright (c) 2013-2025, Kim Davies and contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: src/pip/_vendor/idna/__init__.py ================================================ from .core import ( IDNABidiError, IDNAError, InvalidCodepoint, InvalidCodepointContext, alabel, check_bidi, check_hyphen_ok, check_initial_combiner, check_label, check_nfc, decode, encode, ulabel, uts46_remap, valid_contextj, valid_contexto, valid_label_length, valid_string_length, ) from .intranges import intranges_contain from .package_data import __version__ __all__ = [ "__version__", "IDNABidiError", "IDNAError", "InvalidCodepoint", "InvalidCodepointContext", "alabel", "check_bidi", "check_hyphen_ok", "check_initial_combiner", "check_label", "check_nfc", "decode", "encode", "intranges_contain", "ulabel", "uts46_remap", "valid_contextj", "valid_contexto", "valid_label_length", "valid_string_length", ] ================================================ FILE: src/pip/_vendor/idna/codec.py ================================================ import codecs import re from typing import Any, Optional, Tuple from .core import IDNAError, alabel, decode, encode, ulabel _unicode_dots_re = re.compile("[\u002e\u3002\uff0e\uff61]") class Codec(codecs.Codec): def encode(self, data: str, errors: str = "strict") -> Tuple[bytes, int]: if errors != "strict": raise IDNAError('Unsupported error handling "{}"'.format(errors)) if not data: return b"", 0 return encode(data), len(data) def decode(self, data: bytes, errors: str = "strict") -> Tuple[str, int]: if errors != "strict": raise IDNAError('Unsupported error handling "{}"'.format(errors)) if not data: return "", 0 return decode(data), len(data) class IncrementalEncoder(codecs.BufferedIncrementalEncoder): def _buffer_encode(self, data: str, errors: str, final: bool) -> Tuple[bytes, int]: if errors != "strict": raise IDNAError('Unsupported error handling "{}"'.format(errors)) if not data: return b"", 0 labels = _unicode_dots_re.split(data) trailing_dot = b"" if labels: if not labels[-1]: trailing_dot = b"." del labels[-1] elif not final: # Keep potentially unfinished label until the next call del labels[-1] if labels: trailing_dot = b"." result = [] size = 0 for label in labels: result.append(alabel(label)) if size: size += 1 size += len(label) # Join with U+002E result_bytes = b".".join(result) + trailing_dot size += len(trailing_dot) return result_bytes, size class IncrementalDecoder(codecs.BufferedIncrementalDecoder): def _buffer_decode(self, data: Any, errors: str, final: bool) -> Tuple[str, int]: if errors != "strict": raise IDNAError('Unsupported error handling "{}"'.format(errors)) if not data: return ("", 0) if not isinstance(data, str): data = str(data, "ascii") labels = _unicode_dots_re.split(data) trailing_dot = "" if labels: if not labels[-1]: trailing_dot = "." del labels[-1] elif not final: # Keep potentially unfinished label until the next call del labels[-1] if labels: trailing_dot = "." result = [] size = 0 for label in labels: result.append(ulabel(label)) if size: size += 1 size += len(label) result_str = ".".join(result) + trailing_dot size += len(trailing_dot) return (result_str, size) class StreamWriter(Codec, codecs.StreamWriter): pass class StreamReader(Codec, codecs.StreamReader): pass def search_function(name: str) -> Optional[codecs.CodecInfo]: if name != "idna2008": return None return codecs.CodecInfo( name=name, encode=Codec().encode, decode=Codec().decode, # type: ignore incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamwriter=StreamWriter, streamreader=StreamReader, ) codecs.register(search_function) ================================================ FILE: src/pip/_vendor/idna/compat.py ================================================ from typing import Any, Union from .core import decode, encode def ToASCII(label: str) -> bytes: return encode(label) def ToUnicode(label: Union[bytes, bytearray]) -> str: return decode(label) def nameprep(s: Any) -> None: raise NotImplementedError("IDNA 2008 does not utilise nameprep protocol") ================================================ FILE: src/pip/_vendor/idna/core.py ================================================ import bisect import re import unicodedata from typing import Optional, Union from . import idnadata from .intranges import intranges_contain _virama_combining_class = 9 _alabel_prefix = b"xn--" _unicode_dots_re = re.compile("[\u002e\u3002\uff0e\uff61]") class IDNAError(UnicodeError): """Base exception for all IDNA-encoding related problems""" pass class IDNABidiError(IDNAError): """Exception when bidirectional requirements are not satisfied""" pass class InvalidCodepoint(IDNAError): """Exception when a disallowed or unallocated codepoint is used""" pass class InvalidCodepointContext(IDNAError): """Exception when the codepoint is not valid in the context it is used""" pass def _combining_class(cp: int) -> int: v = unicodedata.combining(chr(cp)) if v == 0: if not unicodedata.name(chr(cp)): raise ValueError("Unknown character in unicodedata") return v def _is_script(cp: str, script: str) -> bool: return intranges_contain(ord(cp), idnadata.scripts[script]) def _punycode(s: str) -> bytes: return s.encode("punycode") def _unot(s: int) -> str: return "U+{:04X}".format(s) def valid_label_length(label: Union[bytes, str]) -> bool: if len(label) > 63: return False return True def valid_string_length(label: Union[bytes, str], trailing_dot: bool) -> bool: if len(label) > (254 if trailing_dot else 253): return False return True def check_bidi(label: str, check_ltr: bool = False) -> bool: # Bidi rules should only be applied if string contains RTL characters bidi_label = False for idx, cp in enumerate(label, 1): direction = unicodedata.bidirectional(cp) if direction == "": # String likely comes from a newer version of Unicode raise IDNABidiError("Unknown directionality in label {} at position {}".format(repr(label), idx)) if direction in ["R", "AL", "AN"]: bidi_label = True if not bidi_label and not check_ltr: return True # Bidi rule 1 direction = unicodedata.bidirectional(label[0]) if direction in ["R", "AL"]: rtl = True elif direction == "L": rtl = False else: raise IDNABidiError("First codepoint in label {} must be directionality L, R or AL".format(repr(label))) valid_ending = False number_type: Optional[str] = None for idx, cp in enumerate(label, 1): direction = unicodedata.bidirectional(cp) if rtl: # Bidi rule 2 if direction not in [ "R", "AL", "AN", "EN", "ES", "CS", "ET", "ON", "BN", "NSM", ]: raise IDNABidiError("Invalid direction for codepoint at position {} in a right-to-left label".format(idx)) # Bidi rule 3 if direction in ["R", "AL", "EN", "AN"]: valid_ending = True elif direction != "NSM": valid_ending = False # Bidi rule 4 if direction in ["AN", "EN"]: if not number_type: number_type = direction else: if number_type != direction: raise IDNABidiError("Can not mix numeral types in a right-to-left label") else: # Bidi rule 5 if direction not in ["L", "EN", "ES", "CS", "ET", "ON", "BN", "NSM"]: raise IDNABidiError("Invalid direction for codepoint at position {} in a left-to-right label".format(idx)) # Bidi rule 6 if direction in ["L", "EN"]: valid_ending = True elif direction != "NSM": valid_ending = False if not valid_ending: raise IDNABidiError("Label ends with illegal codepoint directionality") return True def check_initial_combiner(label: str) -> bool: if unicodedata.category(label[0])[0] == "M": raise IDNAError("Label begins with an illegal combining character") return True def check_hyphen_ok(label: str) -> bool: if label[2:4] == "--": raise IDNAError("Label has disallowed hyphens in 3rd and 4th position") if label[0] == "-" or label[-1] == "-": raise IDNAError("Label must not start or end with a hyphen") return True def check_nfc(label: str) -> None: if unicodedata.normalize("NFC", label) != label: raise IDNAError("Label must be in Normalization Form C") def valid_contextj(label: str, pos: int) -> bool: cp_value = ord(label[pos]) if cp_value == 0x200C: if pos > 0: if _combining_class(ord(label[pos - 1])) == _virama_combining_class: return True ok = False for i in range(pos - 1, -1, -1): joining_type = idnadata.joining_types.get(ord(label[i])) if joining_type == ord("T"): continue elif joining_type in [ord("L"), ord("D")]: ok = True break else: break if not ok: return False ok = False for i in range(pos + 1, len(label)): joining_type = idnadata.joining_types.get(ord(label[i])) if joining_type == ord("T"): continue elif joining_type in [ord("R"), ord("D")]: ok = True break else: break return ok if cp_value == 0x200D: if pos > 0: if _combining_class(ord(label[pos - 1])) == _virama_combining_class: return True return False else: return False def valid_contexto(label: str, pos: int, exception: bool = False) -> bool: cp_value = ord(label[pos]) if cp_value == 0x00B7: if 0 < pos < len(label) - 1: if ord(label[pos - 1]) == 0x006C and ord(label[pos + 1]) == 0x006C: return True return False elif cp_value == 0x0375: if pos < len(label) - 1 and len(label) > 1: return _is_script(label[pos + 1], "Greek") return False elif cp_value == 0x05F3 or cp_value == 0x05F4: if pos > 0: return _is_script(label[pos - 1], "Hebrew") return False elif cp_value == 0x30FB: for cp in label: if cp == "\u30fb": continue if _is_script(cp, "Hiragana") or _is_script(cp, "Katakana") or _is_script(cp, "Han"): return True return False elif 0x660 <= cp_value <= 0x669: for cp in label: if 0x6F0 <= ord(cp) <= 0x06F9: return False return True elif 0x6F0 <= cp_value <= 0x6F9: for cp in label: if 0x660 <= ord(cp) <= 0x0669: return False return True return False def check_label(label: Union[str, bytes, bytearray]) -> None: if isinstance(label, (bytes, bytearray)): label = label.decode("utf-8") if len(label) == 0: raise IDNAError("Empty Label") check_nfc(label) check_hyphen_ok(label) check_initial_combiner(label) for pos, cp in enumerate(label): cp_value = ord(cp) if intranges_contain(cp_value, idnadata.codepoint_classes["PVALID"]): continue elif intranges_contain(cp_value, idnadata.codepoint_classes["CONTEXTJ"]): try: if not valid_contextj(label, pos): raise InvalidCodepointContext( "Joiner {} not allowed at position {} in {}".format(_unot(cp_value), pos + 1, repr(label)) ) except ValueError: raise IDNAError( "Unknown codepoint adjacent to joiner {} at position {} in {}".format( _unot(cp_value), pos + 1, repr(label) ) ) elif intranges_contain(cp_value, idnadata.codepoint_classes["CONTEXTO"]): if not valid_contexto(label, pos): raise InvalidCodepointContext( "Codepoint {} not allowed at position {} in {}".format(_unot(cp_value), pos + 1, repr(label)) ) else: raise InvalidCodepoint( "Codepoint {} at position {} of {} not allowed".format(_unot(cp_value), pos + 1, repr(label)) ) check_bidi(label) def alabel(label: str) -> bytes: try: label_bytes = label.encode("ascii") ulabel(label_bytes) if not valid_label_length(label_bytes): raise IDNAError("Label too long") return label_bytes except UnicodeEncodeError: pass check_label(label) label_bytes = _alabel_prefix + _punycode(label) if not valid_label_length(label_bytes): raise IDNAError("Label too long") return label_bytes def ulabel(label: Union[str, bytes, bytearray]) -> str: if not isinstance(label, (bytes, bytearray)): try: label_bytes = label.encode("ascii") except UnicodeEncodeError: check_label(label) return label else: label_bytes = bytes(label) label_bytes = label_bytes.lower() if label_bytes.startswith(_alabel_prefix): label_bytes = label_bytes[len(_alabel_prefix) :] if not label_bytes: raise IDNAError("Malformed A-label, no Punycode eligible content found") if label_bytes.decode("ascii")[-1] == "-": raise IDNAError("A-label must not end with a hyphen") else: check_label(label_bytes) return label_bytes.decode("ascii") try: label = label_bytes.decode("punycode") except UnicodeError: raise IDNAError("Invalid A-label") check_label(label) return label def uts46_remap(domain: str, std3_rules: bool = True, transitional: bool = False) -> str: """Re-map the characters in the string according to UTS46 processing.""" from .uts46data import uts46data output = "" for pos, char in enumerate(domain): code_point = ord(char) try: uts46row = uts46data[code_point if code_point < 256 else bisect.bisect_left(uts46data, (code_point, "Z")) - 1] status = uts46row[1] replacement: Optional[str] = None if len(uts46row) == 3: replacement = uts46row[2] if ( status == "V" or (status == "D" and not transitional) or (status == "3" and not std3_rules and replacement is None) ): output += char elif replacement is not None and ( status == "M" or (status == "3" and not std3_rules) or (status == "D" and transitional) ): output += replacement elif status != "I": raise IndexError() except IndexError: raise InvalidCodepoint( "Codepoint {} not allowed at position {} in {}".format(_unot(code_point), pos + 1, repr(domain)) ) return unicodedata.normalize("NFC", output) def encode( s: Union[str, bytes, bytearray], strict: bool = False, uts46: bool = False, std3_rules: bool = False, transitional: bool = False, ) -> bytes: if not isinstance(s, str): try: s = str(s, "ascii") except UnicodeDecodeError: raise IDNAError("should pass a unicode string to the function rather than a byte string.") if uts46: s = uts46_remap(s, std3_rules, transitional) trailing_dot = False result = [] if strict: labels = s.split(".") else: labels = _unicode_dots_re.split(s) if not labels or labels == [""]: raise IDNAError("Empty domain") if labels[-1] == "": del labels[-1] trailing_dot = True for label in labels: s = alabel(label) if s: result.append(s) else: raise IDNAError("Empty label") if trailing_dot: result.append(b"") s = b".".join(result) if not valid_string_length(s, trailing_dot): raise IDNAError("Domain too long") return s def decode( s: Union[str, bytes, bytearray], strict: bool = False, uts46: bool = False, std3_rules: bool = False, ) -> str: try: if not isinstance(s, str): s = str(s, "ascii") except UnicodeDecodeError: raise IDNAError("Invalid ASCII in A-label") if uts46: s = uts46_remap(s, std3_rules, False) trailing_dot = False result = [] if not strict: labels = _unicode_dots_re.split(s) else: labels = s.split(".") if not labels or labels == [""]: raise IDNAError("Empty domain") if not labels[-1]: del labels[-1] trailing_dot = True for label in labels: s = ulabel(label) if s: result.append(s) else: raise IDNAError("Empty label") if trailing_dot: result.append("") return ".".join(result) ================================================ FILE: src/pip/_vendor/idna/idnadata.py ================================================ # This file is automatically generated by tools/idna-data __version__ = "16.0.0" scripts = { "Greek": ( 0x37000000374, 0x37500000378, 0x37A0000037E, 0x37F00000380, 0x38400000385, 0x38600000387, 0x3880000038B, 0x38C0000038D, 0x38E000003A2, 0x3A3000003E2, 0x3F000000400, 0x1D2600001D2B, 0x1D5D00001D62, 0x1D6600001D6B, 0x1DBF00001DC0, 0x1F0000001F16, 0x1F1800001F1E, 0x1F2000001F46, 0x1F4800001F4E, 0x1F5000001F58, 0x1F5900001F5A, 0x1F5B00001F5C, 0x1F5D00001F5E, 0x1F5F00001F7E, 0x1F8000001FB5, 0x1FB600001FC5, 0x1FC600001FD4, 0x1FD600001FDC, 0x1FDD00001FF0, 0x1FF200001FF5, 0x1FF600001FFF, 0x212600002127, 0xAB650000AB66, 0x101400001018F, 0x101A0000101A1, 0x1D2000001D246, ), "Han": ( 0x2E8000002E9A, 0x2E9B00002EF4, 0x2F0000002FD6, 0x300500003006, 0x300700003008, 0x30210000302A, 0x30380000303C, 0x340000004DC0, 0x4E000000A000, 0xF9000000FA6E, 0xFA700000FADA, 0x16FE200016FE4, 0x16FF000016FF2, 0x200000002A6E0, 0x2A7000002B73A, 0x2B7400002B81E, 0x2B8200002CEA2, 0x2CEB00002EBE1, 0x2EBF00002EE5E, 0x2F8000002FA1E, 0x300000003134B, 0x31350000323B0, ), "Hebrew": ( 0x591000005C8, 0x5D0000005EB, 0x5EF000005F5, 0xFB1D0000FB37, 0xFB380000FB3D, 0xFB3E0000FB3F, 0xFB400000FB42, 0xFB430000FB45, 0xFB460000FB50, ), "Hiragana": ( 0x304100003097, 0x309D000030A0, 0x1B0010001B120, 0x1B1320001B133, 0x1B1500001B153, 0x1F2000001F201, ), "Katakana": ( 0x30A1000030FB, 0x30FD00003100, 0x31F000003200, 0x32D0000032FF, 0x330000003358, 0xFF660000FF70, 0xFF710000FF9E, 0x1AFF00001AFF4, 0x1AFF50001AFFC, 0x1AFFD0001AFFF, 0x1B0000001B001, 0x1B1200001B123, 0x1B1550001B156, 0x1B1640001B168, ), } joining_types = { 0xAD: 84, 0x300: 84, 0x301: 84, 0x302: 84, 0x303: 84, 0x304: 84, 0x305: 84, 0x306: 84, 0x307: 84, 0x308: 84, 0x309: 84, 0x30A: 84, 0x30B: 84, 0x30C: 84, 0x30D: 84, 0x30E: 84, 0x30F: 84, 0x310: 84, 0x311: 84, 0x312: 84, 0x313: 84, 0x314: 84, 0x315: 84, 0x316: 84, 0x317: 84, 0x318: 84, 0x319: 84, 0x31A: 84, 0x31B: 84, 0x31C: 84, 0x31D: 84, 0x31E: 84, 0x31F: 84, 0x320: 84, 0x321: 84, 0x322: 84, 0x323: 84, 0x324: 84, 0x325: 84, 0x326: 84, 0x327: 84, 0x328: 84, 0x329: 84, 0x32A: 84, 0x32B: 84, 0x32C: 84, 0x32D: 84, 0x32E: 84, 0x32F: 84, 0x330: 84, 0x331: 84, 0x332: 84, 0x333: 84, 0x334: 84, 0x335: 84, 0x336: 84, 0x337: 84, 0x338: 84, 0x339: 84, 0x33A: 84, 0x33B: 84, 0x33C: 84, 0x33D: 84, 0x33E: 84, 0x33F: 84, 0x340: 84, 0x341: 84, 0x342: 84, 0x343: 84, 0x344: 84, 0x345: 84, 0x346: 84, 0x347: 84, 0x348: 84, 0x349: 84, 0x34A: 84, 0x34B: 84, 0x34C: 84, 0x34D: 84, 0x34E: 84, 0x34F: 84, 0x350: 84, 0x351: 84, 0x352: 84, 0x353: 84, 0x354: 84, 0x355: 84, 0x356: 84, 0x357: 84, 0x358: 84, 0x359: 84, 0x35A: 84, 0x35B: 84, 0x35C: 84, 0x35D: 84, 0x35E: 84, 0x35F: 84, 0x360: 84, 0x361: 84, 0x362: 84, 0x363: 84, 0x364: 84, 0x365: 84, 0x366: 84, 0x367: 84, 0x368: 84, 0x369: 84, 0x36A: 84, 0x36B: 84, 0x36C: 84, 0x36D: 84, 0x36E: 84, 0x36F: 84, 0x483: 84, 0x484: 84, 0x485: 84, 0x486: 84, 0x487: 84, 0x488: 84, 0x489: 84, 0x591: 84, 0x592: 84, 0x593: 84, 0x594: 84, 0x595: 84, 0x596: 84, 0x597: 84, 0x598: 84, 0x599: 84, 0x59A: 84, 0x59B: 84, 0x59C: 84, 0x59D: 84, 0x59E: 84, 0x59F: 84, 0x5A0: 84, 0x5A1: 84, 0x5A2: 84, 0x5A3: 84, 0x5A4: 84, 0x5A5: 84, 0x5A6: 84, 0x5A7: 84, 0x5A8: 84, 0x5A9: 84, 0x5AA: 84, 0x5AB: 84, 0x5AC: 84, 0x5AD: 84, 0x5AE: 84, 0x5AF: 84, 0x5B0: 84, 0x5B1: 84, 0x5B2: 84, 0x5B3: 84, 0x5B4: 84, 0x5B5: 84, 0x5B6: 84, 0x5B7: 84, 0x5B8: 84, 0x5B9: 84, 0x5BA: 84, 0x5BB: 84, 0x5BC: 84, 0x5BD: 84, 0x5BF: 84, 0x5C1: 84, 0x5C2: 84, 0x5C4: 84, 0x5C5: 84, 0x5C7: 84, 0x610: 84, 0x611: 84, 0x612: 84, 0x613: 84, 0x614: 84, 0x615: 84, 0x616: 84, 0x617: 84, 0x618: 84, 0x619: 84, 0x61A: 84, 0x61C: 84, 0x620: 68, 0x622: 82, 0x623: 82, 0x624: 82, 0x625: 82, 0x626: 68, 0x627: 82, 0x628: 68, 0x629: 82, 0x62A: 68, 0x62B: 68, 0x62C: 68, 0x62D: 68, 0x62E: 68, 0x62F: 82, 0x630: 82, 0x631: 82, 0x632: 82, 0x633: 68, 0x634: 68, 0x635: 68, 0x636: 68, 0x637: 68, 0x638: 68, 0x639: 68, 0x63A: 68, 0x63B: 68, 0x63C: 68, 0x63D: 68, 0x63E: 68, 0x63F: 68, 0x640: 67, 0x641: 68, 0x642: 68, 0x643: 68, 0x644: 68, 0x645: 68, 0x646: 68, 0x647: 68, 0x648: 82, 0x649: 68, 0x64A: 68, 0x64B: 84, 0x64C: 84, 0x64D: 84, 0x64E: 84, 0x64F: 84, 0x650: 84, 0x651: 84, 0x652: 84, 0x653: 84, 0x654: 84, 0x655: 84, 0x656: 84, 0x657: 84, 0x658: 84, 0x659: 84, 0x65A: 84, 0x65B: 84, 0x65C: 84, 0x65D: 84, 0x65E: 84, 0x65F: 84, 0x66E: 68, 0x66F: 68, 0x670: 84, 0x671: 82, 0x672: 82, 0x673: 82, 0x675: 82, 0x676: 82, 0x677: 82, 0x678: 68, 0x679: 68, 0x67A: 68, 0x67B: 68, 0x67C: 68, 0x67D: 68, 0x67E: 68, 0x67F: 68, 0x680: 68, 0x681: 68, 0x682: 68, 0x683: 68, 0x684: 68, 0x685: 68, 0x686: 68, 0x687: 68, 0x688: 82, 0x689: 82, 0x68A: 82, 0x68B: 82, 0x68C: 82, 0x68D: 82, 0x68E: 82, 0x68F: 82, 0x690: 82, 0x691: 82, 0x692: 82, 0x693: 82, 0x694: 82, 0x695: 82, 0x696: 82, 0x697: 82, 0x698: 82, 0x699: 82, 0x69A: 68, 0x69B: 68, 0x69C: 68, 0x69D: 68, 0x69E: 68, 0x69F: 68, 0x6A0: 68, 0x6A1: 68, 0x6A2: 68, 0x6A3: 68, 0x6A4: 68, 0x6A5: 68, 0x6A6: 68, 0x6A7: 68, 0x6A8: 68, 0x6A9: 68, 0x6AA: 68, 0x6AB: 68, 0x6AC: 68, 0x6AD: 68, 0x6AE: 68, 0x6AF: 68, 0x6B0: 68, 0x6B1: 68, 0x6B2: 68, 0x6B3: 68, 0x6B4: 68, 0x6B5: 68, 0x6B6: 68, 0x6B7: 68, 0x6B8: 68, 0x6B9: 68, 0x6BA: 68, 0x6BB: 68, 0x6BC: 68, 0x6BD: 68, 0x6BE: 68, 0x6BF: 68, 0x6C0: 82, 0x6C1: 68, 0x6C2: 68, 0x6C3: 82, 0x6C4: 82, 0x6C5: 82, 0x6C6: 82, 0x6C7: 82, 0x6C8: 82, 0x6C9: 82, 0x6CA: 82, 0x6CB: 82, 0x6CC: 68, 0x6CD: 82, 0x6CE: 68, 0x6CF: 82, 0x6D0: 68, 0x6D1: 68, 0x6D2: 82, 0x6D3: 82, 0x6D5: 82, 0x6D6: 84, 0x6D7: 84, 0x6D8: 84, 0x6D9: 84, 0x6DA: 84, 0x6DB: 84, 0x6DC: 84, 0x6DF: 84, 0x6E0: 84, 0x6E1: 84, 0x6E2: 84, 0x6E3: 84, 0x6E4: 84, 0x6E7: 84, 0x6E8: 84, 0x6EA: 84, 0x6EB: 84, 0x6EC: 84, 0x6ED: 84, 0x6EE: 82, 0x6EF: 82, 0x6FA: 68, 0x6FB: 68, 0x6FC: 68, 0x6FF: 68, 0x70F: 84, 0x710: 82, 0x711: 84, 0x712: 68, 0x713: 68, 0x714: 68, 0x715: 82, 0x716: 82, 0x717: 82, 0x718: 82, 0x719: 82, 0x71A: 68, 0x71B: 68, 0x71C: 68, 0x71D: 68, 0x71E: 82, 0x71F: 68, 0x720: 68, 0x721: 68, 0x722: 68, 0x723: 68, 0x724: 68, 0x725: 68, 0x726: 68, 0x727: 68, 0x728: 82, 0x729: 68, 0x72A: 82, 0x72B: 68, 0x72C: 82, 0x72D: 68, 0x72E: 68, 0x72F: 82, 0x730: 84, 0x731: 84, 0x732: 84, 0x733: 84, 0x734: 84, 0x735: 84, 0x736: 84, 0x737: 84, 0x738: 84, 0x739: 84, 0x73A: 84, 0x73B: 84, 0x73C: 84, 0x73D: 84, 0x73E: 84, 0x73F: 84, 0x740: 84, 0x741: 84, 0x742: 84, 0x743: 84, 0x744: 84, 0x745: 84, 0x746: 84, 0x747: 84, 0x748: 84, 0x749: 84, 0x74A: 84, 0x74D: 82, 0x74E: 68, 0x74F: 68, 0x750: 68, 0x751: 68, 0x752: 68, 0x753: 68, 0x754: 68, 0x755: 68, 0x756: 68, 0x757: 68, 0x758: 68, 0x759: 82, 0x75A: 82, 0x75B: 82, 0x75C: 68, 0x75D: 68, 0x75E: 68, 0x75F: 68, 0x760: 68, 0x761: 68, 0x762: 68, 0x763: 68, 0x764: 68, 0x765: 68, 0x766: 68, 0x767: 68, 0x768: 68, 0x769: 68, 0x76A: 68, 0x76B: 82, 0x76C: 82, 0x76D: 68, 0x76E: 68, 0x76F: 68, 0x770: 68, 0x771: 82, 0x772: 68, 0x773: 82, 0x774: 82, 0x775: 68, 0x776: 68, 0x777: 68, 0x778: 82, 0x779: 82, 0x77A: 68, 0x77B: 68, 0x77C: 68, 0x77D: 68, 0x77E: 68, 0x77F: 68, 0x7A6: 84, 0x7A7: 84, 0x7A8: 84, 0x7A9: 84, 0x7AA: 84, 0x7AB: 84, 0x7AC: 84, 0x7AD: 84, 0x7AE: 84, 0x7AF: 84, 0x7B0: 84, 0x7CA: 68, 0x7CB: 68, 0x7CC: 68, 0x7CD: 68, 0x7CE: 68, 0x7CF: 68, 0x7D0: 68, 0x7D1: 68, 0x7D2: 68, 0x7D3: 68, 0x7D4: 68, 0x7D5: 68, 0x7D6: 68, 0x7D7: 68, 0x7D8: 68, 0x7D9: 68, 0x7DA: 68, 0x7DB: 68, 0x7DC: 68, 0x7DD: 68, 0x7DE: 68, 0x7DF: 68, 0x7E0: 68, 0x7E1: 68, 0x7E2: 68, 0x7E3: 68, 0x7E4: 68, 0x7E5: 68, 0x7E6: 68, 0x7E7: 68, 0x7E8: 68, 0x7E9: 68, 0x7EA: 68, 0x7EB: 84, 0x7EC: 84, 0x7ED: 84, 0x7EE: 84, 0x7EF: 84, 0x7F0: 84, 0x7F1: 84, 0x7F2: 84, 0x7F3: 84, 0x7FA: 67, 0x7FD: 84, 0x816: 84, 0x817: 84, 0x818: 84, 0x819: 84, 0x81B: 84, 0x81C: 84, 0x81D: 84, 0x81E: 84, 0x81F: 84, 0x820: 84, 0x821: 84, 0x822: 84, 0x823: 84, 0x825: 84, 0x826: 84, 0x827: 84, 0x829: 84, 0x82A: 84, 0x82B: 84, 0x82C: 84, 0x82D: 84, 0x840: 82, 0x841: 68, 0x842: 68, 0x843: 68, 0x844: 68, 0x845: 68, 0x846: 82, 0x847: 82, 0x848: 68, 0x849: 82, 0x84A: 68, 0x84B: 68, 0x84C: 68, 0x84D: 68, 0x84E: 68, 0x84F: 68, 0x850: 68, 0x851: 68, 0x852: 68, 0x853: 68, 0x854: 82, 0x855: 68, 0x856: 82, 0x857: 82, 0x858: 82, 0x859: 84, 0x85A: 84, 0x85B: 84, 0x860: 68, 0x862: 68, 0x863: 68, 0x864: 68, 0x865: 68, 0x867: 82, 0x868: 68, 0x869: 82, 0x86A: 82, 0x870: 82, 0x871: 82, 0x872: 82, 0x873: 82, 0x874: 82, 0x875: 82, 0x876: 82, 0x877: 82, 0x878: 82, 0x879: 82, 0x87A: 82, 0x87B: 82, 0x87C: 82, 0x87D: 82, 0x87E: 82, 0x87F: 82, 0x880: 82, 0x881: 82, 0x882: 82, 0x883: 67, 0x884: 67, 0x885: 67, 0x886: 68, 0x889: 68, 0x88A: 68, 0x88B: 68, 0x88C: 68, 0x88D: 68, 0x88E: 82, 0x897: 84, 0x898: 84, 0x899: 84, 0x89A: 84, 0x89B: 84, 0x89C: 84, 0x89D: 84, 0x89E: 84, 0x89F: 84, 0x8A0: 68, 0x8A1: 68, 0x8A2: 68, 0x8A3: 68, 0x8A4: 68, 0x8A5: 68, 0x8A6: 68, 0x8A7: 68, 0x8A8: 68, 0x8A9: 68, 0x8AA: 82, 0x8AB: 82, 0x8AC: 82, 0x8AE: 82, 0x8AF: 68, 0x8B0: 68, 0x8B1: 82, 0x8B2: 82, 0x8B3: 68, 0x8B4: 68, 0x8B5: 68, 0x8B6: 68, 0x8B7: 68, 0x8B8: 68, 0x8B9: 82, 0x8BA: 68, 0x8BB: 68, 0x8BC: 68, 0x8BD: 68, 0x8BE: 68, 0x8BF: 68, 0x8C0: 68, 0x8C1: 68, 0x8C2: 68, 0x8C3: 68, 0x8C4: 68, 0x8C5: 68, 0x8C6: 68, 0x8C7: 68, 0x8C8: 68, 0x8CA: 84, 0x8CB: 84, 0x8CC: 84, 0x8CD: 84, 0x8CE: 84, 0x8CF: 84, 0x8D0: 84, 0x8D1: 84, 0x8D2: 84, 0x8D3: 84, 0x8D4: 84, 0x8D5: 84, 0x8D6: 84, 0x8D7: 84, 0x8D8: 84, 0x8D9: 84, 0x8DA: 84, 0x8DB: 84, 0x8DC: 84, 0x8DD: 84, 0x8DE: 84, 0x8DF: 84, 0x8E0: 84, 0x8E1: 84, 0x8E3: 84, 0x8E4: 84, 0x8E5: 84, 0x8E6: 84, 0x8E7: 84, 0x8E8: 84, 0x8E9: 84, 0x8EA: 84, 0x8EB: 84, 0x8EC: 84, 0x8ED: 84, 0x8EE: 84, 0x8EF: 84, 0x8F0: 84, 0x8F1: 84, 0x8F2: 84, 0x8F3: 84, 0x8F4: 84, 0x8F5: 84, 0x8F6: 84, 0x8F7: 84, 0x8F8: 84, 0x8F9: 84, 0x8FA: 84, 0x8FB: 84, 0x8FC: 84, 0x8FD: 84, 0x8FE: 84, 0x8FF: 84, 0x900: 84, 0x901: 84, 0x902: 84, 0x93A: 84, 0x93C: 84, 0x941: 84, 0x942: 84, 0x943: 84, 0x944: 84, 0x945: 84, 0x946: 84, 0x947: 84, 0x948: 84, 0x94D: 84, 0x951: 84, 0x952: 84, 0x953: 84, 0x954: 84, 0x955: 84, 0x956: 84, 0x957: 84, 0x962: 84, 0x963: 84, 0x981: 84, 0x9BC: 84, 0x9C1: 84, 0x9C2: 84, 0x9C3: 84, 0x9C4: 84, 0x9CD: 84, 0x9E2: 84, 0x9E3: 84, 0x9FE: 84, 0xA01: 84, 0xA02: 84, 0xA3C: 84, 0xA41: 84, 0xA42: 84, 0xA47: 84, 0xA48: 84, 0xA4B: 84, 0xA4C: 84, 0xA4D: 84, 0xA51: 84, 0xA70: 84, 0xA71: 84, 0xA75: 84, 0xA81: 84, 0xA82: 84, 0xABC: 84, 0xAC1: 84, 0xAC2: 84, 0xAC3: 84, 0xAC4: 84, 0xAC5: 84, 0xAC7: 84, 0xAC8: 84, 0xACD: 84, 0xAE2: 84, 0xAE3: 84, 0xAFA: 84, 0xAFB: 84, 0xAFC: 84, 0xAFD: 84, 0xAFE: 84, 0xAFF: 84, 0xB01: 84, 0xB3C: 84, 0xB3F: 84, 0xB41: 84, 0xB42: 84, 0xB43: 84, 0xB44: 84, 0xB4D: 84, 0xB55: 84, 0xB56: 84, 0xB62: 84, 0xB63: 84, 0xB82: 84, 0xBC0: 84, 0xBCD: 84, 0xC00: 84, 0xC04: 84, 0xC3C: 84, 0xC3E: 84, 0xC3F: 84, 0xC40: 84, 0xC46: 84, 0xC47: 84, 0xC48: 84, 0xC4A: 84, 0xC4B: 84, 0xC4C: 84, 0xC4D: 84, 0xC55: 84, 0xC56: 84, 0xC62: 84, 0xC63: 84, 0xC81: 84, 0xCBC: 84, 0xCBF: 84, 0xCC6: 84, 0xCCC: 84, 0xCCD: 84, 0xCE2: 84, 0xCE3: 84, 0xD00: 84, 0xD01: 84, 0xD3B: 84, 0xD3C: 84, 0xD41: 84, 0xD42: 84, 0xD43: 84, 0xD44: 84, 0xD4D: 84, 0xD62: 84, 0xD63: 84, 0xD81: 84, 0xDCA: 84, 0xDD2: 84, 0xDD3: 84, 0xDD4: 84, 0xDD6: 84, 0xE31: 84, 0xE34: 84, 0xE35: 84, 0xE36: 84, 0xE37: 84, 0xE38: 84, 0xE39: 84, 0xE3A: 84, 0xE47: 84, 0xE48: 84, 0xE49: 84, 0xE4A: 84, 0xE4B: 84, 0xE4C: 84, 0xE4D: 84, 0xE4E: 84, 0xEB1: 84, 0xEB4: 84, 0xEB5: 84, 0xEB6: 84, 0xEB7: 84, 0xEB8: 84, 0xEB9: 84, 0xEBA: 84, 0xEBB: 84, 0xEBC: 84, 0xEC8: 84, 0xEC9: 84, 0xECA: 84, 0xECB: 84, 0xECC: 84, 0xECD: 84, 0xECE: 84, 0xF18: 84, 0xF19: 84, 0xF35: 84, 0xF37: 84, 0xF39: 84, 0xF71: 84, 0xF72: 84, 0xF73: 84, 0xF74: 84, 0xF75: 84, 0xF76: 84, 0xF77: 84, 0xF78: 84, 0xF79: 84, 0xF7A: 84, 0xF7B: 84, 0xF7C: 84, 0xF7D: 84, 0xF7E: 84, 0xF80: 84, 0xF81: 84, 0xF82: 84, 0xF83: 84, 0xF84: 84, 0xF86: 84, 0xF87: 84, 0xF8D: 84, 0xF8E: 84, 0xF8F: 84, 0xF90: 84, 0xF91: 84, 0xF92: 84, 0xF93: 84, 0xF94: 84, 0xF95: 84, 0xF96: 84, 0xF97: 84, 0xF99: 84, 0xF9A: 84, 0xF9B: 84, 0xF9C: 84, 0xF9D: 84, 0xF9E: 84, 0xF9F: 84, 0xFA0: 84, 0xFA1: 84, 0xFA2: 84, 0xFA3: 84, 0xFA4: 84, 0xFA5: 84, 0xFA6: 84, 0xFA7: 84, 0xFA8: 84, 0xFA9: 84, 0xFAA: 84, 0xFAB: 84, 0xFAC: 84, 0xFAD: 84, 0xFAE: 84, 0xFAF: 84, 0xFB0: 84, 0xFB1: 84, 0xFB2: 84, 0xFB3: 84, 0xFB4: 84, 0xFB5: 84, 0xFB6: 84, 0xFB7: 84, 0xFB8: 84, 0xFB9: 84, 0xFBA: 84, 0xFBB: 84, 0xFBC: 84, 0xFC6: 84, 0x102D: 84, 0x102E: 84, 0x102F: 84, 0x1030: 84, 0x1032: 84, 0x1033: 84, 0x1034: 84, 0x1035: 84, 0x1036: 84, 0x1037: 84, 0x1039: 84, 0x103A: 84, 0x103D: 84, 0x103E: 84, 0x1058: 84, 0x1059: 84, 0x105E: 84, 0x105F: 84, 0x1060: 84, 0x1071: 84, 0x1072: 84, 0x1073: 84, 0x1074: 84, 0x1082: 84, 0x1085: 84, 0x1086: 84, 0x108D: 84, 0x109D: 84, 0x135D: 84, 0x135E: 84, 0x135F: 84, 0x1712: 84, 0x1713: 84, 0x1714: 84, 0x1732: 84, 0x1733: 84, 0x1752: 84, 0x1753: 84, 0x1772: 84, 0x1773: 84, 0x17B4: 84, 0x17B5: 84, 0x17B7: 84, 0x17B8: 84, 0x17B9: 84, 0x17BA: 84, 0x17BB: 84, 0x17BC: 84, 0x17BD: 84, 0x17C6: 84, 0x17C9: 84, 0x17CA: 84, 0x17CB: 84, 0x17CC: 84, 0x17CD: 84, 0x17CE: 84, 0x17CF: 84, 0x17D0: 84, 0x17D1: 84, 0x17D2: 84, 0x17D3: 84, 0x17DD: 84, 0x1807: 68, 0x180A: 67, 0x180B: 84, 0x180C: 84, 0x180D: 84, 0x180F: 84, 0x1820: 68, 0x1821: 68, 0x1822: 68, 0x1823: 68, 0x1824: 68, 0x1825: 68, 0x1826: 68, 0x1827: 68, 0x1828: 68, 0x1829: 68, 0x182A: 68, 0x182B: 68, 0x182C: 68, 0x182D: 68, 0x182E: 68, 0x182F: 68, 0x1830: 68, 0x1831: 68, 0x1832: 68, 0x1833: 68, 0x1834: 68, 0x1835: 68, 0x1836: 68, 0x1837: 68, 0x1838: 68, 0x1839: 68, 0x183A: 68, 0x183B: 68, 0x183C: 68, 0x183D: 68, 0x183E: 68, 0x183F: 68, 0x1840: 68, 0x1841: 68, 0x1842: 68, 0x1843: 68, 0x1844: 68, 0x1845: 68, 0x1846: 68, 0x1847: 68, 0x1848: 68, 0x1849: 68, 0x184A: 68, 0x184B: 68, 0x184C: 68, 0x184D: 68, 0x184E: 68, 0x184F: 68, 0x1850: 68, 0x1851: 68, 0x1852: 68, 0x1853: 68, 0x1854: 68, 0x1855: 68, 0x1856: 68, 0x1857: 68, 0x1858: 68, 0x1859: 68, 0x185A: 68, 0x185B: 68, 0x185C: 68, 0x185D: 68, 0x185E: 68, 0x185F: 68, 0x1860: 68, 0x1861: 68, 0x1862: 68, 0x1863: 68, 0x1864: 68, 0x1865: 68, 0x1866: 68, 0x1867: 68, 0x1868: 68, 0x1869: 68, 0x186A: 68, 0x186B: 68, 0x186C: 68, 0x186D: 68, 0x186E: 68, 0x186F: 68, 0x1870: 68, 0x1871: 68, 0x1872: 68, 0x1873: 68, 0x1874: 68, 0x1875: 68, 0x1876: 68, 0x1877: 68, 0x1878: 68, 0x1885: 84, 0x1886: 84, 0x1887: 68, 0x1888: 68, 0x1889: 68, 0x188A: 68, 0x188B: 68, 0x188C: 68, 0x188D: 68, 0x188E: 68, 0x188F: 68, 0x1890: 68, 0x1891: 68, 0x1892: 68, 0x1893: 68, 0x1894: 68, 0x1895: 68, 0x1896: 68, 0x1897: 68, 0x1898: 68, 0x1899: 68, 0x189A: 68, 0x189B: 68, 0x189C: 68, 0x189D: 68, 0x189E: 68, 0x189F: 68, 0x18A0: 68, 0x18A1: 68, 0x18A2: 68, 0x18A3: 68, 0x18A4: 68, 0x18A5: 68, 0x18A6: 68, 0x18A7: 68, 0x18A8: 68, 0x18A9: 84, 0x18AA: 68, 0x1920: 84, 0x1921: 84, 0x1922: 84, 0x1927: 84, 0x1928: 84, 0x1932: 84, 0x1939: 84, 0x193A: 84, 0x193B: 84, 0x1A17: 84, 0x1A18: 84, 0x1A1B: 84, 0x1A56: 84, 0x1A58: 84, 0x1A59: 84, 0x1A5A: 84, 0x1A5B: 84, 0x1A5C: 84, 0x1A5D: 84, 0x1A5E: 84, 0x1A60: 84, 0x1A62: 84, 0x1A65: 84, 0x1A66: 84, 0x1A67: 84, 0x1A68: 84, 0x1A69: 84, 0x1A6A: 84, 0x1A6B: 84, 0x1A6C: 84, 0x1A73: 84, 0x1A74: 84, 0x1A75: 84, 0x1A76: 84, 0x1A77: 84, 0x1A78: 84, 0x1A79: 84, 0x1A7A: 84, 0x1A7B: 84, 0x1A7C: 84, 0x1A7F: 84, 0x1AB0: 84, 0x1AB1: 84, 0x1AB2: 84, 0x1AB3: 84, 0x1AB4: 84, 0x1AB5: 84, 0x1AB6: 84, 0x1AB7: 84, 0x1AB8: 84, 0x1AB9: 84, 0x1ABA: 84, 0x1ABB: 84, 0x1ABC: 84, 0x1ABD: 84, 0x1ABE: 84, 0x1ABF: 84, 0x1AC0: 84, 0x1AC1: 84, 0x1AC2: 84, 0x1AC3: 84, 0x1AC4: 84, 0x1AC5: 84, 0x1AC6: 84, 0x1AC7: 84, 0x1AC8: 84, 0x1AC9: 84, 0x1ACA: 84, 0x1ACB: 84, 0x1ACC: 84, 0x1ACD: 84, 0x1ACE: 84, 0x1B00: 84, 0x1B01: 84, 0x1B02: 84, 0x1B03: 84, 0x1B34: 84, 0x1B36: 84, 0x1B37: 84, 0x1B38: 84, 0x1B39: 84, 0x1B3A: 84, 0x1B3C: 84, 0x1B42: 84, 0x1B6B: 84, 0x1B6C: 84, 0x1B6D: 84, 0x1B6E: 84, 0x1B6F: 84, 0x1B70: 84, 0x1B71: 84, 0x1B72: 84, 0x1B73: 84, 0x1B80: 84, 0x1B81: 84, 0x1BA2: 84, 0x1BA3: 84, 0x1BA4: 84, 0x1BA5: 84, 0x1BA8: 84, 0x1BA9: 84, 0x1BAB: 84, 0x1BAC: 84, 0x1BAD: 84, 0x1BE6: 84, 0x1BE8: 84, 0x1BE9: 84, 0x1BED: 84, 0x1BEF: 84, 0x1BF0: 84, 0x1BF1: 84, 0x1C2C: 84, 0x1C2D: 84, 0x1C2E: 84, 0x1C2F: 84, 0x1C30: 84, 0x1C31: 84, 0x1C32: 84, 0x1C33: 84, 0x1C36: 84, 0x1C37: 84, 0x1CD0: 84, 0x1CD1: 84, 0x1CD2: 84, 0x1CD4: 84, 0x1CD5: 84, 0x1CD6: 84, 0x1CD7: 84, 0x1CD8: 84, 0x1CD9: 84, 0x1CDA: 84, 0x1CDB: 84, 0x1CDC: 84, 0x1CDD: 84, 0x1CDE: 84, 0x1CDF: 84, 0x1CE0: 84, 0x1CE2: 84, 0x1CE3: 84, 0x1CE4: 84, 0x1CE5: 84, 0x1CE6: 84, 0x1CE7: 84, 0x1CE8: 84, 0x1CED: 84, 0x1CF4: 84, 0x1CF8: 84, 0x1CF9: 84, 0x1DC0: 84, 0x1DC1: 84, 0x1DC2: 84, 0x1DC3: 84, 0x1DC4: 84, 0x1DC5: 84, 0x1DC6: 84, 0x1DC7: 84, 0x1DC8: 84, 0x1DC9: 84, 0x1DCA: 84, 0x1DCB: 84, 0x1DCC: 84, 0x1DCD: 84, 0x1DCE: 84, 0x1DCF: 84, 0x1DD0: 84, 0x1DD1: 84, 0x1DD2: 84, 0x1DD3: 84, 0x1DD4: 84, 0x1DD5: 84, 0x1DD6: 84, 0x1DD7: 84, 0x1DD8: 84, 0x1DD9: 84, 0x1DDA: 84, 0x1DDB: 84, 0x1DDC: 84, 0x1DDD: 84, 0x1DDE: 84, 0x1DDF: 84, 0x1DE0: 84, 0x1DE1: 84, 0x1DE2: 84, 0x1DE3: 84, 0x1DE4: 84, 0x1DE5: 84, 0x1DE6: 84, 0x1DE7: 84, 0x1DE8: 84, 0x1DE9: 84, 0x1DEA: 84, 0x1DEB: 84, 0x1DEC: 84, 0x1DED: 84, 0x1DEE: 84, 0x1DEF: 84, 0x1DF0: 84, 0x1DF1: 84, 0x1DF2: 84, 0x1DF3: 84, 0x1DF4: 84, 0x1DF5: 84, 0x1DF6: 84, 0x1DF7: 84, 0x1DF8: 84, 0x1DF9: 84, 0x1DFA: 84, 0x1DFB: 84, 0x1DFC: 84, 0x1DFD: 84, 0x1DFE: 84, 0x1DFF: 84, 0x200B: 84, 0x200D: 67, 0x200E: 84, 0x200F: 84, 0x202A: 84, 0x202B: 84, 0x202C: 84, 0x202D: 84, 0x202E: 84, 0x2060: 84, 0x2061: 84, 0x2062: 84, 0x2063: 84, 0x2064: 84, 0x206A: 84, 0x206B: 84, 0x206C: 84, 0x206D: 84, 0x206E: 84, 0x206F: 84, 0x20D0: 84, 0x20D1: 84, 0x20D2: 84, 0x20D3: 84, 0x20D4: 84, 0x20D5: 84, 0x20D6: 84, 0x20D7: 84, 0x20D8: 84, 0x20D9: 84, 0x20DA: 84, 0x20DB: 84, 0x20DC: 84, 0x20DD: 84, 0x20DE: 84, 0x20DF: 84, 0x20E0: 84, 0x20E1: 84, 0x20E2: 84, 0x20E3: 84, 0x20E4: 84, 0x20E5: 84, 0x20E6: 84, 0x20E7: 84, 0x20E8: 84, 0x20E9: 84, 0x20EA: 84, 0x20EB: 84, 0x20EC: 84, 0x20ED: 84, 0x20EE: 84, 0x20EF: 84, 0x20F0: 84, 0x2CEF: 84, 0x2CF0: 84, 0x2CF1: 84, 0x2D7F: 84, 0x2DE0: 84, 0x2DE1: 84, 0x2DE2: 84, 0x2DE3: 84, 0x2DE4: 84, 0x2DE5: 84, 0x2DE6: 84, 0x2DE7: 84, 0x2DE8: 84, 0x2DE9: 84, 0x2DEA: 84, 0x2DEB: 84, 0x2DEC: 84, 0x2DED: 84, 0x2DEE: 84, 0x2DEF: 84, 0x2DF0: 84, 0x2DF1: 84, 0x2DF2: 84, 0x2DF3: 84, 0x2DF4: 84, 0x2DF5: 84, 0x2DF6: 84, 0x2DF7: 84, 0x2DF8: 84, 0x2DF9: 84, 0x2DFA: 84, 0x2DFB: 84, 0x2DFC: 84, 0x2DFD: 84, 0x2DFE: 84, 0x2DFF: 84, 0x302A: 84, 0x302B: 84, 0x302C: 84, 0x302D: 84, 0x3099: 84, 0x309A: 84, 0xA66F: 84, 0xA670: 84, 0xA671: 84, 0xA672: 84, 0xA674: 84, 0xA675: 84, 0xA676: 84, 0xA677: 84, 0xA678: 84, 0xA679: 84, 0xA67A: 84, 0xA67B: 84, 0xA67C: 84, 0xA67D: 84, 0xA69E: 84, 0xA69F: 84, 0xA6F0: 84, 0xA6F1: 84, 0xA802: 84, 0xA806: 84, 0xA80B: 84, 0xA825: 84, 0xA826: 84, 0xA82C: 84, 0xA840: 68, 0xA841: 68, 0xA842: 68, 0xA843: 68, 0xA844: 68, 0xA845: 68, 0xA846: 68, 0xA847: 68, 0xA848: 68, 0xA849: 68, 0xA84A: 68, 0xA84B: 68, 0xA84C: 68, 0xA84D: 68, 0xA84E: 68, 0xA84F: 68, 0xA850: 68, 0xA851: 68, 0xA852: 68, 0xA853: 68, 0xA854: 68, 0xA855: 68, 0xA856: 68, 0xA857: 68, 0xA858: 68, 0xA859: 68, 0xA85A: 68, 0xA85B: 68, 0xA85C: 68, 0xA85D: 68, 0xA85E: 68, 0xA85F: 68, 0xA860: 68, 0xA861: 68, 0xA862: 68, 0xA863: 68, 0xA864: 68, 0xA865: 68, 0xA866: 68, 0xA867: 68, 0xA868: 68, 0xA869: 68, 0xA86A: 68, 0xA86B: 68, 0xA86C: 68, 0xA86D: 68, 0xA86E: 68, 0xA86F: 68, 0xA870: 68, 0xA871: 68, 0xA872: 76, 0xA8C4: 84, 0xA8C5: 84, 0xA8E0: 84, 0xA8E1: 84, 0xA8E2: 84, 0xA8E3: 84, 0xA8E4: 84, 0xA8E5: 84, 0xA8E6: 84, 0xA8E7: 84, 0xA8E8: 84, 0xA8E9: 84, 0xA8EA: 84, 0xA8EB: 84, 0xA8EC: 84, 0xA8ED: 84, 0xA8EE: 84, 0xA8EF: 84, 0xA8F0: 84, 0xA8F1: 84, 0xA8FF: 84, 0xA926: 84, 0xA927: 84, 0xA928: 84, 0xA929: 84, 0xA92A: 84, 0xA92B: 84, 0xA92C: 84, 0xA92D: 84, 0xA947: 84, 0xA948: 84, 0xA949: 84, 0xA94A: 84, 0xA94B: 84, 0xA94C: 84, 0xA94D: 84, 0xA94E: 84, 0xA94F: 84, 0xA950: 84, 0xA951: 84, 0xA980: 84, 0xA981: 84, 0xA982: 84, 0xA9B3: 84, 0xA9B6: 84, 0xA9B7: 84, 0xA9B8: 84, 0xA9B9: 84, 0xA9BC: 84, 0xA9BD: 84, 0xA9E5: 84, 0xAA29: 84, 0xAA2A: 84, 0xAA2B: 84, 0xAA2C: 84, 0xAA2D: 84, 0xAA2E: 84, 0xAA31: 84, 0xAA32: 84, 0xAA35: 84, 0xAA36: 84, 0xAA43: 84, 0xAA4C: 84, 0xAA7C: 84, 0xAAB0: 84, 0xAAB2: 84, 0xAAB3: 84, 0xAAB4: 84, 0xAAB7: 84, 0xAAB8: 84, 0xAABE: 84, 0xAABF: 84, 0xAAC1: 84, 0xAAEC: 84, 0xAAED: 84, 0xAAF6: 84, 0xABE5: 84, 0xABE8: 84, 0xABED: 84, 0xFB1E: 84, 0xFE00: 84, 0xFE01: 84, 0xFE02: 84, 0xFE03: 84, 0xFE04: 84, 0xFE05: 84, 0xFE06: 84, 0xFE07: 84, 0xFE08: 84, 0xFE09: 84, 0xFE0A: 84, 0xFE0B: 84, 0xFE0C: 84, 0xFE0D: 84, 0xFE0E: 84, 0xFE0F: 84, 0xFE20: 84, 0xFE21: 84, 0xFE22: 84, 0xFE23: 84, 0xFE24: 84, 0xFE25: 84, 0xFE26: 84, 0xFE27: 84, 0xFE28: 84, 0xFE29: 84, 0xFE2A: 84, 0xFE2B: 84, 0xFE2C: 84, 0xFE2D: 84, 0xFE2E: 84, 0xFE2F: 84, 0xFEFF: 84, 0xFFF9: 84, 0xFFFA: 84, 0xFFFB: 84, 0x101FD: 84, 0x102E0: 84, 0x10376: 84, 0x10377: 84, 0x10378: 84, 0x10379: 84, 0x1037A: 84, 0x10A01: 84, 0x10A02: 84, 0x10A03: 84, 0x10A05: 84, 0x10A06: 84, 0x10A0C: 84, 0x10A0D: 84, 0x10A0E: 84, 0x10A0F: 84, 0x10A38: 84, 0x10A39: 84, 0x10A3A: 84, 0x10A3F: 84, 0x10AC0: 68, 0x10AC1: 68, 0x10AC2: 68, 0x10AC3: 68, 0x10AC4: 68, 0x10AC5: 82, 0x10AC7: 82, 0x10AC9: 82, 0x10ACA: 82, 0x10ACD: 76, 0x10ACE: 82, 0x10ACF: 82, 0x10AD0: 82, 0x10AD1: 82, 0x10AD2: 82, 0x10AD3: 68, 0x10AD4: 68, 0x10AD5: 68, 0x10AD6: 68, 0x10AD7: 76, 0x10AD8: 68, 0x10AD9: 68, 0x10ADA: 68, 0x10ADB: 68, 0x10ADC: 68, 0x10ADD: 82, 0x10ADE: 68, 0x10ADF: 68, 0x10AE0: 68, 0x10AE1: 82, 0x10AE4: 82, 0x10AE5: 84, 0x10AE6: 84, 0x10AEB: 68, 0x10AEC: 68, 0x10AED: 68, 0x10AEE: 68, 0x10AEF: 82, 0x10B80: 68, 0x10B81: 82, 0x10B82: 68, 0x10B83: 82, 0x10B84: 82, 0x10B85: 82, 0x10B86: 68, 0x10B87: 68, 0x10B88: 68, 0x10B89: 82, 0x10B8A: 68, 0x10B8B: 68, 0x10B8C: 82, 0x10B8D: 68, 0x10B8E: 82, 0x10B8F: 82, 0x10B90: 68, 0x10B91: 82, 0x10BA9: 82, 0x10BAA: 82, 0x10BAB: 82, 0x10BAC: 82, 0x10BAD: 68, 0x10BAE: 68, 0x10D00: 76, 0x10D01: 68, 0x10D02: 68, 0x10D03: 68, 0x10D04: 68, 0x10D05: 68, 0x10D06: 68, 0x10D07: 68, 0x10D08: 68, 0x10D09: 68, 0x10D0A: 68, 0x10D0B: 68, 0x10D0C: 68, 0x10D0D: 68, 0x10D0E: 68, 0x10D0F: 68, 0x10D10: 68, 0x10D11: 68, 0x10D12: 68, 0x10D13: 68, 0x10D14: 68, 0x10D15: 68, 0x10D16: 68, 0x10D17: 68, 0x10D18: 68, 0x10D19: 68, 0x10D1A: 68, 0x10D1B: 68, 0x10D1C: 68, 0x10D1D: 68, 0x10D1E: 68, 0x10D1F: 68, 0x10D20: 68, 0x10D21: 68, 0x10D22: 82, 0x10D23: 68, 0x10D24: 84, 0x10D25: 84, 0x10D26: 84, 0x10D27: 84, 0x10D69: 84, 0x10D6A: 84, 0x10D6B: 84, 0x10D6C: 84, 0x10D6D: 84, 0x10EAB: 84, 0x10EAC: 84, 0x10EC2: 82, 0x10EC3: 68, 0x10EC4: 68, 0x10EFC: 84, 0x10EFD: 84, 0x10EFE: 84, 0x10EFF: 84, 0x10F30: 68, 0x10F31: 68, 0x10F32: 68, 0x10F33: 82, 0x10F34: 68, 0x10F35: 68, 0x10F36: 68, 0x10F37: 68, 0x10F38: 68, 0x10F39: 68, 0x10F3A: 68, 0x10F3B: 68, 0x10F3C: 68, 0x10F3D: 68, 0x10F3E: 68, 0x10F3F: 68, 0x10F40: 68, 0x10F41: 68, 0x10F42: 68, 0x10F43: 68, 0x10F44: 68, 0x10F46: 84, 0x10F47: 84, 0x10F48: 84, 0x10F49: 84, 0x10F4A: 84, 0x10F4B: 84, 0x10F4C: 84, 0x10F4D: 84, 0x10F4E: 84, 0x10F4F: 84, 0x10F50: 84, 0x10F51: 68, 0x10F52: 68, 0x10F53: 68, 0x10F54: 82, 0x10F70: 68, 0x10F71: 68, 0x10F72: 68, 0x10F73: 68, 0x10F74: 82, 0x10F75: 82, 0x10F76: 68, 0x10F77: 68, 0x10F78: 68, 0x10F79: 68, 0x10F7A: 68, 0x10F7B: 68, 0x10F7C: 68, 0x10F7D: 68, 0x10F7E: 68, 0x10F7F: 68, 0x10F80: 68, 0x10F81: 68, 0x10F82: 84, 0x10F83: 84, 0x10F84: 84, 0x10F85: 84, 0x10FB0: 68, 0x10FB2: 68, 0x10FB3: 68, 0x10FB4: 82, 0x10FB5: 82, 0x10FB6: 82, 0x10FB8: 68, 0x10FB9: 82, 0x10FBA: 82, 0x10FBB: 68, 0x10FBC: 68, 0x10FBD: 82, 0x10FBE: 68, 0x10FBF: 68, 0x10FC1: 68, 0x10FC2: 82, 0x10FC3: 82, 0x10FC4: 68, 0x10FC9: 82, 0x10FCA: 68, 0x10FCB: 76, 0x11001: 84, 0x11038: 84, 0x11039: 84, 0x1103A: 84, 0x1103B: 84, 0x1103C: 84, 0x1103D: 84, 0x1103E: 84, 0x1103F: 84, 0x11040: 84, 0x11041: 84, 0x11042: 84, 0x11043: 84, 0x11044: 84, 0x11045: 84, 0x11046: 84, 0x11070: 84, 0x11073: 84, 0x11074: 84, 0x1107F: 84, 0x11080: 84, 0x11081: 84, 0x110B3: 84, 0x110B4: 84, 0x110B5: 84, 0x110B6: 84, 0x110B9: 84, 0x110BA: 84, 0x110C2: 84, 0x11100: 84, 0x11101: 84, 0x11102: 84, 0x11127: 84, 0x11128: 84, 0x11129: 84, 0x1112A: 84, 0x1112B: 84, 0x1112D: 84, 0x1112E: 84, 0x1112F: 84, 0x11130: 84, 0x11131: 84, 0x11132: 84, 0x11133: 84, 0x11134: 84, 0x11173: 84, 0x11180: 84, 0x11181: 84, 0x111B6: 84, 0x111B7: 84, 0x111B8: 84, 0x111B9: 84, 0x111BA: 84, 0x111BB: 84, 0x111BC: 84, 0x111BD: 84, 0x111BE: 84, 0x111C9: 84, 0x111CA: 84, 0x111CB: 84, 0x111CC: 84, 0x111CF: 84, 0x1122F: 84, 0x11230: 84, 0x11231: 84, 0x11234: 84, 0x11236: 84, 0x11237: 84, 0x1123E: 84, 0x11241: 84, 0x112DF: 84, 0x112E3: 84, 0x112E4: 84, 0x112E5: 84, 0x112E6: 84, 0x112E7: 84, 0x112E8: 84, 0x112E9: 84, 0x112EA: 84, 0x11300: 84, 0x11301: 84, 0x1133B: 84, 0x1133C: 84, 0x11340: 84, 0x11366: 84, 0x11367: 84, 0x11368: 84, 0x11369: 84, 0x1136A: 84, 0x1136B: 84, 0x1136C: 84, 0x11370: 84, 0x11371: 84, 0x11372: 84, 0x11373: 84, 0x11374: 84, 0x113BB: 84, 0x113BC: 84, 0x113BD: 84, 0x113BE: 84, 0x113BF: 84, 0x113C0: 84, 0x113CE: 84, 0x113D0: 84, 0x113D2: 84, 0x113E1: 84, 0x113E2: 84, 0x11438: 84, 0x11439: 84, 0x1143A: 84, 0x1143B: 84, 0x1143C: 84, 0x1143D: 84, 0x1143E: 84, 0x1143F: 84, 0x11442: 84, 0x11443: 84, 0x11444: 84, 0x11446: 84, 0x1145E: 84, 0x114B3: 84, 0x114B4: 84, 0x114B5: 84, 0x114B6: 84, 0x114B7: 84, 0x114B8: 84, 0x114BA: 84, 0x114BF: 84, 0x114C0: 84, 0x114C2: 84, 0x114C3: 84, 0x115B2: 84, 0x115B3: 84, 0x115B4: 84, 0x115B5: 84, 0x115BC: 84, 0x115BD: 84, 0x115BF: 84, 0x115C0: 84, 0x115DC: 84, 0x115DD: 84, 0x11633: 84, 0x11634: 84, 0x11635: 84, 0x11636: 84, 0x11637: 84, 0x11638: 84, 0x11639: 84, 0x1163A: 84, 0x1163D: 84, 0x1163F: 84, 0x11640: 84, 0x116AB: 84, 0x116AD: 84, 0x116B0: 84, 0x116B1: 84, 0x116B2: 84, 0x116B3: 84, 0x116B4: 84, 0x116B5: 84, 0x116B7: 84, 0x1171D: 84, 0x1171F: 84, 0x11722: 84, 0x11723: 84, 0x11724: 84, 0x11725: 84, 0x11727: 84, 0x11728: 84, 0x11729: 84, 0x1172A: 84, 0x1172B: 84, 0x1182F: 84, 0x11830: 84, 0x11831: 84, 0x11832: 84, 0x11833: 84, 0x11834: 84, 0x11835: 84, 0x11836: 84, 0x11837: 84, 0x11839: 84, 0x1183A: 84, 0x1193B: 84, 0x1193C: 84, 0x1193E: 84, 0x11943: 84, 0x119D4: 84, 0x119D5: 84, 0x119D6: 84, 0x119D7: 84, 0x119DA: 84, 0x119DB: 84, 0x119E0: 84, 0x11A01: 84, 0x11A02: 84, 0x11A03: 84, 0x11A04: 84, 0x11A05: 84, 0x11A06: 84, 0x11A07: 84, 0x11A08: 84, 0x11A09: 84, 0x11A0A: 84, 0x11A33: 84, 0x11A34: 84, 0x11A35: 84, 0x11A36: 84, 0x11A37: 84, 0x11A38: 84, 0x11A3B: 84, 0x11A3C: 84, 0x11A3D: 84, 0x11A3E: 84, 0x11A47: 84, 0x11A51: 84, 0x11A52: 84, 0x11A53: 84, 0x11A54: 84, 0x11A55: 84, 0x11A56: 84, 0x11A59: 84, 0x11A5A: 84, 0x11A5B: 84, 0x11A8A: 84, 0x11A8B: 84, 0x11A8C: 84, 0x11A8D: 84, 0x11A8E: 84, 0x11A8F: 84, 0x11A90: 84, 0x11A91: 84, 0x11A92: 84, 0x11A93: 84, 0x11A94: 84, 0x11A95: 84, 0x11A96: 84, 0x11A98: 84, 0x11A99: 84, 0x11C30: 84, 0x11C31: 84, 0x11C32: 84, 0x11C33: 84, 0x11C34: 84, 0x11C35: 84, 0x11C36: 84, 0x11C38: 84, 0x11C39: 84, 0x11C3A: 84, 0x11C3B: 84, 0x11C3C: 84, 0x11C3D: 84, 0x11C3F: 84, 0x11C92: 84, 0x11C93: 84, 0x11C94: 84, 0x11C95: 84, 0x11C96: 84, 0x11C97: 84, 0x11C98: 84, 0x11C99: 84, 0x11C9A: 84, 0x11C9B: 84, 0x11C9C: 84, 0x11C9D: 84, 0x11C9E: 84, 0x11C9F: 84, 0x11CA0: 84, 0x11CA1: 84, 0x11CA2: 84, 0x11CA3: 84, 0x11CA4: 84, 0x11CA5: 84, 0x11CA6: 84, 0x11CA7: 84, 0x11CAA: 84, 0x11CAB: 84, 0x11CAC: 84, 0x11CAD: 84, 0x11CAE: 84, 0x11CAF: 84, 0x11CB0: 84, 0x11CB2: 84, 0x11CB3: 84, 0x11CB5: 84, 0x11CB6: 84, 0x11D31: 84, 0x11D32: 84, 0x11D33: 84, 0x11D34: 84, 0x11D35: 84, 0x11D36: 84, 0x11D3A: 84, 0x11D3C: 84, 0x11D3D: 84, 0x11D3F: 84, 0x11D40: 84, 0x11D41: 84, 0x11D42: 84, 0x11D43: 84, 0x11D44: 84, 0x11D45: 84, 0x11D47: 84, 0x11D90: 84, 0x11D91: 84, 0x11D95: 84, 0x11D97: 84, 0x11EF3: 84, 0x11EF4: 84, 0x11F00: 84, 0x11F01: 84, 0x11F36: 84, 0x11F37: 84, 0x11F38: 84, 0x11F39: 84, 0x11F3A: 84, 0x11F40: 84, 0x11F42: 84, 0x11F5A: 84, 0x13430: 84, 0x13431: 84, 0x13432: 84, 0x13433: 84, 0x13434: 84, 0x13435: 84, 0x13436: 84, 0x13437: 84, 0x13438: 84, 0x13439: 84, 0x1343A: 84, 0x1343B: 84, 0x1343C: 84, 0x1343D: 84, 0x1343E: 84, 0x1343F: 84, 0x13440: 84, 0x13447: 84, 0x13448: 84, 0x13449: 84, 0x1344A: 84, 0x1344B: 84, 0x1344C: 84, 0x1344D: 84, 0x1344E: 84, 0x1344F: 84, 0x13450: 84, 0x13451: 84, 0x13452: 84, 0x13453: 84, 0x13454: 84, 0x13455: 84, 0x1611E: 84, 0x1611F: 84, 0x16120: 84, 0x16121: 84, 0x16122: 84, 0x16123: 84, 0x16124: 84, 0x16125: 84, 0x16126: 84, 0x16127: 84, 0x16128: 84, 0x16129: 84, 0x1612D: 84, 0x1612E: 84, 0x1612F: 84, 0x16AF0: 84, 0x16AF1: 84, 0x16AF2: 84, 0x16AF3: 84, 0x16AF4: 84, 0x16B30: 84, 0x16B31: 84, 0x16B32: 84, 0x16B33: 84, 0x16B34: 84, 0x16B35: 84, 0x16B36: 84, 0x16F4F: 84, 0x16F8F: 84, 0x16F90: 84, 0x16F91: 84, 0x16F92: 84, 0x16FE4: 84, 0x1BC9D: 84, 0x1BC9E: 84, 0x1BCA0: 84, 0x1BCA1: 84, 0x1BCA2: 84, 0x1BCA3: 84, 0x1CF00: 84, 0x1CF01: 84, 0x1CF02: 84, 0x1CF03: 84, 0x1CF04: 84, 0x1CF05: 84, 0x1CF06: 84, 0x1CF07: 84, 0x1CF08: 84, 0x1CF09: 84, 0x1CF0A: 84, 0x1CF0B: 84, 0x1CF0C: 84, 0x1CF0D: 84, 0x1CF0E: 84, 0x1CF0F: 84, 0x1CF10: 84, 0x1CF11: 84, 0x1CF12: 84, 0x1CF13: 84, 0x1CF14: 84, 0x1CF15: 84, 0x1CF16: 84, 0x1CF17: 84, 0x1CF18: 84, 0x1CF19: 84, 0x1CF1A: 84, 0x1CF1B: 84, 0x1CF1C: 84, 0x1CF1D: 84, 0x1CF1E: 84, 0x1CF1F: 84, 0x1CF20: 84, 0x1CF21: 84, 0x1CF22: 84, 0x1CF23: 84, 0x1CF24: 84, 0x1CF25: 84, 0x1CF26: 84, 0x1CF27: 84, 0x1CF28: 84, 0x1CF29: 84, 0x1CF2A: 84, 0x1CF2B: 84, 0x1CF2C: 84, 0x1CF2D: 84, 0x1CF30: 84, 0x1CF31: 84, 0x1CF32: 84, 0x1CF33: 84, 0x1CF34: 84, 0x1CF35: 84, 0x1CF36: 84, 0x1CF37: 84, 0x1CF38: 84, 0x1CF39: 84, 0x1CF3A: 84, 0x1CF3B: 84, 0x1CF3C: 84, 0x1CF3D: 84, 0x1CF3E: 84, 0x1CF3F: 84, 0x1CF40: 84, 0x1CF41: 84, 0x1CF42: 84, 0x1CF43: 84, 0x1CF44: 84, 0x1CF45: 84, 0x1CF46: 84, 0x1D167: 84, 0x1D168: 84, 0x1D169: 84, 0x1D173: 84, 0x1D174: 84, 0x1D175: 84, 0x1D176: 84, 0x1D177: 84, 0x1D178: 84, 0x1D179: 84, 0x1D17A: 84, 0x1D17B: 84, 0x1D17C: 84, 0x1D17D: 84, 0x1D17E: 84, 0x1D17F: 84, 0x1D180: 84, 0x1D181: 84, 0x1D182: 84, 0x1D185: 84, 0x1D186: 84, 0x1D187: 84, 0x1D188: 84, 0x1D189: 84, 0x1D18A: 84, 0x1D18B: 84, 0x1D1AA: 84, 0x1D1AB: 84, 0x1D1AC: 84, 0x1D1AD: 84, 0x1D242: 84, 0x1D243: 84, 0x1D244: 84, 0x1DA00: 84, 0x1DA01: 84, 0x1DA02: 84, 0x1DA03: 84, 0x1DA04: 84, 0x1DA05: 84, 0x1DA06: 84, 0x1DA07: 84, 0x1DA08: 84, 0x1DA09: 84, 0x1DA0A: 84, 0x1DA0B: 84, 0x1DA0C: 84, 0x1DA0D: 84, 0x1DA0E: 84, 0x1DA0F: 84, 0x1DA10: 84, 0x1DA11: 84, 0x1DA12: 84, 0x1DA13: 84, 0x1DA14: 84, 0x1DA15: 84, 0x1DA16: 84, 0x1DA17: 84, 0x1DA18: 84, 0x1DA19: 84, 0x1DA1A: 84, 0x1DA1B: 84, 0x1DA1C: 84, 0x1DA1D: 84, 0x1DA1E: 84, 0x1DA1F: 84, 0x1DA20: 84, 0x1DA21: 84, 0x1DA22: 84, 0x1DA23: 84, 0x1DA24: 84, 0x1DA25: 84, 0x1DA26: 84, 0x1DA27: 84, 0x1DA28: 84, 0x1DA29: 84, 0x1DA2A: 84, 0x1DA2B: 84, 0x1DA2C: 84, 0x1DA2D: 84, 0x1DA2E: 84, 0x1DA2F: 84, 0x1DA30: 84, 0x1DA31: 84, 0x1DA32: 84, 0x1DA33: 84, 0x1DA34: 84, 0x1DA35: 84, 0x1DA36: 84, 0x1DA3B: 84, 0x1DA3C: 84, 0x1DA3D: 84, 0x1DA3E: 84, 0x1DA3F: 84, 0x1DA40: 84, 0x1DA41: 84, 0x1DA42: 84, 0x1DA43: 84, 0x1DA44: 84, 0x1DA45: 84, 0x1DA46: 84, 0x1DA47: 84, 0x1DA48: 84, 0x1DA49: 84, 0x1DA4A: 84, 0x1DA4B: 84, 0x1DA4C: 84, 0x1DA4D: 84, 0x1DA4E: 84, 0x1DA4F: 84, 0x1DA50: 84, 0x1DA51: 84, 0x1DA52: 84, 0x1DA53: 84, 0x1DA54: 84, 0x1DA55: 84, 0x1DA56: 84, 0x1DA57: 84, 0x1DA58: 84, 0x1DA59: 84, 0x1DA5A: 84, 0x1DA5B: 84, 0x1DA5C: 84, 0x1DA5D: 84, 0x1DA5E: 84, 0x1DA5F: 84, 0x1DA60: 84, 0x1DA61: 84, 0x1DA62: 84, 0x1DA63: 84, 0x1DA64: 84, 0x1DA65: 84, 0x1DA66: 84, 0x1DA67: 84, 0x1DA68: 84, 0x1DA69: 84, 0x1DA6A: 84, 0x1DA6B: 84, 0x1DA6C: 84, 0x1DA75: 84, 0x1DA84: 84, 0x1DA9B: 84, 0x1DA9C: 84, 0x1DA9D: 84, 0x1DA9E: 84, 0x1DA9F: 84, 0x1DAA1: 84, 0x1DAA2: 84, 0x1DAA3: 84, 0x1DAA4: 84, 0x1DAA5: 84, 0x1DAA6: 84, 0x1DAA7: 84, 0x1DAA8: 84, 0x1DAA9: 84, 0x1DAAA: 84, 0x1DAAB: 84, 0x1DAAC: 84, 0x1DAAD: 84, 0x1DAAE: 84, 0x1DAAF: 84, 0x1E000: 84, 0x1E001: 84, 0x1E002: 84, 0x1E003: 84, 0x1E004: 84, 0x1E005: 84, 0x1E006: 84, 0x1E008: 84, 0x1E009: 84, 0x1E00A: 84, 0x1E00B: 84, 0x1E00C: 84, 0x1E00D: 84, 0x1E00E: 84, 0x1E00F: 84, 0x1E010: 84, 0x1E011: 84, 0x1E012: 84, 0x1E013: 84, 0x1E014: 84, 0x1E015: 84, 0x1E016: 84, 0x1E017: 84, 0x1E018: 84, 0x1E01B: 84, 0x1E01C: 84, 0x1E01D: 84, 0x1E01E: 84, 0x1E01F: 84, 0x1E020: 84, 0x1E021: 84, 0x1E023: 84, 0x1E024: 84, 0x1E026: 84, 0x1E027: 84, 0x1E028: 84, 0x1E029: 84, 0x1E02A: 84, 0x1E08F: 84, 0x1E130: 84, 0x1E131: 84, 0x1E132: 84, 0x1E133: 84, 0x1E134: 84, 0x1E135: 84, 0x1E136: 84, 0x1E2AE: 84, 0x1E2EC: 84, 0x1E2ED: 84, 0x1E2EE: 84, 0x1E2EF: 84, 0x1E4EC: 84, 0x1E4ED: 84, 0x1E4EE: 84, 0x1E4EF: 84, 0x1E5EE: 84, 0x1E5EF: 84, 0x1E8D0: 84, 0x1E8D1: 84, 0x1E8D2: 84, 0x1E8D3: 84, 0x1E8D4: 84, 0x1E8D5: 84, 0x1E8D6: 84, 0x1E900: 68, 0x1E901: 68, 0x1E902: 68, 0x1E903: 68, 0x1E904: 68, 0x1E905: 68, 0x1E906: 68, 0x1E907: 68, 0x1E908: 68, 0x1E909: 68, 0x1E90A: 68, 0x1E90B: 68, 0x1E90C: 68, 0x1E90D: 68, 0x1E90E: 68, 0x1E90F: 68, 0x1E910: 68, 0x1E911: 68, 0x1E912: 68, 0x1E913: 68, 0x1E914: 68, 0x1E915: 68, 0x1E916: 68, 0x1E917: 68, 0x1E918: 68, 0x1E919: 68, 0x1E91A: 68, 0x1E91B: 68, 0x1E91C: 68, 0x1E91D: 68, 0x1E91E: 68, 0x1E91F: 68, 0x1E920: 68, 0x1E921: 68, 0x1E922: 68, 0x1E923: 68, 0x1E924: 68, 0x1E925: 68, 0x1E926: 68, 0x1E927: 68, 0x1E928: 68, 0x1E929: 68, 0x1E92A: 68, 0x1E92B: 68, 0x1E92C: 68, 0x1E92D: 68, 0x1E92E: 68, 0x1E92F: 68, 0x1E930: 68, 0x1E931: 68, 0x1E932: 68, 0x1E933: 68, 0x1E934: 68, 0x1E935: 68, 0x1E936: 68, 0x1E937: 68, 0x1E938: 68, 0x1E939: 68, 0x1E93A: 68, 0x1E93B: 68, 0x1E93C: 68, 0x1E93D: 68, 0x1E93E: 68, 0x1E93F: 68, 0x1E940: 68, 0x1E941: 68, 0x1E942: 68, 0x1E943: 68, 0x1E944: 84, 0x1E945: 84, 0x1E946: 84, 0x1E947: 84, 0x1E948: 84, 0x1E949: 84, 0x1E94A: 84, 0x1E94B: 84, 0xE0001: 84, 0xE0020: 84, 0xE0021: 84, 0xE0022: 84, 0xE0023: 84, 0xE0024: 84, 0xE0025: 84, 0xE0026: 84, 0xE0027: 84, 0xE0028: 84, 0xE0029: 84, 0xE002A: 84, 0xE002B: 84, 0xE002C: 84, 0xE002D: 84, 0xE002E: 84, 0xE002F: 84, 0xE0030: 84, 0xE0031: 84, 0xE0032: 84, 0xE0033: 84, 0xE0034: 84, 0xE0035: 84, 0xE0036: 84, 0xE0037: 84, 0xE0038: 84, 0xE0039: 84, 0xE003A: 84, 0xE003B: 84, 0xE003C: 84, 0xE003D: 84, 0xE003E: 84, 0xE003F: 84, 0xE0040: 84, 0xE0041: 84, 0xE0042: 84, 0xE0043: 84, 0xE0044: 84, 0xE0045: 84, 0xE0046: 84, 0xE0047: 84, 0xE0048: 84, 0xE0049: 84, 0xE004A: 84, 0xE004B: 84, 0xE004C: 84, 0xE004D: 84, 0xE004E: 84, 0xE004F: 84, 0xE0050: 84, 0xE0051: 84, 0xE0052: 84, 0xE0053: 84, 0xE0054: 84, 0xE0055: 84, 0xE0056: 84, 0xE0057: 84, 0xE0058: 84, 0xE0059: 84, 0xE005A: 84, 0xE005B: 84, 0xE005C: 84, 0xE005D: 84, 0xE005E: 84, 0xE005F: 84, 0xE0060: 84, 0xE0061: 84, 0xE0062: 84, 0xE0063: 84, 0xE0064: 84, 0xE0065: 84, 0xE0066: 84, 0xE0067: 84, 0xE0068: 84, 0xE0069: 84, 0xE006A: 84, 0xE006B: 84, 0xE006C: 84, 0xE006D: 84, 0xE006E: 84, 0xE006F: 84, 0xE0070: 84, 0xE0071: 84, 0xE0072: 84, 0xE0073: 84, 0xE0074: 84, 0xE0075: 84, 0xE0076: 84, 0xE0077: 84, 0xE0078: 84, 0xE0079: 84, 0xE007A: 84, 0xE007B: 84, 0xE007C: 84, 0xE007D: 84, 0xE007E: 84, 0xE007F: 84, 0xE0100: 84, 0xE0101: 84, 0xE0102: 84, 0xE0103: 84, 0xE0104: 84, 0xE0105: 84, 0xE0106: 84, 0xE0107: 84, 0xE0108: 84, 0xE0109: 84, 0xE010A: 84, 0xE010B: 84, 0xE010C: 84, 0xE010D: 84, 0xE010E: 84, 0xE010F: 84, 0xE0110: 84, 0xE0111: 84, 0xE0112: 84, 0xE0113: 84, 0xE0114: 84, 0xE0115: 84, 0xE0116: 84, 0xE0117: 84, 0xE0118: 84, 0xE0119: 84, 0xE011A: 84, 0xE011B: 84, 0xE011C: 84, 0xE011D: 84, 0xE011E: 84, 0xE011F: 84, 0xE0120: 84, 0xE0121: 84, 0xE0122: 84, 0xE0123: 84, 0xE0124: 84, 0xE0125: 84, 0xE0126: 84, 0xE0127: 84, 0xE0128: 84, 0xE0129: 84, 0xE012A: 84, 0xE012B: 84, 0xE012C: 84, 0xE012D: 84, 0xE012E: 84, 0xE012F: 84, 0xE0130: 84, 0xE0131: 84, 0xE0132: 84, 0xE0133: 84, 0xE0134: 84, 0xE0135: 84, 0xE0136: 84, 0xE0137: 84, 0xE0138: 84, 0xE0139: 84, 0xE013A: 84, 0xE013B: 84, 0xE013C: 84, 0xE013D: 84, 0xE013E: 84, 0xE013F: 84, 0xE0140: 84, 0xE0141: 84, 0xE0142: 84, 0xE0143: 84, 0xE0144: 84, 0xE0145: 84, 0xE0146: 84, 0xE0147: 84, 0xE0148: 84, 0xE0149: 84, 0xE014A: 84, 0xE014B: 84, 0xE014C: 84, 0xE014D: 84, 0xE014E: 84, 0xE014F: 84, 0xE0150: 84, 0xE0151: 84, 0xE0152: 84, 0xE0153: 84, 0xE0154: 84, 0xE0155: 84, 0xE0156: 84, 0xE0157: 84, 0xE0158: 84, 0xE0159: 84, 0xE015A: 84, 0xE015B: 84, 0xE015C: 84, 0xE015D: 84, 0xE015E: 84, 0xE015F: 84, 0xE0160: 84, 0xE0161: 84, 0xE0162: 84, 0xE0163: 84, 0xE0164: 84, 0xE0165: 84, 0xE0166: 84, 0xE0167: 84, 0xE0168: 84, 0xE0169: 84, 0xE016A: 84, 0xE016B: 84, 0xE016C: 84, 0xE016D: 84, 0xE016E: 84, 0xE016F: 84, 0xE0170: 84, 0xE0171: 84, 0xE0172: 84, 0xE0173: 84, 0xE0174: 84, 0xE0175: 84, 0xE0176: 84, 0xE0177: 84, 0xE0178: 84, 0xE0179: 84, 0xE017A: 84, 0xE017B: 84, 0xE017C: 84, 0xE017D: 84, 0xE017E: 84, 0xE017F: 84, 0xE0180: 84, 0xE0181: 84, 0xE0182: 84, 0xE0183: 84, 0xE0184: 84, 0xE0185: 84, 0xE0186: 84, 0xE0187: 84, 0xE0188: 84, 0xE0189: 84, 0xE018A: 84, 0xE018B: 84, 0xE018C: 84, 0xE018D: 84, 0xE018E: 84, 0xE018F: 84, 0xE0190: 84, 0xE0191: 84, 0xE0192: 84, 0xE0193: 84, 0xE0194: 84, 0xE0195: 84, 0xE0196: 84, 0xE0197: 84, 0xE0198: 84, 0xE0199: 84, 0xE019A: 84, 0xE019B: 84, 0xE019C: 84, 0xE019D: 84, 0xE019E: 84, 0xE019F: 84, 0xE01A0: 84, 0xE01A1: 84, 0xE01A2: 84, 0xE01A3: 84, 0xE01A4: 84, 0xE01A5: 84, 0xE01A6: 84, 0xE01A7: 84, 0xE01A8: 84, 0xE01A9: 84, 0xE01AA: 84, 0xE01AB: 84, 0xE01AC: 84, 0xE01AD: 84, 0xE01AE: 84, 0xE01AF: 84, 0xE01B0: 84, 0xE01B1: 84, 0xE01B2: 84, 0xE01B3: 84, 0xE01B4: 84, 0xE01B5: 84, 0xE01B6: 84, 0xE01B7: 84, 0xE01B8: 84, 0xE01B9: 84, 0xE01BA: 84, 0xE01BB: 84, 0xE01BC: 84, 0xE01BD: 84, 0xE01BE: 84, 0xE01BF: 84, 0xE01C0: 84, 0xE01C1: 84, 0xE01C2: 84, 0xE01C3: 84, 0xE01C4: 84, 0xE01C5: 84, 0xE01C6: 84, 0xE01C7: 84, 0xE01C8: 84, 0xE01C9: 84, 0xE01CA: 84, 0xE01CB: 84, 0xE01CC: 84, 0xE01CD: 84, 0xE01CE: 84, 0xE01CF: 84, 0xE01D0: 84, 0xE01D1: 84, 0xE01D2: 84, 0xE01D3: 84, 0xE01D4: 84, 0xE01D5: 84, 0xE01D6: 84, 0xE01D7: 84, 0xE01D8: 84, 0xE01D9: 84, 0xE01DA: 84, 0xE01DB: 84, 0xE01DC: 84, 0xE01DD: 84, 0xE01DE: 84, 0xE01DF: 84, 0xE01E0: 84, 0xE01E1: 84, 0xE01E2: 84, 0xE01E3: 84, 0xE01E4: 84, 0xE01E5: 84, 0xE01E6: 84, 0xE01E7: 84, 0xE01E8: 84, 0xE01E9: 84, 0xE01EA: 84, 0xE01EB: 84, 0xE01EC: 84, 0xE01ED: 84, 0xE01EE: 84, 0xE01EF: 84, } codepoint_classes = { "PVALID": ( 0x2D0000002E, 0x300000003A, 0x610000007B, 0xDF000000F7, 0xF800000100, 0x10100000102, 0x10300000104, 0x10500000106, 0x10700000108, 0x1090000010A, 0x10B0000010C, 0x10D0000010E, 0x10F00000110, 0x11100000112, 0x11300000114, 0x11500000116, 0x11700000118, 0x1190000011A, 0x11B0000011C, 0x11D0000011E, 0x11F00000120, 0x12100000122, 0x12300000124, 0x12500000126, 0x12700000128, 0x1290000012A, 0x12B0000012C, 0x12D0000012E, 0x12F00000130, 0x13100000132, 0x13500000136, 0x13700000139, 0x13A0000013B, 0x13C0000013D, 0x13E0000013F, 0x14200000143, 0x14400000145, 0x14600000147, 0x14800000149, 0x14B0000014C, 0x14D0000014E, 0x14F00000150, 0x15100000152, 0x15300000154, 0x15500000156, 0x15700000158, 0x1590000015A, 0x15B0000015C, 0x15D0000015E, 0x15F00000160, 0x16100000162, 0x16300000164, 0x16500000166, 0x16700000168, 0x1690000016A, 0x16B0000016C, 0x16D0000016E, 0x16F00000170, 0x17100000172, 0x17300000174, 0x17500000176, 0x17700000178, 0x17A0000017B, 0x17C0000017D, 0x17E0000017F, 0x18000000181, 0x18300000184, 0x18500000186, 0x18800000189, 0x18C0000018E, 0x19200000193, 0x19500000196, 0x1990000019C, 0x19E0000019F, 0x1A1000001A2, 0x1A3000001A4, 0x1A5000001A6, 0x1A8000001A9, 0x1AA000001AC, 0x1AD000001AE, 0x1B0000001B1, 0x1B4000001B5, 0x1B6000001B7, 0x1B9000001BC, 0x1BD000001C4, 0x1CE000001CF, 0x1D0000001D1, 0x1D2000001D3, 0x1D4000001D5, 0x1D6000001D7, 0x1D8000001D9, 0x1DA000001DB, 0x1DC000001DE, 0x1DF000001E0, 0x1E1000001E2, 0x1E3000001E4, 0x1E5000001E6, 0x1E7000001E8, 0x1E9000001EA, 0x1EB000001EC, 0x1ED000001EE, 0x1EF000001F1, 0x1F5000001F6, 0x1F9000001FA, 0x1FB000001FC, 0x1FD000001FE, 0x1FF00000200, 0x20100000202, 0x20300000204, 0x20500000206, 0x20700000208, 0x2090000020A, 0x20B0000020C, 0x20D0000020E, 0x20F00000210, 0x21100000212, 0x21300000214, 0x21500000216, 0x21700000218, 0x2190000021A, 0x21B0000021C, 0x21D0000021E, 0x21F00000220, 0x22100000222, 0x22300000224, 0x22500000226, 0x22700000228, 0x2290000022A, 0x22B0000022C, 0x22D0000022E, 0x22F00000230, 0x23100000232, 0x2330000023A, 0x23C0000023D, 0x23F00000241, 0x24200000243, 0x24700000248, 0x2490000024A, 0x24B0000024C, 0x24D0000024E, 0x24F000002B0, 0x2B9000002C2, 0x2C6000002D2, 0x2EC000002ED, 0x2EE000002EF, 0x30000000340, 0x34200000343, 0x3460000034F, 0x35000000370, 0x37100000372, 0x37300000374, 0x37700000378, 0x37B0000037E, 0x39000000391, 0x3AC000003CF, 0x3D7000003D8, 0x3D9000003DA, 0x3DB000003DC, 0x3DD000003DE, 0x3DF000003E0, 0x3E1000003E2, 0x3E3000003E4, 0x3E5000003E6, 0x3E7000003E8, 0x3E9000003EA, 0x3EB000003EC, 0x3ED000003EE, 0x3EF000003F0, 0x3F3000003F4, 0x3F8000003F9, 0x3FB000003FD, 0x43000000460, 0x46100000462, 0x46300000464, 0x46500000466, 0x46700000468, 0x4690000046A, 0x46B0000046C, 0x46D0000046E, 0x46F00000470, 0x47100000472, 0x47300000474, 0x47500000476, 0x47700000478, 0x4790000047A, 0x47B0000047C, 0x47D0000047E, 0x47F00000480, 0x48100000482, 0x48300000488, 0x48B0000048C, 0x48D0000048E, 0x48F00000490, 0x49100000492, 0x49300000494, 0x49500000496, 0x49700000498, 0x4990000049A, 0x49B0000049C, 0x49D0000049E, 0x49F000004A0, 0x4A1000004A2, 0x4A3000004A4, 0x4A5000004A6, 0x4A7000004A8, 0x4A9000004AA, 0x4AB000004AC, 0x4AD000004AE, 0x4AF000004B0, 0x4B1000004B2, 0x4B3000004B4, 0x4B5000004B6, 0x4B7000004B8, 0x4B9000004BA, 0x4BB000004BC, 0x4BD000004BE, 0x4BF000004C0, 0x4C2000004C3, 0x4C4000004C5, 0x4C6000004C7, 0x4C8000004C9, 0x4CA000004CB, 0x4CC000004CD, 0x4CE000004D0, 0x4D1000004D2, 0x4D3000004D4, 0x4D5000004D6, 0x4D7000004D8, 0x4D9000004DA, 0x4DB000004DC, 0x4DD000004DE, 0x4DF000004E0, 0x4E1000004E2, 0x4E3000004E4, 0x4E5000004E6, 0x4E7000004E8, 0x4E9000004EA, 0x4EB000004EC, 0x4ED000004EE, 0x4EF000004F0, 0x4F1000004F2, 0x4F3000004F4, 0x4F5000004F6, 0x4F7000004F8, 0x4F9000004FA, 0x4FB000004FC, 0x4FD000004FE, 0x4FF00000500, 0x50100000502, 0x50300000504, 0x50500000506, 0x50700000508, 0x5090000050A, 0x50B0000050C, 0x50D0000050E, 0x50F00000510, 0x51100000512, 0x51300000514, 0x51500000516, 0x51700000518, 0x5190000051A, 0x51B0000051C, 0x51D0000051E, 0x51F00000520, 0x52100000522, 0x52300000524, 0x52500000526, 0x52700000528, 0x5290000052A, 0x52B0000052C, 0x52D0000052E, 0x52F00000530, 0x5590000055A, 0x56000000587, 0x58800000589, 0x591000005BE, 0x5BF000005C0, 0x5C1000005C3, 0x5C4000005C6, 0x5C7000005C8, 0x5D0000005EB, 0x5EF000005F3, 0x6100000061B, 0x62000000640, 0x64100000660, 0x66E00000675, 0x679000006D4, 0x6D5000006DD, 0x6DF000006E9, 0x6EA000006F0, 0x6FA00000700, 0x7100000074B, 0x74D000007B2, 0x7C0000007F6, 0x7FD000007FE, 0x8000000082E, 0x8400000085C, 0x8600000086B, 0x87000000888, 0x8890000088F, 0x897000008E2, 0x8E300000958, 0x96000000964, 0x96600000970, 0x97100000984, 0x9850000098D, 0x98F00000991, 0x993000009A9, 0x9AA000009B1, 0x9B2000009B3, 0x9B6000009BA, 0x9BC000009C5, 0x9C7000009C9, 0x9CB000009CF, 0x9D7000009D8, 0x9E0000009E4, 0x9E6000009F2, 0x9FC000009FD, 0x9FE000009FF, 0xA0100000A04, 0xA0500000A0B, 0xA0F00000A11, 0xA1300000A29, 0xA2A00000A31, 0xA3200000A33, 0xA3500000A36, 0xA3800000A3A, 0xA3C00000A3D, 0xA3E00000A43, 0xA4700000A49, 0xA4B00000A4E, 0xA5100000A52, 0xA5C00000A5D, 0xA6600000A76, 0xA8100000A84, 0xA8500000A8E, 0xA8F00000A92, 0xA9300000AA9, 0xAAA00000AB1, 0xAB200000AB4, 0xAB500000ABA, 0xABC00000AC6, 0xAC700000ACA, 0xACB00000ACE, 0xAD000000AD1, 0xAE000000AE4, 0xAE600000AF0, 0xAF900000B00, 0xB0100000B04, 0xB0500000B0D, 0xB0F00000B11, 0xB1300000B29, 0xB2A00000B31, 0xB3200000B34, 0xB3500000B3A, 0xB3C00000B45, 0xB4700000B49, 0xB4B00000B4E, 0xB5500000B58, 0xB5F00000B64, 0xB6600000B70, 0xB7100000B72, 0xB8200000B84, 0xB8500000B8B, 0xB8E00000B91, 0xB9200000B96, 0xB9900000B9B, 0xB9C00000B9D, 0xB9E00000BA0, 0xBA300000BA5, 0xBA800000BAB, 0xBAE00000BBA, 0xBBE00000BC3, 0xBC600000BC9, 0xBCA00000BCE, 0xBD000000BD1, 0xBD700000BD8, 0xBE600000BF0, 0xC0000000C0D, 0xC0E00000C11, 0xC1200000C29, 0xC2A00000C3A, 0xC3C00000C45, 0xC4600000C49, 0xC4A00000C4E, 0xC5500000C57, 0xC5800000C5B, 0xC5D00000C5E, 0xC6000000C64, 0xC6600000C70, 0xC8000000C84, 0xC8500000C8D, 0xC8E00000C91, 0xC9200000CA9, 0xCAA00000CB4, 0xCB500000CBA, 0xCBC00000CC5, 0xCC600000CC9, 0xCCA00000CCE, 0xCD500000CD7, 0xCDD00000CDF, 0xCE000000CE4, 0xCE600000CF0, 0xCF100000CF4, 0xD0000000D0D, 0xD0E00000D11, 0xD1200000D45, 0xD4600000D49, 0xD4A00000D4F, 0xD5400000D58, 0xD5F00000D64, 0xD6600000D70, 0xD7A00000D80, 0xD8100000D84, 0xD8500000D97, 0xD9A00000DB2, 0xDB300000DBC, 0xDBD00000DBE, 0xDC000000DC7, 0xDCA00000DCB, 0xDCF00000DD5, 0xDD600000DD7, 0xDD800000DE0, 0xDE600000DF0, 0xDF200000DF4, 0xE0100000E33, 0xE3400000E3B, 0xE4000000E4F, 0xE5000000E5A, 0xE8100000E83, 0xE8400000E85, 0xE8600000E8B, 0xE8C00000EA4, 0xEA500000EA6, 0xEA700000EB3, 0xEB400000EBE, 0xEC000000EC5, 0xEC600000EC7, 0xEC800000ECF, 0xED000000EDA, 0xEDE00000EE0, 0xF0000000F01, 0xF0B00000F0C, 0xF1800000F1A, 0xF2000000F2A, 0xF3500000F36, 0xF3700000F38, 0xF3900000F3A, 0xF3E00000F43, 0xF4400000F48, 0xF4900000F4D, 0xF4E00000F52, 0xF5300000F57, 0xF5800000F5C, 0xF5D00000F69, 0xF6A00000F6D, 0xF7100000F73, 0xF7400000F75, 0xF7A00000F81, 0xF8200000F85, 0xF8600000F93, 0xF9400000F98, 0xF9900000F9D, 0xF9E00000FA2, 0xFA300000FA7, 0xFA800000FAC, 0xFAD00000FB9, 0xFBA00000FBD, 0xFC600000FC7, 0x10000000104A, 0x10500000109E, 0x10D0000010FB, 0x10FD00001100, 0x120000001249, 0x124A0000124E, 0x125000001257, 0x125800001259, 0x125A0000125E, 0x126000001289, 0x128A0000128E, 0x1290000012B1, 0x12B2000012B6, 0x12B8000012BF, 0x12C0000012C1, 0x12C2000012C6, 0x12C8000012D7, 0x12D800001311, 0x131200001316, 0x13180000135B, 0x135D00001360, 0x138000001390, 0x13A0000013F6, 0x14010000166D, 0x166F00001680, 0x16810000169B, 0x16A0000016EB, 0x16F1000016F9, 0x170000001716, 0x171F00001735, 0x174000001754, 0x17600000176D, 0x176E00001771, 0x177200001774, 0x1780000017B4, 0x17B6000017D4, 0x17D7000017D8, 0x17DC000017DE, 0x17E0000017EA, 0x18100000181A, 0x182000001879, 0x1880000018AB, 0x18B0000018F6, 0x19000000191F, 0x19200000192C, 0x19300000193C, 0x19460000196E, 0x197000001975, 0x1980000019AC, 0x19B0000019CA, 0x19D0000019DA, 0x1A0000001A1C, 0x1A2000001A5F, 0x1A6000001A7D, 0x1A7F00001A8A, 0x1A9000001A9A, 0x1AA700001AA8, 0x1AB000001ABE, 0x1ABF00001ACF, 0x1B0000001B4D, 0x1B5000001B5A, 0x1B6B00001B74, 0x1B8000001BF4, 0x1C0000001C38, 0x1C4000001C4A, 0x1C4D00001C7E, 0x1C8A00001C8B, 0x1CD000001CD3, 0x1CD400001CFB, 0x1D0000001D2C, 0x1D2F00001D30, 0x1D3B00001D3C, 0x1D4E00001D4F, 0x1D6B00001D78, 0x1D7900001D9B, 0x1DC000001E00, 0x1E0100001E02, 0x1E0300001E04, 0x1E0500001E06, 0x1E0700001E08, 0x1E0900001E0A, 0x1E0B00001E0C, 0x1E0D00001E0E, 0x1E0F00001E10, 0x1E1100001E12, 0x1E1300001E14, 0x1E1500001E16, 0x1E1700001E18, 0x1E1900001E1A, 0x1E1B00001E1C, 0x1E1D00001E1E, 0x1E1F00001E20, 0x1E2100001E22, 0x1E2300001E24, 0x1E2500001E26, 0x1E2700001E28, 0x1E2900001E2A, 0x1E2B00001E2C, 0x1E2D00001E2E, 0x1E2F00001E30, 0x1E3100001E32, 0x1E3300001E34, 0x1E3500001E36, 0x1E3700001E38, 0x1E3900001E3A, 0x1E3B00001E3C, 0x1E3D00001E3E, 0x1E3F00001E40, 0x1E4100001E42, 0x1E4300001E44, 0x1E4500001E46, 0x1E4700001E48, 0x1E4900001E4A, 0x1E4B00001E4C, 0x1E4D00001E4E, 0x1E4F00001E50, 0x1E5100001E52, 0x1E5300001E54, 0x1E5500001E56, 0x1E5700001E58, 0x1E5900001E5A, 0x1E5B00001E5C, 0x1E5D00001E5E, 0x1E5F00001E60, 0x1E6100001E62, 0x1E6300001E64, 0x1E6500001E66, 0x1E6700001E68, 0x1E6900001E6A, 0x1E6B00001E6C, 0x1E6D00001E6E, 0x1E6F00001E70, 0x1E7100001E72, 0x1E7300001E74, 0x1E7500001E76, 0x1E7700001E78, 0x1E7900001E7A, 0x1E7B00001E7C, 0x1E7D00001E7E, 0x1E7F00001E80, 0x1E8100001E82, 0x1E8300001E84, 0x1E8500001E86, 0x1E8700001E88, 0x1E8900001E8A, 0x1E8B00001E8C, 0x1E8D00001E8E, 0x1E8F00001E90, 0x1E9100001E92, 0x1E9300001E94, 0x1E9500001E9A, 0x1E9C00001E9E, 0x1E9F00001EA0, 0x1EA100001EA2, 0x1EA300001EA4, 0x1EA500001EA6, 0x1EA700001EA8, 0x1EA900001EAA, 0x1EAB00001EAC, 0x1EAD00001EAE, 0x1EAF00001EB0, 0x1EB100001EB2, 0x1EB300001EB4, 0x1EB500001EB6, 0x1EB700001EB8, 0x1EB900001EBA, 0x1EBB00001EBC, 0x1EBD00001EBE, 0x1EBF00001EC0, 0x1EC100001EC2, 0x1EC300001EC4, 0x1EC500001EC6, 0x1EC700001EC8, 0x1EC900001ECA, 0x1ECB00001ECC, 0x1ECD00001ECE, 0x1ECF00001ED0, 0x1ED100001ED2, 0x1ED300001ED4, 0x1ED500001ED6, 0x1ED700001ED8, 0x1ED900001EDA, 0x1EDB00001EDC, 0x1EDD00001EDE, 0x1EDF00001EE0, 0x1EE100001EE2, 0x1EE300001EE4, 0x1EE500001EE6, 0x1EE700001EE8, 0x1EE900001EEA, 0x1EEB00001EEC, 0x1EED00001EEE, 0x1EEF00001EF0, 0x1EF100001EF2, 0x1EF300001EF4, 0x1EF500001EF6, 0x1EF700001EF8, 0x1EF900001EFA, 0x1EFB00001EFC, 0x1EFD00001EFE, 0x1EFF00001F08, 0x1F1000001F16, 0x1F2000001F28, 0x1F3000001F38, 0x1F4000001F46, 0x1F5000001F58, 0x1F6000001F68, 0x1F7000001F71, 0x1F7200001F73, 0x1F7400001F75, 0x1F7600001F77, 0x1F7800001F79, 0x1F7A00001F7B, 0x1F7C00001F7D, 0x1FB000001FB2, 0x1FB600001FB7, 0x1FC600001FC7, 0x1FD000001FD3, 0x1FD600001FD8, 0x1FE000001FE3, 0x1FE400001FE8, 0x1FF600001FF7, 0x214E0000214F, 0x218400002185, 0x2C3000002C60, 0x2C6100002C62, 0x2C6500002C67, 0x2C6800002C69, 0x2C6A00002C6B, 0x2C6C00002C6D, 0x2C7100002C72, 0x2C7300002C75, 0x2C7600002C7C, 0x2C8100002C82, 0x2C8300002C84, 0x2C8500002C86, 0x2C8700002C88, 0x2C8900002C8A, 0x2C8B00002C8C, 0x2C8D00002C8E, 0x2C8F00002C90, 0x2C9100002C92, 0x2C9300002C94, 0x2C9500002C96, 0x2C9700002C98, 0x2C9900002C9A, 0x2C9B00002C9C, 0x2C9D00002C9E, 0x2C9F00002CA0, 0x2CA100002CA2, 0x2CA300002CA4, 0x2CA500002CA6, 0x2CA700002CA8, 0x2CA900002CAA, 0x2CAB00002CAC, 0x2CAD00002CAE, 0x2CAF00002CB0, 0x2CB100002CB2, 0x2CB300002CB4, 0x2CB500002CB6, 0x2CB700002CB8, 0x2CB900002CBA, 0x2CBB00002CBC, 0x2CBD00002CBE, 0x2CBF00002CC0, 0x2CC100002CC2, 0x2CC300002CC4, 0x2CC500002CC6, 0x2CC700002CC8, 0x2CC900002CCA, 0x2CCB00002CCC, 0x2CCD00002CCE, 0x2CCF00002CD0, 0x2CD100002CD2, 0x2CD300002CD4, 0x2CD500002CD6, 0x2CD700002CD8, 0x2CD900002CDA, 0x2CDB00002CDC, 0x2CDD00002CDE, 0x2CDF00002CE0, 0x2CE100002CE2, 0x2CE300002CE5, 0x2CEC00002CED, 0x2CEE00002CF2, 0x2CF300002CF4, 0x2D0000002D26, 0x2D2700002D28, 0x2D2D00002D2E, 0x2D3000002D68, 0x2D7F00002D97, 0x2DA000002DA7, 0x2DA800002DAF, 0x2DB000002DB7, 0x2DB800002DBF, 0x2DC000002DC7, 0x2DC800002DCF, 0x2DD000002DD7, 0x2DD800002DDF, 0x2DE000002E00, 0x2E2F00002E30, 0x300500003008, 0x302A0000302E, 0x303C0000303D, 0x304100003097, 0x30990000309B, 0x309D0000309F, 0x30A1000030FB, 0x30FC000030FF, 0x310500003130, 0x31A0000031C0, 0x31F000003200, 0x340000004DC0, 0x4E000000A48D, 0xA4D00000A4FE, 0xA5000000A60D, 0xA6100000A62C, 0xA6410000A642, 0xA6430000A644, 0xA6450000A646, 0xA6470000A648, 0xA6490000A64A, 0xA64B0000A64C, 0xA64D0000A64E, 0xA64F0000A650, 0xA6510000A652, 0xA6530000A654, 0xA6550000A656, 0xA6570000A658, 0xA6590000A65A, 0xA65B0000A65C, 0xA65D0000A65E, 0xA65F0000A660, 0xA6610000A662, 0xA6630000A664, 0xA6650000A666, 0xA6670000A668, 0xA6690000A66A, 0xA66B0000A66C, 0xA66D0000A670, 0xA6740000A67E, 0xA67F0000A680, 0xA6810000A682, 0xA6830000A684, 0xA6850000A686, 0xA6870000A688, 0xA6890000A68A, 0xA68B0000A68C, 0xA68D0000A68E, 0xA68F0000A690, 0xA6910000A692, 0xA6930000A694, 0xA6950000A696, 0xA6970000A698, 0xA6990000A69A, 0xA69B0000A69C, 0xA69E0000A6E6, 0xA6F00000A6F2, 0xA7170000A720, 0xA7230000A724, 0xA7250000A726, 0xA7270000A728, 0xA7290000A72A, 0xA72B0000A72C, 0xA72D0000A72E, 0xA72F0000A732, 0xA7330000A734, 0xA7350000A736, 0xA7370000A738, 0xA7390000A73A, 0xA73B0000A73C, 0xA73D0000A73E, 0xA73F0000A740, 0xA7410000A742, 0xA7430000A744, 0xA7450000A746, 0xA7470000A748, 0xA7490000A74A, 0xA74B0000A74C, 0xA74D0000A74E, 0xA74F0000A750, 0xA7510000A752, 0xA7530000A754, 0xA7550000A756, 0xA7570000A758, 0xA7590000A75A, 0xA75B0000A75C, 0xA75D0000A75E, 0xA75F0000A760, 0xA7610000A762, 0xA7630000A764, 0xA7650000A766, 0xA7670000A768, 0xA7690000A76A, 0xA76B0000A76C, 0xA76D0000A76E, 0xA76F0000A770, 0xA7710000A779, 0xA77A0000A77B, 0xA77C0000A77D, 0xA77F0000A780, 0xA7810000A782, 0xA7830000A784, 0xA7850000A786, 0xA7870000A789, 0xA78C0000A78D, 0xA78E0000A790, 0xA7910000A792, 0xA7930000A796, 0xA7970000A798, 0xA7990000A79A, 0xA79B0000A79C, 0xA79D0000A79E, 0xA79F0000A7A0, 0xA7A10000A7A2, 0xA7A30000A7A4, 0xA7A50000A7A6, 0xA7A70000A7A8, 0xA7A90000A7AA, 0xA7AF0000A7B0, 0xA7B50000A7B6, 0xA7B70000A7B8, 0xA7B90000A7BA, 0xA7BB0000A7BC, 0xA7BD0000A7BE, 0xA7BF0000A7C0, 0xA7C10000A7C2, 0xA7C30000A7C4, 0xA7C80000A7C9, 0xA7CA0000A7CB, 0xA7CD0000A7CE, 0xA7D10000A7D2, 0xA7D30000A7D4, 0xA7D50000A7D6, 0xA7D70000A7D8, 0xA7D90000A7DA, 0xA7DB0000A7DC, 0xA7F60000A7F8, 0xA7FA0000A828, 0xA82C0000A82D, 0xA8400000A874, 0xA8800000A8C6, 0xA8D00000A8DA, 0xA8E00000A8F8, 0xA8FB0000A8FC, 0xA8FD0000A92E, 0xA9300000A954, 0xA9800000A9C1, 0xA9CF0000A9DA, 0xA9E00000A9FF, 0xAA000000AA37, 0xAA400000AA4E, 0xAA500000AA5A, 0xAA600000AA77, 0xAA7A0000AAC3, 0xAADB0000AADE, 0xAAE00000AAF0, 0xAAF20000AAF7, 0xAB010000AB07, 0xAB090000AB0F, 0xAB110000AB17, 0xAB200000AB27, 0xAB280000AB2F, 0xAB300000AB5B, 0xAB600000AB69, 0xABC00000ABEB, 0xABEC0000ABEE, 0xABF00000ABFA, 0xAC000000D7A4, 0xFA0E0000FA10, 0xFA110000FA12, 0xFA130000FA15, 0xFA1F0000FA20, 0xFA210000FA22, 0xFA230000FA25, 0xFA270000FA2A, 0xFB1E0000FB1F, 0xFE200000FE30, 0xFE730000FE74, 0x100000001000C, 0x1000D00010027, 0x100280001003B, 0x1003C0001003E, 0x1003F0001004E, 0x100500001005E, 0x10080000100FB, 0x101FD000101FE, 0x102800001029D, 0x102A0000102D1, 0x102E0000102E1, 0x1030000010320, 0x1032D00010341, 0x103420001034A, 0x103500001037B, 0x103800001039E, 0x103A0000103C4, 0x103C8000103D0, 0x104280001049E, 0x104A0000104AA, 0x104D8000104FC, 0x1050000010528, 0x1053000010564, 0x10597000105A2, 0x105A3000105B2, 0x105B3000105BA, 0x105BB000105BD, 0x105C0000105F4, 0x1060000010737, 0x1074000010756, 0x1076000010768, 0x1078000010781, 0x1080000010806, 0x1080800010809, 0x1080A00010836, 0x1083700010839, 0x1083C0001083D, 0x1083F00010856, 0x1086000010877, 0x108800001089F, 0x108E0000108F3, 0x108F4000108F6, 0x1090000010916, 0x109200001093A, 0x10980000109B8, 0x109BE000109C0, 0x10A0000010A04, 0x10A0500010A07, 0x10A0C00010A14, 0x10A1500010A18, 0x10A1900010A36, 0x10A3800010A3B, 0x10A3F00010A40, 0x10A6000010A7D, 0x10A8000010A9D, 0x10AC000010AC8, 0x10AC900010AE7, 0x10B0000010B36, 0x10B4000010B56, 0x10B6000010B73, 0x10B8000010B92, 0x10C0000010C49, 0x10CC000010CF3, 0x10D0000010D28, 0x10D3000010D3A, 0x10D4000010D50, 0x10D6900010D6E, 0x10D6F00010D86, 0x10E8000010EAA, 0x10EAB00010EAD, 0x10EB000010EB2, 0x10EC200010EC5, 0x10EFC00010F1D, 0x10F2700010F28, 0x10F3000010F51, 0x10F7000010F86, 0x10FB000010FC5, 0x10FE000010FF7, 0x1100000011047, 0x1106600011076, 0x1107F000110BB, 0x110C2000110C3, 0x110D0000110E9, 0x110F0000110FA, 0x1110000011135, 0x1113600011140, 0x1114400011148, 0x1115000011174, 0x1117600011177, 0x11180000111C5, 0x111C9000111CD, 0x111CE000111DB, 0x111DC000111DD, 0x1120000011212, 0x1121300011238, 0x1123E00011242, 0x1128000011287, 0x1128800011289, 0x1128A0001128E, 0x1128F0001129E, 0x1129F000112A9, 0x112B0000112EB, 0x112F0000112FA, 0x1130000011304, 0x113050001130D, 0x1130F00011311, 0x1131300011329, 0x1132A00011331, 0x1133200011334, 0x113350001133A, 0x1133B00011345, 0x1134700011349, 0x1134B0001134E, 0x1135000011351, 0x1135700011358, 0x1135D00011364, 0x113660001136D, 0x1137000011375, 0x113800001138A, 0x1138B0001138C, 0x1138E0001138F, 0x11390000113B6, 0x113B7000113C1, 0x113C2000113C3, 0x113C5000113C6, 0x113C7000113CB, 0x113CC000113D4, 0x113E1000113E3, 0x114000001144B, 0x114500001145A, 0x1145E00011462, 0x11480000114C6, 0x114C7000114C8, 0x114D0000114DA, 0x11580000115B6, 0x115B8000115C1, 0x115D8000115DE, 0x1160000011641, 0x1164400011645, 0x116500001165A, 0x11680000116B9, 0x116C0000116CA, 0x116D0000116E4, 0x117000001171B, 0x1171D0001172C, 0x117300001173A, 0x1174000011747, 0x118000001183B, 0x118C0000118EA, 0x118FF00011907, 0x119090001190A, 0x1190C00011914, 0x1191500011917, 0x1191800011936, 0x1193700011939, 0x1193B00011944, 0x119500001195A, 0x119A0000119A8, 0x119AA000119D8, 0x119DA000119E2, 0x119E3000119E5, 0x11A0000011A3F, 0x11A4700011A48, 0x11A5000011A9A, 0x11A9D00011A9E, 0x11AB000011AF9, 0x11BC000011BE1, 0x11BF000011BFA, 0x11C0000011C09, 0x11C0A00011C37, 0x11C3800011C41, 0x11C5000011C5A, 0x11C7200011C90, 0x11C9200011CA8, 0x11CA900011CB7, 0x11D0000011D07, 0x11D0800011D0A, 0x11D0B00011D37, 0x11D3A00011D3B, 0x11D3C00011D3E, 0x11D3F00011D48, 0x11D5000011D5A, 0x11D6000011D66, 0x11D6700011D69, 0x11D6A00011D8F, 0x11D9000011D92, 0x11D9300011D99, 0x11DA000011DAA, 0x11EE000011EF7, 0x11F0000011F11, 0x11F1200011F3B, 0x11F3E00011F43, 0x11F5000011F5B, 0x11FB000011FB1, 0x120000001239A, 0x1248000012544, 0x12F9000012FF1, 0x1300000013430, 0x1344000013456, 0x13460000143FB, 0x1440000014647, 0x161000001613A, 0x1680000016A39, 0x16A4000016A5F, 0x16A6000016A6A, 0x16A7000016ABF, 0x16AC000016ACA, 0x16AD000016AEE, 0x16AF000016AF5, 0x16B0000016B37, 0x16B4000016B44, 0x16B5000016B5A, 0x16B6300016B78, 0x16B7D00016B90, 0x16D4000016D6D, 0x16D7000016D7A, 0x16E6000016E80, 0x16F0000016F4B, 0x16F4F00016F88, 0x16F8F00016FA0, 0x16FE000016FE2, 0x16FE300016FE5, 0x16FF000016FF2, 0x17000000187F8, 0x1880000018CD6, 0x18CFF00018D09, 0x1AFF00001AFF4, 0x1AFF50001AFFC, 0x1AFFD0001AFFF, 0x1B0000001B123, 0x1B1320001B133, 0x1B1500001B153, 0x1B1550001B156, 0x1B1640001B168, 0x1B1700001B2FC, 0x1BC000001BC6B, 0x1BC700001BC7D, 0x1BC800001BC89, 0x1BC900001BC9A, 0x1BC9D0001BC9F, 0x1CCF00001CCFA, 0x1CF000001CF2E, 0x1CF300001CF47, 0x1DA000001DA37, 0x1DA3B0001DA6D, 0x1DA750001DA76, 0x1DA840001DA85, 0x1DA9B0001DAA0, 0x1DAA10001DAB0, 0x1DF000001DF1F, 0x1DF250001DF2B, 0x1E0000001E007, 0x1E0080001E019, 0x1E01B0001E022, 0x1E0230001E025, 0x1E0260001E02B, 0x1E08F0001E090, 0x1E1000001E12D, 0x1E1300001E13E, 0x1E1400001E14A, 0x1E14E0001E14F, 0x1E2900001E2AF, 0x1E2C00001E2FA, 0x1E4D00001E4FA, 0x1E5D00001E5FB, 0x1E7E00001E7E7, 0x1E7E80001E7EC, 0x1E7ED0001E7EF, 0x1E7F00001E7FF, 0x1E8000001E8C5, 0x1E8D00001E8D7, 0x1E9220001E94C, 0x1E9500001E95A, 0x200000002A6E0, 0x2A7000002B73A, 0x2B7400002B81E, 0x2B8200002CEA2, 0x2CEB00002EBE1, 0x2EBF00002EE5E, 0x300000003134B, 0x31350000323B0, ), "CONTEXTJ": (0x200C0000200E,), "CONTEXTO": ( 0xB7000000B8, 0x37500000376, 0x5F3000005F5, 0x6600000066A, 0x6F0000006FA, 0x30FB000030FC, ), } ================================================ FILE: src/pip/_vendor/idna/intranges.py ================================================ """ Given a list of integers, made up of (hopefully) a small number of long runs of consecutive integers, compute a representation of the form ((start1, end1), (start2, end2) ...). Then answer the question "was x present in the original list?" in time O(log(# runs)). """ import bisect from typing import List, Tuple def intranges_from_list(list_: List[int]) -> Tuple[int, ...]: """Represent a list of integers as a sequence of ranges: ((start_0, end_0), (start_1, end_1), ...), such that the original integers are exactly those x such that start_i <= x < end_i for some i. Ranges are encoded as single integers (start << 32 | end), not as tuples. """ sorted_list = sorted(list_) ranges = [] last_write = -1 for i in range(len(sorted_list)): if i + 1 < len(sorted_list): if sorted_list[i] == sorted_list[i + 1] - 1: continue current_range = sorted_list[last_write + 1 : i + 1] ranges.append(_encode_range(current_range[0], current_range[-1] + 1)) last_write = i return tuple(ranges) def _encode_range(start: int, end: int) -> int: return (start << 32) | end def _decode_range(r: int) -> Tuple[int, int]: return (r >> 32), (r & ((1 << 32) - 1)) def intranges_contain(int_: int, ranges: Tuple[int, ...]) -> bool: """Determine if `int_` falls into one of the ranges in `ranges`.""" tuple_ = _encode_range(int_, 0) pos = bisect.bisect_left(ranges, tuple_) # we could be immediately ahead of a tuple (start, end) # with start < int_ <= end if pos > 0: left, right = _decode_range(ranges[pos - 1]) if left <= int_ < right: return True # or we could be immediately behind a tuple (int_, end) if pos < len(ranges): left, _ = _decode_range(ranges[pos]) if left == int_: return True return False ================================================ FILE: src/pip/_vendor/idna/package_data.py ================================================ __version__ = "3.11" ================================================ FILE: src/pip/_vendor/idna/py.typed ================================================ ================================================ FILE: src/pip/_vendor/idna/uts46data.py ================================================ # This file is automatically generated by tools/idna-data # vim: set fileencoding=utf-8 : from typing import List, Tuple, Union """IDNA Mapping Table from UTS46.""" __version__ = "16.0.0" def _seg_0() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x0, "V"), (0x1, "V"), (0x2, "V"), (0x3, "V"), (0x4, "V"), (0x5, "V"), (0x6, "V"), (0x7, "V"), (0x8, "V"), (0x9, "V"), (0xA, "V"), (0xB, "V"), (0xC, "V"), (0xD, "V"), (0xE, "V"), (0xF, "V"), (0x10, "V"), (0x11, "V"), (0x12, "V"), (0x13, "V"), (0x14, "V"), (0x15, "V"), (0x16, "V"), (0x17, "V"), (0x18, "V"), (0x19, "V"), (0x1A, "V"), (0x1B, "V"), (0x1C, "V"), (0x1D, "V"), (0x1E, "V"), (0x1F, "V"), (0x20, "V"), (0x21, "V"), (0x22, "V"), (0x23, "V"), (0x24, "V"), (0x25, "V"), (0x26, "V"), (0x27, "V"), (0x28, "V"), (0x29, "V"), (0x2A, "V"), (0x2B, "V"), (0x2C, "V"), (0x2D, "V"), (0x2E, "V"), (0x2F, "V"), (0x30, "V"), (0x31, "V"), (0x32, "V"), (0x33, "V"), (0x34, "V"), (0x35, "V"), (0x36, "V"), (0x37, "V"), (0x38, "V"), (0x39, "V"), (0x3A, "V"), (0x3B, "V"), (0x3C, "V"), (0x3D, "V"), (0x3E, "V"), (0x3F, "V"), (0x40, "V"), (0x41, "M", "a"), (0x42, "M", "b"), (0x43, "M", "c"), (0x44, "M", "d"), (0x45, "M", "e"), (0x46, "M", "f"), (0x47, "M", "g"), (0x48, "M", "h"), (0x49, "M", "i"), (0x4A, "M", "j"), (0x4B, "M", "k"), (0x4C, "M", "l"), (0x4D, "M", "m"), (0x4E, "M", "n"), (0x4F, "M", "o"), (0x50, "M", "p"), (0x51, "M", "q"), (0x52, "M", "r"), (0x53, "M", "s"), (0x54, "M", "t"), (0x55, "M", "u"), (0x56, "M", "v"), (0x57, "M", "w"), (0x58, "M", "x"), (0x59, "M", "y"), (0x5A, "M", "z"), (0x5B, "V"), (0x5C, "V"), (0x5D, "V"), (0x5E, "V"), (0x5F, "V"), (0x60, "V"), (0x61, "V"), (0x62, "V"), (0x63, "V"), ] def _seg_1() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x64, "V"), (0x65, "V"), (0x66, "V"), (0x67, "V"), (0x68, "V"), (0x69, "V"), (0x6A, "V"), (0x6B, "V"), (0x6C, "V"), (0x6D, "V"), (0x6E, "V"), (0x6F, "V"), (0x70, "V"), (0x71, "V"), (0x72, "V"), (0x73, "V"), (0x74, "V"), (0x75, "V"), (0x76, "V"), (0x77, "V"), (0x78, "V"), (0x79, "V"), (0x7A, "V"), (0x7B, "V"), (0x7C, "V"), (0x7D, "V"), (0x7E, "V"), (0x7F, "V"), (0x80, "X"), (0x81, "X"), (0x82, "X"), (0x83, "X"), (0x84, "X"), (0x85, "X"), (0x86, "X"), (0x87, "X"), (0x88, "X"), (0x89, "X"), (0x8A, "X"), (0x8B, "X"), (0x8C, "X"), (0x8D, "X"), (0x8E, "X"), (0x8F, "X"), (0x90, "X"), (0x91, "X"), (0x92, "X"), (0x93, "X"), (0x94, "X"), (0x95, "X"), (0x96, "X"), (0x97, "X"), (0x98, "X"), (0x99, "X"), (0x9A, "X"), (0x9B, "X"), (0x9C, "X"), (0x9D, "X"), (0x9E, "X"), (0x9F, "X"), (0xA0, "M", " "), (0xA1, "V"), (0xA2, "V"), (0xA3, "V"), (0xA4, "V"), (0xA5, "V"), (0xA6, "V"), (0xA7, "V"), (0xA8, "M", " ̈"), (0xA9, "V"), (0xAA, "M", "a"), (0xAB, "V"), (0xAC, "V"), (0xAD, "I"), (0xAE, "V"), (0xAF, "M", " ̄"), (0xB0, "V"), (0xB1, "V"), (0xB2, "M", "2"), (0xB3, "M", "3"), (0xB4, "M", " ́"), (0xB5, "M", "μ"), (0xB6, "V"), (0xB7, "V"), (0xB8, "M", " ̧"), (0xB9, "M", "1"), (0xBA, "M", "o"), (0xBB, "V"), (0xBC, "M", "1⁄4"), (0xBD, "M", "1⁄2"), (0xBE, "M", "3⁄4"), (0xBF, "V"), (0xC0, "M", "à"), (0xC1, "M", "á"), (0xC2, "M", "â"), (0xC3, "M", "ã"), (0xC4, "M", "ä"), (0xC5, "M", "å"), (0xC6, "M", "æ"), (0xC7, "M", "ç"), ] def _seg_2() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xC8, "M", "è"), (0xC9, "M", "é"), (0xCA, "M", "ê"), (0xCB, "M", "ë"), (0xCC, "M", "ì"), (0xCD, "M", "í"), (0xCE, "M", "î"), (0xCF, "M", "ï"), (0xD0, "M", "ð"), (0xD1, "M", "ñ"), (0xD2, "M", "ò"), (0xD3, "M", "ó"), (0xD4, "M", "ô"), (0xD5, "M", "õ"), (0xD6, "M", "ö"), (0xD7, "V"), (0xD8, "M", "ø"), (0xD9, "M", "ù"), (0xDA, "M", "ú"), (0xDB, "M", "û"), (0xDC, "M", "ü"), (0xDD, "M", "ý"), (0xDE, "M", "þ"), (0xDF, "D", "ss"), (0xE0, "V"), (0xE1, "V"), (0xE2, "V"), (0xE3, "V"), (0xE4, "V"), (0xE5, "V"), (0xE6, "V"), (0xE7, "V"), (0xE8, "V"), (0xE9, "V"), (0xEA, "V"), (0xEB, "V"), (0xEC, "V"), (0xED, "V"), (0xEE, "V"), (0xEF, "V"), (0xF0, "V"), (0xF1, "V"), (0xF2, "V"), (0xF3, "V"), (0xF4, "V"), (0xF5, "V"), (0xF6, "V"), (0xF7, "V"), (0xF8, "V"), (0xF9, "V"), (0xFA, "V"), (0xFB, "V"), (0xFC, "V"), (0xFD, "V"), (0xFE, "V"), (0xFF, "V"), (0x100, "M", "ā"), (0x101, "V"), (0x102, "M", "ă"), (0x103, "V"), (0x104, "M", "ą"), (0x105, "V"), (0x106, "M", "ć"), (0x107, "V"), (0x108, "M", "ĉ"), (0x109, "V"), (0x10A, "M", "ċ"), (0x10B, "V"), (0x10C, "M", "č"), (0x10D, "V"), (0x10E, "M", "ď"), (0x10F, "V"), (0x110, "M", "đ"), (0x111, "V"), (0x112, "M", "ē"), (0x113, "V"), (0x114, "M", "ĕ"), (0x115, "V"), (0x116, "M", "ė"), (0x117, "V"), (0x118, "M", "ę"), (0x119, "V"), (0x11A, "M", "ě"), (0x11B, "V"), (0x11C, "M", "ĝ"), (0x11D, "V"), (0x11E, "M", "ğ"), (0x11F, "V"), (0x120, "M", "ġ"), (0x121, "V"), (0x122, "M", "ģ"), (0x123, "V"), (0x124, "M", "ĥ"), (0x125, "V"), (0x126, "M", "ħ"), (0x127, "V"), (0x128, "M", "ĩ"), (0x129, "V"), (0x12A, "M", "ī"), (0x12B, "V"), ] def _seg_3() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x12C, "M", "ĭ"), (0x12D, "V"), (0x12E, "M", "į"), (0x12F, "V"), (0x130, "M", "i̇"), (0x131, "V"), (0x132, "M", "ij"), (0x134, "M", "ĵ"), (0x135, "V"), (0x136, "M", "ķ"), (0x137, "V"), (0x139, "M", "ĺ"), (0x13A, "V"), (0x13B, "M", "ļ"), (0x13C, "V"), (0x13D, "M", "ľ"), (0x13E, "V"), (0x13F, "M", "l·"), (0x141, "M", "ł"), (0x142, "V"), (0x143, "M", "ń"), (0x144, "V"), (0x145, "M", "ņ"), (0x146, "V"), (0x147, "M", "ň"), (0x148, "V"), (0x149, "M", "ʼn"), (0x14A, "M", "ŋ"), (0x14B, "V"), (0x14C, "M", "ō"), (0x14D, "V"), (0x14E, "M", "ŏ"), (0x14F, "V"), (0x150, "M", "ő"), (0x151, "V"), (0x152, "M", "œ"), (0x153, "V"), (0x154, "M", "ŕ"), (0x155, "V"), (0x156, "M", "ŗ"), (0x157, "V"), (0x158, "M", "ř"), (0x159, "V"), (0x15A, "M", "ś"), (0x15B, "V"), (0x15C, "M", "ŝ"), (0x15D, "V"), (0x15E, "M", "ş"), (0x15F, "V"), (0x160, "M", "š"), (0x161, "V"), (0x162, "M", "ţ"), (0x163, "V"), (0x164, "M", "ť"), (0x165, "V"), (0x166, "M", "ŧ"), (0x167, "V"), (0x168, "M", "ũ"), (0x169, "V"), (0x16A, "M", "ū"), (0x16B, "V"), (0x16C, "M", "ŭ"), (0x16D, "V"), (0x16E, "M", "ů"), (0x16F, "V"), (0x170, "M", "ű"), (0x171, "V"), (0x172, "M", "ų"), (0x173, "V"), (0x174, "M", "ŵ"), (0x175, "V"), (0x176, "M", "ŷ"), (0x177, "V"), (0x178, "M", "ÿ"), (0x179, "M", "ź"), (0x17A, "V"), (0x17B, "M", "ż"), (0x17C, "V"), (0x17D, "M", "ž"), (0x17E, "V"), (0x17F, "M", "s"), (0x180, "V"), (0x181, "M", "ɓ"), (0x182, "M", "ƃ"), (0x183, "V"), (0x184, "M", "ƅ"), (0x185, "V"), (0x186, "M", "ɔ"), (0x187, "M", "ƈ"), (0x188, "V"), (0x189, "M", "ɖ"), (0x18A, "M", "ɗ"), (0x18B, "M", "ƌ"), (0x18C, "V"), (0x18E, "M", "ǝ"), (0x18F, "M", "ə"), (0x190, "M", "ɛ"), (0x191, "M", "ƒ"), (0x192, "V"), (0x193, "M", "ɠ"), ] def _seg_4() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x194, "M", "ɣ"), (0x195, "V"), (0x196, "M", "ɩ"), (0x197, "M", "ɨ"), (0x198, "M", "ƙ"), (0x199, "V"), (0x19C, "M", "ɯ"), (0x19D, "M", "ɲ"), (0x19E, "V"), (0x19F, "M", "ɵ"), (0x1A0, "M", "ơ"), (0x1A1, "V"), (0x1A2, "M", "ƣ"), (0x1A3, "V"), (0x1A4, "M", "ƥ"), (0x1A5, "V"), (0x1A6, "M", "ʀ"), (0x1A7, "M", "ƨ"), (0x1A8, "V"), (0x1A9, "M", "ʃ"), (0x1AA, "V"), (0x1AC, "M", "ƭ"), (0x1AD, "V"), (0x1AE, "M", "ʈ"), (0x1AF, "M", "ư"), (0x1B0, "V"), (0x1B1, "M", "ʊ"), (0x1B2, "M", "ʋ"), (0x1B3, "M", "ƴ"), (0x1B4, "V"), (0x1B5, "M", "ƶ"), (0x1B6, "V"), (0x1B7, "M", "ʒ"), (0x1B8, "M", "ƹ"), (0x1B9, "V"), (0x1BC, "M", "ƽ"), (0x1BD, "V"), (0x1C4, "M", "dž"), (0x1C7, "M", "lj"), (0x1CA, "M", "nj"), (0x1CD, "M", "ǎ"), (0x1CE, "V"), (0x1CF, "M", "ǐ"), (0x1D0, "V"), (0x1D1, "M", "ǒ"), (0x1D2, "V"), (0x1D3, "M", "ǔ"), (0x1D4, "V"), (0x1D5, "M", "ǖ"), (0x1D6, "V"), (0x1D7, "M", "ǘ"), (0x1D8, "V"), (0x1D9, "M", "ǚ"), (0x1DA, "V"), (0x1DB, "M", "ǜ"), (0x1DC, "V"), (0x1DE, "M", "ǟ"), (0x1DF, "V"), (0x1E0, "M", "ǡ"), (0x1E1, "V"), (0x1E2, "M", "ǣ"), (0x1E3, "V"), (0x1E4, "M", "ǥ"), (0x1E5, "V"), (0x1E6, "M", "ǧ"), (0x1E7, "V"), (0x1E8, "M", "ǩ"), (0x1E9, "V"), (0x1EA, "M", "ǫ"), (0x1EB, "V"), (0x1EC, "M", "ǭ"), (0x1ED, "V"), (0x1EE, "M", "ǯ"), (0x1EF, "V"), (0x1F1, "M", "dz"), (0x1F4, "M", "ǵ"), (0x1F5, "V"), (0x1F6, "M", "ƕ"), (0x1F7, "M", "ƿ"), (0x1F8, "M", "ǹ"), (0x1F9, "V"), (0x1FA, "M", "ǻ"), (0x1FB, "V"), (0x1FC, "M", "ǽ"), (0x1FD, "V"), (0x1FE, "M", "ǿ"), (0x1FF, "V"), (0x200, "M", "ȁ"), (0x201, "V"), (0x202, "M", "ȃ"), (0x203, "V"), (0x204, "M", "ȅ"), (0x205, "V"), (0x206, "M", "ȇ"), (0x207, "V"), (0x208, "M", "ȉ"), (0x209, "V"), (0x20A, "M", "ȋ"), (0x20B, "V"), (0x20C, "M", "ȍ"), ] def _seg_5() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x20D, "V"), (0x20E, "M", "ȏ"), (0x20F, "V"), (0x210, "M", "ȑ"), (0x211, "V"), (0x212, "M", "ȓ"), (0x213, "V"), (0x214, "M", "ȕ"), (0x215, "V"), (0x216, "M", "ȗ"), (0x217, "V"), (0x218, "M", "ș"), (0x219, "V"), (0x21A, "M", "ț"), (0x21B, "V"), (0x21C, "M", "ȝ"), (0x21D, "V"), (0x21E, "M", "ȟ"), (0x21F, "V"), (0x220, "M", "ƞ"), (0x221, "V"), (0x222, "M", "ȣ"), (0x223, "V"), (0x224, "M", "ȥ"), (0x225, "V"), (0x226, "M", "ȧ"), (0x227, "V"), (0x228, "M", "ȩ"), (0x229, "V"), (0x22A, "M", "ȫ"), (0x22B, "V"), (0x22C, "M", "ȭ"), (0x22D, "V"), (0x22E, "M", "ȯ"), (0x22F, "V"), (0x230, "M", "ȱ"), (0x231, "V"), (0x232, "M", "ȳ"), (0x233, "V"), (0x23A, "M", "ⱥ"), (0x23B, "M", "ȼ"), (0x23C, "V"), (0x23D, "M", "ƚ"), (0x23E, "M", "ⱦ"), (0x23F, "V"), (0x241, "M", "ɂ"), (0x242, "V"), (0x243, "M", "ƀ"), (0x244, "M", "ʉ"), (0x245, "M", "ʌ"), (0x246, "M", "ɇ"), (0x247, "V"), (0x248, "M", "ɉ"), (0x249, "V"), (0x24A, "M", "ɋ"), (0x24B, "V"), (0x24C, "M", "ɍ"), (0x24D, "V"), (0x24E, "M", "ɏ"), (0x24F, "V"), (0x2B0, "M", "h"), (0x2B1, "M", "ɦ"), (0x2B2, "M", "j"), (0x2B3, "M", "r"), (0x2B4, "M", "ɹ"), (0x2B5, "M", "ɻ"), (0x2B6, "M", "ʁ"), (0x2B7, "M", "w"), (0x2B8, "M", "y"), (0x2B9, "V"), (0x2D8, "M", " ̆"), (0x2D9, "M", " ̇"), (0x2DA, "M", " ̊"), (0x2DB, "M", " ̨"), (0x2DC, "M", " ̃"), (0x2DD, "M", " ̋"), (0x2DE, "V"), (0x2E0, "M", "ɣ"), (0x2E1, "M", "l"), (0x2E2, "M", "s"), (0x2E3, "M", "x"), (0x2E4, "M", "ʕ"), (0x2E5, "V"), (0x340, "M", "̀"), (0x341, "M", "́"), (0x342, "V"), (0x343, "M", "̓"), (0x344, "M", "̈́"), (0x345, "M", "ι"), (0x346, "V"), (0x34F, "I"), (0x350, "V"), (0x370, "M", "ͱ"), (0x371, "V"), (0x372, "M", "ͳ"), (0x373, "V"), (0x374, "M", "ʹ"), (0x375, "V"), (0x376, "M", "ͷ"), (0x377, "V"), ] def _seg_6() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x378, "X"), (0x37A, "M", " ι"), (0x37B, "V"), (0x37E, "M", ";"), (0x37F, "M", "ϳ"), (0x380, "X"), (0x384, "M", " ́"), (0x385, "M", " ̈́"), (0x386, "M", "ά"), (0x387, "M", "·"), (0x388, "M", "έ"), (0x389, "M", "ή"), (0x38A, "M", "ί"), (0x38B, "X"), (0x38C, "M", "ό"), (0x38D, "X"), (0x38E, "M", "ύ"), (0x38F, "M", "ώ"), (0x390, "V"), (0x391, "M", "α"), (0x392, "M", "β"), (0x393, "M", "γ"), (0x394, "M", "δ"), (0x395, "M", "ε"), (0x396, "M", "ζ"), (0x397, "M", "η"), (0x398, "M", "θ"), (0x399, "M", "ι"), (0x39A, "M", "κ"), (0x39B, "M", "λ"), (0x39C, "M", "μ"), (0x39D, "M", "ν"), (0x39E, "M", "ξ"), (0x39F, "M", "ο"), (0x3A0, "M", "π"), (0x3A1, "M", "ρ"), (0x3A2, "X"), (0x3A3, "M", "σ"), (0x3A4, "M", "τ"), (0x3A5, "M", "υ"), (0x3A6, "M", "φ"), (0x3A7, "M", "χ"), (0x3A8, "M", "ψ"), (0x3A9, "M", "ω"), (0x3AA, "M", "ϊ"), (0x3AB, "M", "ϋ"), (0x3AC, "V"), (0x3C2, "D", "σ"), (0x3C3, "V"), (0x3CF, "M", "ϗ"), (0x3D0, "M", "β"), (0x3D1, "M", "θ"), (0x3D2, "M", "υ"), (0x3D3, "M", "ύ"), (0x3D4, "M", "ϋ"), (0x3D5, "M", "φ"), (0x3D6, "M", "π"), (0x3D7, "V"), (0x3D8, "M", "ϙ"), (0x3D9, "V"), (0x3DA, "M", "ϛ"), (0x3DB, "V"), (0x3DC, "M", "ϝ"), (0x3DD, "V"), (0x3DE, "M", "ϟ"), (0x3DF, "V"), (0x3E0, "M", "ϡ"), (0x3E1, "V"), (0x3E2, "M", "ϣ"), (0x3E3, "V"), (0x3E4, "M", "ϥ"), (0x3E5, "V"), (0x3E6, "M", "ϧ"), (0x3E7, "V"), (0x3E8, "M", "ϩ"), (0x3E9, "V"), (0x3EA, "M", "ϫ"), (0x3EB, "V"), (0x3EC, "M", "ϭ"), (0x3ED, "V"), (0x3EE, "M", "ϯ"), (0x3EF, "V"), (0x3F0, "M", "κ"), (0x3F1, "M", "ρ"), (0x3F2, "M", "σ"), (0x3F3, "V"), (0x3F4, "M", "θ"), (0x3F5, "M", "ε"), (0x3F6, "V"), (0x3F7, "M", "ϸ"), (0x3F8, "V"), (0x3F9, "M", "σ"), (0x3FA, "M", "ϻ"), (0x3FB, "V"), (0x3FD, "M", "ͻ"), (0x3FE, "M", "ͼ"), (0x3FF, "M", "ͽ"), (0x400, "M", "ѐ"), (0x401, "M", "ё"), (0x402, "M", "ђ"), ] def _seg_7() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x403, "M", "ѓ"), (0x404, "M", "є"), (0x405, "M", "ѕ"), (0x406, "M", "і"), (0x407, "M", "ї"), (0x408, "M", "ј"), (0x409, "M", "љ"), (0x40A, "M", "њ"), (0x40B, "M", "ћ"), (0x40C, "M", "ќ"), (0x40D, "M", "ѝ"), (0x40E, "M", "ў"), (0x40F, "M", "џ"), (0x410, "M", "а"), (0x411, "M", "б"), (0x412, "M", "в"), (0x413, "M", "г"), (0x414, "M", "д"), (0x415, "M", "е"), (0x416, "M", "ж"), (0x417, "M", "з"), (0x418, "M", "и"), (0x419, "M", "й"), (0x41A, "M", "к"), (0x41B, "M", "л"), (0x41C, "M", "м"), (0x41D, "M", "н"), (0x41E, "M", "о"), (0x41F, "M", "п"), (0x420, "M", "р"), (0x421, "M", "с"), (0x422, "M", "т"), (0x423, "M", "у"), (0x424, "M", "ф"), (0x425, "M", "х"), (0x426, "M", "ц"), (0x427, "M", "ч"), (0x428, "M", "ш"), (0x429, "M", "щ"), (0x42A, "M", "ъ"), (0x42B, "M", "ы"), (0x42C, "M", "ь"), (0x42D, "M", "э"), (0x42E, "M", "ю"), (0x42F, "M", "я"), (0x430, "V"), (0x460, "M", "ѡ"), (0x461, "V"), (0x462, "M", "ѣ"), (0x463, "V"), (0x464, "M", "ѥ"), (0x465, "V"), (0x466, "M", "ѧ"), (0x467, "V"), (0x468, "M", "ѩ"), (0x469, "V"), (0x46A, "M", "ѫ"), (0x46B, "V"), (0x46C, "M", "ѭ"), (0x46D, "V"), (0x46E, "M", "ѯ"), (0x46F, "V"), (0x470, "M", "ѱ"), (0x471, "V"), (0x472, "M", "ѳ"), (0x473, "V"), (0x474, "M", "ѵ"), (0x475, "V"), (0x476, "M", "ѷ"), (0x477, "V"), (0x478, "M", "ѹ"), (0x479, "V"), (0x47A, "M", "ѻ"), (0x47B, "V"), (0x47C, "M", "ѽ"), (0x47D, "V"), (0x47E, "M", "ѿ"), (0x47F, "V"), (0x480, "M", "ҁ"), (0x481, "V"), (0x48A, "M", "ҋ"), (0x48B, "V"), (0x48C, "M", "ҍ"), (0x48D, "V"), (0x48E, "M", "ҏ"), (0x48F, "V"), (0x490, "M", "ґ"), (0x491, "V"), (0x492, "M", "ғ"), (0x493, "V"), (0x494, "M", "ҕ"), (0x495, "V"), (0x496, "M", "җ"), (0x497, "V"), (0x498, "M", "ҙ"), (0x499, "V"), (0x49A, "M", "қ"), (0x49B, "V"), (0x49C, "M", "ҝ"), (0x49D, "V"), ] def _seg_8() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x49E, "M", "ҟ"), (0x49F, "V"), (0x4A0, "M", "ҡ"), (0x4A1, "V"), (0x4A2, "M", "ң"), (0x4A3, "V"), (0x4A4, "M", "ҥ"), (0x4A5, "V"), (0x4A6, "M", "ҧ"), (0x4A7, "V"), (0x4A8, "M", "ҩ"), (0x4A9, "V"), (0x4AA, "M", "ҫ"), (0x4AB, "V"), (0x4AC, "M", "ҭ"), (0x4AD, "V"), (0x4AE, "M", "ү"), (0x4AF, "V"), (0x4B0, "M", "ұ"), (0x4B1, "V"), (0x4B2, "M", "ҳ"), (0x4B3, "V"), (0x4B4, "M", "ҵ"), (0x4B5, "V"), (0x4B6, "M", "ҷ"), (0x4B7, "V"), (0x4B8, "M", "ҹ"), (0x4B9, "V"), (0x4BA, "M", "һ"), (0x4BB, "V"), (0x4BC, "M", "ҽ"), (0x4BD, "V"), (0x4BE, "M", "ҿ"), (0x4BF, "V"), (0x4C0, "M", "ӏ"), (0x4C1, "M", "ӂ"), (0x4C2, "V"), (0x4C3, "M", "ӄ"), (0x4C4, "V"), (0x4C5, "M", "ӆ"), (0x4C6, "V"), (0x4C7, "M", "ӈ"), (0x4C8, "V"), (0x4C9, "M", "ӊ"), (0x4CA, "V"), (0x4CB, "M", "ӌ"), (0x4CC, "V"), (0x4CD, "M", "ӎ"), (0x4CE, "V"), (0x4D0, "M", "ӑ"), (0x4D1, "V"), (0x4D2, "M", "ӓ"), (0x4D3, "V"), (0x4D4, "M", "ӕ"), (0x4D5, "V"), (0x4D6, "M", "ӗ"), (0x4D7, "V"), (0x4D8, "M", "ә"), (0x4D9, "V"), (0x4DA, "M", "ӛ"), (0x4DB, "V"), (0x4DC, "M", "ӝ"), (0x4DD, "V"), (0x4DE, "M", "ӟ"), (0x4DF, "V"), (0x4E0, "M", "ӡ"), (0x4E1, "V"), (0x4E2, "M", "ӣ"), (0x4E3, "V"), (0x4E4, "M", "ӥ"), (0x4E5, "V"), (0x4E6, "M", "ӧ"), (0x4E7, "V"), (0x4E8, "M", "ө"), (0x4E9, "V"), (0x4EA, "M", "ӫ"), (0x4EB, "V"), (0x4EC, "M", "ӭ"), (0x4ED, "V"), (0x4EE, "M", "ӯ"), (0x4EF, "V"), (0x4F0, "M", "ӱ"), (0x4F1, "V"), (0x4F2, "M", "ӳ"), (0x4F3, "V"), (0x4F4, "M", "ӵ"), (0x4F5, "V"), (0x4F6, "M", "ӷ"), (0x4F7, "V"), (0x4F8, "M", "ӹ"), (0x4F9, "V"), (0x4FA, "M", "ӻ"), (0x4FB, "V"), (0x4FC, "M", "ӽ"), (0x4FD, "V"), (0x4FE, "M", "ӿ"), (0x4FF, "V"), (0x500, "M", "ԁ"), (0x501, "V"), (0x502, "M", "ԃ"), ] def _seg_9() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x503, "V"), (0x504, "M", "ԅ"), (0x505, "V"), (0x506, "M", "ԇ"), (0x507, "V"), (0x508, "M", "ԉ"), (0x509, "V"), (0x50A, "M", "ԋ"), (0x50B, "V"), (0x50C, "M", "ԍ"), (0x50D, "V"), (0x50E, "M", "ԏ"), (0x50F, "V"), (0x510, "M", "ԑ"), (0x511, "V"), (0x512, "M", "ԓ"), (0x513, "V"), (0x514, "M", "ԕ"), (0x515, "V"), (0x516, "M", "ԗ"), (0x517, "V"), (0x518, "M", "ԙ"), (0x519, "V"), (0x51A, "M", "ԛ"), (0x51B, "V"), (0x51C, "M", "ԝ"), (0x51D, "V"), (0x51E, "M", "ԟ"), (0x51F, "V"), (0x520, "M", "ԡ"), (0x521, "V"), (0x522, "M", "ԣ"), (0x523, "V"), (0x524, "M", "ԥ"), (0x525, "V"), (0x526, "M", "ԧ"), (0x527, "V"), (0x528, "M", "ԩ"), (0x529, "V"), (0x52A, "M", "ԫ"), (0x52B, "V"), (0x52C, "M", "ԭ"), (0x52D, "V"), (0x52E, "M", "ԯ"), (0x52F, "V"), (0x530, "X"), (0x531, "M", "ա"), (0x532, "M", "բ"), (0x533, "M", "գ"), (0x534, "M", "դ"), (0x535, "M", "ե"), (0x536, "M", "զ"), (0x537, "M", "է"), (0x538, "M", "ը"), (0x539, "M", "թ"), (0x53A, "M", "ժ"), (0x53B, "M", "ի"), (0x53C, "M", "լ"), (0x53D, "M", "խ"), (0x53E, "M", "ծ"), (0x53F, "M", "կ"), (0x540, "M", "հ"), (0x541, "M", "ձ"), (0x542, "M", "ղ"), (0x543, "M", "ճ"), (0x544, "M", "մ"), (0x545, "M", "յ"), (0x546, "M", "ն"), (0x547, "M", "շ"), (0x548, "M", "ո"), (0x549, "M", "չ"), (0x54A, "M", "պ"), (0x54B, "M", "ջ"), (0x54C, "M", "ռ"), (0x54D, "M", "ս"), (0x54E, "M", "վ"), (0x54F, "M", "տ"), (0x550, "M", "ր"), (0x551, "M", "ց"), (0x552, "M", "ւ"), (0x553, "M", "փ"), (0x554, "M", "ք"), (0x555, "M", "օ"), (0x556, "M", "ֆ"), (0x557, "X"), (0x559, "V"), (0x587, "M", "եւ"), (0x588, "V"), (0x58B, "X"), (0x58D, "V"), (0x590, "X"), (0x591, "V"), (0x5C8, "X"), (0x5D0, "V"), (0x5EB, "X"), (0x5EF, "V"), (0x5F5, "X"), (0x606, "V"), (0x61C, "X"), (0x61D, "V"), ] def _seg_10() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x675, "M", "اٴ"), (0x676, "M", "وٴ"), (0x677, "M", "ۇٴ"), (0x678, "M", "يٴ"), (0x679, "V"), (0x6DD, "X"), (0x6DE, "V"), (0x70E, "X"), (0x710, "V"), (0x74B, "X"), (0x74D, "V"), (0x7B2, "X"), (0x7C0, "V"), (0x7FB, "X"), (0x7FD, "V"), (0x82E, "X"), (0x830, "V"), (0x83F, "X"), (0x840, "V"), (0x85C, "X"), (0x85E, "V"), (0x85F, "X"), (0x860, "V"), (0x86B, "X"), (0x870, "V"), (0x88F, "X"), (0x897, "V"), (0x8E2, "X"), (0x8E3, "V"), (0x958, "M", "क़"), (0x959, "M", "ख़"), (0x95A, "M", "ग़"), (0x95B, "M", "ज़"), (0x95C, "M", "ड़"), (0x95D, "M", "ढ़"), (0x95E, "M", "फ़"), (0x95F, "M", "य़"), (0x960, "V"), (0x984, "X"), (0x985, "V"), (0x98D, "X"), (0x98F, "V"), (0x991, "X"), (0x993, "V"), (0x9A9, "X"), (0x9AA, "V"), (0x9B1, "X"), (0x9B2, "V"), (0x9B3, "X"), (0x9B6, "V"), (0x9BA, "X"), (0x9BC, "V"), (0x9C5, "X"), (0x9C7, "V"), (0x9C9, "X"), (0x9CB, "V"), (0x9CF, "X"), (0x9D7, "V"), (0x9D8, "X"), (0x9DC, "M", "ড়"), (0x9DD, "M", "ঢ়"), (0x9DE, "X"), (0x9DF, "M", "য়"), (0x9E0, "V"), (0x9E4, "X"), (0x9E6, "V"), (0x9FF, "X"), (0xA01, "V"), (0xA04, "X"), (0xA05, "V"), (0xA0B, "X"), (0xA0F, "V"), (0xA11, "X"), (0xA13, "V"), (0xA29, "X"), (0xA2A, "V"), (0xA31, "X"), (0xA32, "V"), (0xA33, "M", "ਲ਼"), (0xA34, "X"), (0xA35, "V"), (0xA36, "M", "ਸ਼"), (0xA37, "X"), (0xA38, "V"), (0xA3A, "X"), (0xA3C, "V"), (0xA3D, "X"), (0xA3E, "V"), (0xA43, "X"), (0xA47, "V"), (0xA49, "X"), (0xA4B, "V"), (0xA4E, "X"), (0xA51, "V"), (0xA52, "X"), (0xA59, "M", "ਖ਼"), (0xA5A, "M", "ਗ਼"), (0xA5B, "M", "ਜ਼"), (0xA5C, "V"), (0xA5D, "X"), ] def _seg_11() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xA5E, "M", "ਫ਼"), (0xA5F, "X"), (0xA66, "V"), (0xA77, "X"), (0xA81, "V"), (0xA84, "X"), (0xA85, "V"), (0xA8E, "X"), (0xA8F, "V"), (0xA92, "X"), (0xA93, "V"), (0xAA9, "X"), (0xAAA, "V"), (0xAB1, "X"), (0xAB2, "V"), (0xAB4, "X"), (0xAB5, "V"), (0xABA, "X"), (0xABC, "V"), (0xAC6, "X"), (0xAC7, "V"), (0xACA, "X"), (0xACB, "V"), (0xACE, "X"), (0xAD0, "V"), (0xAD1, "X"), (0xAE0, "V"), (0xAE4, "X"), (0xAE6, "V"), (0xAF2, "X"), (0xAF9, "V"), (0xB00, "X"), (0xB01, "V"), (0xB04, "X"), (0xB05, "V"), (0xB0D, "X"), (0xB0F, "V"), (0xB11, "X"), (0xB13, "V"), (0xB29, "X"), (0xB2A, "V"), (0xB31, "X"), (0xB32, "V"), (0xB34, "X"), (0xB35, "V"), (0xB3A, "X"), (0xB3C, "V"), (0xB45, "X"), (0xB47, "V"), (0xB49, "X"), (0xB4B, "V"), (0xB4E, "X"), (0xB55, "V"), (0xB58, "X"), (0xB5C, "M", "ଡ଼"), (0xB5D, "M", "ଢ଼"), (0xB5E, "X"), (0xB5F, "V"), (0xB64, "X"), (0xB66, "V"), (0xB78, "X"), (0xB82, "V"), (0xB84, "X"), (0xB85, "V"), (0xB8B, "X"), (0xB8E, "V"), (0xB91, "X"), (0xB92, "V"), (0xB96, "X"), (0xB99, "V"), (0xB9B, "X"), (0xB9C, "V"), (0xB9D, "X"), (0xB9E, "V"), (0xBA0, "X"), (0xBA3, "V"), (0xBA5, "X"), (0xBA8, "V"), (0xBAB, "X"), (0xBAE, "V"), (0xBBA, "X"), (0xBBE, "V"), (0xBC3, "X"), (0xBC6, "V"), (0xBC9, "X"), (0xBCA, "V"), (0xBCE, "X"), (0xBD0, "V"), (0xBD1, "X"), (0xBD7, "V"), (0xBD8, "X"), (0xBE6, "V"), (0xBFB, "X"), (0xC00, "V"), (0xC0D, "X"), (0xC0E, "V"), (0xC11, "X"), (0xC12, "V"), (0xC29, "X"), (0xC2A, "V"), ] def _seg_12() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xC3A, "X"), (0xC3C, "V"), (0xC45, "X"), (0xC46, "V"), (0xC49, "X"), (0xC4A, "V"), (0xC4E, "X"), (0xC55, "V"), (0xC57, "X"), (0xC58, "V"), (0xC5B, "X"), (0xC5D, "V"), (0xC5E, "X"), (0xC60, "V"), (0xC64, "X"), (0xC66, "V"), (0xC70, "X"), (0xC77, "V"), (0xC8D, "X"), (0xC8E, "V"), (0xC91, "X"), (0xC92, "V"), (0xCA9, "X"), (0xCAA, "V"), (0xCB4, "X"), (0xCB5, "V"), (0xCBA, "X"), (0xCBC, "V"), (0xCC5, "X"), (0xCC6, "V"), (0xCC9, "X"), (0xCCA, "V"), (0xCCE, "X"), (0xCD5, "V"), (0xCD7, "X"), (0xCDD, "V"), (0xCDF, "X"), (0xCE0, "V"), (0xCE4, "X"), (0xCE6, "V"), (0xCF0, "X"), (0xCF1, "V"), (0xCF4, "X"), (0xD00, "V"), (0xD0D, "X"), (0xD0E, "V"), (0xD11, "X"), (0xD12, "V"), (0xD45, "X"), (0xD46, "V"), (0xD49, "X"), (0xD4A, "V"), (0xD50, "X"), (0xD54, "V"), (0xD64, "X"), (0xD66, "V"), (0xD80, "X"), (0xD81, "V"), (0xD84, "X"), (0xD85, "V"), (0xD97, "X"), (0xD9A, "V"), (0xDB2, "X"), (0xDB3, "V"), (0xDBC, "X"), (0xDBD, "V"), (0xDBE, "X"), (0xDC0, "V"), (0xDC7, "X"), (0xDCA, "V"), (0xDCB, "X"), (0xDCF, "V"), (0xDD5, "X"), (0xDD6, "V"), (0xDD7, "X"), (0xDD8, "V"), (0xDE0, "X"), (0xDE6, "V"), (0xDF0, "X"), (0xDF2, "V"), (0xDF5, "X"), (0xE01, "V"), (0xE33, "M", "ํา"), (0xE34, "V"), (0xE3B, "X"), (0xE3F, "V"), (0xE5C, "X"), (0xE81, "V"), (0xE83, "X"), (0xE84, "V"), (0xE85, "X"), (0xE86, "V"), (0xE8B, "X"), (0xE8C, "V"), (0xEA4, "X"), (0xEA5, "V"), (0xEA6, "X"), (0xEA7, "V"), (0xEB3, "M", "ໍາ"), (0xEB4, "V"), ] def _seg_13() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xEBE, "X"), (0xEC0, "V"), (0xEC5, "X"), (0xEC6, "V"), (0xEC7, "X"), (0xEC8, "V"), (0xECF, "X"), (0xED0, "V"), (0xEDA, "X"), (0xEDC, "M", "ຫນ"), (0xEDD, "M", "ຫມ"), (0xEDE, "V"), (0xEE0, "X"), (0xF00, "V"), (0xF0C, "M", "་"), (0xF0D, "V"), (0xF43, "M", "གྷ"), (0xF44, "V"), (0xF48, "X"), (0xF49, "V"), (0xF4D, "M", "ཌྷ"), (0xF4E, "V"), (0xF52, "M", "དྷ"), (0xF53, "V"), (0xF57, "M", "བྷ"), (0xF58, "V"), (0xF5C, "M", "ཛྷ"), (0xF5D, "V"), (0xF69, "M", "ཀྵ"), (0xF6A, "V"), (0xF6D, "X"), (0xF71, "V"), (0xF73, "M", "ཱི"), (0xF74, "V"), (0xF75, "M", "ཱུ"), (0xF76, "M", "ྲྀ"), (0xF77, "M", "ྲཱྀ"), (0xF78, "M", "ླྀ"), (0xF79, "M", "ླཱྀ"), (0xF7A, "V"), (0xF81, "M", "ཱྀ"), (0xF82, "V"), (0xF93, "M", "ྒྷ"), (0xF94, "V"), (0xF98, "X"), (0xF99, "V"), (0xF9D, "M", "ྜྷ"), (0xF9E, "V"), (0xFA2, "M", "ྡྷ"), (0xFA3, "V"), (0xFA7, "M", "ྦྷ"), (0xFA8, "V"), (0xFAC, "M", "ྫྷ"), (0xFAD, "V"), (0xFB9, "M", "ྐྵ"), (0xFBA, "V"), (0xFBD, "X"), (0xFBE, "V"), (0xFCD, "X"), (0xFCE, "V"), (0xFDB, "X"), (0x1000, "V"), (0x10A0, "M", "ⴀ"), (0x10A1, "M", "ⴁ"), (0x10A2, "M", "ⴂ"), (0x10A3, "M", "ⴃ"), (0x10A4, "M", "ⴄ"), (0x10A5, "M", "ⴅ"), (0x10A6, "M", "ⴆ"), (0x10A7, "M", "ⴇ"), (0x10A8, "M", "ⴈ"), (0x10A9, "M", "ⴉ"), (0x10AA, "M", "ⴊ"), (0x10AB, "M", "ⴋ"), (0x10AC, "M", "ⴌ"), (0x10AD, "M", "ⴍ"), (0x10AE, "M", "ⴎ"), (0x10AF, "M", "ⴏ"), (0x10B0, "M", "ⴐ"), (0x10B1, "M", "ⴑ"), (0x10B2, "M", "ⴒ"), (0x10B3, "M", "ⴓ"), (0x10B4, "M", "ⴔ"), (0x10B5, "M", "ⴕ"), (0x10B6, "M", "ⴖ"), (0x10B7, "M", "ⴗ"), (0x10B8, "M", "ⴘ"), (0x10B9, "M", "ⴙ"), (0x10BA, "M", "ⴚ"), (0x10BB, "M", "ⴛ"), (0x10BC, "M", "ⴜ"), (0x10BD, "M", "ⴝ"), (0x10BE, "M", "ⴞ"), (0x10BF, "M", "ⴟ"), (0x10C0, "M", "ⴠ"), (0x10C1, "M", "ⴡ"), (0x10C2, "M", "ⴢ"), (0x10C3, "M", "ⴣ"), (0x10C4, "M", "ⴤ"), (0x10C5, "M", "ⴥ"), ] def _seg_14() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x10C6, "X"), (0x10C7, "M", "ⴧ"), (0x10C8, "X"), (0x10CD, "M", "ⴭ"), (0x10CE, "X"), (0x10D0, "V"), (0x10FC, "M", "ნ"), (0x10FD, "V"), (0x115F, "I"), (0x1161, "V"), (0x1249, "X"), (0x124A, "V"), (0x124E, "X"), (0x1250, "V"), (0x1257, "X"), (0x1258, "V"), (0x1259, "X"), (0x125A, "V"), (0x125E, "X"), (0x1260, "V"), (0x1289, "X"), (0x128A, "V"), (0x128E, "X"), (0x1290, "V"), (0x12B1, "X"), (0x12B2, "V"), (0x12B6, "X"), (0x12B8, "V"), (0x12BF, "X"), (0x12C0, "V"), (0x12C1, "X"), (0x12C2, "V"), (0x12C6, "X"), (0x12C8, "V"), (0x12D7, "X"), (0x12D8, "V"), (0x1311, "X"), (0x1312, "V"), (0x1316, "X"), (0x1318, "V"), (0x135B, "X"), (0x135D, "V"), (0x137D, "X"), (0x1380, "V"), (0x139A, "X"), (0x13A0, "V"), (0x13F6, "X"), (0x13F8, "M", "Ᏸ"), (0x13F9, "M", "Ᏹ"), (0x13FA, "M", "Ᏺ"), (0x13FB, "M", "Ᏻ"), (0x13FC, "M", "Ᏼ"), (0x13FD, "M", "Ᏽ"), (0x13FE, "X"), (0x1400, "V"), (0x1680, "X"), (0x1681, "V"), (0x169D, "X"), (0x16A0, "V"), (0x16F9, "X"), (0x1700, "V"), (0x1716, "X"), (0x171F, "V"), (0x1737, "X"), (0x1740, "V"), (0x1754, "X"), (0x1760, "V"), (0x176D, "X"), (0x176E, "V"), (0x1771, "X"), (0x1772, "V"), (0x1774, "X"), (0x1780, "V"), (0x17B4, "I"), (0x17B6, "V"), (0x17DE, "X"), (0x17E0, "V"), (0x17EA, "X"), (0x17F0, "V"), (0x17FA, "X"), (0x1800, "V"), (0x180B, "I"), (0x1810, "V"), (0x181A, "X"), (0x1820, "V"), (0x1879, "X"), (0x1880, "V"), (0x18AB, "X"), (0x18B0, "V"), (0x18F6, "X"), (0x1900, "V"), (0x191F, "X"), (0x1920, "V"), (0x192C, "X"), (0x1930, "V"), (0x193C, "X"), (0x1940, "V"), (0x1941, "X"), (0x1944, "V"), (0x196E, "X"), ] def _seg_15() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1970, "V"), (0x1975, "X"), (0x1980, "V"), (0x19AC, "X"), (0x19B0, "V"), (0x19CA, "X"), (0x19D0, "V"), (0x19DB, "X"), (0x19DE, "V"), (0x1A1C, "X"), (0x1A1E, "V"), (0x1A5F, "X"), (0x1A60, "V"), (0x1A7D, "X"), (0x1A7F, "V"), (0x1A8A, "X"), (0x1A90, "V"), (0x1A9A, "X"), (0x1AA0, "V"), (0x1AAE, "X"), (0x1AB0, "V"), (0x1ACF, "X"), (0x1B00, "V"), (0x1B4D, "X"), (0x1B4E, "V"), (0x1BF4, "X"), (0x1BFC, "V"), (0x1C38, "X"), (0x1C3B, "V"), (0x1C4A, "X"), (0x1C4D, "V"), (0x1C80, "M", "в"), (0x1C81, "M", "д"), (0x1C82, "M", "о"), (0x1C83, "M", "с"), (0x1C84, "M", "т"), (0x1C86, "M", "ъ"), (0x1C87, "M", "ѣ"), (0x1C88, "M", "ꙋ"), (0x1C89, "M", "ᲊ"), (0x1C8A, "V"), (0x1C8B, "X"), (0x1C90, "M", "ა"), (0x1C91, "M", "ბ"), (0x1C92, "M", "გ"), (0x1C93, "M", "დ"), (0x1C94, "M", "ე"), (0x1C95, "M", "ვ"), (0x1C96, "M", "ზ"), (0x1C97, "M", "თ"), (0x1C98, "M", "ი"), (0x1C99, "M", "კ"), (0x1C9A, "M", "ლ"), (0x1C9B, "M", "მ"), (0x1C9C, "M", "ნ"), (0x1C9D, "M", "ო"), (0x1C9E, "M", "პ"), (0x1C9F, "M", "ჟ"), (0x1CA0, "M", "რ"), (0x1CA1, "M", "ს"), (0x1CA2, "M", "ტ"), (0x1CA3, "M", "უ"), (0x1CA4, "M", "ფ"), (0x1CA5, "M", "ქ"), (0x1CA6, "M", "ღ"), (0x1CA7, "M", "ყ"), (0x1CA8, "M", "შ"), (0x1CA9, "M", "ჩ"), (0x1CAA, "M", "ც"), (0x1CAB, "M", "ძ"), (0x1CAC, "M", "წ"), (0x1CAD, "M", "ჭ"), (0x1CAE, "M", "ხ"), (0x1CAF, "M", "ჯ"), (0x1CB0, "M", "ჰ"), (0x1CB1, "M", "ჱ"), (0x1CB2, "M", "ჲ"), (0x1CB3, "M", "ჳ"), (0x1CB4, "M", "ჴ"), (0x1CB5, "M", "ჵ"), (0x1CB6, "M", "ჶ"), (0x1CB7, "M", "ჷ"), (0x1CB8, "M", "ჸ"), (0x1CB9, "M", "ჹ"), (0x1CBA, "M", "ჺ"), (0x1CBB, "X"), (0x1CBD, "M", "ჽ"), (0x1CBE, "M", "ჾ"), (0x1CBF, "M", "ჿ"), (0x1CC0, "V"), (0x1CC8, "X"), (0x1CD0, "V"), (0x1CFB, "X"), (0x1D00, "V"), (0x1D2C, "M", "a"), (0x1D2D, "M", "æ"), (0x1D2E, "M", "b"), (0x1D2F, "V"), (0x1D30, "M", "d"), (0x1D31, "M", "e"), ] def _seg_16() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1D32, "M", "ǝ"), (0x1D33, "M", "g"), (0x1D34, "M", "h"), (0x1D35, "M", "i"), (0x1D36, "M", "j"), (0x1D37, "M", "k"), (0x1D38, "M", "l"), (0x1D39, "M", "m"), (0x1D3A, "M", "n"), (0x1D3B, "V"), (0x1D3C, "M", "o"), (0x1D3D, "M", "ȣ"), (0x1D3E, "M", "p"), (0x1D3F, "M", "r"), (0x1D40, "M", "t"), (0x1D41, "M", "u"), (0x1D42, "M", "w"), (0x1D43, "M", "a"), (0x1D44, "M", "ɐ"), (0x1D45, "M", "ɑ"), (0x1D46, "M", "ᴂ"), (0x1D47, "M", "b"), (0x1D48, "M", "d"), (0x1D49, "M", "e"), (0x1D4A, "M", "ə"), (0x1D4B, "M", "ɛ"), (0x1D4C, "M", "ɜ"), (0x1D4D, "M", "g"), (0x1D4E, "V"), (0x1D4F, "M", "k"), (0x1D50, "M", "m"), (0x1D51, "M", "ŋ"), (0x1D52, "M", "o"), (0x1D53, "M", "ɔ"), (0x1D54, "M", "ᴖ"), (0x1D55, "M", "ᴗ"), (0x1D56, "M", "p"), (0x1D57, "M", "t"), (0x1D58, "M", "u"), (0x1D59, "M", "ᴝ"), (0x1D5A, "M", "ɯ"), (0x1D5B, "M", "v"), (0x1D5C, "M", "ᴥ"), (0x1D5D, "M", "β"), (0x1D5E, "M", "γ"), (0x1D5F, "M", "δ"), (0x1D60, "M", "φ"), (0x1D61, "M", "χ"), (0x1D62, "M", "i"), (0x1D63, "M", "r"), (0x1D64, "M", "u"), (0x1D65, "M", "v"), (0x1D66, "M", "β"), (0x1D67, "M", "γ"), (0x1D68, "M", "ρ"), (0x1D69, "M", "φ"), (0x1D6A, "M", "χ"), (0x1D6B, "V"), (0x1D78, "M", "н"), (0x1D79, "V"), (0x1D9B, "M", "ɒ"), (0x1D9C, "M", "c"), (0x1D9D, "M", "ɕ"), (0x1D9E, "M", "ð"), (0x1D9F, "M", "ɜ"), (0x1DA0, "M", "f"), (0x1DA1, "M", "ɟ"), (0x1DA2, "M", "ɡ"), (0x1DA3, "M", "ɥ"), (0x1DA4, "M", "ɨ"), (0x1DA5, "M", "ɩ"), (0x1DA6, "M", "ɪ"), (0x1DA7, "M", "ᵻ"), (0x1DA8, "M", "ʝ"), (0x1DA9, "M", "ɭ"), (0x1DAA, "M", "ᶅ"), (0x1DAB, "M", "ʟ"), (0x1DAC, "M", "ɱ"), (0x1DAD, "M", "ɰ"), (0x1DAE, "M", "ɲ"), (0x1DAF, "M", "ɳ"), (0x1DB0, "M", "ɴ"), (0x1DB1, "M", "ɵ"), (0x1DB2, "M", "ɸ"), (0x1DB3, "M", "ʂ"), (0x1DB4, "M", "ʃ"), (0x1DB5, "M", "ƫ"), (0x1DB6, "M", "ʉ"), (0x1DB7, "M", "ʊ"), (0x1DB8, "M", "ᴜ"), (0x1DB9, "M", "ʋ"), (0x1DBA, "M", "ʌ"), (0x1DBB, "M", "z"), (0x1DBC, "M", "ʐ"), (0x1DBD, "M", "ʑ"), (0x1DBE, "M", "ʒ"), (0x1DBF, "M", "θ"), (0x1DC0, "V"), (0x1E00, "M", "ḁ"), (0x1E01, "V"), ] def _seg_17() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1E02, "M", "ḃ"), (0x1E03, "V"), (0x1E04, "M", "ḅ"), (0x1E05, "V"), (0x1E06, "M", "ḇ"), (0x1E07, "V"), (0x1E08, "M", "ḉ"), (0x1E09, "V"), (0x1E0A, "M", "ḋ"), (0x1E0B, "V"), (0x1E0C, "M", "ḍ"), (0x1E0D, "V"), (0x1E0E, "M", "ḏ"), (0x1E0F, "V"), (0x1E10, "M", "ḑ"), (0x1E11, "V"), (0x1E12, "M", "ḓ"), (0x1E13, "V"), (0x1E14, "M", "ḕ"), (0x1E15, "V"), (0x1E16, "M", "ḗ"), (0x1E17, "V"), (0x1E18, "M", "ḙ"), (0x1E19, "V"), (0x1E1A, "M", "ḛ"), (0x1E1B, "V"), (0x1E1C, "M", "ḝ"), (0x1E1D, "V"), (0x1E1E, "M", "ḟ"), (0x1E1F, "V"), (0x1E20, "M", "ḡ"), (0x1E21, "V"), (0x1E22, "M", "ḣ"), (0x1E23, "V"), (0x1E24, "M", "ḥ"), (0x1E25, "V"), (0x1E26, "M", "ḧ"), (0x1E27, "V"), (0x1E28, "M", "ḩ"), (0x1E29, "V"), (0x1E2A, "M", "ḫ"), (0x1E2B, "V"), (0x1E2C, "M", "ḭ"), (0x1E2D, "V"), (0x1E2E, "M", "ḯ"), (0x1E2F, "V"), (0x1E30, "M", "ḱ"), (0x1E31, "V"), (0x1E32, "M", "ḳ"), (0x1E33, "V"), (0x1E34, "M", "ḵ"), (0x1E35, "V"), (0x1E36, "M", "ḷ"), (0x1E37, "V"), (0x1E38, "M", "ḹ"), (0x1E39, "V"), (0x1E3A, "M", "ḻ"), (0x1E3B, "V"), (0x1E3C, "M", "ḽ"), (0x1E3D, "V"), (0x1E3E, "M", "ḿ"), (0x1E3F, "V"), (0x1E40, "M", "ṁ"), (0x1E41, "V"), (0x1E42, "M", "ṃ"), (0x1E43, "V"), (0x1E44, "M", "ṅ"), (0x1E45, "V"), (0x1E46, "M", "ṇ"), (0x1E47, "V"), (0x1E48, "M", "ṉ"), (0x1E49, "V"), (0x1E4A, "M", "ṋ"), (0x1E4B, "V"), (0x1E4C, "M", "ṍ"), (0x1E4D, "V"), (0x1E4E, "M", "ṏ"), (0x1E4F, "V"), (0x1E50, "M", "ṑ"), (0x1E51, "V"), (0x1E52, "M", "ṓ"), (0x1E53, "V"), (0x1E54, "M", "ṕ"), (0x1E55, "V"), (0x1E56, "M", "ṗ"), (0x1E57, "V"), (0x1E58, "M", "ṙ"), (0x1E59, "V"), (0x1E5A, "M", "ṛ"), (0x1E5B, "V"), (0x1E5C, "M", "ṝ"), (0x1E5D, "V"), (0x1E5E, "M", "ṟ"), (0x1E5F, "V"), (0x1E60, "M", "ṡ"), (0x1E61, "V"), (0x1E62, "M", "ṣ"), (0x1E63, "V"), (0x1E64, "M", "ṥ"), (0x1E65, "V"), ] def _seg_18() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1E66, "M", "ṧ"), (0x1E67, "V"), (0x1E68, "M", "ṩ"), (0x1E69, "V"), (0x1E6A, "M", "ṫ"), (0x1E6B, "V"), (0x1E6C, "M", "ṭ"), (0x1E6D, "V"), (0x1E6E, "M", "ṯ"), (0x1E6F, "V"), (0x1E70, "M", "ṱ"), (0x1E71, "V"), (0x1E72, "M", "ṳ"), (0x1E73, "V"), (0x1E74, "M", "ṵ"), (0x1E75, "V"), (0x1E76, "M", "ṷ"), (0x1E77, "V"), (0x1E78, "M", "ṹ"), (0x1E79, "V"), (0x1E7A, "M", "ṻ"), (0x1E7B, "V"), (0x1E7C, "M", "ṽ"), (0x1E7D, "V"), (0x1E7E, "M", "ṿ"), (0x1E7F, "V"), (0x1E80, "M", "ẁ"), (0x1E81, "V"), (0x1E82, "M", "ẃ"), (0x1E83, "V"), (0x1E84, "M", "ẅ"), (0x1E85, "V"), (0x1E86, "M", "ẇ"), (0x1E87, "V"), (0x1E88, "M", "ẉ"), (0x1E89, "V"), (0x1E8A, "M", "ẋ"), (0x1E8B, "V"), (0x1E8C, "M", "ẍ"), (0x1E8D, "V"), (0x1E8E, "M", "ẏ"), (0x1E8F, "V"), (0x1E90, "M", "ẑ"), (0x1E91, "V"), (0x1E92, "M", "ẓ"), (0x1E93, "V"), (0x1E94, "M", "ẕ"), (0x1E95, "V"), (0x1E9A, "M", "aʾ"), (0x1E9B, "M", "ṡ"), (0x1E9C, "V"), (0x1E9E, "M", "ß"), (0x1E9F, "V"), (0x1EA0, "M", "ạ"), (0x1EA1, "V"), (0x1EA2, "M", "ả"), (0x1EA3, "V"), (0x1EA4, "M", "ấ"), (0x1EA5, "V"), (0x1EA6, "M", "ầ"), (0x1EA7, "V"), (0x1EA8, "M", "ẩ"), (0x1EA9, "V"), (0x1EAA, "M", "ẫ"), (0x1EAB, "V"), (0x1EAC, "M", "ậ"), (0x1EAD, "V"), (0x1EAE, "M", "ắ"), (0x1EAF, "V"), (0x1EB0, "M", "ằ"), (0x1EB1, "V"), (0x1EB2, "M", "ẳ"), (0x1EB3, "V"), (0x1EB4, "M", "ẵ"), (0x1EB5, "V"), (0x1EB6, "M", "ặ"), (0x1EB7, "V"), (0x1EB8, "M", "ẹ"), (0x1EB9, "V"), (0x1EBA, "M", "ẻ"), (0x1EBB, "V"), (0x1EBC, "M", "ẽ"), (0x1EBD, "V"), (0x1EBE, "M", "ế"), (0x1EBF, "V"), (0x1EC0, "M", "ề"), (0x1EC1, "V"), (0x1EC2, "M", "ể"), (0x1EC3, "V"), (0x1EC4, "M", "ễ"), (0x1EC5, "V"), (0x1EC6, "M", "ệ"), (0x1EC7, "V"), (0x1EC8, "M", "ỉ"), (0x1EC9, "V"), (0x1ECA, "M", "ị"), (0x1ECB, "V"), (0x1ECC, "M", "ọ"), (0x1ECD, "V"), (0x1ECE, "M", "ỏ"), ] def _seg_19() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1ECF, "V"), (0x1ED0, "M", "ố"), (0x1ED1, "V"), (0x1ED2, "M", "ồ"), (0x1ED3, "V"), (0x1ED4, "M", "ổ"), (0x1ED5, "V"), (0x1ED6, "M", "ỗ"), (0x1ED7, "V"), (0x1ED8, "M", "ộ"), (0x1ED9, "V"), (0x1EDA, "M", "ớ"), (0x1EDB, "V"), (0x1EDC, "M", "ờ"), (0x1EDD, "V"), (0x1EDE, "M", "ở"), (0x1EDF, "V"), (0x1EE0, "M", "ỡ"), (0x1EE1, "V"), (0x1EE2, "M", "ợ"), (0x1EE3, "V"), (0x1EE4, "M", "ụ"), (0x1EE5, "V"), (0x1EE6, "M", "ủ"), (0x1EE7, "V"), (0x1EE8, "M", "ứ"), (0x1EE9, "V"), (0x1EEA, "M", "ừ"), (0x1EEB, "V"), (0x1EEC, "M", "ử"), (0x1EED, "V"), (0x1EEE, "M", "ữ"), (0x1EEF, "V"), (0x1EF0, "M", "ự"), (0x1EF1, "V"), (0x1EF2, "M", "ỳ"), (0x1EF3, "V"), (0x1EF4, "M", "ỵ"), (0x1EF5, "V"), (0x1EF6, "M", "ỷ"), (0x1EF7, "V"), (0x1EF8, "M", "ỹ"), (0x1EF9, "V"), (0x1EFA, "M", "ỻ"), (0x1EFB, "V"), (0x1EFC, "M", "ỽ"), (0x1EFD, "V"), (0x1EFE, "M", "ỿ"), (0x1EFF, "V"), (0x1F08, "M", "ἀ"), (0x1F09, "M", "ἁ"), (0x1F0A, "M", "ἂ"), (0x1F0B, "M", "ἃ"), (0x1F0C, "M", "ἄ"), (0x1F0D, "M", "ἅ"), (0x1F0E, "M", "ἆ"), (0x1F0F, "M", "ἇ"), (0x1F10, "V"), (0x1F16, "X"), (0x1F18, "M", "ἐ"), (0x1F19, "M", "ἑ"), (0x1F1A, "M", "ἒ"), (0x1F1B, "M", "ἓ"), (0x1F1C, "M", "ἔ"), (0x1F1D, "M", "ἕ"), (0x1F1E, "X"), (0x1F20, "V"), (0x1F28, "M", "ἠ"), (0x1F29, "M", "ἡ"), (0x1F2A, "M", "ἢ"), (0x1F2B, "M", "ἣ"), (0x1F2C, "M", "ἤ"), (0x1F2D, "M", "ἥ"), (0x1F2E, "M", "ἦ"), (0x1F2F, "M", "ἧ"), (0x1F30, "V"), (0x1F38, "M", "ἰ"), (0x1F39, "M", "ἱ"), (0x1F3A, "M", "ἲ"), (0x1F3B, "M", "ἳ"), (0x1F3C, "M", "ἴ"), (0x1F3D, "M", "ἵ"), (0x1F3E, "M", "ἶ"), (0x1F3F, "M", "ἷ"), (0x1F40, "V"), (0x1F46, "X"), (0x1F48, "M", "ὀ"), (0x1F49, "M", "ὁ"), (0x1F4A, "M", "ὂ"), (0x1F4B, "M", "ὃ"), (0x1F4C, "M", "ὄ"), (0x1F4D, "M", "ὅ"), (0x1F4E, "X"), (0x1F50, "V"), (0x1F58, "X"), (0x1F59, "M", "ὑ"), (0x1F5A, "X"), (0x1F5B, "M", "ὓ"), (0x1F5C, "X"), (0x1F5D, "M", "ὕ"), ] def _seg_20() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1F5E, "X"), (0x1F5F, "M", "ὗ"), (0x1F60, "V"), (0x1F68, "M", "ὠ"), (0x1F69, "M", "ὡ"), (0x1F6A, "M", "ὢ"), (0x1F6B, "M", "ὣ"), (0x1F6C, "M", "ὤ"), (0x1F6D, "M", "ὥ"), (0x1F6E, "M", "ὦ"), (0x1F6F, "M", "ὧ"), (0x1F70, "V"), (0x1F71, "M", "ά"), (0x1F72, "V"), (0x1F73, "M", "έ"), (0x1F74, "V"), (0x1F75, "M", "ή"), (0x1F76, "V"), (0x1F77, "M", "ί"), (0x1F78, "V"), (0x1F79, "M", "ό"), (0x1F7A, "V"), (0x1F7B, "M", "ύ"), (0x1F7C, "V"), (0x1F7D, "M", "ώ"), (0x1F7E, "X"), (0x1F80, "M", "ἀι"), (0x1F81, "M", "ἁι"), (0x1F82, "M", "ἂι"), (0x1F83, "M", "ἃι"), (0x1F84, "M", "ἄι"), (0x1F85, "M", "ἅι"), (0x1F86, "M", "ἆι"), (0x1F87, "M", "ἇι"), (0x1F88, "M", "ἀι"), (0x1F89, "M", "ἁι"), (0x1F8A, "M", "ἂι"), (0x1F8B, "M", "ἃι"), (0x1F8C, "M", "ἄι"), (0x1F8D, "M", "ἅι"), (0x1F8E, "M", "ἆι"), (0x1F8F, "M", "ἇι"), (0x1F90, "M", "ἠι"), (0x1F91, "M", "ἡι"), (0x1F92, "M", "ἢι"), (0x1F93, "M", "ἣι"), (0x1F94, "M", "ἤι"), (0x1F95, "M", "ἥι"), (0x1F96, "M", "ἦι"), (0x1F97, "M", "ἧι"), (0x1F98, "M", "ἠι"), (0x1F99, "M", "ἡι"), (0x1F9A, "M", "ἢι"), (0x1F9B, "M", "ἣι"), (0x1F9C, "M", "ἤι"), (0x1F9D, "M", "ἥι"), (0x1F9E, "M", "ἦι"), (0x1F9F, "M", "ἧι"), (0x1FA0, "M", "ὠι"), (0x1FA1, "M", "ὡι"), (0x1FA2, "M", "ὢι"), (0x1FA3, "M", "ὣι"), (0x1FA4, "M", "ὤι"), (0x1FA5, "M", "ὥι"), (0x1FA6, "M", "ὦι"), (0x1FA7, "M", "ὧι"), (0x1FA8, "M", "ὠι"), (0x1FA9, "M", "ὡι"), (0x1FAA, "M", "ὢι"), (0x1FAB, "M", "ὣι"), (0x1FAC, "M", "ὤι"), (0x1FAD, "M", "ὥι"), (0x1FAE, "M", "ὦι"), (0x1FAF, "M", "ὧι"), (0x1FB0, "V"), (0x1FB2, "M", "ὰι"), (0x1FB3, "M", "αι"), (0x1FB4, "M", "άι"), (0x1FB5, "X"), (0x1FB6, "V"), (0x1FB7, "M", "ᾶι"), (0x1FB8, "M", "ᾰ"), (0x1FB9, "M", "ᾱ"), (0x1FBA, "M", "ὰ"), (0x1FBB, "M", "ά"), (0x1FBC, "M", "αι"), (0x1FBD, "M", " ̓"), (0x1FBE, "M", "ι"), (0x1FBF, "M", " ̓"), (0x1FC0, "M", " ͂"), (0x1FC1, "M", " ̈͂"), (0x1FC2, "M", "ὴι"), (0x1FC3, "M", "ηι"), (0x1FC4, "M", "ήι"), (0x1FC5, "X"), (0x1FC6, "V"), (0x1FC7, "M", "ῆι"), (0x1FC8, "M", "ὲ"), (0x1FC9, "M", "έ"), (0x1FCA, "M", "ὴ"), ] def _seg_21() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1FCB, "M", "ή"), (0x1FCC, "M", "ηι"), (0x1FCD, "M", " ̓̀"), (0x1FCE, "M", " ̓́"), (0x1FCF, "M", " ̓͂"), (0x1FD0, "V"), (0x1FD3, "M", "ΐ"), (0x1FD4, "X"), (0x1FD6, "V"), (0x1FD8, "M", "ῐ"), (0x1FD9, "M", "ῑ"), (0x1FDA, "M", "ὶ"), (0x1FDB, "M", "ί"), (0x1FDC, "X"), (0x1FDD, "M", " ̔̀"), (0x1FDE, "M", " ̔́"), (0x1FDF, "M", " ̔͂"), (0x1FE0, "V"), (0x1FE3, "M", "ΰ"), (0x1FE4, "V"), (0x1FE8, "M", "ῠ"), (0x1FE9, "M", "ῡ"), (0x1FEA, "M", "ὺ"), (0x1FEB, "M", "ύ"), (0x1FEC, "M", "ῥ"), (0x1FED, "M", " ̈̀"), (0x1FEE, "M", " ̈́"), (0x1FEF, "M", "`"), (0x1FF0, "X"), (0x1FF2, "M", "ὼι"), (0x1FF3, "M", "ωι"), (0x1FF4, "M", "ώι"), (0x1FF5, "X"), (0x1FF6, "V"), (0x1FF7, "M", "ῶι"), (0x1FF8, "M", "ὸ"), (0x1FF9, "M", "ό"), (0x1FFA, "M", "ὼ"), (0x1FFB, "M", "ώ"), (0x1FFC, "M", "ωι"), (0x1FFD, "M", " ́"), (0x1FFE, "M", " ̔"), (0x1FFF, "X"), (0x2000, "M", " "), (0x200B, "I"), (0x200C, "D", ""), (0x200E, "X"), (0x2010, "V"), (0x2011, "M", "‐"), (0x2012, "V"), (0x2017, "M", " ̳"), (0x2018, "V"), (0x2024, "X"), (0x2027, "V"), (0x2028, "X"), (0x202F, "M", " "), (0x2030, "V"), (0x2033, "M", "′′"), (0x2034, "M", "′′′"), (0x2035, "V"), (0x2036, "M", "‵‵"), (0x2037, "M", "‵‵‵"), (0x2038, "V"), (0x203C, "M", "!!"), (0x203D, "V"), (0x203E, "M", " ̅"), (0x203F, "V"), (0x2047, "M", "??"), (0x2048, "M", "?!"), (0x2049, "M", "!?"), (0x204A, "V"), (0x2057, "M", "′′′′"), (0x2058, "V"), (0x205F, "M", " "), (0x2060, "I"), (0x2065, "X"), (0x206A, "I"), (0x2070, "M", "0"), (0x2071, "M", "i"), (0x2072, "X"), (0x2074, "M", "4"), (0x2075, "M", "5"), (0x2076, "M", "6"), (0x2077, "M", "7"), (0x2078, "M", "8"), (0x2079, "M", "9"), (0x207A, "M", "+"), (0x207B, "M", "−"), (0x207C, "M", "="), (0x207D, "M", "("), (0x207E, "M", ")"), (0x207F, "M", "n"), (0x2080, "M", "0"), (0x2081, "M", "1"), (0x2082, "M", "2"), (0x2083, "M", "3"), (0x2084, "M", "4"), (0x2085, "M", "5"), (0x2086, "M", "6"), (0x2087, "M", "7"), ] def _seg_22() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x2088, "M", "8"), (0x2089, "M", "9"), (0x208A, "M", "+"), (0x208B, "M", "−"), (0x208C, "M", "="), (0x208D, "M", "("), (0x208E, "M", ")"), (0x208F, "X"), (0x2090, "M", "a"), (0x2091, "M", "e"), (0x2092, "M", "o"), (0x2093, "M", "x"), (0x2094, "M", "ə"), (0x2095, "M", "h"), (0x2096, "M", "k"), (0x2097, "M", "l"), (0x2098, "M", "m"), (0x2099, "M", "n"), (0x209A, "M", "p"), (0x209B, "M", "s"), (0x209C, "M", "t"), (0x209D, "X"), (0x20A0, "V"), (0x20A8, "M", "rs"), (0x20A9, "V"), (0x20C1, "X"), (0x20D0, "V"), (0x20F1, "X"), (0x2100, "M", "a/c"), (0x2101, "M", "a/s"), (0x2102, "M", "c"), (0x2103, "M", "°c"), (0x2104, "V"), (0x2105, "M", "c/o"), (0x2106, "M", "c/u"), (0x2107, "M", "ɛ"), (0x2108, "V"), (0x2109, "M", "°f"), (0x210A, "M", "g"), (0x210B, "M", "h"), (0x210F, "M", "ħ"), (0x2110, "M", "i"), (0x2112, "M", "l"), (0x2114, "V"), (0x2115, "M", "n"), (0x2116, "M", "no"), (0x2117, "V"), (0x2119, "M", "p"), (0x211A, "M", "q"), (0x211B, "M", "r"), (0x211E, "V"), (0x2120, "M", "sm"), (0x2121, "M", "tel"), (0x2122, "M", "tm"), (0x2123, "V"), (0x2124, "M", "z"), (0x2125, "V"), (0x2126, "M", "ω"), (0x2127, "V"), (0x2128, "M", "z"), (0x2129, "V"), (0x212A, "M", "k"), (0x212B, "M", "å"), (0x212C, "M", "b"), (0x212D, "M", "c"), (0x212E, "V"), (0x212F, "M", "e"), (0x2131, "M", "f"), (0x2132, "M", "ⅎ"), (0x2133, "M", "m"), (0x2134, "M", "o"), (0x2135, "M", "א"), (0x2136, "M", "ב"), (0x2137, "M", "ג"), (0x2138, "M", "ד"), (0x2139, "M", "i"), (0x213A, "V"), (0x213B, "M", "fax"), (0x213C, "M", "π"), (0x213D, "M", "γ"), (0x213F, "M", "π"), (0x2140, "M", "∑"), (0x2141, "V"), (0x2145, "M", "d"), (0x2147, "M", "e"), (0x2148, "M", "i"), (0x2149, "M", "j"), (0x214A, "V"), (0x2150, "M", "1⁄7"), (0x2151, "M", "1⁄9"), (0x2152, "M", "1⁄10"), (0x2153, "M", "1⁄3"), (0x2154, "M", "2⁄3"), (0x2155, "M", "1⁄5"), (0x2156, "M", "2⁄5"), (0x2157, "M", "3⁄5"), (0x2158, "M", "4⁄5"), (0x2159, "M", "1⁄6"), (0x215A, "M", "5⁄6"), (0x215B, "M", "1⁄8"), ] def _seg_23() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x215C, "M", "3⁄8"), (0x215D, "M", "5⁄8"), (0x215E, "M", "7⁄8"), (0x215F, "M", "1⁄"), (0x2160, "M", "i"), (0x2161, "M", "ii"), (0x2162, "M", "iii"), (0x2163, "M", "iv"), (0x2164, "M", "v"), (0x2165, "M", "vi"), (0x2166, "M", "vii"), (0x2167, "M", "viii"), (0x2168, "M", "ix"), (0x2169, "M", "x"), (0x216A, "M", "xi"), (0x216B, "M", "xii"), (0x216C, "M", "l"), (0x216D, "M", "c"), (0x216E, "M", "d"), (0x216F, "M", "m"), (0x2170, "M", "i"), (0x2171, "M", "ii"), (0x2172, "M", "iii"), (0x2173, "M", "iv"), (0x2174, "M", "v"), (0x2175, "M", "vi"), (0x2176, "M", "vii"), (0x2177, "M", "viii"), (0x2178, "M", "ix"), (0x2179, "M", "x"), (0x217A, "M", "xi"), (0x217B, "M", "xii"), (0x217C, "M", "l"), (0x217D, "M", "c"), (0x217E, "M", "d"), (0x217F, "M", "m"), (0x2180, "V"), (0x2183, "M", "ↄ"), (0x2184, "V"), (0x2189, "M", "0⁄3"), (0x218A, "V"), (0x218C, "X"), (0x2190, "V"), (0x222C, "M", "∫∫"), (0x222D, "M", "∫∫∫"), (0x222E, "V"), (0x222F, "M", "∮∮"), (0x2230, "M", "∮∮∮"), (0x2231, "V"), (0x2329, "M", "〈"), (0x232A, "M", "〉"), (0x232B, "V"), (0x242A, "X"), (0x2440, "V"), (0x244B, "X"), (0x2460, "M", "1"), (0x2461, "M", "2"), (0x2462, "M", "3"), (0x2463, "M", "4"), (0x2464, "M", "5"), (0x2465, "M", "6"), (0x2466, "M", "7"), (0x2467, "M", "8"), (0x2468, "M", "9"), (0x2469, "M", "10"), (0x246A, "M", "11"), (0x246B, "M", "12"), (0x246C, "M", "13"), (0x246D, "M", "14"), (0x246E, "M", "15"), (0x246F, "M", "16"), (0x2470, "M", "17"), (0x2471, "M", "18"), (0x2472, "M", "19"), (0x2473, "M", "20"), (0x2474, "M", "(1)"), (0x2475, "M", "(2)"), (0x2476, "M", "(3)"), (0x2477, "M", "(4)"), (0x2478, "M", "(5)"), (0x2479, "M", "(6)"), (0x247A, "M", "(7)"), (0x247B, "M", "(8)"), (0x247C, "M", "(9)"), (0x247D, "M", "(10)"), (0x247E, "M", "(11)"), (0x247F, "M", "(12)"), (0x2480, "M", "(13)"), (0x2481, "M", "(14)"), (0x2482, "M", "(15)"), (0x2483, "M", "(16)"), (0x2484, "M", "(17)"), (0x2485, "M", "(18)"), (0x2486, "M", "(19)"), (0x2487, "M", "(20)"), (0x2488, "X"), (0x249C, "M", "(a)"), (0x249D, "M", "(b)"), (0x249E, "M", "(c)"), (0x249F, "M", "(d)"), ] def _seg_24() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x24A0, "M", "(e)"), (0x24A1, "M", "(f)"), (0x24A2, "M", "(g)"), (0x24A3, "M", "(h)"), (0x24A4, "M", "(i)"), (0x24A5, "M", "(j)"), (0x24A6, "M", "(k)"), (0x24A7, "M", "(l)"), (0x24A8, "M", "(m)"), (0x24A9, "M", "(n)"), (0x24AA, "M", "(o)"), (0x24AB, "M", "(p)"), (0x24AC, "M", "(q)"), (0x24AD, "M", "(r)"), (0x24AE, "M", "(s)"), (0x24AF, "M", "(t)"), (0x24B0, "M", "(u)"), (0x24B1, "M", "(v)"), (0x24B2, "M", "(w)"), (0x24B3, "M", "(x)"), (0x24B4, "M", "(y)"), (0x24B5, "M", "(z)"), (0x24B6, "M", "a"), (0x24B7, "M", "b"), (0x24B8, "M", "c"), (0x24B9, "M", "d"), (0x24BA, "M", "e"), (0x24BB, "M", "f"), (0x24BC, "M", "g"), (0x24BD, "M", "h"), (0x24BE, "M", "i"), (0x24BF, "M", "j"), (0x24C0, "M", "k"), (0x24C1, "M", "l"), (0x24C2, "M", "m"), (0x24C3, "M", "n"), (0x24C4, "M", "o"), (0x24C5, "M", "p"), (0x24C6, "M", "q"), (0x24C7, "M", "r"), (0x24C8, "M", "s"), (0x24C9, "M", "t"), (0x24CA, "M", "u"), (0x24CB, "M", "v"), (0x24CC, "M", "w"), (0x24CD, "M", "x"), (0x24CE, "M", "y"), (0x24CF, "M", "z"), (0x24D0, "M", "a"), (0x24D1, "M", "b"), (0x24D2, "M", "c"), (0x24D3, "M", "d"), (0x24D4, "M", "e"), (0x24D5, "M", "f"), (0x24D6, "M", "g"), (0x24D7, "M", "h"), (0x24D8, "M", "i"), (0x24D9, "M", "j"), (0x24DA, "M", "k"), (0x24DB, "M", "l"), (0x24DC, "M", "m"), (0x24DD, "M", "n"), (0x24DE, "M", "o"), (0x24DF, "M", "p"), (0x24E0, "M", "q"), (0x24E1, "M", "r"), (0x24E2, "M", "s"), (0x24E3, "M", "t"), (0x24E4, "M", "u"), (0x24E5, "M", "v"), (0x24E6, "M", "w"), (0x24E7, "M", "x"), (0x24E8, "M", "y"), (0x24E9, "M", "z"), (0x24EA, "M", "0"), (0x24EB, "V"), (0x2A0C, "M", "∫∫∫∫"), (0x2A0D, "V"), (0x2A74, "M", "::="), (0x2A75, "M", "=="), (0x2A76, "M", "==="), (0x2A77, "V"), (0x2ADC, "M", "⫝̸"), (0x2ADD, "V"), (0x2B74, "X"), (0x2B76, "V"), (0x2B96, "X"), (0x2B97, "V"), (0x2C00, "M", "ⰰ"), (0x2C01, "M", "ⰱ"), (0x2C02, "M", "ⰲ"), (0x2C03, "M", "ⰳ"), (0x2C04, "M", "ⰴ"), (0x2C05, "M", "ⰵ"), (0x2C06, "M", "ⰶ"), (0x2C07, "M", "ⰷ"), (0x2C08, "M", "ⰸ"), (0x2C09, "M", "ⰹ"), (0x2C0A, "M", "ⰺ"), (0x2C0B, "M", "ⰻ"), ] def _seg_25() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x2C0C, "M", "ⰼ"), (0x2C0D, "M", "ⰽ"), (0x2C0E, "M", "ⰾ"), (0x2C0F, "M", "ⰿ"), (0x2C10, "M", "ⱀ"), (0x2C11, "M", "ⱁ"), (0x2C12, "M", "ⱂ"), (0x2C13, "M", "ⱃ"), (0x2C14, "M", "ⱄ"), (0x2C15, "M", "ⱅ"), (0x2C16, "M", "ⱆ"), (0x2C17, "M", "ⱇ"), (0x2C18, "M", "ⱈ"), (0x2C19, "M", "ⱉ"), (0x2C1A, "M", "ⱊ"), (0x2C1B, "M", "ⱋ"), (0x2C1C, "M", "ⱌ"), (0x2C1D, "M", "ⱍ"), (0x2C1E, "M", "ⱎ"), (0x2C1F, "M", "ⱏ"), (0x2C20, "M", "ⱐ"), (0x2C21, "M", "ⱑ"), (0x2C22, "M", "ⱒ"), (0x2C23, "M", "ⱓ"), (0x2C24, "M", "ⱔ"), (0x2C25, "M", "ⱕ"), (0x2C26, "M", "ⱖ"), (0x2C27, "M", "ⱗ"), (0x2C28, "M", "ⱘ"), (0x2C29, "M", "ⱙ"), (0x2C2A, "M", "ⱚ"), (0x2C2B, "M", "ⱛ"), (0x2C2C, "M", "ⱜ"), (0x2C2D, "M", "ⱝ"), (0x2C2E, "M", "ⱞ"), (0x2C2F, "M", "ⱟ"), (0x2C30, "V"), (0x2C60, "M", "ⱡ"), (0x2C61, "V"), (0x2C62, "M", "ɫ"), (0x2C63, "M", "ᵽ"), (0x2C64, "M", "ɽ"), (0x2C65, "V"), (0x2C67, "M", "ⱨ"), (0x2C68, "V"), (0x2C69, "M", "ⱪ"), (0x2C6A, "V"), (0x2C6B, "M", "ⱬ"), (0x2C6C, "V"), (0x2C6D, "M", "ɑ"), (0x2C6E, "M", "ɱ"), (0x2C6F, "M", "ɐ"), (0x2C70, "M", "ɒ"), (0x2C71, "V"), (0x2C72, "M", "ⱳ"), (0x2C73, "V"), (0x2C75, "M", "ⱶ"), (0x2C76, "V"), (0x2C7C, "M", "j"), (0x2C7D, "M", "v"), (0x2C7E, "M", "ȿ"), (0x2C7F, "M", "ɀ"), (0x2C80, "M", "ⲁ"), (0x2C81, "V"), (0x2C82, "M", "ⲃ"), (0x2C83, "V"), (0x2C84, "M", "ⲅ"), (0x2C85, "V"), (0x2C86, "M", "ⲇ"), (0x2C87, "V"), (0x2C88, "M", "ⲉ"), (0x2C89, "V"), (0x2C8A, "M", "ⲋ"), (0x2C8B, "V"), (0x2C8C, "M", "ⲍ"), (0x2C8D, "V"), (0x2C8E, "M", "ⲏ"), (0x2C8F, "V"), (0x2C90, "M", "ⲑ"), (0x2C91, "V"), (0x2C92, "M", "ⲓ"), (0x2C93, "V"), (0x2C94, "M", "ⲕ"), (0x2C95, "V"), (0x2C96, "M", "ⲗ"), (0x2C97, "V"), (0x2C98, "M", "ⲙ"), (0x2C99, "V"), (0x2C9A, "M", "ⲛ"), (0x2C9B, "V"), (0x2C9C, "M", "ⲝ"), (0x2C9D, "V"), (0x2C9E, "M", "ⲟ"), (0x2C9F, "V"), (0x2CA0, "M", "ⲡ"), (0x2CA1, "V"), (0x2CA2, "M", "ⲣ"), (0x2CA3, "V"), (0x2CA4, "M", "ⲥ"), (0x2CA5, "V"), ] def _seg_26() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x2CA6, "M", "ⲧ"), (0x2CA7, "V"), (0x2CA8, "M", "ⲩ"), (0x2CA9, "V"), (0x2CAA, "M", "ⲫ"), (0x2CAB, "V"), (0x2CAC, "M", "ⲭ"), (0x2CAD, "V"), (0x2CAE, "M", "ⲯ"), (0x2CAF, "V"), (0x2CB0, "M", "ⲱ"), (0x2CB1, "V"), (0x2CB2, "M", "ⲳ"), (0x2CB3, "V"), (0x2CB4, "M", "ⲵ"), (0x2CB5, "V"), (0x2CB6, "M", "ⲷ"), (0x2CB7, "V"), (0x2CB8, "M", "ⲹ"), (0x2CB9, "V"), (0x2CBA, "M", "ⲻ"), (0x2CBB, "V"), (0x2CBC, "M", "ⲽ"), (0x2CBD, "V"), (0x2CBE, "M", "ⲿ"), (0x2CBF, "V"), (0x2CC0, "M", "ⳁ"), (0x2CC1, "V"), (0x2CC2, "M", "ⳃ"), (0x2CC3, "V"), (0x2CC4, "M", "ⳅ"), (0x2CC5, "V"), (0x2CC6, "M", "ⳇ"), (0x2CC7, "V"), (0x2CC8, "M", "ⳉ"), (0x2CC9, "V"), (0x2CCA, "M", "ⳋ"), (0x2CCB, "V"), (0x2CCC, "M", "ⳍ"), (0x2CCD, "V"), (0x2CCE, "M", "ⳏ"), (0x2CCF, "V"), (0x2CD0, "M", "ⳑ"), (0x2CD1, "V"), (0x2CD2, "M", "ⳓ"), (0x2CD3, "V"), (0x2CD4, "M", "ⳕ"), (0x2CD5, "V"), (0x2CD6, "M", "ⳗ"), (0x2CD7, "V"), (0x2CD8, "M", "ⳙ"), (0x2CD9, "V"), (0x2CDA, "M", "ⳛ"), (0x2CDB, "V"), (0x2CDC, "M", "ⳝ"), (0x2CDD, "V"), (0x2CDE, "M", "ⳟ"), (0x2CDF, "V"), (0x2CE0, "M", "ⳡ"), (0x2CE1, "V"), (0x2CE2, "M", "ⳣ"), (0x2CE3, "V"), (0x2CEB, "M", "ⳬ"), (0x2CEC, "V"), (0x2CED, "M", "ⳮ"), (0x2CEE, "V"), (0x2CF2, "M", "ⳳ"), (0x2CF3, "V"), (0x2CF4, "X"), (0x2CF9, "V"), (0x2D26, "X"), (0x2D27, "V"), (0x2D28, "X"), (0x2D2D, "V"), (0x2D2E, "X"), (0x2D30, "V"), (0x2D68, "X"), (0x2D6F, "M", "ⵡ"), (0x2D70, "V"), (0x2D71, "X"), (0x2D7F, "V"), (0x2D97, "X"), (0x2DA0, "V"), (0x2DA7, "X"), (0x2DA8, "V"), (0x2DAF, "X"), (0x2DB0, "V"), (0x2DB7, "X"), (0x2DB8, "V"), (0x2DBF, "X"), (0x2DC0, "V"), (0x2DC7, "X"), (0x2DC8, "V"), (0x2DCF, "X"), (0x2DD0, "V"), (0x2DD7, "X"), (0x2DD8, "V"), (0x2DDF, "X"), (0x2DE0, "V"), (0x2E5E, "X"), ] def _seg_27() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x2E80, "V"), (0x2E9A, "X"), (0x2E9B, "V"), (0x2E9F, "M", "母"), (0x2EA0, "V"), (0x2EF3, "M", "龟"), (0x2EF4, "X"), (0x2F00, "M", "一"), (0x2F01, "M", "丨"), (0x2F02, "M", "丶"), (0x2F03, "M", "丿"), (0x2F04, "M", "乙"), (0x2F05, "M", "亅"), (0x2F06, "M", "二"), (0x2F07, "M", "亠"), (0x2F08, "M", "人"), (0x2F09, "M", "儿"), (0x2F0A, "M", "入"), (0x2F0B, "M", "八"), (0x2F0C, "M", "冂"), (0x2F0D, "M", "冖"), (0x2F0E, "M", "冫"), (0x2F0F, "M", "几"), (0x2F10, "M", "凵"), (0x2F11, "M", "刀"), (0x2F12, "M", "力"), (0x2F13, "M", "勹"), (0x2F14, "M", "匕"), (0x2F15, "M", "匚"), (0x2F16, "M", "匸"), (0x2F17, "M", "十"), (0x2F18, "M", "卜"), (0x2F19, "M", "卩"), (0x2F1A, "M", "厂"), (0x2F1B, "M", "厶"), (0x2F1C, "M", "又"), (0x2F1D, "M", "口"), (0x2F1E, "M", "囗"), (0x2F1F, "M", "土"), (0x2F20, "M", "士"), (0x2F21, "M", "夂"), (0x2F22, "M", "夊"), (0x2F23, "M", "夕"), (0x2F24, "M", "大"), (0x2F25, "M", "女"), (0x2F26, "M", "子"), (0x2F27, "M", "宀"), (0x2F28, "M", "寸"), (0x2F29, "M", "小"), (0x2F2A, "M", "尢"), (0x2F2B, "M", "尸"), (0x2F2C, "M", "屮"), (0x2F2D, "M", "山"), (0x2F2E, "M", "巛"), (0x2F2F, "M", "工"), (0x2F30, "M", "己"), (0x2F31, "M", "巾"), (0x2F32, "M", "干"), (0x2F33, "M", "幺"), (0x2F34, "M", "广"), (0x2F35, "M", "廴"), (0x2F36, "M", "廾"), (0x2F37, "M", "弋"), (0x2F38, "M", "弓"), (0x2F39, "M", "彐"), (0x2F3A, "M", "彡"), (0x2F3B, "M", "彳"), (0x2F3C, "M", "心"), (0x2F3D, "M", "戈"), (0x2F3E, "M", "戶"), (0x2F3F, "M", "手"), (0x2F40, "M", "支"), (0x2F41, "M", "攴"), (0x2F42, "M", "文"), (0x2F43, "M", "斗"), (0x2F44, "M", "斤"), (0x2F45, "M", "方"), (0x2F46, "M", "无"), (0x2F47, "M", "日"), (0x2F48, "M", "曰"), (0x2F49, "M", "月"), (0x2F4A, "M", "木"), (0x2F4B, "M", "欠"), (0x2F4C, "M", "止"), (0x2F4D, "M", "歹"), (0x2F4E, "M", "殳"), (0x2F4F, "M", "毋"), (0x2F50, "M", "比"), (0x2F51, "M", "毛"), (0x2F52, "M", "氏"), (0x2F53, "M", "气"), (0x2F54, "M", "水"), (0x2F55, "M", "火"), (0x2F56, "M", "爪"), (0x2F57, "M", "父"), (0x2F58, "M", "爻"), (0x2F59, "M", "爿"), (0x2F5A, "M", "片"), (0x2F5B, "M", "牙"), (0x2F5C, "M", "牛"), ] def _seg_28() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x2F5D, "M", "犬"), (0x2F5E, "M", "玄"), (0x2F5F, "M", "玉"), (0x2F60, "M", "瓜"), (0x2F61, "M", "瓦"), (0x2F62, "M", "甘"), (0x2F63, "M", "生"), (0x2F64, "M", "用"), (0x2F65, "M", "田"), (0x2F66, "M", "疋"), (0x2F67, "M", "疒"), (0x2F68, "M", "癶"), (0x2F69, "M", "白"), (0x2F6A, "M", "皮"), (0x2F6B, "M", "皿"), (0x2F6C, "M", "目"), (0x2F6D, "M", "矛"), (0x2F6E, "M", "矢"), (0x2F6F, "M", "石"), (0x2F70, "M", "示"), (0x2F71, "M", "禸"), (0x2F72, "M", "禾"), (0x2F73, "M", "穴"), (0x2F74, "M", "立"), (0x2F75, "M", "竹"), (0x2F76, "M", "米"), (0x2F77, "M", "糸"), (0x2F78, "M", "缶"), (0x2F79, "M", "网"), (0x2F7A, "M", "羊"), (0x2F7B, "M", "羽"), (0x2F7C, "M", "老"), (0x2F7D, "M", "而"), (0x2F7E, "M", "耒"), (0x2F7F, "M", "耳"), (0x2F80, "M", "聿"), (0x2F81, "M", "肉"), (0x2F82, "M", "臣"), (0x2F83, "M", "自"), (0x2F84, "M", "至"), (0x2F85, "M", "臼"), (0x2F86, "M", "舌"), (0x2F87, "M", "舛"), (0x2F88, "M", "舟"), (0x2F89, "M", "艮"), (0x2F8A, "M", "色"), (0x2F8B, "M", "艸"), (0x2F8C, "M", "虍"), (0x2F8D, "M", "虫"), (0x2F8E, "M", "血"), (0x2F8F, "M", "行"), (0x2F90, "M", "衣"), (0x2F91, "M", "襾"), (0x2F92, "M", "見"), (0x2F93, "M", "角"), (0x2F94, "M", "言"), (0x2F95, "M", "谷"), (0x2F96, "M", "豆"), (0x2F97, "M", "豕"), (0x2F98, "M", "豸"), (0x2F99, "M", "貝"), (0x2F9A, "M", "赤"), (0x2F9B, "M", "走"), (0x2F9C, "M", "足"), (0x2F9D, "M", "身"), (0x2F9E, "M", "車"), (0x2F9F, "M", "辛"), (0x2FA0, "M", "辰"), (0x2FA1, "M", "辵"), (0x2FA2, "M", "邑"), (0x2FA3, "M", "酉"), (0x2FA4, "M", "釆"), (0x2FA5, "M", "里"), (0x2FA6, "M", "金"), (0x2FA7, "M", "長"), (0x2FA8, "M", "門"), (0x2FA9, "M", "阜"), (0x2FAA, "M", "隶"), (0x2FAB, "M", "隹"), (0x2FAC, "M", "雨"), (0x2FAD, "M", "靑"), (0x2FAE, "M", "非"), (0x2FAF, "M", "面"), (0x2FB0, "M", "革"), (0x2FB1, "M", "韋"), (0x2FB2, "M", "韭"), (0x2FB3, "M", "音"), (0x2FB4, "M", "頁"), (0x2FB5, "M", "風"), (0x2FB6, "M", "飛"), (0x2FB7, "M", "食"), (0x2FB8, "M", "首"), (0x2FB9, "M", "香"), (0x2FBA, "M", "馬"), (0x2FBB, "M", "骨"), (0x2FBC, "M", "高"), (0x2FBD, "M", "髟"), (0x2FBE, "M", "鬥"), (0x2FBF, "M", "鬯"), (0x2FC0, "M", "鬲"), ] def _seg_29() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x2FC1, "M", "鬼"), (0x2FC2, "M", "魚"), (0x2FC3, "M", "鳥"), (0x2FC4, "M", "鹵"), (0x2FC5, "M", "鹿"), (0x2FC6, "M", "麥"), (0x2FC7, "M", "麻"), (0x2FC8, "M", "黃"), (0x2FC9, "M", "黍"), (0x2FCA, "M", "黑"), (0x2FCB, "M", "黹"), (0x2FCC, "M", "黽"), (0x2FCD, "M", "鼎"), (0x2FCE, "M", "鼓"), (0x2FCF, "M", "鼠"), (0x2FD0, "M", "鼻"), (0x2FD1, "M", "齊"), (0x2FD2, "M", "齒"), (0x2FD3, "M", "龍"), (0x2FD4, "M", "龜"), (0x2FD5, "M", "龠"), (0x2FD6, "X"), (0x3000, "M", " "), (0x3001, "V"), (0x3002, "M", "."), (0x3003, "V"), (0x3036, "M", "〒"), (0x3037, "V"), (0x3038, "M", "十"), (0x3039, "M", "卄"), (0x303A, "M", "卅"), (0x303B, "V"), (0x3040, "X"), (0x3041, "V"), (0x3097, "X"), (0x3099, "V"), (0x309B, "M", " ゙"), (0x309C, "M", " ゚"), (0x309D, "V"), (0x309F, "M", "より"), (0x30A0, "V"), (0x30FF, "M", "コト"), (0x3100, "X"), (0x3105, "V"), (0x3130, "X"), (0x3131, "M", "ᄀ"), (0x3132, "M", "ᄁ"), (0x3133, "M", "ᆪ"), (0x3134, "M", "ᄂ"), (0x3135, "M", "ᆬ"), (0x3136, "M", "ᆭ"), (0x3137, "M", "ᄃ"), (0x3138, "M", "ᄄ"), (0x3139, "M", "ᄅ"), (0x313A, "M", "ᆰ"), (0x313B, "M", "ᆱ"), (0x313C, "M", "ᆲ"), (0x313D, "M", "ᆳ"), (0x313E, "M", "ᆴ"), (0x313F, "M", "ᆵ"), (0x3140, "M", "ᄚ"), (0x3141, "M", "ᄆ"), (0x3142, "M", "ᄇ"), (0x3143, "M", "ᄈ"), (0x3144, "M", "ᄡ"), (0x3145, "M", "ᄉ"), (0x3146, "M", "ᄊ"), (0x3147, "M", "ᄋ"), (0x3148, "M", "ᄌ"), (0x3149, "M", "ᄍ"), (0x314A, "M", "ᄎ"), (0x314B, "M", "ᄏ"), (0x314C, "M", "ᄐ"), (0x314D, "M", "ᄑ"), (0x314E, "M", "ᄒ"), (0x314F, "M", "ᅡ"), (0x3150, "M", "ᅢ"), (0x3151, "M", "ᅣ"), (0x3152, "M", "ᅤ"), (0x3153, "M", "ᅥ"), (0x3154, "M", "ᅦ"), (0x3155, "M", "ᅧ"), (0x3156, "M", "ᅨ"), (0x3157, "M", "ᅩ"), (0x3158, "M", "ᅪ"), (0x3159, "M", "ᅫ"), (0x315A, "M", "ᅬ"), (0x315B, "M", "ᅭ"), (0x315C, "M", "ᅮ"), (0x315D, "M", "ᅯ"), (0x315E, "M", "ᅰ"), (0x315F, "M", "ᅱ"), (0x3160, "M", "ᅲ"), (0x3161, "M", "ᅳ"), (0x3162, "M", "ᅴ"), (0x3163, "M", "ᅵ"), (0x3164, "I"), (0x3165, "M", "ᄔ"), (0x3166, "M", "ᄕ"), (0x3167, "M", "ᇇ"), ] def _seg_30() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x3168, "M", "ᇈ"), (0x3169, "M", "ᇌ"), (0x316A, "M", "ᇎ"), (0x316B, "M", "ᇓ"), (0x316C, "M", "ᇗ"), (0x316D, "M", "ᇙ"), (0x316E, "M", "ᄜ"), (0x316F, "M", "ᇝ"), (0x3170, "M", "ᇟ"), (0x3171, "M", "ᄝ"), (0x3172, "M", "ᄞ"), (0x3173, "M", "ᄠ"), (0x3174, "M", "ᄢ"), (0x3175, "M", "ᄣ"), (0x3176, "M", "ᄧ"), (0x3177, "M", "ᄩ"), (0x3178, "M", "ᄫ"), (0x3179, "M", "ᄬ"), (0x317A, "M", "ᄭ"), (0x317B, "M", "ᄮ"), (0x317C, "M", "ᄯ"), (0x317D, "M", "ᄲ"), (0x317E, "M", "ᄶ"), (0x317F, "M", "ᅀ"), (0x3180, "M", "ᅇ"), (0x3181, "M", "ᅌ"), (0x3182, "M", "ᇱ"), (0x3183, "M", "ᇲ"), (0x3184, "M", "ᅗ"), (0x3185, "M", "ᅘ"), (0x3186, "M", "ᅙ"), (0x3187, "M", "ᆄ"), (0x3188, "M", "ᆅ"), (0x3189, "M", "ᆈ"), (0x318A, "M", "ᆑ"), (0x318B, "M", "ᆒ"), (0x318C, "M", "ᆔ"), (0x318D, "M", "ᆞ"), (0x318E, "M", "ᆡ"), (0x318F, "X"), (0x3190, "V"), (0x3192, "M", "一"), (0x3193, "M", "二"), (0x3194, "M", "三"), (0x3195, "M", "四"), (0x3196, "M", "上"), (0x3197, "M", "中"), (0x3198, "M", "下"), (0x3199, "M", "甲"), (0x319A, "M", "乙"), (0x319B, "M", "丙"), (0x319C, "M", "丁"), (0x319D, "M", "天"), (0x319E, "M", "地"), (0x319F, "M", "人"), (0x31A0, "V"), (0x31E6, "X"), (0x31F0, "V"), (0x3200, "M", "(ᄀ)"), (0x3201, "M", "(ᄂ)"), (0x3202, "M", "(ᄃ)"), (0x3203, "M", "(ᄅ)"), (0x3204, "M", "(ᄆ)"), (0x3205, "M", "(ᄇ)"), (0x3206, "M", "(ᄉ)"), (0x3207, "M", "(ᄋ)"), (0x3208, "M", "(ᄌ)"), (0x3209, "M", "(ᄎ)"), (0x320A, "M", "(ᄏ)"), (0x320B, "M", "(ᄐ)"), (0x320C, "M", "(ᄑ)"), (0x320D, "M", "(ᄒ)"), (0x320E, "M", "(가)"), (0x320F, "M", "(나)"), (0x3210, "M", "(다)"), (0x3211, "M", "(라)"), (0x3212, "M", "(마)"), (0x3213, "M", "(바)"), (0x3214, "M", "(사)"), (0x3215, "M", "(아)"), (0x3216, "M", "(자)"), (0x3217, "M", "(차)"), (0x3218, "M", "(카)"), (0x3219, "M", "(타)"), (0x321A, "M", "(파)"), (0x321B, "M", "(하)"), (0x321C, "M", "(주)"), (0x321D, "M", "(오전)"), (0x321E, "M", "(오후)"), (0x321F, "X"), (0x3220, "M", "(一)"), (0x3221, "M", "(二)"), (0x3222, "M", "(三)"), (0x3223, "M", "(四)"), (0x3224, "M", "(五)"), (0x3225, "M", "(六)"), (0x3226, "M", "(七)"), (0x3227, "M", "(八)"), (0x3228, "M", "(九)"), (0x3229, "M", "(十)"), ] def _seg_31() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x322A, "M", "(月)"), (0x322B, "M", "(火)"), (0x322C, "M", "(水)"), (0x322D, "M", "(木)"), (0x322E, "M", "(金)"), (0x322F, "M", "(土)"), (0x3230, "M", "(日)"), (0x3231, "M", "(株)"), (0x3232, "M", "(有)"), (0x3233, "M", "(社)"), (0x3234, "M", "(名)"), (0x3235, "M", "(特)"), (0x3236, "M", "(財)"), (0x3237, "M", "(祝)"), (0x3238, "M", "(労)"), (0x3239, "M", "(代)"), (0x323A, "M", "(呼)"), (0x323B, "M", "(学)"), (0x323C, "M", "(監)"), (0x323D, "M", "(企)"), (0x323E, "M", "(資)"), (0x323F, "M", "(協)"), (0x3240, "M", "(祭)"), (0x3241, "M", "(休)"), (0x3242, "M", "(自)"), (0x3243, "M", "(至)"), (0x3244, "M", "問"), (0x3245, "M", "幼"), (0x3246, "M", "文"), (0x3247, "M", "箏"), (0x3248, "V"), (0x3250, "M", "pte"), (0x3251, "M", "21"), (0x3252, "M", "22"), (0x3253, "M", "23"), (0x3254, "M", "24"), (0x3255, "M", "25"), (0x3256, "M", "26"), (0x3257, "M", "27"), (0x3258, "M", "28"), (0x3259, "M", "29"), (0x325A, "M", "30"), (0x325B, "M", "31"), (0x325C, "M", "32"), (0x325D, "M", "33"), (0x325E, "M", "34"), (0x325F, "M", "35"), (0x3260, "M", "ᄀ"), (0x3261, "M", "ᄂ"), (0x3262, "M", "ᄃ"), (0x3263, "M", "ᄅ"), (0x3264, "M", "ᄆ"), (0x3265, "M", "ᄇ"), (0x3266, "M", "ᄉ"), (0x3267, "M", "ᄋ"), (0x3268, "M", "ᄌ"), (0x3269, "M", "ᄎ"), (0x326A, "M", "ᄏ"), (0x326B, "M", "ᄐ"), (0x326C, "M", "ᄑ"), (0x326D, "M", "ᄒ"), (0x326E, "M", "가"), (0x326F, "M", "나"), (0x3270, "M", "다"), (0x3271, "M", "라"), (0x3272, "M", "마"), (0x3273, "M", "바"), (0x3274, "M", "사"), (0x3275, "M", "아"), (0x3276, "M", "자"), (0x3277, "M", "차"), (0x3278, "M", "카"), (0x3279, "M", "타"), (0x327A, "M", "파"), (0x327B, "M", "하"), (0x327C, "M", "참고"), (0x327D, "M", "주의"), (0x327E, "M", "우"), (0x327F, "V"), (0x3280, "M", "一"), (0x3281, "M", "二"), (0x3282, "M", "三"), (0x3283, "M", "四"), (0x3284, "M", "五"), (0x3285, "M", "六"), (0x3286, "M", "七"), (0x3287, "M", "八"), (0x3288, "M", "九"), (0x3289, "M", "十"), (0x328A, "M", "月"), (0x328B, "M", "火"), (0x328C, "M", "水"), (0x328D, "M", "木"), (0x328E, "M", "金"), (0x328F, "M", "土"), (0x3290, "M", "日"), (0x3291, "M", "株"), (0x3292, "M", "有"), (0x3293, "M", "社"), (0x3294, "M", "名"), ] def _seg_32() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x3295, "M", "特"), (0x3296, "M", "財"), (0x3297, "M", "祝"), (0x3298, "M", "労"), (0x3299, "M", "秘"), (0x329A, "M", "男"), (0x329B, "M", "女"), (0x329C, "M", "適"), (0x329D, "M", "優"), (0x329E, "M", "印"), (0x329F, "M", "注"), (0x32A0, "M", "項"), (0x32A1, "M", "休"), (0x32A2, "M", "写"), (0x32A3, "M", "正"), (0x32A4, "M", "上"), (0x32A5, "M", "中"), (0x32A6, "M", "下"), (0x32A7, "M", "左"), (0x32A8, "M", "右"), (0x32A9, "M", "医"), (0x32AA, "M", "宗"), (0x32AB, "M", "学"), (0x32AC, "M", "監"), (0x32AD, "M", "企"), (0x32AE, "M", "資"), (0x32AF, "M", "協"), (0x32B0, "M", "夜"), (0x32B1, "M", "36"), (0x32B2, "M", "37"), (0x32B3, "M", "38"), (0x32B4, "M", "39"), (0x32B5, "M", "40"), (0x32B6, "M", "41"), (0x32B7, "M", "42"), (0x32B8, "M", "43"), (0x32B9, "M", "44"), (0x32BA, "M", "45"), (0x32BB, "M", "46"), (0x32BC, "M", "47"), (0x32BD, "M", "48"), (0x32BE, "M", "49"), (0x32BF, "M", "50"), (0x32C0, "M", "1月"), (0x32C1, "M", "2月"), (0x32C2, "M", "3月"), (0x32C3, "M", "4月"), (0x32C4, "M", "5月"), (0x32C5, "M", "6月"), (0x32C6, "M", "7月"), (0x32C7, "M", "8月"), (0x32C8, "M", "9月"), (0x32C9, "M", "10月"), (0x32CA, "M", "11月"), (0x32CB, "M", "12月"), (0x32CC, "M", "hg"), (0x32CD, "M", "erg"), (0x32CE, "M", "ev"), (0x32CF, "M", "ltd"), (0x32D0, "M", "ア"), (0x32D1, "M", "イ"), (0x32D2, "M", "ウ"), (0x32D3, "M", "エ"), (0x32D4, "M", "オ"), (0x32D5, "M", "カ"), (0x32D6, "M", "キ"), (0x32D7, "M", "ク"), (0x32D8, "M", "ケ"), (0x32D9, "M", "コ"), (0x32DA, "M", "サ"), (0x32DB, "M", "シ"), (0x32DC, "M", "ス"), (0x32DD, "M", "セ"), (0x32DE, "M", "ソ"), (0x32DF, "M", "タ"), (0x32E0, "M", "チ"), (0x32E1, "M", "ツ"), (0x32E2, "M", "テ"), (0x32E3, "M", "ト"), (0x32E4, "M", "ナ"), (0x32E5, "M", "ニ"), (0x32E6, "M", "ヌ"), (0x32E7, "M", "ネ"), (0x32E8, "M", "ノ"), (0x32E9, "M", "ハ"), (0x32EA, "M", "ヒ"), (0x32EB, "M", "フ"), (0x32EC, "M", "ヘ"), (0x32ED, "M", "ホ"), (0x32EE, "M", "マ"), (0x32EF, "M", "ミ"), (0x32F0, "M", "ム"), (0x32F1, "M", "メ"), (0x32F2, "M", "モ"), (0x32F3, "M", "ヤ"), (0x32F4, "M", "ユ"), (0x32F5, "M", "ヨ"), (0x32F6, "M", "ラ"), (0x32F7, "M", "リ"), (0x32F8, "M", "ル"), ] def _seg_33() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x32F9, "M", "レ"), (0x32FA, "M", "ロ"), (0x32FB, "M", "ワ"), (0x32FC, "M", "ヰ"), (0x32FD, "M", "ヱ"), (0x32FE, "M", "ヲ"), (0x32FF, "M", "令和"), (0x3300, "M", "アパート"), (0x3301, "M", "アルファ"), (0x3302, "M", "アンペア"), (0x3303, "M", "アール"), (0x3304, "M", "イニング"), (0x3305, "M", "インチ"), (0x3306, "M", "ウォン"), (0x3307, "M", "エスクード"), (0x3308, "M", "エーカー"), (0x3309, "M", "オンス"), (0x330A, "M", "オーム"), (0x330B, "M", "カイリ"), (0x330C, "M", "カラット"), (0x330D, "M", "カロリー"), (0x330E, "M", "ガロン"), (0x330F, "M", "ガンマ"), (0x3310, "M", "ギガ"), (0x3311, "M", "ギニー"), (0x3312, "M", "キュリー"), (0x3313, "M", "ギルダー"), (0x3314, "M", "キロ"), (0x3315, "M", "キログラム"), (0x3316, "M", "キロメートル"), (0x3317, "M", "キロワット"), (0x3318, "M", "グラム"), (0x3319, "M", "グラムトン"), (0x331A, "M", "クルゼイロ"), (0x331B, "M", "クローネ"), (0x331C, "M", "ケース"), (0x331D, "M", "コルナ"), (0x331E, "M", "コーポ"), (0x331F, "M", "サイクル"), (0x3320, "M", "サンチーム"), (0x3321, "M", "シリング"), (0x3322, "M", "センチ"), (0x3323, "M", "セント"), (0x3324, "M", "ダース"), (0x3325, "M", "デシ"), (0x3326, "M", "ドル"), (0x3327, "M", "トン"), (0x3328, "M", "ナノ"), (0x3329, "M", "ノット"), (0x332A, "M", "ハイツ"), (0x332B, "M", "パーセント"), (0x332C, "M", "パーツ"), (0x332D, "M", "バーレル"), (0x332E, "M", "ピアストル"), (0x332F, "M", "ピクル"), (0x3330, "M", "ピコ"), (0x3331, "M", "ビル"), (0x3332, "M", "ファラッド"), (0x3333, "M", "フィート"), (0x3334, "M", "ブッシェル"), (0x3335, "M", "フラン"), (0x3336, "M", "ヘクタール"), (0x3337, "M", "ペソ"), (0x3338, "M", "ペニヒ"), (0x3339, "M", "ヘルツ"), (0x333A, "M", "ペンス"), (0x333B, "M", "ページ"), (0x333C, "M", "ベータ"), (0x333D, "M", "ポイント"), (0x333E, "M", "ボルト"), (0x333F, "M", "ホン"), (0x3340, "M", "ポンド"), (0x3341, "M", "ホール"), (0x3342, "M", "ホーン"), (0x3343, "M", "マイクロ"), (0x3344, "M", "マイル"), (0x3345, "M", "マッハ"), (0x3346, "M", "マルク"), (0x3347, "M", "マンション"), (0x3348, "M", "ミクロン"), (0x3349, "M", "ミリ"), (0x334A, "M", "ミリバール"), (0x334B, "M", "メガ"), (0x334C, "M", "メガトン"), (0x334D, "M", "メートル"), (0x334E, "M", "ヤード"), (0x334F, "M", "ヤール"), (0x3350, "M", "ユアン"), (0x3351, "M", "リットル"), (0x3352, "M", "リラ"), (0x3353, "M", "ルピー"), (0x3354, "M", "ルーブル"), (0x3355, "M", "レム"), (0x3356, "M", "レントゲン"), (0x3357, "M", "ワット"), (0x3358, "M", "0点"), (0x3359, "M", "1点"), (0x335A, "M", "2点"), (0x335B, "M", "3点"), (0x335C, "M", "4点"), ] def _seg_34() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x335D, "M", "5点"), (0x335E, "M", "6点"), (0x335F, "M", "7点"), (0x3360, "M", "8点"), (0x3361, "M", "9点"), (0x3362, "M", "10点"), (0x3363, "M", "11点"), (0x3364, "M", "12点"), (0x3365, "M", "13点"), (0x3366, "M", "14点"), (0x3367, "M", "15点"), (0x3368, "M", "16点"), (0x3369, "M", "17点"), (0x336A, "M", "18点"), (0x336B, "M", "19点"), (0x336C, "M", "20点"), (0x336D, "M", "21点"), (0x336E, "M", "22点"), (0x336F, "M", "23点"), (0x3370, "M", "24点"), (0x3371, "M", "hpa"), (0x3372, "M", "da"), (0x3373, "M", "au"), (0x3374, "M", "bar"), (0x3375, "M", "ov"), (0x3376, "M", "pc"), (0x3377, "M", "dm"), (0x3378, "M", "dm2"), (0x3379, "M", "dm3"), (0x337A, "M", "iu"), (0x337B, "M", "平成"), (0x337C, "M", "昭和"), (0x337D, "M", "大正"), (0x337E, "M", "明治"), (0x337F, "M", "株式会社"), (0x3380, "M", "pa"), (0x3381, "M", "na"), (0x3382, "M", "μa"), (0x3383, "M", "ma"), (0x3384, "M", "ka"), (0x3385, "M", "kb"), (0x3386, "M", "mb"), (0x3387, "M", "gb"), (0x3388, "M", "cal"), (0x3389, "M", "kcal"), (0x338A, "M", "pf"), (0x338B, "M", "nf"), (0x338C, "M", "μf"), (0x338D, "M", "μg"), (0x338E, "M", "mg"), (0x338F, "M", "kg"), (0x3390, "M", "hz"), (0x3391, "M", "khz"), (0x3392, "M", "mhz"), (0x3393, "M", "ghz"), (0x3394, "M", "thz"), (0x3395, "M", "μl"), (0x3396, "M", "ml"), (0x3397, "M", "dl"), (0x3398, "M", "kl"), (0x3399, "M", "fm"), (0x339A, "M", "nm"), (0x339B, "M", "μm"), (0x339C, "M", "mm"), (0x339D, "M", "cm"), (0x339E, "M", "km"), (0x339F, "M", "mm2"), (0x33A0, "M", "cm2"), (0x33A1, "M", "m2"), (0x33A2, "M", "km2"), (0x33A3, "M", "mm3"), (0x33A4, "M", "cm3"), (0x33A5, "M", "m3"), (0x33A6, "M", "km3"), (0x33A7, "M", "m∕s"), (0x33A8, "M", "m∕s2"), (0x33A9, "M", "pa"), (0x33AA, "M", "kpa"), (0x33AB, "M", "mpa"), (0x33AC, "M", "gpa"), (0x33AD, "M", "rad"), (0x33AE, "M", "rad∕s"), (0x33AF, "M", "rad∕s2"), (0x33B0, "M", "ps"), (0x33B1, "M", "ns"), (0x33B2, "M", "μs"), (0x33B3, "M", "ms"), (0x33B4, "M", "pv"), (0x33B5, "M", "nv"), (0x33B6, "M", "μv"), (0x33B7, "M", "mv"), (0x33B8, "M", "kv"), (0x33B9, "M", "mv"), (0x33BA, "M", "pw"), (0x33BB, "M", "nw"), (0x33BC, "M", "μw"), (0x33BD, "M", "mw"), (0x33BE, "M", "kw"), (0x33BF, "M", "mw"), (0x33C0, "M", "kω"), ] def _seg_35() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x33C1, "M", "mω"), (0x33C2, "X"), (0x33C3, "M", "bq"), (0x33C4, "M", "cc"), (0x33C5, "M", "cd"), (0x33C6, "M", "c∕kg"), (0x33C7, "X"), (0x33C8, "M", "db"), (0x33C9, "M", "gy"), (0x33CA, "M", "ha"), (0x33CB, "M", "hp"), (0x33CC, "M", "in"), (0x33CD, "M", "kk"), (0x33CE, "M", "km"), (0x33CF, "M", "kt"), (0x33D0, "M", "lm"), (0x33D1, "M", "ln"), (0x33D2, "M", "log"), (0x33D3, "M", "lx"), (0x33D4, "M", "mb"), (0x33D5, "M", "mil"), (0x33D6, "M", "mol"), (0x33D7, "M", "ph"), (0x33D8, "X"), (0x33D9, "M", "ppm"), (0x33DA, "M", "pr"), (0x33DB, "M", "sr"), (0x33DC, "M", "sv"), (0x33DD, "M", "wb"), (0x33DE, "M", "v∕m"), (0x33DF, "M", "a∕m"), (0x33E0, "M", "1日"), (0x33E1, "M", "2日"), (0x33E2, "M", "3日"), (0x33E3, "M", "4日"), (0x33E4, "M", "5日"), (0x33E5, "M", "6日"), (0x33E6, "M", "7日"), (0x33E7, "M", "8日"), (0x33E8, "M", "9日"), (0x33E9, "M", "10日"), (0x33EA, "M", "11日"), (0x33EB, "M", "12日"), (0x33EC, "M", "13日"), (0x33ED, "M", "14日"), (0x33EE, "M", "15日"), (0x33EF, "M", "16日"), (0x33F0, "M", "17日"), (0x33F1, "M", "18日"), (0x33F2, "M", "19日"), (0x33F3, "M", "20日"), (0x33F4, "M", "21日"), (0x33F5, "M", "22日"), (0x33F6, "M", "23日"), (0x33F7, "M", "24日"), (0x33F8, "M", "25日"), (0x33F9, "M", "26日"), (0x33FA, "M", "27日"), (0x33FB, "M", "28日"), (0x33FC, "M", "29日"), (0x33FD, "M", "30日"), (0x33FE, "M", "31日"), (0x33FF, "M", "gal"), (0x3400, "V"), (0xA48D, "X"), (0xA490, "V"), (0xA4C7, "X"), (0xA4D0, "V"), (0xA62C, "X"), (0xA640, "M", "ꙁ"), (0xA641, "V"), (0xA642, "M", "ꙃ"), (0xA643, "V"), (0xA644, "M", "ꙅ"), (0xA645, "V"), (0xA646, "M", "ꙇ"), (0xA647, "V"), (0xA648, "M", "ꙉ"), (0xA649, "V"), (0xA64A, "M", "ꙋ"), (0xA64B, "V"), (0xA64C, "M", "ꙍ"), (0xA64D, "V"), (0xA64E, "M", "ꙏ"), (0xA64F, "V"), (0xA650, "M", "ꙑ"), (0xA651, "V"), (0xA652, "M", "ꙓ"), (0xA653, "V"), (0xA654, "M", "ꙕ"), (0xA655, "V"), (0xA656, "M", "ꙗ"), (0xA657, "V"), (0xA658, "M", "ꙙ"), (0xA659, "V"), (0xA65A, "M", "ꙛ"), (0xA65B, "V"), (0xA65C, "M", "ꙝ"), (0xA65D, "V"), (0xA65E, "M", "ꙟ"), ] def _seg_36() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xA65F, "V"), (0xA660, "M", "ꙡ"), (0xA661, "V"), (0xA662, "M", "ꙣ"), (0xA663, "V"), (0xA664, "M", "ꙥ"), (0xA665, "V"), (0xA666, "M", "ꙧ"), (0xA667, "V"), (0xA668, "M", "ꙩ"), (0xA669, "V"), (0xA66A, "M", "ꙫ"), (0xA66B, "V"), (0xA66C, "M", "ꙭ"), (0xA66D, "V"), (0xA680, "M", "ꚁ"), (0xA681, "V"), (0xA682, "M", "ꚃ"), (0xA683, "V"), (0xA684, "M", "ꚅ"), (0xA685, "V"), (0xA686, "M", "ꚇ"), (0xA687, "V"), (0xA688, "M", "ꚉ"), (0xA689, "V"), (0xA68A, "M", "ꚋ"), (0xA68B, "V"), (0xA68C, "M", "ꚍ"), (0xA68D, "V"), (0xA68E, "M", "ꚏ"), (0xA68F, "V"), (0xA690, "M", "ꚑ"), (0xA691, "V"), (0xA692, "M", "ꚓ"), (0xA693, "V"), (0xA694, "M", "ꚕ"), (0xA695, "V"), (0xA696, "M", "ꚗ"), (0xA697, "V"), (0xA698, "M", "ꚙ"), (0xA699, "V"), (0xA69A, "M", "ꚛ"), (0xA69B, "V"), (0xA69C, "M", "ъ"), (0xA69D, "M", "ь"), (0xA69E, "V"), (0xA6F8, "X"), (0xA700, "V"), (0xA722, "M", "ꜣ"), (0xA723, "V"), (0xA724, "M", "ꜥ"), (0xA725, "V"), (0xA726, "M", "ꜧ"), (0xA727, "V"), (0xA728, "M", "ꜩ"), (0xA729, "V"), (0xA72A, "M", "ꜫ"), (0xA72B, "V"), (0xA72C, "M", "ꜭ"), (0xA72D, "V"), (0xA72E, "M", "ꜯ"), (0xA72F, "V"), (0xA732, "M", "ꜳ"), (0xA733, "V"), (0xA734, "M", "ꜵ"), (0xA735, "V"), (0xA736, "M", "ꜷ"), (0xA737, "V"), (0xA738, "M", "ꜹ"), (0xA739, "V"), (0xA73A, "M", "ꜻ"), (0xA73B, "V"), (0xA73C, "M", "ꜽ"), (0xA73D, "V"), (0xA73E, "M", "ꜿ"), (0xA73F, "V"), (0xA740, "M", "ꝁ"), (0xA741, "V"), (0xA742, "M", "ꝃ"), (0xA743, "V"), (0xA744, "M", "ꝅ"), (0xA745, "V"), (0xA746, "M", "ꝇ"), (0xA747, "V"), (0xA748, "M", "ꝉ"), (0xA749, "V"), (0xA74A, "M", "ꝋ"), (0xA74B, "V"), (0xA74C, "M", "ꝍ"), (0xA74D, "V"), (0xA74E, "M", "ꝏ"), (0xA74F, "V"), (0xA750, "M", "ꝑ"), (0xA751, "V"), (0xA752, "M", "ꝓ"), (0xA753, "V"), (0xA754, "M", "ꝕ"), (0xA755, "V"), (0xA756, "M", "ꝗ"), (0xA757, "V"), ] def _seg_37() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xA758, "M", "ꝙ"), (0xA759, "V"), (0xA75A, "M", "ꝛ"), (0xA75B, "V"), (0xA75C, "M", "ꝝ"), (0xA75D, "V"), (0xA75E, "M", "ꝟ"), (0xA75F, "V"), (0xA760, "M", "ꝡ"), (0xA761, "V"), (0xA762, "M", "ꝣ"), (0xA763, "V"), (0xA764, "M", "ꝥ"), (0xA765, "V"), (0xA766, "M", "ꝧ"), (0xA767, "V"), (0xA768, "M", "ꝩ"), (0xA769, "V"), (0xA76A, "M", "ꝫ"), (0xA76B, "V"), (0xA76C, "M", "ꝭ"), (0xA76D, "V"), (0xA76E, "M", "ꝯ"), (0xA76F, "V"), (0xA770, "M", "ꝯ"), (0xA771, "V"), (0xA779, "M", "ꝺ"), (0xA77A, "V"), (0xA77B, "M", "ꝼ"), (0xA77C, "V"), (0xA77D, "M", "ᵹ"), (0xA77E, "M", "ꝿ"), (0xA77F, "V"), (0xA780, "M", "ꞁ"), (0xA781, "V"), (0xA782, "M", "ꞃ"), (0xA783, "V"), (0xA784, "M", "ꞅ"), (0xA785, "V"), (0xA786, "M", "ꞇ"), (0xA787, "V"), (0xA78B, "M", "ꞌ"), (0xA78C, "V"), (0xA78D, "M", "ɥ"), (0xA78E, "V"), (0xA790, "M", "ꞑ"), (0xA791, "V"), (0xA792, "M", "ꞓ"), (0xA793, "V"), (0xA796, "M", "ꞗ"), (0xA797, "V"), (0xA798, "M", "ꞙ"), (0xA799, "V"), (0xA79A, "M", "ꞛ"), (0xA79B, "V"), (0xA79C, "M", "ꞝ"), (0xA79D, "V"), (0xA79E, "M", "ꞟ"), (0xA79F, "V"), (0xA7A0, "M", "ꞡ"), (0xA7A1, "V"), (0xA7A2, "M", "ꞣ"), (0xA7A3, "V"), (0xA7A4, "M", "ꞥ"), (0xA7A5, "V"), (0xA7A6, "M", "ꞧ"), (0xA7A7, "V"), (0xA7A8, "M", "ꞩ"), (0xA7A9, "V"), (0xA7AA, "M", "ɦ"), (0xA7AB, "M", "ɜ"), (0xA7AC, "M", "ɡ"), (0xA7AD, "M", "ɬ"), (0xA7AE, "M", "ɪ"), (0xA7AF, "V"), (0xA7B0, "M", "ʞ"), (0xA7B1, "M", "ʇ"), (0xA7B2, "M", "ʝ"), (0xA7B3, "M", "ꭓ"), (0xA7B4, "M", "ꞵ"), (0xA7B5, "V"), (0xA7B6, "M", "ꞷ"), (0xA7B7, "V"), (0xA7B8, "M", "ꞹ"), (0xA7B9, "V"), (0xA7BA, "M", "ꞻ"), (0xA7BB, "V"), (0xA7BC, "M", "ꞽ"), (0xA7BD, "V"), (0xA7BE, "M", "ꞿ"), (0xA7BF, "V"), (0xA7C0, "M", "ꟁ"), (0xA7C1, "V"), (0xA7C2, "M", "ꟃ"), (0xA7C3, "V"), (0xA7C4, "M", "ꞔ"), (0xA7C5, "M", "ʂ"), (0xA7C6, "M", "ᶎ"), (0xA7C7, "M", "ꟈ"), (0xA7C8, "V"), ] def _seg_38() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xA7C9, "M", "ꟊ"), (0xA7CA, "V"), (0xA7CB, "M", "ɤ"), (0xA7CC, "M", "ꟍ"), (0xA7CD, "V"), (0xA7CE, "X"), (0xA7D0, "M", "ꟑ"), (0xA7D1, "V"), (0xA7D2, "X"), (0xA7D3, "V"), (0xA7D4, "X"), (0xA7D5, "V"), (0xA7D6, "M", "ꟗ"), (0xA7D7, "V"), (0xA7D8, "M", "ꟙ"), (0xA7D9, "V"), (0xA7DA, "M", "ꟛ"), (0xA7DB, "V"), (0xA7DC, "M", "ƛ"), (0xA7DD, "X"), (0xA7F2, "M", "c"), (0xA7F3, "M", "f"), (0xA7F4, "M", "q"), (0xA7F5, "M", "ꟶ"), (0xA7F6, "V"), (0xA7F8, "M", "ħ"), (0xA7F9, "M", "œ"), (0xA7FA, "V"), (0xA82D, "X"), (0xA830, "V"), (0xA83A, "X"), (0xA840, "V"), (0xA878, "X"), (0xA880, "V"), (0xA8C6, "X"), (0xA8CE, "V"), (0xA8DA, "X"), (0xA8E0, "V"), (0xA954, "X"), (0xA95F, "V"), (0xA97D, "X"), (0xA980, "V"), (0xA9CE, "X"), (0xA9CF, "V"), (0xA9DA, "X"), (0xA9DE, "V"), (0xA9FF, "X"), (0xAA00, "V"), (0xAA37, "X"), (0xAA40, "V"), (0xAA4E, "X"), (0xAA50, "V"), (0xAA5A, "X"), (0xAA5C, "V"), (0xAAC3, "X"), (0xAADB, "V"), (0xAAF7, "X"), (0xAB01, "V"), (0xAB07, "X"), (0xAB09, "V"), (0xAB0F, "X"), (0xAB11, "V"), (0xAB17, "X"), (0xAB20, "V"), (0xAB27, "X"), (0xAB28, "V"), (0xAB2F, "X"), (0xAB30, "V"), (0xAB5C, "M", "ꜧ"), (0xAB5D, "M", "ꬷ"), (0xAB5E, "M", "ɫ"), (0xAB5F, "M", "ꭒ"), (0xAB60, "V"), (0xAB69, "M", "ʍ"), (0xAB6A, "V"), (0xAB6C, "X"), (0xAB70, "M", "Ꭰ"), (0xAB71, "M", "Ꭱ"), (0xAB72, "M", "Ꭲ"), (0xAB73, "M", "Ꭳ"), (0xAB74, "M", "Ꭴ"), (0xAB75, "M", "Ꭵ"), (0xAB76, "M", "Ꭶ"), (0xAB77, "M", "Ꭷ"), (0xAB78, "M", "Ꭸ"), (0xAB79, "M", "Ꭹ"), (0xAB7A, "M", "Ꭺ"), (0xAB7B, "M", "Ꭻ"), (0xAB7C, "M", "Ꭼ"), (0xAB7D, "M", "Ꭽ"), (0xAB7E, "M", "Ꭾ"), (0xAB7F, "M", "Ꭿ"), (0xAB80, "M", "Ꮀ"), (0xAB81, "M", "Ꮁ"), (0xAB82, "M", "Ꮂ"), (0xAB83, "M", "Ꮃ"), (0xAB84, "M", "Ꮄ"), (0xAB85, "M", "Ꮅ"), (0xAB86, "M", "Ꮆ"), (0xAB87, "M", "Ꮇ"), ] def _seg_39() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xAB88, "M", "Ꮈ"), (0xAB89, "M", "Ꮉ"), (0xAB8A, "M", "Ꮊ"), (0xAB8B, "M", "Ꮋ"), (0xAB8C, "M", "Ꮌ"), (0xAB8D, "M", "Ꮍ"), (0xAB8E, "M", "Ꮎ"), (0xAB8F, "M", "Ꮏ"), (0xAB90, "M", "Ꮐ"), (0xAB91, "M", "Ꮑ"), (0xAB92, "M", "Ꮒ"), (0xAB93, "M", "Ꮓ"), (0xAB94, "M", "Ꮔ"), (0xAB95, "M", "Ꮕ"), (0xAB96, "M", "Ꮖ"), (0xAB97, "M", "Ꮗ"), (0xAB98, "M", "Ꮘ"), (0xAB99, "M", "Ꮙ"), (0xAB9A, "M", "Ꮚ"), (0xAB9B, "M", "Ꮛ"), (0xAB9C, "M", "Ꮜ"), (0xAB9D, "M", "Ꮝ"), (0xAB9E, "M", "Ꮞ"), (0xAB9F, "M", "Ꮟ"), (0xABA0, "M", "Ꮠ"), (0xABA1, "M", "Ꮡ"), (0xABA2, "M", "Ꮢ"), (0xABA3, "M", "Ꮣ"), (0xABA4, "M", "Ꮤ"), (0xABA5, "M", "Ꮥ"), (0xABA6, "M", "Ꮦ"), (0xABA7, "M", "Ꮧ"), (0xABA8, "M", "Ꮨ"), (0xABA9, "M", "Ꮩ"), (0xABAA, "M", "Ꮪ"), (0xABAB, "M", "Ꮫ"), (0xABAC, "M", "Ꮬ"), (0xABAD, "M", "Ꮭ"), (0xABAE, "M", "Ꮮ"), (0xABAF, "M", "Ꮯ"), (0xABB0, "M", "Ꮰ"), (0xABB1, "M", "Ꮱ"), (0xABB2, "M", "Ꮲ"), (0xABB3, "M", "Ꮳ"), (0xABB4, "M", "Ꮴ"), (0xABB5, "M", "Ꮵ"), (0xABB6, "M", "Ꮶ"), (0xABB7, "M", "Ꮷ"), (0xABB8, "M", "Ꮸ"), (0xABB9, "M", "Ꮹ"), (0xABBA, "M", "Ꮺ"), (0xABBB, "M", "Ꮻ"), (0xABBC, "M", "Ꮼ"), (0xABBD, "M", "Ꮽ"), (0xABBE, "M", "Ꮾ"), (0xABBF, "M", "Ꮿ"), (0xABC0, "V"), (0xABEE, "X"), (0xABF0, "V"), (0xABFA, "X"), (0xAC00, "V"), (0xD7A4, "X"), (0xD7B0, "V"), (0xD7C7, "X"), (0xD7CB, "V"), (0xD7FC, "X"), (0xF900, "M", "豈"), (0xF901, "M", "更"), (0xF902, "M", "車"), (0xF903, "M", "賈"), (0xF904, "M", "滑"), (0xF905, "M", "串"), (0xF906, "M", "句"), (0xF907, "M", "龜"), (0xF909, "M", "契"), (0xF90A, "M", "金"), (0xF90B, "M", "喇"), (0xF90C, "M", "奈"), (0xF90D, "M", "懶"), (0xF90E, "M", "癩"), (0xF90F, "M", "羅"), (0xF910, "M", "蘿"), (0xF911, "M", "螺"), (0xF912, "M", "裸"), (0xF913, "M", "邏"), (0xF914, "M", "樂"), (0xF915, "M", "洛"), (0xF916, "M", "烙"), (0xF917, "M", "珞"), (0xF918, "M", "落"), (0xF919, "M", "酪"), (0xF91A, "M", "駱"), (0xF91B, "M", "亂"), (0xF91C, "M", "卵"), (0xF91D, "M", "欄"), (0xF91E, "M", "爛"), (0xF91F, "M", "蘭"), (0xF920, "M", "鸞"), (0xF921, "M", "嵐"), (0xF922, "M", "濫"), ] def _seg_40() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xF923, "M", "藍"), (0xF924, "M", "襤"), (0xF925, "M", "拉"), (0xF926, "M", "臘"), (0xF927, "M", "蠟"), (0xF928, "M", "廊"), (0xF929, "M", "朗"), (0xF92A, "M", "浪"), (0xF92B, "M", "狼"), (0xF92C, "M", "郎"), (0xF92D, "M", "來"), (0xF92E, "M", "冷"), (0xF92F, "M", "勞"), (0xF930, "M", "擄"), (0xF931, "M", "櫓"), (0xF932, "M", "爐"), (0xF933, "M", "盧"), (0xF934, "M", "老"), (0xF935, "M", "蘆"), (0xF936, "M", "虜"), (0xF937, "M", "路"), (0xF938, "M", "露"), (0xF939, "M", "魯"), (0xF93A, "M", "鷺"), (0xF93B, "M", "碌"), (0xF93C, "M", "祿"), (0xF93D, "M", "綠"), (0xF93E, "M", "菉"), (0xF93F, "M", "錄"), (0xF940, "M", "鹿"), (0xF941, "M", "論"), (0xF942, "M", "壟"), (0xF943, "M", "弄"), (0xF944, "M", "籠"), (0xF945, "M", "聾"), (0xF946, "M", "牢"), (0xF947, "M", "磊"), (0xF948, "M", "賂"), (0xF949, "M", "雷"), (0xF94A, "M", "壘"), (0xF94B, "M", "屢"), (0xF94C, "M", "樓"), (0xF94D, "M", "淚"), (0xF94E, "M", "漏"), (0xF94F, "M", "累"), (0xF950, "M", "縷"), (0xF951, "M", "陋"), (0xF952, "M", "勒"), (0xF953, "M", "肋"), (0xF954, "M", "凜"), (0xF955, "M", "凌"), (0xF956, "M", "稜"), (0xF957, "M", "綾"), (0xF958, "M", "菱"), (0xF959, "M", "陵"), (0xF95A, "M", "讀"), (0xF95B, "M", "拏"), (0xF95C, "M", "樂"), (0xF95D, "M", "諾"), (0xF95E, "M", "丹"), (0xF95F, "M", "寧"), (0xF960, "M", "怒"), (0xF961, "M", "率"), (0xF962, "M", "異"), (0xF963, "M", "北"), (0xF964, "M", "磻"), (0xF965, "M", "便"), (0xF966, "M", "復"), (0xF967, "M", "不"), (0xF968, "M", "泌"), (0xF969, "M", "數"), (0xF96A, "M", "索"), (0xF96B, "M", "參"), (0xF96C, "M", "塞"), (0xF96D, "M", "省"), (0xF96E, "M", "葉"), (0xF96F, "M", "說"), (0xF970, "M", "殺"), (0xF971, "M", "辰"), (0xF972, "M", "沈"), (0xF973, "M", "拾"), (0xF974, "M", "若"), (0xF975, "M", "掠"), (0xF976, "M", "略"), (0xF977, "M", "亮"), (0xF978, "M", "兩"), (0xF979, "M", "凉"), (0xF97A, "M", "梁"), (0xF97B, "M", "糧"), (0xF97C, "M", "良"), (0xF97D, "M", "諒"), (0xF97E, "M", "量"), (0xF97F, "M", "勵"), (0xF980, "M", "呂"), (0xF981, "M", "女"), (0xF982, "M", "廬"), (0xF983, "M", "旅"), (0xF984, "M", "濾"), (0xF985, "M", "礪"), (0xF986, "M", "閭"), ] def _seg_41() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xF987, "M", "驪"), (0xF988, "M", "麗"), (0xF989, "M", "黎"), (0xF98A, "M", "力"), (0xF98B, "M", "曆"), (0xF98C, "M", "歷"), (0xF98D, "M", "轢"), (0xF98E, "M", "年"), (0xF98F, "M", "憐"), (0xF990, "M", "戀"), (0xF991, "M", "撚"), (0xF992, "M", "漣"), (0xF993, "M", "煉"), (0xF994, "M", "璉"), (0xF995, "M", "秊"), (0xF996, "M", "練"), (0xF997, "M", "聯"), (0xF998, "M", "輦"), (0xF999, "M", "蓮"), (0xF99A, "M", "連"), (0xF99B, "M", "鍊"), (0xF99C, "M", "列"), (0xF99D, "M", "劣"), (0xF99E, "M", "咽"), (0xF99F, "M", "烈"), (0xF9A0, "M", "裂"), (0xF9A1, "M", "說"), (0xF9A2, "M", "廉"), (0xF9A3, "M", "念"), (0xF9A4, "M", "捻"), (0xF9A5, "M", "殮"), (0xF9A6, "M", "簾"), (0xF9A7, "M", "獵"), (0xF9A8, "M", "令"), (0xF9A9, "M", "囹"), (0xF9AA, "M", "寧"), (0xF9AB, "M", "嶺"), (0xF9AC, "M", "怜"), (0xF9AD, "M", "玲"), (0xF9AE, "M", "瑩"), (0xF9AF, "M", "羚"), (0xF9B0, "M", "聆"), (0xF9B1, "M", "鈴"), (0xF9B2, "M", "零"), (0xF9B3, "M", "靈"), (0xF9B4, "M", "領"), (0xF9B5, "M", "例"), (0xF9B6, "M", "禮"), (0xF9B7, "M", "醴"), (0xF9B8, "M", "隸"), (0xF9B9, "M", "惡"), (0xF9BA, "M", "了"), (0xF9BB, "M", "僚"), (0xF9BC, "M", "寮"), (0xF9BD, "M", "尿"), (0xF9BE, "M", "料"), (0xF9BF, "M", "樂"), (0xF9C0, "M", "燎"), (0xF9C1, "M", "療"), (0xF9C2, "M", "蓼"), (0xF9C3, "M", "遼"), (0xF9C4, "M", "龍"), (0xF9C5, "M", "暈"), (0xF9C6, "M", "阮"), (0xF9C7, "M", "劉"), (0xF9C8, "M", "杻"), (0xF9C9, "M", "柳"), (0xF9CA, "M", "流"), (0xF9CB, "M", "溜"), (0xF9CC, "M", "琉"), (0xF9CD, "M", "留"), (0xF9CE, "M", "硫"), (0xF9CF, "M", "紐"), (0xF9D0, "M", "類"), (0xF9D1, "M", "六"), (0xF9D2, "M", "戮"), (0xF9D3, "M", "陸"), (0xF9D4, "M", "倫"), (0xF9D5, "M", "崙"), (0xF9D6, "M", "淪"), (0xF9D7, "M", "輪"), (0xF9D8, "M", "律"), (0xF9D9, "M", "慄"), (0xF9DA, "M", "栗"), (0xF9DB, "M", "率"), (0xF9DC, "M", "隆"), (0xF9DD, "M", "利"), (0xF9DE, "M", "吏"), (0xF9DF, "M", "履"), (0xF9E0, "M", "易"), (0xF9E1, "M", "李"), (0xF9E2, "M", "梨"), (0xF9E3, "M", "泥"), (0xF9E4, "M", "理"), (0xF9E5, "M", "痢"), (0xF9E6, "M", "罹"), (0xF9E7, "M", "裏"), (0xF9E8, "M", "裡"), (0xF9E9, "M", "里"), (0xF9EA, "M", "離"), ] def _seg_42() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xF9EB, "M", "匿"), (0xF9EC, "M", "溺"), (0xF9ED, "M", "吝"), (0xF9EE, "M", "燐"), (0xF9EF, "M", "璘"), (0xF9F0, "M", "藺"), (0xF9F1, "M", "隣"), (0xF9F2, "M", "鱗"), (0xF9F3, "M", "麟"), (0xF9F4, "M", "林"), (0xF9F5, "M", "淋"), (0xF9F6, "M", "臨"), (0xF9F7, "M", "立"), (0xF9F8, "M", "笠"), (0xF9F9, "M", "粒"), (0xF9FA, "M", "狀"), (0xF9FB, "M", "炙"), (0xF9FC, "M", "識"), (0xF9FD, "M", "什"), (0xF9FE, "M", "茶"), (0xF9FF, "M", "刺"), (0xFA00, "M", "切"), (0xFA01, "M", "度"), (0xFA02, "M", "拓"), (0xFA03, "M", "糖"), (0xFA04, "M", "宅"), (0xFA05, "M", "洞"), (0xFA06, "M", "暴"), (0xFA07, "M", "輻"), (0xFA08, "M", "行"), (0xFA09, "M", "降"), (0xFA0A, "M", "見"), (0xFA0B, "M", "廓"), (0xFA0C, "M", "兀"), (0xFA0D, "M", "嗀"), (0xFA0E, "V"), (0xFA10, "M", "塚"), (0xFA11, "V"), (0xFA12, "M", "晴"), (0xFA13, "V"), (0xFA15, "M", "凞"), (0xFA16, "M", "猪"), (0xFA17, "M", "益"), (0xFA18, "M", "礼"), (0xFA19, "M", "神"), (0xFA1A, "M", "祥"), (0xFA1B, "M", "福"), (0xFA1C, "M", "靖"), (0xFA1D, "M", "精"), (0xFA1E, "M", "羽"), (0xFA1F, "V"), (0xFA20, "M", "蘒"), (0xFA21, "V"), (0xFA22, "M", "諸"), (0xFA23, "V"), (0xFA25, "M", "逸"), (0xFA26, "M", "都"), (0xFA27, "V"), (0xFA2A, "M", "飯"), (0xFA2B, "M", "飼"), (0xFA2C, "M", "館"), (0xFA2D, "M", "鶴"), (0xFA2E, "M", "郞"), (0xFA2F, "M", "隷"), (0xFA30, "M", "侮"), (0xFA31, "M", "僧"), (0xFA32, "M", "免"), (0xFA33, "M", "勉"), (0xFA34, "M", "勤"), (0xFA35, "M", "卑"), (0xFA36, "M", "喝"), (0xFA37, "M", "嘆"), (0xFA38, "M", "器"), (0xFA39, "M", "塀"), (0xFA3A, "M", "墨"), (0xFA3B, "M", "層"), (0xFA3C, "M", "屮"), (0xFA3D, "M", "悔"), (0xFA3E, "M", "慨"), (0xFA3F, "M", "憎"), (0xFA40, "M", "懲"), (0xFA41, "M", "敏"), (0xFA42, "M", "既"), (0xFA43, "M", "暑"), (0xFA44, "M", "梅"), (0xFA45, "M", "海"), (0xFA46, "M", "渚"), (0xFA47, "M", "漢"), (0xFA48, "M", "煮"), (0xFA49, "M", "爫"), (0xFA4A, "M", "琢"), (0xFA4B, "M", "碑"), (0xFA4C, "M", "社"), (0xFA4D, "M", "祉"), (0xFA4E, "M", "祈"), (0xFA4F, "M", "祐"), (0xFA50, "M", "祖"), (0xFA51, "M", "祝"), (0xFA52, "M", "禍"), (0xFA53, "M", "禎"), ] def _seg_43() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xFA54, "M", "穀"), (0xFA55, "M", "突"), (0xFA56, "M", "節"), (0xFA57, "M", "練"), (0xFA58, "M", "縉"), (0xFA59, "M", "繁"), (0xFA5A, "M", "署"), (0xFA5B, "M", "者"), (0xFA5C, "M", "臭"), (0xFA5D, "M", "艹"), (0xFA5F, "M", "著"), (0xFA60, "M", "褐"), (0xFA61, "M", "視"), (0xFA62, "M", "謁"), (0xFA63, "M", "謹"), (0xFA64, "M", "賓"), (0xFA65, "M", "贈"), (0xFA66, "M", "辶"), (0xFA67, "M", "逸"), (0xFA68, "M", "難"), (0xFA69, "M", "響"), (0xFA6A, "M", "頻"), (0xFA6B, "M", "恵"), (0xFA6C, "M", "𤋮"), (0xFA6D, "M", "舘"), (0xFA6E, "X"), (0xFA70, "M", "並"), (0xFA71, "M", "况"), (0xFA72, "M", "全"), (0xFA73, "M", "侀"), (0xFA74, "M", "充"), (0xFA75, "M", "冀"), (0xFA76, "M", "勇"), (0xFA77, "M", "勺"), (0xFA78, "M", "喝"), (0xFA79, "M", "啕"), (0xFA7A, "M", "喙"), (0xFA7B, "M", "嗢"), (0xFA7C, "M", "塚"), (0xFA7D, "M", "墳"), (0xFA7E, "M", "奄"), (0xFA7F, "M", "奔"), (0xFA80, "M", "婢"), (0xFA81, "M", "嬨"), (0xFA82, "M", "廒"), (0xFA83, "M", "廙"), (0xFA84, "M", "彩"), (0xFA85, "M", "徭"), (0xFA86, "M", "惘"), (0xFA87, "M", "慎"), (0xFA88, "M", "愈"), (0xFA89, "M", "憎"), (0xFA8A, "M", "慠"), (0xFA8B, "M", "懲"), (0xFA8C, "M", "戴"), (0xFA8D, "M", "揄"), (0xFA8E, "M", "搜"), (0xFA8F, "M", "摒"), (0xFA90, "M", "敖"), (0xFA91, "M", "晴"), (0xFA92, "M", "朗"), (0xFA93, "M", "望"), (0xFA94, "M", "杖"), (0xFA95, "M", "歹"), (0xFA96, "M", "殺"), (0xFA97, "M", "流"), (0xFA98, "M", "滛"), (0xFA99, "M", "滋"), (0xFA9A, "M", "漢"), (0xFA9B, "M", "瀞"), (0xFA9C, "M", "煮"), (0xFA9D, "M", "瞧"), (0xFA9E, "M", "爵"), (0xFA9F, "M", "犯"), (0xFAA0, "M", "猪"), (0xFAA1, "M", "瑱"), (0xFAA2, "M", "甆"), (0xFAA3, "M", "画"), (0xFAA4, "M", "瘝"), (0xFAA5, "M", "瘟"), (0xFAA6, "M", "益"), (0xFAA7, "M", "盛"), (0xFAA8, "M", "直"), (0xFAA9, "M", "睊"), (0xFAAA, "M", "着"), (0xFAAB, "M", "磌"), (0xFAAC, "M", "窱"), (0xFAAD, "M", "節"), (0xFAAE, "M", "类"), (0xFAAF, "M", "絛"), (0xFAB0, "M", "練"), (0xFAB1, "M", "缾"), (0xFAB2, "M", "者"), (0xFAB3, "M", "荒"), (0xFAB4, "M", "華"), (0xFAB5, "M", "蝹"), (0xFAB6, "M", "襁"), (0xFAB7, "M", "覆"), (0xFAB8, "M", "視"), (0xFAB9, "M", "調"), ] def _seg_44() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xFABA, "M", "諸"), (0xFABB, "M", "請"), (0xFABC, "M", "謁"), (0xFABD, "M", "諾"), (0xFABE, "M", "諭"), (0xFABF, "M", "謹"), (0xFAC0, "M", "變"), (0xFAC1, "M", "贈"), (0xFAC2, "M", "輸"), (0xFAC3, "M", "遲"), (0xFAC4, "M", "醙"), (0xFAC5, "M", "鉶"), (0xFAC6, "M", "陼"), (0xFAC7, "M", "難"), (0xFAC8, "M", "靖"), (0xFAC9, "M", "韛"), (0xFACA, "M", "響"), (0xFACB, "M", "頋"), (0xFACC, "M", "頻"), (0xFACD, "M", "鬒"), (0xFACE, "M", "龜"), (0xFACF, "M", "𢡊"), (0xFAD0, "M", "𢡄"), (0xFAD1, "M", "𣏕"), (0xFAD2, "M", "㮝"), (0xFAD3, "M", "䀘"), (0xFAD4, "M", "䀹"), (0xFAD5, "M", "𥉉"), (0xFAD6, "M", "𥳐"), (0xFAD7, "M", "𧻓"), (0xFAD8, "M", "齃"), (0xFAD9, "M", "龎"), (0xFADA, "X"), (0xFB00, "M", "ff"), (0xFB01, "M", "fi"), (0xFB02, "M", "fl"), (0xFB03, "M", "ffi"), (0xFB04, "M", "ffl"), (0xFB05, "M", "st"), (0xFB07, "X"), (0xFB13, "M", "մն"), (0xFB14, "M", "մե"), (0xFB15, "M", "մի"), (0xFB16, "M", "վն"), (0xFB17, "M", "մխ"), (0xFB18, "X"), (0xFB1D, "M", "יִ"), (0xFB1E, "V"), (0xFB1F, "M", "ײַ"), (0xFB20, "M", "ע"), (0xFB21, "M", "א"), (0xFB22, "M", "ד"), (0xFB23, "M", "ה"), (0xFB24, "M", "כ"), (0xFB25, "M", "ל"), (0xFB26, "M", "ם"), (0xFB27, "M", "ר"), (0xFB28, "M", "ת"), (0xFB29, "M", "+"), (0xFB2A, "M", "שׁ"), (0xFB2B, "M", "שׂ"), (0xFB2C, "M", "שּׁ"), (0xFB2D, "M", "שּׂ"), (0xFB2E, "M", "אַ"), (0xFB2F, "M", "אָ"), (0xFB30, "M", "אּ"), (0xFB31, "M", "בּ"), (0xFB32, "M", "גּ"), (0xFB33, "M", "דּ"), (0xFB34, "M", "הּ"), (0xFB35, "M", "וּ"), (0xFB36, "M", "זּ"), (0xFB37, "X"), (0xFB38, "M", "טּ"), (0xFB39, "M", "יּ"), (0xFB3A, "M", "ךּ"), (0xFB3B, "M", "כּ"), (0xFB3C, "M", "לּ"), (0xFB3D, "X"), (0xFB3E, "M", "מּ"), (0xFB3F, "X"), (0xFB40, "M", "נּ"), (0xFB41, "M", "סּ"), (0xFB42, "X"), (0xFB43, "M", "ףּ"), (0xFB44, "M", "פּ"), (0xFB45, "X"), (0xFB46, "M", "צּ"), (0xFB47, "M", "קּ"), (0xFB48, "M", "רּ"), (0xFB49, "M", "שּ"), (0xFB4A, "M", "תּ"), (0xFB4B, "M", "וֹ"), (0xFB4C, "M", "בֿ"), (0xFB4D, "M", "כֿ"), (0xFB4E, "M", "פֿ"), (0xFB4F, "M", "אל"), (0xFB50, "M", "ٱ"), (0xFB52, "M", "ٻ"), (0xFB56, "M", "پ"), ] def _seg_45() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xFB5A, "M", "ڀ"), (0xFB5E, "M", "ٺ"), (0xFB62, "M", "ٿ"), (0xFB66, "M", "ٹ"), (0xFB6A, "M", "ڤ"), (0xFB6E, "M", "ڦ"), (0xFB72, "M", "ڄ"), (0xFB76, "M", "ڃ"), (0xFB7A, "M", "چ"), (0xFB7E, "M", "ڇ"), (0xFB82, "M", "ڍ"), (0xFB84, "M", "ڌ"), (0xFB86, "M", "ڎ"), (0xFB88, "M", "ڈ"), (0xFB8A, "M", "ژ"), (0xFB8C, "M", "ڑ"), (0xFB8E, "M", "ک"), (0xFB92, "M", "گ"), (0xFB96, "M", "ڳ"), (0xFB9A, "M", "ڱ"), (0xFB9E, "M", "ں"), (0xFBA0, "M", "ڻ"), (0xFBA4, "M", "ۀ"), (0xFBA6, "M", "ہ"), (0xFBAA, "M", "ھ"), (0xFBAE, "M", "ے"), (0xFBB0, "M", "ۓ"), (0xFBB2, "V"), (0xFBC3, "X"), (0xFBD3, "M", "ڭ"), (0xFBD7, "M", "ۇ"), (0xFBD9, "M", "ۆ"), (0xFBDB, "M", "ۈ"), (0xFBDD, "M", "ۇٴ"), (0xFBDE, "M", "ۋ"), (0xFBE0, "M", "ۅ"), (0xFBE2, "M", "ۉ"), (0xFBE4, "M", "ې"), (0xFBE8, "M", "ى"), (0xFBEA, "M", "ئا"), (0xFBEC, "M", "ئە"), (0xFBEE, "M", "ئو"), (0xFBF0, "M", "ئۇ"), (0xFBF2, "M", "ئۆ"), (0xFBF4, "M", "ئۈ"), (0xFBF6, "M", "ئې"), (0xFBF9, "M", "ئى"), (0xFBFC, "M", "ی"), (0xFC00, "M", "ئج"), (0xFC01, "M", "ئح"), (0xFC02, "M", "ئم"), (0xFC03, "M", "ئى"), (0xFC04, "M", "ئي"), (0xFC05, "M", "بج"), (0xFC06, "M", "بح"), (0xFC07, "M", "بخ"), (0xFC08, "M", "بم"), (0xFC09, "M", "بى"), (0xFC0A, "M", "بي"), (0xFC0B, "M", "تج"), (0xFC0C, "M", "تح"), (0xFC0D, "M", "تخ"), (0xFC0E, "M", "تم"), (0xFC0F, "M", "تى"), (0xFC10, "M", "تي"), (0xFC11, "M", "ثج"), (0xFC12, "M", "ثم"), (0xFC13, "M", "ثى"), (0xFC14, "M", "ثي"), (0xFC15, "M", "جح"), (0xFC16, "M", "جم"), (0xFC17, "M", "حج"), (0xFC18, "M", "حم"), (0xFC19, "M", "خج"), (0xFC1A, "M", "خح"), (0xFC1B, "M", "خم"), (0xFC1C, "M", "سج"), (0xFC1D, "M", "سح"), (0xFC1E, "M", "سخ"), (0xFC1F, "M", "سم"), (0xFC20, "M", "صح"), (0xFC21, "M", "صم"), (0xFC22, "M", "ضج"), (0xFC23, "M", "ضح"), (0xFC24, "M", "ضخ"), (0xFC25, "M", "ضم"), (0xFC26, "M", "طح"), (0xFC27, "M", "طم"), (0xFC28, "M", "ظم"), (0xFC29, "M", "عج"), (0xFC2A, "M", "عم"), (0xFC2B, "M", "غج"), (0xFC2C, "M", "غم"), (0xFC2D, "M", "فج"), (0xFC2E, "M", "فح"), (0xFC2F, "M", "فخ"), (0xFC30, "M", "فم"), (0xFC31, "M", "فى"), (0xFC32, "M", "في"), (0xFC33, "M", "قح"), ] def _seg_46() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xFC34, "M", "قم"), (0xFC35, "M", "قى"), (0xFC36, "M", "قي"), (0xFC37, "M", "كا"), (0xFC38, "M", "كج"), (0xFC39, "M", "كح"), (0xFC3A, "M", "كخ"), (0xFC3B, "M", "كل"), (0xFC3C, "M", "كم"), (0xFC3D, "M", "كى"), (0xFC3E, "M", "كي"), (0xFC3F, "M", "لج"), (0xFC40, "M", "لح"), (0xFC41, "M", "لخ"), (0xFC42, "M", "لم"), (0xFC43, "M", "لى"), (0xFC44, "M", "لي"), (0xFC45, "M", "مج"), (0xFC46, "M", "مح"), (0xFC47, "M", "مخ"), (0xFC48, "M", "مم"), (0xFC49, "M", "مى"), (0xFC4A, "M", "مي"), (0xFC4B, "M", "نج"), (0xFC4C, "M", "نح"), (0xFC4D, "M", "نخ"), (0xFC4E, "M", "نم"), (0xFC4F, "M", "نى"), (0xFC50, "M", "ني"), (0xFC51, "M", "هج"), (0xFC52, "M", "هم"), (0xFC53, "M", "هى"), (0xFC54, "M", "هي"), (0xFC55, "M", "يج"), (0xFC56, "M", "يح"), (0xFC57, "M", "يخ"), (0xFC58, "M", "يم"), (0xFC59, "M", "يى"), (0xFC5A, "M", "يي"), (0xFC5B, "M", "ذٰ"), (0xFC5C, "M", "رٰ"), (0xFC5D, "M", "ىٰ"), (0xFC5E, "M", " ٌّ"), (0xFC5F, "M", " ٍّ"), (0xFC60, "M", " َّ"), (0xFC61, "M", " ُّ"), (0xFC62, "M", " ِّ"), (0xFC63, "M", " ّٰ"), (0xFC64, "M", "ئر"), (0xFC65, "M", "ئز"), (0xFC66, "M", "ئم"), (0xFC67, "M", "ئن"), (0xFC68, "M", "ئى"), (0xFC69, "M", "ئي"), (0xFC6A, "M", "بر"), (0xFC6B, "M", "بز"), (0xFC6C, "M", "بم"), (0xFC6D, "M", "بن"), (0xFC6E, "M", "بى"), (0xFC6F, "M", "بي"), (0xFC70, "M", "تر"), (0xFC71, "M", "تز"), (0xFC72, "M", "تم"), (0xFC73, "M", "تن"), (0xFC74, "M", "تى"), (0xFC75, "M", "تي"), (0xFC76, "M", "ثر"), (0xFC77, "M", "ثز"), (0xFC78, "M", "ثم"), (0xFC79, "M", "ثن"), (0xFC7A, "M", "ثى"), (0xFC7B, "M", "ثي"), (0xFC7C, "M", "فى"), (0xFC7D, "M", "في"), (0xFC7E, "M", "قى"), (0xFC7F, "M", "قي"), (0xFC80, "M", "كا"), (0xFC81, "M", "كل"), (0xFC82, "M", "كم"), (0xFC83, "M", "كى"), (0xFC84, "M", "كي"), (0xFC85, "M", "لم"), (0xFC86, "M", "لى"), (0xFC87, "M", "لي"), (0xFC88, "M", "ما"), (0xFC89, "M", "مم"), (0xFC8A, "M", "نر"), (0xFC8B, "M", "نز"), (0xFC8C, "M", "نم"), (0xFC8D, "M", "نن"), (0xFC8E, "M", "نى"), (0xFC8F, "M", "ني"), (0xFC90, "M", "ىٰ"), (0xFC91, "M", "ير"), (0xFC92, "M", "يز"), (0xFC93, "M", "يم"), (0xFC94, "M", "ين"), (0xFC95, "M", "يى"), (0xFC96, "M", "يي"), (0xFC97, "M", "ئج"), ] def _seg_47() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xFC98, "M", "ئح"), (0xFC99, "M", "ئخ"), (0xFC9A, "M", "ئم"), (0xFC9B, "M", "ئه"), (0xFC9C, "M", "بج"), (0xFC9D, "M", "بح"), (0xFC9E, "M", "بخ"), (0xFC9F, "M", "بم"), (0xFCA0, "M", "به"), (0xFCA1, "M", "تج"), (0xFCA2, "M", "تح"), (0xFCA3, "M", "تخ"), (0xFCA4, "M", "تم"), (0xFCA5, "M", "ته"), (0xFCA6, "M", "ثم"), (0xFCA7, "M", "جح"), (0xFCA8, "M", "جم"), (0xFCA9, "M", "حج"), (0xFCAA, "M", "حم"), (0xFCAB, "M", "خج"), (0xFCAC, "M", "خم"), (0xFCAD, "M", "سج"), (0xFCAE, "M", "سح"), (0xFCAF, "M", "سخ"), (0xFCB0, "M", "سم"), (0xFCB1, "M", "صح"), (0xFCB2, "M", "صخ"), (0xFCB3, "M", "صم"), (0xFCB4, "M", "ضج"), (0xFCB5, "M", "ضح"), (0xFCB6, "M", "ضخ"), (0xFCB7, "M", "ضم"), (0xFCB8, "M", "طح"), (0xFCB9, "M", "ظم"), (0xFCBA, "M", "عج"), (0xFCBB, "M", "عم"), (0xFCBC, "M", "غج"), (0xFCBD, "M", "غم"), (0xFCBE, "M", "فج"), (0xFCBF, "M", "فح"), (0xFCC0, "M", "فخ"), (0xFCC1, "M", "فم"), (0xFCC2, "M", "قح"), (0xFCC3, "M", "قم"), (0xFCC4, "M", "كج"), (0xFCC5, "M", "كح"), (0xFCC6, "M", "كخ"), (0xFCC7, "M", "كل"), (0xFCC8, "M", "كم"), (0xFCC9, "M", "لج"), (0xFCCA, "M", "لح"), (0xFCCB, "M", "لخ"), (0xFCCC, "M", "لم"), (0xFCCD, "M", "له"), (0xFCCE, "M", "مج"), (0xFCCF, "M", "مح"), (0xFCD0, "M", "مخ"), (0xFCD1, "M", "مم"), (0xFCD2, "M", "نج"), (0xFCD3, "M", "نح"), (0xFCD4, "M", "نخ"), (0xFCD5, "M", "نم"), (0xFCD6, "M", "نه"), (0xFCD7, "M", "هج"), (0xFCD8, "M", "هم"), (0xFCD9, "M", "هٰ"), (0xFCDA, "M", "يج"), (0xFCDB, "M", "يح"), (0xFCDC, "M", "يخ"), (0xFCDD, "M", "يم"), (0xFCDE, "M", "يه"), (0xFCDF, "M", "ئم"), (0xFCE0, "M", "ئه"), (0xFCE1, "M", "بم"), (0xFCE2, "M", "به"), (0xFCE3, "M", "تم"), (0xFCE4, "M", "ته"), (0xFCE5, "M", "ثم"), (0xFCE6, "M", "ثه"), (0xFCE7, "M", "سم"), (0xFCE8, "M", "سه"), (0xFCE9, "M", "شم"), (0xFCEA, "M", "شه"), (0xFCEB, "M", "كل"), (0xFCEC, "M", "كم"), (0xFCED, "M", "لم"), (0xFCEE, "M", "نم"), (0xFCEF, "M", "نه"), (0xFCF0, "M", "يم"), (0xFCF1, "M", "يه"), (0xFCF2, "M", "ـَّ"), (0xFCF3, "M", "ـُّ"), (0xFCF4, "M", "ـِّ"), (0xFCF5, "M", "طى"), (0xFCF6, "M", "طي"), (0xFCF7, "M", "عى"), (0xFCF8, "M", "عي"), (0xFCF9, "M", "غى"), (0xFCFA, "M", "غي"), (0xFCFB, "M", "سى"), ] def _seg_48() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xFCFC, "M", "سي"), (0xFCFD, "M", "شى"), (0xFCFE, "M", "شي"), (0xFCFF, "M", "حى"), (0xFD00, "M", "حي"), (0xFD01, "M", "جى"), (0xFD02, "M", "جي"), (0xFD03, "M", "خى"), (0xFD04, "M", "خي"), (0xFD05, "M", "صى"), (0xFD06, "M", "صي"), (0xFD07, "M", "ضى"), (0xFD08, "M", "ضي"), (0xFD09, "M", "شج"), (0xFD0A, "M", "شح"), (0xFD0B, "M", "شخ"), (0xFD0C, "M", "شم"), (0xFD0D, "M", "شر"), (0xFD0E, "M", "سر"), (0xFD0F, "M", "صر"), (0xFD10, "M", "ضر"), (0xFD11, "M", "طى"), (0xFD12, "M", "طي"), (0xFD13, "M", "عى"), (0xFD14, "M", "عي"), (0xFD15, "M", "غى"), (0xFD16, "M", "غي"), (0xFD17, "M", "سى"), (0xFD18, "M", "سي"), (0xFD19, "M", "شى"), (0xFD1A, "M", "شي"), (0xFD1B, "M", "حى"), (0xFD1C, "M", "حي"), (0xFD1D, "M", "جى"), (0xFD1E, "M", "جي"), (0xFD1F, "M", "خى"), (0xFD20, "M", "خي"), (0xFD21, "M", "صى"), (0xFD22, "M", "صي"), (0xFD23, "M", "ضى"), (0xFD24, "M", "ضي"), (0xFD25, "M", "شج"), (0xFD26, "M", "شح"), (0xFD27, "M", "شخ"), (0xFD28, "M", "شم"), (0xFD29, "M", "شر"), (0xFD2A, "M", "سر"), (0xFD2B, "M", "صر"), (0xFD2C, "M", "ضر"), (0xFD2D, "M", "شج"), (0xFD2E, "M", "شح"), (0xFD2F, "M", "شخ"), (0xFD30, "M", "شم"), (0xFD31, "M", "سه"), (0xFD32, "M", "شه"), (0xFD33, "M", "طم"), (0xFD34, "M", "سج"), (0xFD35, "M", "سح"), (0xFD36, "M", "سخ"), (0xFD37, "M", "شج"), (0xFD38, "M", "شح"), (0xFD39, "M", "شخ"), (0xFD3A, "M", "طم"), (0xFD3B, "M", "ظم"), (0xFD3C, "M", "اً"), (0xFD3E, "V"), (0xFD50, "M", "تجم"), (0xFD51, "M", "تحج"), (0xFD53, "M", "تحم"), (0xFD54, "M", "تخم"), (0xFD55, "M", "تمج"), (0xFD56, "M", "تمح"), (0xFD57, "M", "تمخ"), (0xFD58, "M", "جمح"), (0xFD5A, "M", "حمي"), (0xFD5B, "M", "حمى"), (0xFD5C, "M", "سحج"), (0xFD5D, "M", "سجح"), (0xFD5E, "M", "سجى"), (0xFD5F, "M", "سمح"), (0xFD61, "M", "سمج"), (0xFD62, "M", "سمم"), (0xFD64, "M", "صحح"), (0xFD66, "M", "صمم"), (0xFD67, "M", "شحم"), (0xFD69, "M", "شجي"), (0xFD6A, "M", "شمخ"), (0xFD6C, "M", "شمم"), (0xFD6E, "M", "ضحى"), (0xFD6F, "M", "ضخم"), (0xFD71, "M", "طمح"), (0xFD73, "M", "طمم"), (0xFD74, "M", "طمي"), (0xFD75, "M", "عجم"), (0xFD76, "M", "عمم"), (0xFD78, "M", "عمى"), (0xFD79, "M", "غمم"), (0xFD7A, "M", "غمي"), (0xFD7B, "M", "غمى"), (0xFD7C, "M", "فخم"), ] def _seg_49() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xFD7E, "M", "قمح"), (0xFD7F, "M", "قمم"), (0xFD80, "M", "لحم"), (0xFD81, "M", "لحي"), (0xFD82, "M", "لحى"), (0xFD83, "M", "لجج"), (0xFD85, "M", "لخم"), (0xFD87, "M", "لمح"), (0xFD89, "M", "محج"), (0xFD8A, "M", "محم"), (0xFD8B, "M", "محي"), (0xFD8C, "M", "مجح"), (0xFD8D, "M", "مجم"), (0xFD8E, "M", "مخج"), (0xFD8F, "M", "مخم"), (0xFD90, "X"), (0xFD92, "M", "مجخ"), (0xFD93, "M", "همج"), (0xFD94, "M", "همم"), (0xFD95, "M", "نحم"), (0xFD96, "M", "نحى"), (0xFD97, "M", "نجم"), (0xFD99, "M", "نجى"), (0xFD9A, "M", "نمي"), (0xFD9B, "M", "نمى"), (0xFD9C, "M", "يمم"), (0xFD9E, "M", "بخي"), (0xFD9F, "M", "تجي"), (0xFDA0, "M", "تجى"), (0xFDA1, "M", "تخي"), (0xFDA2, "M", "تخى"), (0xFDA3, "M", "تمي"), (0xFDA4, "M", "تمى"), (0xFDA5, "M", "جمي"), (0xFDA6, "M", "جحى"), (0xFDA7, "M", "جمى"), (0xFDA8, "M", "سخى"), (0xFDA9, "M", "صحي"), (0xFDAA, "M", "شحي"), (0xFDAB, "M", "ضحي"), (0xFDAC, "M", "لجي"), (0xFDAD, "M", "لمي"), (0xFDAE, "M", "يحي"), (0xFDAF, "M", "يجي"), (0xFDB0, "M", "يمي"), (0xFDB1, "M", "ممي"), (0xFDB2, "M", "قمي"), (0xFDB3, "M", "نحي"), (0xFDB4, "M", "قمح"), (0xFDB5, "M", "لحم"), (0xFDB6, "M", "عمي"), (0xFDB7, "M", "كمي"), (0xFDB8, "M", "نجح"), (0xFDB9, "M", "مخي"), (0xFDBA, "M", "لجم"), (0xFDBB, "M", "كمم"), (0xFDBC, "M", "لجم"), (0xFDBD, "M", "نجح"), (0xFDBE, "M", "جحي"), (0xFDBF, "M", "حجي"), (0xFDC0, "M", "مجي"), (0xFDC1, "M", "فمي"), (0xFDC2, "M", "بحي"), (0xFDC3, "M", "كمم"), (0xFDC4, "M", "عجم"), (0xFDC5, "M", "صمم"), (0xFDC6, "M", "سخي"), (0xFDC7, "M", "نجي"), (0xFDC8, "X"), (0xFDCF, "V"), (0xFDD0, "X"), (0xFDF0, "M", "صلے"), (0xFDF1, "M", "قلے"), (0xFDF2, "M", "الله"), (0xFDF3, "M", "اكبر"), (0xFDF4, "M", "محمد"), (0xFDF5, "M", "صلعم"), (0xFDF6, "M", "رسول"), (0xFDF7, "M", "عليه"), (0xFDF8, "M", "وسلم"), (0xFDF9, "M", "صلى"), (0xFDFA, "M", "صلى الله عليه وسلم"), (0xFDFB, "M", "جل جلاله"), (0xFDFC, "M", "ریال"), (0xFDFD, "V"), (0xFE00, "I"), (0xFE10, "M", ","), (0xFE11, "M", "、"), (0xFE12, "X"), (0xFE13, "M", ":"), (0xFE14, "M", ";"), (0xFE15, "M", "!"), (0xFE16, "M", "?"), (0xFE17, "M", "〖"), (0xFE18, "M", "〗"), (0xFE19, "X"), (0xFE20, "V"), (0xFE30, "X"), (0xFE31, "M", "—"), (0xFE32, "M", "–"), ] def _seg_50() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xFE33, "M", "_"), (0xFE35, "M", "("), (0xFE36, "M", ")"), (0xFE37, "M", "{"), (0xFE38, "M", "}"), (0xFE39, "M", "〔"), (0xFE3A, "M", "〕"), (0xFE3B, "M", "【"), (0xFE3C, "M", "】"), (0xFE3D, "M", "《"), (0xFE3E, "M", "》"), (0xFE3F, "M", "〈"), (0xFE40, "M", "〉"), (0xFE41, "M", "「"), (0xFE42, "M", "」"), (0xFE43, "M", "『"), (0xFE44, "M", "』"), (0xFE45, "V"), (0xFE47, "M", "["), (0xFE48, "M", "]"), (0xFE49, "M", " ̅"), (0xFE4D, "M", "_"), (0xFE50, "M", ","), (0xFE51, "M", "、"), (0xFE52, "X"), (0xFE54, "M", ";"), (0xFE55, "M", ":"), (0xFE56, "M", "?"), (0xFE57, "M", "!"), (0xFE58, "M", "—"), (0xFE59, "M", "("), (0xFE5A, "M", ")"), (0xFE5B, "M", "{"), (0xFE5C, "M", "}"), (0xFE5D, "M", "〔"), (0xFE5E, "M", "〕"), (0xFE5F, "M", "#"), (0xFE60, "M", "&"), (0xFE61, "M", "*"), (0xFE62, "M", "+"), (0xFE63, "M", "-"), (0xFE64, "M", "<"), (0xFE65, "M", ">"), (0xFE66, "M", "="), (0xFE67, "X"), (0xFE68, "M", "\\"), (0xFE69, "M", "$"), (0xFE6A, "M", "%"), (0xFE6B, "M", "@"), (0xFE6C, "X"), (0xFE70, "M", " ً"), (0xFE71, "M", "ـً"), (0xFE72, "M", " ٌ"), (0xFE73, "V"), (0xFE74, "M", " ٍ"), (0xFE75, "X"), (0xFE76, "M", " َ"), (0xFE77, "M", "ـَ"), (0xFE78, "M", " ُ"), (0xFE79, "M", "ـُ"), (0xFE7A, "M", " ِ"), (0xFE7B, "M", "ـِ"), (0xFE7C, "M", " ّ"), (0xFE7D, "M", "ـّ"), (0xFE7E, "M", " ْ"), (0xFE7F, "M", "ـْ"), (0xFE80, "M", "ء"), (0xFE81, "M", "آ"), (0xFE83, "M", "أ"), (0xFE85, "M", "ؤ"), (0xFE87, "M", "إ"), (0xFE89, "M", "ئ"), (0xFE8D, "M", "ا"), (0xFE8F, "M", "ب"), (0xFE93, "M", "ة"), (0xFE95, "M", "ت"), (0xFE99, "M", "ث"), (0xFE9D, "M", "ج"), (0xFEA1, "M", "ح"), (0xFEA5, "M", "خ"), (0xFEA9, "M", "د"), (0xFEAB, "M", "ذ"), (0xFEAD, "M", "ر"), (0xFEAF, "M", "ز"), (0xFEB1, "M", "س"), (0xFEB5, "M", "ش"), (0xFEB9, "M", "ص"), (0xFEBD, "M", "ض"), (0xFEC1, "M", "ط"), (0xFEC5, "M", "ظ"), (0xFEC9, "M", "ع"), (0xFECD, "M", "غ"), (0xFED1, "M", "ف"), (0xFED5, "M", "ق"), (0xFED9, "M", "ك"), (0xFEDD, "M", "ل"), (0xFEE1, "M", "م"), (0xFEE5, "M", "ن"), (0xFEE9, "M", "ه"), (0xFEED, "M", "و"), ] def _seg_51() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xFEEF, "M", "ى"), (0xFEF1, "M", "ي"), (0xFEF5, "M", "لآ"), (0xFEF7, "M", "لأ"), (0xFEF9, "M", "لإ"), (0xFEFB, "M", "لا"), (0xFEFD, "X"), (0xFEFF, "I"), (0xFF00, "X"), (0xFF01, "M", "!"), (0xFF02, "M", '"'), (0xFF03, "M", "#"), (0xFF04, "M", "$"), (0xFF05, "M", "%"), (0xFF06, "M", "&"), (0xFF07, "M", "'"), (0xFF08, "M", "("), (0xFF09, "M", ")"), (0xFF0A, "M", "*"), (0xFF0B, "M", "+"), (0xFF0C, "M", ","), (0xFF0D, "M", "-"), (0xFF0E, "M", "."), (0xFF0F, "M", "/"), (0xFF10, "M", "0"), (0xFF11, "M", "1"), (0xFF12, "M", "2"), (0xFF13, "M", "3"), (0xFF14, "M", "4"), (0xFF15, "M", "5"), (0xFF16, "M", "6"), (0xFF17, "M", "7"), (0xFF18, "M", "8"), (0xFF19, "M", "9"), (0xFF1A, "M", ":"), (0xFF1B, "M", ";"), (0xFF1C, "M", "<"), (0xFF1D, "M", "="), (0xFF1E, "M", ">"), (0xFF1F, "M", "?"), (0xFF20, "M", "@"), (0xFF21, "M", "a"), (0xFF22, "M", "b"), (0xFF23, "M", "c"), (0xFF24, "M", "d"), (0xFF25, "M", "e"), (0xFF26, "M", "f"), (0xFF27, "M", "g"), (0xFF28, "M", "h"), (0xFF29, "M", "i"), (0xFF2A, "M", "j"), (0xFF2B, "M", "k"), (0xFF2C, "M", "l"), (0xFF2D, "M", "m"), (0xFF2E, "M", "n"), (0xFF2F, "M", "o"), (0xFF30, "M", "p"), (0xFF31, "M", "q"), (0xFF32, "M", "r"), (0xFF33, "M", "s"), (0xFF34, "M", "t"), (0xFF35, "M", "u"), (0xFF36, "M", "v"), (0xFF37, "M", "w"), (0xFF38, "M", "x"), (0xFF39, "M", "y"), (0xFF3A, "M", "z"), (0xFF3B, "M", "["), (0xFF3C, "M", "\\"), (0xFF3D, "M", "]"), (0xFF3E, "M", "^"), (0xFF3F, "M", "_"), (0xFF40, "M", "`"), (0xFF41, "M", "a"), (0xFF42, "M", "b"), (0xFF43, "M", "c"), (0xFF44, "M", "d"), (0xFF45, "M", "e"), (0xFF46, "M", "f"), (0xFF47, "M", "g"), (0xFF48, "M", "h"), (0xFF49, "M", "i"), (0xFF4A, "M", "j"), (0xFF4B, "M", "k"), (0xFF4C, "M", "l"), (0xFF4D, "M", "m"), (0xFF4E, "M", "n"), (0xFF4F, "M", "o"), (0xFF50, "M", "p"), (0xFF51, "M", "q"), (0xFF52, "M", "r"), (0xFF53, "M", "s"), (0xFF54, "M", "t"), (0xFF55, "M", "u"), (0xFF56, "M", "v"), (0xFF57, "M", "w"), (0xFF58, "M", "x"), (0xFF59, "M", "y"), (0xFF5A, "M", "z"), (0xFF5B, "M", "{"), ] def _seg_52() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xFF5C, "M", "|"), (0xFF5D, "M", "}"), (0xFF5E, "M", "~"), (0xFF5F, "M", "⦅"), (0xFF60, "M", "⦆"), (0xFF61, "M", "."), (0xFF62, "M", "「"), (0xFF63, "M", "」"), (0xFF64, "M", "、"), (0xFF65, "M", "・"), (0xFF66, "M", "ヲ"), (0xFF67, "M", "ァ"), (0xFF68, "M", "ィ"), (0xFF69, "M", "ゥ"), (0xFF6A, "M", "ェ"), (0xFF6B, "M", "ォ"), (0xFF6C, "M", "ャ"), (0xFF6D, "M", "ュ"), (0xFF6E, "M", "ョ"), (0xFF6F, "M", "ッ"), (0xFF70, "M", "ー"), (0xFF71, "M", "ア"), (0xFF72, "M", "イ"), (0xFF73, "M", "ウ"), (0xFF74, "M", "エ"), (0xFF75, "M", "オ"), (0xFF76, "M", "カ"), (0xFF77, "M", "キ"), (0xFF78, "M", "ク"), (0xFF79, "M", "ケ"), (0xFF7A, "M", "コ"), (0xFF7B, "M", "サ"), (0xFF7C, "M", "シ"), (0xFF7D, "M", "ス"), (0xFF7E, "M", "セ"), (0xFF7F, "M", "ソ"), (0xFF80, "M", "タ"), (0xFF81, "M", "チ"), (0xFF82, "M", "ツ"), (0xFF83, "M", "テ"), (0xFF84, "M", "ト"), (0xFF85, "M", "ナ"), (0xFF86, "M", "ニ"), (0xFF87, "M", "ヌ"), (0xFF88, "M", "ネ"), (0xFF89, "M", "ノ"), (0xFF8A, "M", "ハ"), (0xFF8B, "M", "ヒ"), (0xFF8C, "M", "フ"), (0xFF8D, "M", "ヘ"), (0xFF8E, "M", "ホ"), (0xFF8F, "M", "マ"), (0xFF90, "M", "ミ"), (0xFF91, "M", "ム"), (0xFF92, "M", "メ"), (0xFF93, "M", "モ"), (0xFF94, "M", "ヤ"), (0xFF95, "M", "ユ"), (0xFF96, "M", "ヨ"), (0xFF97, "M", "ラ"), (0xFF98, "M", "リ"), (0xFF99, "M", "ル"), (0xFF9A, "M", "レ"), (0xFF9B, "M", "ロ"), (0xFF9C, "M", "ワ"), (0xFF9D, "M", "ン"), (0xFF9E, "M", "゙"), (0xFF9F, "M", "゚"), (0xFFA0, "I"), (0xFFA1, "M", "ᄀ"), (0xFFA2, "M", "ᄁ"), (0xFFA3, "M", "ᆪ"), (0xFFA4, "M", "ᄂ"), (0xFFA5, "M", "ᆬ"), (0xFFA6, "M", "ᆭ"), (0xFFA7, "M", "ᄃ"), (0xFFA8, "M", "ᄄ"), (0xFFA9, "M", "ᄅ"), (0xFFAA, "M", "ᆰ"), (0xFFAB, "M", "ᆱ"), (0xFFAC, "M", "ᆲ"), (0xFFAD, "M", "ᆳ"), (0xFFAE, "M", "ᆴ"), (0xFFAF, "M", "ᆵ"), (0xFFB0, "M", "ᄚ"), (0xFFB1, "M", "ᄆ"), (0xFFB2, "M", "ᄇ"), (0xFFB3, "M", "ᄈ"), (0xFFB4, "M", "ᄡ"), (0xFFB5, "M", "ᄉ"), (0xFFB6, "M", "ᄊ"), (0xFFB7, "M", "ᄋ"), (0xFFB8, "M", "ᄌ"), (0xFFB9, "M", "ᄍ"), (0xFFBA, "M", "ᄎ"), (0xFFBB, "M", "ᄏ"), (0xFFBC, "M", "ᄐ"), (0xFFBD, "M", "ᄑ"), (0xFFBE, "M", "ᄒ"), (0xFFBF, "X"), ] def _seg_53() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0xFFC2, "M", "ᅡ"), (0xFFC3, "M", "ᅢ"), (0xFFC4, "M", "ᅣ"), (0xFFC5, "M", "ᅤ"), (0xFFC6, "M", "ᅥ"), (0xFFC7, "M", "ᅦ"), (0xFFC8, "X"), (0xFFCA, "M", "ᅧ"), (0xFFCB, "M", "ᅨ"), (0xFFCC, "M", "ᅩ"), (0xFFCD, "M", "ᅪ"), (0xFFCE, "M", "ᅫ"), (0xFFCF, "M", "ᅬ"), (0xFFD0, "X"), (0xFFD2, "M", "ᅭ"), (0xFFD3, "M", "ᅮ"), (0xFFD4, "M", "ᅯ"), (0xFFD5, "M", "ᅰ"), (0xFFD6, "M", "ᅱ"), (0xFFD7, "M", "ᅲ"), (0xFFD8, "X"), (0xFFDA, "M", "ᅳ"), (0xFFDB, "M", "ᅴ"), (0xFFDC, "M", "ᅵ"), (0xFFDD, "X"), (0xFFE0, "M", "¢"), (0xFFE1, "M", "£"), (0xFFE2, "M", "¬"), (0xFFE3, "M", " ̄"), (0xFFE4, "M", "¦"), (0xFFE5, "M", "¥"), (0xFFE6, "M", "₩"), (0xFFE7, "X"), (0xFFE8, "M", "│"), (0xFFE9, "M", "←"), (0xFFEA, "M", "↑"), (0xFFEB, "M", "→"), (0xFFEC, "M", "↓"), (0xFFED, "M", "■"), (0xFFEE, "M", "○"), (0xFFEF, "X"), (0x10000, "V"), (0x1000C, "X"), (0x1000D, "V"), (0x10027, "X"), (0x10028, "V"), (0x1003B, "X"), (0x1003C, "V"), (0x1003E, "X"), (0x1003F, "V"), (0x1004E, "X"), (0x10050, "V"), (0x1005E, "X"), (0x10080, "V"), (0x100FB, "X"), (0x10100, "V"), (0x10103, "X"), (0x10107, "V"), (0x10134, "X"), (0x10137, "V"), (0x1018F, "X"), (0x10190, "V"), (0x1019D, "X"), (0x101A0, "V"), (0x101A1, "X"), (0x101D0, "V"), (0x101FE, "X"), (0x10280, "V"), (0x1029D, "X"), (0x102A0, "V"), (0x102D1, "X"), (0x102E0, "V"), (0x102FC, "X"), (0x10300, "V"), (0x10324, "X"), (0x1032D, "V"), (0x1034B, "X"), (0x10350, "V"), (0x1037B, "X"), (0x10380, "V"), (0x1039E, "X"), (0x1039F, "V"), (0x103C4, "X"), (0x103C8, "V"), (0x103D6, "X"), (0x10400, "M", "𐐨"), (0x10401, "M", "𐐩"), (0x10402, "M", "𐐪"), (0x10403, "M", "𐐫"), (0x10404, "M", "𐐬"), (0x10405, "M", "𐐭"), (0x10406, "M", "𐐮"), (0x10407, "M", "𐐯"), (0x10408, "M", "𐐰"), (0x10409, "M", "𐐱"), (0x1040A, "M", "𐐲"), (0x1040B, "M", "𐐳"), (0x1040C, "M", "𐐴"), (0x1040D, "M", "𐐵"), (0x1040E, "M", "𐐶"), ] def _seg_54() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1040F, "M", "𐐷"), (0x10410, "M", "𐐸"), (0x10411, "M", "𐐹"), (0x10412, "M", "𐐺"), (0x10413, "M", "𐐻"), (0x10414, "M", "𐐼"), (0x10415, "M", "𐐽"), (0x10416, "M", "𐐾"), (0x10417, "M", "𐐿"), (0x10418, "M", "𐑀"), (0x10419, "M", "𐑁"), (0x1041A, "M", "𐑂"), (0x1041B, "M", "𐑃"), (0x1041C, "M", "𐑄"), (0x1041D, "M", "𐑅"), (0x1041E, "M", "𐑆"), (0x1041F, "M", "𐑇"), (0x10420, "M", "𐑈"), (0x10421, "M", "𐑉"), (0x10422, "M", "𐑊"), (0x10423, "M", "𐑋"), (0x10424, "M", "𐑌"), (0x10425, "M", "𐑍"), (0x10426, "M", "𐑎"), (0x10427, "M", "𐑏"), (0x10428, "V"), (0x1049E, "X"), (0x104A0, "V"), (0x104AA, "X"), (0x104B0, "M", "𐓘"), (0x104B1, "M", "𐓙"), (0x104B2, "M", "𐓚"), (0x104B3, "M", "𐓛"), (0x104B4, "M", "𐓜"), (0x104B5, "M", "𐓝"), (0x104B6, "M", "𐓞"), (0x104B7, "M", "𐓟"), (0x104B8, "M", "𐓠"), (0x104B9, "M", "𐓡"), (0x104BA, "M", "𐓢"), (0x104BB, "M", "𐓣"), (0x104BC, "M", "𐓤"), (0x104BD, "M", "𐓥"), (0x104BE, "M", "𐓦"), (0x104BF, "M", "𐓧"), (0x104C0, "M", "𐓨"), (0x104C1, "M", "𐓩"), (0x104C2, "M", "𐓪"), (0x104C3, "M", "𐓫"), (0x104C4, "M", "𐓬"), (0x104C5, "M", "𐓭"), (0x104C6, "M", "𐓮"), (0x104C7, "M", "𐓯"), (0x104C8, "M", "𐓰"), (0x104C9, "M", "𐓱"), (0x104CA, "M", "𐓲"), (0x104CB, "M", "𐓳"), (0x104CC, "M", "𐓴"), (0x104CD, "M", "𐓵"), (0x104CE, "M", "𐓶"), (0x104CF, "M", "𐓷"), (0x104D0, "M", "𐓸"), (0x104D1, "M", "𐓹"), (0x104D2, "M", "𐓺"), (0x104D3, "M", "𐓻"), (0x104D4, "X"), (0x104D8, "V"), (0x104FC, "X"), (0x10500, "V"), (0x10528, "X"), (0x10530, "V"), (0x10564, "X"), (0x1056F, "V"), (0x10570, "M", "𐖗"), (0x10571, "M", "𐖘"), (0x10572, "M", "𐖙"), (0x10573, "M", "𐖚"), (0x10574, "M", "𐖛"), (0x10575, "M", "𐖜"), (0x10576, "M", "𐖝"), (0x10577, "M", "𐖞"), (0x10578, "M", "𐖟"), (0x10579, "M", "𐖠"), (0x1057A, "M", "𐖡"), (0x1057B, "X"), (0x1057C, "M", "𐖣"), (0x1057D, "M", "𐖤"), (0x1057E, "M", "𐖥"), (0x1057F, "M", "𐖦"), (0x10580, "M", "𐖧"), (0x10581, "M", "𐖨"), (0x10582, "M", "𐖩"), (0x10583, "M", "𐖪"), (0x10584, "M", "𐖫"), (0x10585, "M", "𐖬"), (0x10586, "M", "𐖭"), (0x10587, "M", "𐖮"), (0x10588, "M", "𐖯"), (0x10589, "M", "𐖰"), (0x1058A, "M", "𐖱"), ] def _seg_55() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1058B, "X"), (0x1058C, "M", "𐖳"), (0x1058D, "M", "𐖴"), (0x1058E, "M", "𐖵"), (0x1058F, "M", "𐖶"), (0x10590, "M", "𐖷"), (0x10591, "M", "𐖸"), (0x10592, "M", "𐖹"), (0x10593, "X"), (0x10594, "M", "𐖻"), (0x10595, "M", "𐖼"), (0x10596, "X"), (0x10597, "V"), (0x105A2, "X"), (0x105A3, "V"), (0x105B2, "X"), (0x105B3, "V"), (0x105BA, "X"), (0x105BB, "V"), (0x105BD, "X"), (0x105C0, "V"), (0x105F4, "X"), (0x10600, "V"), (0x10737, "X"), (0x10740, "V"), (0x10756, "X"), (0x10760, "V"), (0x10768, "X"), (0x10780, "V"), (0x10781, "M", "ː"), (0x10782, "M", "ˑ"), (0x10783, "M", "æ"), (0x10784, "M", "ʙ"), (0x10785, "M", "ɓ"), (0x10786, "X"), (0x10787, "M", "ʣ"), (0x10788, "M", "ꭦ"), (0x10789, "M", "ʥ"), (0x1078A, "M", "ʤ"), (0x1078B, "M", "ɖ"), (0x1078C, "M", "ɗ"), (0x1078D, "M", "ᶑ"), (0x1078E, "M", "ɘ"), (0x1078F, "M", "ɞ"), (0x10790, "M", "ʩ"), (0x10791, "M", "ɤ"), (0x10792, "M", "ɢ"), (0x10793, "M", "ɠ"), (0x10794, "M", "ʛ"), (0x10795, "M", "ħ"), (0x10796, "M", "ʜ"), (0x10797, "M", "ɧ"), (0x10798, "M", "ʄ"), (0x10799, "M", "ʪ"), (0x1079A, "M", "ʫ"), (0x1079B, "M", "ɬ"), (0x1079C, "M", "𝼄"), (0x1079D, "M", "ꞎ"), (0x1079E, "M", "ɮ"), (0x1079F, "M", "𝼅"), (0x107A0, "M", "ʎ"), (0x107A1, "M", "𝼆"), (0x107A2, "M", "ø"), (0x107A3, "M", "ɶ"), (0x107A4, "M", "ɷ"), (0x107A5, "M", "q"), (0x107A6, "M", "ɺ"), (0x107A7, "M", "𝼈"), (0x107A8, "M", "ɽ"), (0x107A9, "M", "ɾ"), (0x107AA, "M", "ʀ"), (0x107AB, "M", "ʨ"), (0x107AC, "M", "ʦ"), (0x107AD, "M", "ꭧ"), (0x107AE, "M", "ʧ"), (0x107AF, "M", "ʈ"), (0x107B0, "M", "ⱱ"), (0x107B1, "X"), (0x107B2, "M", "ʏ"), (0x107B3, "M", "ʡ"), (0x107B4, "M", "ʢ"), (0x107B5, "M", "ʘ"), (0x107B6, "M", "ǀ"), (0x107B7, "M", "ǁ"), (0x107B8, "M", "ǂ"), (0x107B9, "M", "𝼊"), (0x107BA, "M", "𝼞"), (0x107BB, "X"), (0x10800, "V"), (0x10806, "X"), (0x10808, "V"), (0x10809, "X"), (0x1080A, "V"), (0x10836, "X"), (0x10837, "V"), (0x10839, "X"), (0x1083C, "V"), (0x1083D, "X"), (0x1083F, "V"), (0x10856, "X"), ] def _seg_56() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x10857, "V"), (0x1089F, "X"), (0x108A7, "V"), (0x108B0, "X"), (0x108E0, "V"), (0x108F3, "X"), (0x108F4, "V"), (0x108F6, "X"), (0x108FB, "V"), (0x1091C, "X"), (0x1091F, "V"), (0x1093A, "X"), (0x1093F, "V"), (0x10940, "X"), (0x10980, "V"), (0x109B8, "X"), (0x109BC, "V"), (0x109D0, "X"), (0x109D2, "V"), (0x10A04, "X"), (0x10A05, "V"), (0x10A07, "X"), (0x10A0C, "V"), (0x10A14, "X"), (0x10A15, "V"), (0x10A18, "X"), (0x10A19, "V"), (0x10A36, "X"), (0x10A38, "V"), (0x10A3B, "X"), (0x10A3F, "V"), (0x10A49, "X"), (0x10A50, "V"), (0x10A59, "X"), (0x10A60, "V"), (0x10AA0, "X"), (0x10AC0, "V"), (0x10AE7, "X"), (0x10AEB, "V"), (0x10AF7, "X"), (0x10B00, "V"), (0x10B36, "X"), (0x10B39, "V"), (0x10B56, "X"), (0x10B58, "V"), (0x10B73, "X"), (0x10B78, "V"), (0x10B92, "X"), (0x10B99, "V"), (0x10B9D, "X"), (0x10BA9, "V"), (0x10BB0, "X"), (0x10C00, "V"), (0x10C49, "X"), (0x10C80, "M", "𐳀"), (0x10C81, "M", "𐳁"), (0x10C82, "M", "𐳂"), (0x10C83, "M", "𐳃"), (0x10C84, "M", "𐳄"), (0x10C85, "M", "𐳅"), (0x10C86, "M", "𐳆"), (0x10C87, "M", "𐳇"), (0x10C88, "M", "𐳈"), (0x10C89, "M", "𐳉"), (0x10C8A, "M", "𐳊"), (0x10C8B, "M", "𐳋"), (0x10C8C, "M", "𐳌"), (0x10C8D, "M", "𐳍"), (0x10C8E, "M", "𐳎"), (0x10C8F, "M", "𐳏"), (0x10C90, "M", "𐳐"), (0x10C91, "M", "𐳑"), (0x10C92, "M", "𐳒"), (0x10C93, "M", "𐳓"), (0x10C94, "M", "𐳔"), (0x10C95, "M", "𐳕"), (0x10C96, "M", "𐳖"), (0x10C97, "M", "𐳗"), (0x10C98, "M", "𐳘"), (0x10C99, "M", "𐳙"), (0x10C9A, "M", "𐳚"), (0x10C9B, "M", "𐳛"), (0x10C9C, "M", "𐳜"), (0x10C9D, "M", "𐳝"), (0x10C9E, "M", "𐳞"), (0x10C9F, "M", "𐳟"), (0x10CA0, "M", "𐳠"), (0x10CA1, "M", "𐳡"), (0x10CA2, "M", "𐳢"), (0x10CA3, "M", "𐳣"), (0x10CA4, "M", "𐳤"), (0x10CA5, "M", "𐳥"), (0x10CA6, "M", "𐳦"), (0x10CA7, "M", "𐳧"), (0x10CA8, "M", "𐳨"), (0x10CA9, "M", "𐳩"), (0x10CAA, "M", "𐳪"), (0x10CAB, "M", "𐳫"), (0x10CAC, "M", "𐳬"), (0x10CAD, "M", "𐳭"), ] def _seg_57() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x10CAE, "M", "𐳮"), (0x10CAF, "M", "𐳯"), (0x10CB0, "M", "𐳰"), (0x10CB1, "M", "𐳱"), (0x10CB2, "M", "𐳲"), (0x10CB3, "X"), (0x10CC0, "V"), (0x10CF3, "X"), (0x10CFA, "V"), (0x10D28, "X"), (0x10D30, "V"), (0x10D3A, "X"), (0x10D40, "V"), (0x10D50, "M", "𐵰"), (0x10D51, "M", "𐵱"), (0x10D52, "M", "𐵲"), (0x10D53, "M", "𐵳"), (0x10D54, "M", "𐵴"), (0x10D55, "M", "𐵵"), (0x10D56, "M", "𐵶"), (0x10D57, "M", "𐵷"), (0x10D58, "M", "𐵸"), (0x10D59, "M", "𐵹"), (0x10D5A, "M", "𐵺"), (0x10D5B, "M", "𐵻"), (0x10D5C, "M", "𐵼"), (0x10D5D, "M", "𐵽"), (0x10D5E, "M", "𐵾"), (0x10D5F, "M", "𐵿"), (0x10D60, "M", "𐶀"), (0x10D61, "M", "𐶁"), (0x10D62, "M", "𐶂"), (0x10D63, "M", "𐶃"), (0x10D64, "M", "𐶄"), (0x10D65, "M", "𐶅"), (0x10D66, "X"), (0x10D69, "V"), (0x10D86, "X"), (0x10D8E, "V"), (0x10D90, "X"), (0x10E60, "V"), (0x10E7F, "X"), (0x10E80, "V"), (0x10EAA, "X"), (0x10EAB, "V"), (0x10EAE, "X"), (0x10EB0, "V"), (0x10EB2, "X"), (0x10EC2, "V"), (0x10EC5, "X"), (0x10EFC, "V"), (0x10F28, "X"), (0x10F30, "V"), (0x10F5A, "X"), (0x10F70, "V"), (0x10F8A, "X"), (0x10FB0, "V"), (0x10FCC, "X"), (0x10FE0, "V"), (0x10FF7, "X"), (0x11000, "V"), (0x1104E, "X"), (0x11052, "V"), (0x11076, "X"), (0x1107F, "V"), (0x110BD, "X"), (0x110BE, "V"), (0x110C3, "X"), (0x110D0, "V"), (0x110E9, "X"), (0x110F0, "V"), (0x110FA, "X"), (0x11100, "V"), (0x11135, "X"), (0x11136, "V"), (0x11148, "X"), (0x11150, "V"), (0x11177, "X"), (0x11180, "V"), (0x111E0, "X"), (0x111E1, "V"), (0x111F5, "X"), (0x11200, "V"), (0x11212, "X"), (0x11213, "V"), (0x11242, "X"), (0x11280, "V"), (0x11287, "X"), (0x11288, "V"), (0x11289, "X"), (0x1128A, "V"), (0x1128E, "X"), (0x1128F, "V"), (0x1129E, "X"), (0x1129F, "V"), (0x112AA, "X"), (0x112B0, "V"), (0x112EB, "X"), (0x112F0, "V"), (0x112FA, "X"), ] def _seg_58() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x11300, "V"), (0x11304, "X"), (0x11305, "V"), (0x1130D, "X"), (0x1130F, "V"), (0x11311, "X"), (0x11313, "V"), (0x11329, "X"), (0x1132A, "V"), (0x11331, "X"), (0x11332, "V"), (0x11334, "X"), (0x11335, "V"), (0x1133A, "X"), (0x1133B, "V"), (0x11345, "X"), (0x11347, "V"), (0x11349, "X"), (0x1134B, "V"), (0x1134E, "X"), (0x11350, "V"), (0x11351, "X"), (0x11357, "V"), (0x11358, "X"), (0x1135D, "V"), (0x11364, "X"), (0x11366, "V"), (0x1136D, "X"), (0x11370, "V"), (0x11375, "X"), (0x11380, "V"), (0x1138A, "X"), (0x1138B, "V"), (0x1138C, "X"), (0x1138E, "V"), (0x1138F, "X"), (0x11390, "V"), (0x113B6, "X"), (0x113B7, "V"), (0x113C1, "X"), (0x113C2, "V"), (0x113C3, "X"), (0x113C5, "V"), (0x113C6, "X"), (0x113C7, "V"), (0x113CB, "X"), (0x113CC, "V"), (0x113D6, "X"), (0x113D7, "V"), (0x113D9, "X"), (0x113E1, "V"), (0x113E3, "X"), (0x11400, "V"), (0x1145C, "X"), (0x1145D, "V"), (0x11462, "X"), (0x11480, "V"), (0x114C8, "X"), (0x114D0, "V"), (0x114DA, "X"), (0x11580, "V"), (0x115B6, "X"), (0x115B8, "V"), (0x115DE, "X"), (0x11600, "V"), (0x11645, "X"), (0x11650, "V"), (0x1165A, "X"), (0x11660, "V"), (0x1166D, "X"), (0x11680, "V"), (0x116BA, "X"), (0x116C0, "V"), (0x116CA, "X"), (0x116D0, "V"), (0x116E4, "X"), (0x11700, "V"), (0x1171B, "X"), (0x1171D, "V"), (0x1172C, "X"), (0x11730, "V"), (0x11747, "X"), (0x11800, "V"), (0x1183C, "X"), (0x118A0, "M", "𑣀"), (0x118A1, "M", "𑣁"), (0x118A2, "M", "𑣂"), (0x118A3, "M", "𑣃"), (0x118A4, "M", "𑣄"), (0x118A5, "M", "𑣅"), (0x118A6, "M", "𑣆"), (0x118A7, "M", "𑣇"), (0x118A8, "M", "𑣈"), (0x118A9, "M", "𑣉"), (0x118AA, "M", "𑣊"), (0x118AB, "M", "𑣋"), (0x118AC, "M", "𑣌"), (0x118AD, "M", "𑣍"), (0x118AE, "M", "𑣎"), (0x118AF, "M", "𑣏"), ] def _seg_59() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x118B0, "M", "𑣐"), (0x118B1, "M", "𑣑"), (0x118B2, "M", "𑣒"), (0x118B3, "M", "𑣓"), (0x118B4, "M", "𑣔"), (0x118B5, "M", "𑣕"), (0x118B6, "M", "𑣖"), (0x118B7, "M", "𑣗"), (0x118B8, "M", "𑣘"), (0x118B9, "M", "𑣙"), (0x118BA, "M", "𑣚"), (0x118BB, "M", "𑣛"), (0x118BC, "M", "𑣜"), (0x118BD, "M", "𑣝"), (0x118BE, "M", "𑣞"), (0x118BF, "M", "𑣟"), (0x118C0, "V"), (0x118F3, "X"), (0x118FF, "V"), (0x11907, "X"), (0x11909, "V"), (0x1190A, "X"), (0x1190C, "V"), (0x11914, "X"), (0x11915, "V"), (0x11917, "X"), (0x11918, "V"), (0x11936, "X"), (0x11937, "V"), (0x11939, "X"), (0x1193B, "V"), (0x11947, "X"), (0x11950, "V"), (0x1195A, "X"), (0x119A0, "V"), (0x119A8, "X"), (0x119AA, "V"), (0x119D8, "X"), (0x119DA, "V"), (0x119E5, "X"), (0x11A00, "V"), (0x11A48, "X"), (0x11A50, "V"), (0x11AA3, "X"), (0x11AB0, "V"), (0x11AF9, "X"), (0x11B00, "V"), (0x11B0A, "X"), (0x11BC0, "V"), (0x11BE2, "X"), (0x11BF0, "V"), (0x11BFA, "X"), (0x11C00, "V"), (0x11C09, "X"), (0x11C0A, "V"), (0x11C37, "X"), (0x11C38, "V"), (0x11C46, "X"), (0x11C50, "V"), (0x11C6D, "X"), (0x11C70, "V"), (0x11C90, "X"), (0x11C92, "V"), (0x11CA8, "X"), (0x11CA9, "V"), (0x11CB7, "X"), (0x11D00, "V"), (0x11D07, "X"), (0x11D08, "V"), (0x11D0A, "X"), (0x11D0B, "V"), (0x11D37, "X"), (0x11D3A, "V"), (0x11D3B, "X"), (0x11D3C, "V"), (0x11D3E, "X"), (0x11D3F, "V"), (0x11D48, "X"), (0x11D50, "V"), (0x11D5A, "X"), (0x11D60, "V"), (0x11D66, "X"), (0x11D67, "V"), (0x11D69, "X"), (0x11D6A, "V"), (0x11D8F, "X"), (0x11D90, "V"), (0x11D92, "X"), (0x11D93, "V"), (0x11D99, "X"), (0x11DA0, "V"), (0x11DAA, "X"), (0x11EE0, "V"), (0x11EF9, "X"), (0x11F00, "V"), (0x11F11, "X"), (0x11F12, "V"), (0x11F3B, "X"), (0x11F3E, "V"), (0x11F5B, "X"), ] def _seg_60() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x11FB0, "V"), (0x11FB1, "X"), (0x11FC0, "V"), (0x11FF2, "X"), (0x11FFF, "V"), (0x1239A, "X"), (0x12400, "V"), (0x1246F, "X"), (0x12470, "V"), (0x12475, "X"), (0x12480, "V"), (0x12544, "X"), (0x12F90, "V"), (0x12FF3, "X"), (0x13000, "V"), (0x13430, "X"), (0x13440, "V"), (0x13456, "X"), (0x13460, "V"), (0x143FB, "X"), (0x14400, "V"), (0x14647, "X"), (0x16100, "V"), (0x1613A, "X"), (0x16800, "V"), (0x16A39, "X"), (0x16A40, "V"), (0x16A5F, "X"), (0x16A60, "V"), (0x16A6A, "X"), (0x16A6E, "V"), (0x16ABF, "X"), (0x16AC0, "V"), (0x16ACA, "X"), (0x16AD0, "V"), (0x16AEE, "X"), (0x16AF0, "V"), (0x16AF6, "X"), (0x16B00, "V"), (0x16B46, "X"), (0x16B50, "V"), (0x16B5A, "X"), (0x16B5B, "V"), (0x16B62, "X"), (0x16B63, "V"), (0x16B78, "X"), (0x16B7D, "V"), (0x16B90, "X"), (0x16D40, "V"), (0x16D7A, "X"), (0x16E40, "M", "𖹠"), (0x16E41, "M", "𖹡"), (0x16E42, "M", "𖹢"), (0x16E43, "M", "𖹣"), (0x16E44, "M", "𖹤"), (0x16E45, "M", "𖹥"), (0x16E46, "M", "𖹦"), (0x16E47, "M", "𖹧"), (0x16E48, "M", "𖹨"), (0x16E49, "M", "𖹩"), (0x16E4A, "M", "𖹪"), (0x16E4B, "M", "𖹫"), (0x16E4C, "M", "𖹬"), (0x16E4D, "M", "𖹭"), (0x16E4E, "M", "𖹮"), (0x16E4F, "M", "𖹯"), (0x16E50, "M", "𖹰"), (0x16E51, "M", "𖹱"), (0x16E52, "M", "𖹲"), (0x16E53, "M", "𖹳"), (0x16E54, "M", "𖹴"), (0x16E55, "M", "𖹵"), (0x16E56, "M", "𖹶"), (0x16E57, "M", "𖹷"), (0x16E58, "M", "𖹸"), (0x16E59, "M", "𖹹"), (0x16E5A, "M", "𖹺"), (0x16E5B, "M", "𖹻"), (0x16E5C, "M", "𖹼"), (0x16E5D, "M", "𖹽"), (0x16E5E, "M", "𖹾"), (0x16E5F, "M", "𖹿"), (0x16E60, "V"), (0x16E9B, "X"), (0x16F00, "V"), (0x16F4B, "X"), (0x16F4F, "V"), (0x16F88, "X"), (0x16F8F, "V"), (0x16FA0, "X"), (0x16FE0, "V"), (0x16FE5, "X"), (0x16FF0, "V"), (0x16FF2, "X"), (0x17000, "V"), (0x187F8, "X"), (0x18800, "V"), (0x18CD6, "X"), (0x18CFF, "V"), (0x18D09, "X"), ] def _seg_61() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1AFF0, "V"), (0x1AFF4, "X"), (0x1AFF5, "V"), (0x1AFFC, "X"), (0x1AFFD, "V"), (0x1AFFF, "X"), (0x1B000, "V"), (0x1B123, "X"), (0x1B132, "V"), (0x1B133, "X"), (0x1B150, "V"), (0x1B153, "X"), (0x1B155, "V"), (0x1B156, "X"), (0x1B164, "V"), (0x1B168, "X"), (0x1B170, "V"), (0x1B2FC, "X"), (0x1BC00, "V"), (0x1BC6B, "X"), (0x1BC70, "V"), (0x1BC7D, "X"), (0x1BC80, "V"), (0x1BC89, "X"), (0x1BC90, "V"), (0x1BC9A, "X"), (0x1BC9C, "V"), (0x1BCA0, "I"), (0x1BCA4, "X"), (0x1CC00, "V"), (0x1CCD6, "M", "a"), (0x1CCD7, "M", "b"), (0x1CCD8, "M", "c"), (0x1CCD9, "M", "d"), (0x1CCDA, "M", "e"), (0x1CCDB, "M", "f"), (0x1CCDC, "M", "g"), (0x1CCDD, "M", "h"), (0x1CCDE, "M", "i"), (0x1CCDF, "M", "j"), (0x1CCE0, "M", "k"), (0x1CCE1, "M", "l"), (0x1CCE2, "M", "m"), (0x1CCE3, "M", "n"), (0x1CCE4, "M", "o"), (0x1CCE5, "M", "p"), (0x1CCE6, "M", "q"), (0x1CCE7, "M", "r"), (0x1CCE8, "M", "s"), (0x1CCE9, "M", "t"), (0x1CCEA, "M", "u"), (0x1CCEB, "M", "v"), (0x1CCEC, "M", "w"), (0x1CCED, "M", "x"), (0x1CCEE, "M", "y"), (0x1CCEF, "M", "z"), (0x1CCF0, "M", "0"), (0x1CCF1, "M", "1"), (0x1CCF2, "M", "2"), (0x1CCF3, "M", "3"), (0x1CCF4, "M", "4"), (0x1CCF5, "M", "5"), (0x1CCF6, "M", "6"), (0x1CCF7, "M", "7"), (0x1CCF8, "M", "8"), (0x1CCF9, "M", "9"), (0x1CCFA, "X"), (0x1CD00, "V"), (0x1CEB4, "X"), (0x1CF00, "V"), (0x1CF2E, "X"), (0x1CF30, "V"), (0x1CF47, "X"), (0x1CF50, "V"), (0x1CFC4, "X"), (0x1D000, "V"), (0x1D0F6, "X"), (0x1D100, "V"), (0x1D127, "X"), (0x1D129, "V"), (0x1D15E, "M", "𝅗𝅥"), (0x1D15F, "M", "𝅘𝅥"), (0x1D160, "M", "𝅘𝅥𝅮"), (0x1D161, "M", "𝅘𝅥𝅯"), (0x1D162, "M", "𝅘𝅥𝅰"), (0x1D163, "M", "𝅘𝅥𝅱"), (0x1D164, "M", "𝅘𝅥𝅲"), (0x1D165, "V"), (0x1D173, "I"), (0x1D17B, "V"), (0x1D1BB, "M", "𝆹𝅥"), (0x1D1BC, "M", "𝆺𝅥"), (0x1D1BD, "M", "𝆹𝅥𝅮"), (0x1D1BE, "M", "𝆺𝅥𝅮"), (0x1D1BF, "M", "𝆹𝅥𝅯"), (0x1D1C0, "M", "𝆺𝅥𝅯"), (0x1D1C1, "V"), (0x1D1EB, "X"), (0x1D200, "V"), (0x1D246, "X"), ] def _seg_62() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1D2C0, "V"), (0x1D2D4, "X"), (0x1D2E0, "V"), (0x1D2F4, "X"), (0x1D300, "V"), (0x1D357, "X"), (0x1D360, "V"), (0x1D379, "X"), (0x1D400, "M", "a"), (0x1D401, "M", "b"), (0x1D402, "M", "c"), (0x1D403, "M", "d"), (0x1D404, "M", "e"), (0x1D405, "M", "f"), (0x1D406, "M", "g"), (0x1D407, "M", "h"), (0x1D408, "M", "i"), (0x1D409, "M", "j"), (0x1D40A, "M", "k"), (0x1D40B, "M", "l"), (0x1D40C, "M", "m"), (0x1D40D, "M", "n"), (0x1D40E, "M", "o"), (0x1D40F, "M", "p"), (0x1D410, "M", "q"), (0x1D411, "M", "r"), (0x1D412, "M", "s"), (0x1D413, "M", "t"), (0x1D414, "M", "u"), (0x1D415, "M", "v"), (0x1D416, "M", "w"), (0x1D417, "M", "x"), (0x1D418, "M", "y"), (0x1D419, "M", "z"), (0x1D41A, "M", "a"), (0x1D41B, "M", "b"), (0x1D41C, "M", "c"), (0x1D41D, "M", "d"), (0x1D41E, "M", "e"), (0x1D41F, "M", "f"), (0x1D420, "M", "g"), (0x1D421, "M", "h"), (0x1D422, "M", "i"), (0x1D423, "M", "j"), (0x1D424, "M", "k"), (0x1D425, "M", "l"), (0x1D426, "M", "m"), (0x1D427, "M", "n"), (0x1D428, "M", "o"), (0x1D429, "M", "p"), (0x1D42A, "M", "q"), (0x1D42B, "M", "r"), (0x1D42C, "M", "s"), (0x1D42D, "M", "t"), (0x1D42E, "M", "u"), (0x1D42F, "M", "v"), (0x1D430, "M", "w"), (0x1D431, "M", "x"), (0x1D432, "M", "y"), (0x1D433, "M", "z"), (0x1D434, "M", "a"), (0x1D435, "M", "b"), (0x1D436, "M", "c"), (0x1D437, "M", "d"), (0x1D438, "M", "e"), (0x1D439, "M", "f"), (0x1D43A, "M", "g"), (0x1D43B, "M", "h"), (0x1D43C, "M", "i"), (0x1D43D, "M", "j"), (0x1D43E, "M", "k"), (0x1D43F, "M", "l"), (0x1D440, "M", "m"), (0x1D441, "M", "n"), (0x1D442, "M", "o"), (0x1D443, "M", "p"), (0x1D444, "M", "q"), (0x1D445, "M", "r"), (0x1D446, "M", "s"), (0x1D447, "M", "t"), (0x1D448, "M", "u"), (0x1D449, "M", "v"), (0x1D44A, "M", "w"), (0x1D44B, "M", "x"), (0x1D44C, "M", "y"), (0x1D44D, "M", "z"), (0x1D44E, "M", "a"), (0x1D44F, "M", "b"), (0x1D450, "M", "c"), (0x1D451, "M", "d"), (0x1D452, "M", "e"), (0x1D453, "M", "f"), (0x1D454, "M", "g"), (0x1D455, "X"), (0x1D456, "M", "i"), (0x1D457, "M", "j"), (0x1D458, "M", "k"), (0x1D459, "M", "l"), (0x1D45A, "M", "m"), (0x1D45B, "M", "n"), ] def _seg_63() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1D45C, "M", "o"), (0x1D45D, "M", "p"), (0x1D45E, "M", "q"), (0x1D45F, "M", "r"), (0x1D460, "M", "s"), (0x1D461, "M", "t"), (0x1D462, "M", "u"), (0x1D463, "M", "v"), (0x1D464, "M", "w"), (0x1D465, "M", "x"), (0x1D466, "M", "y"), (0x1D467, "M", "z"), (0x1D468, "M", "a"), (0x1D469, "M", "b"), (0x1D46A, "M", "c"), (0x1D46B, "M", "d"), (0x1D46C, "M", "e"), (0x1D46D, "M", "f"), (0x1D46E, "M", "g"), (0x1D46F, "M", "h"), (0x1D470, "M", "i"), (0x1D471, "M", "j"), (0x1D472, "M", "k"), (0x1D473, "M", "l"), (0x1D474, "M", "m"), (0x1D475, "M", "n"), (0x1D476, "M", "o"), (0x1D477, "M", "p"), (0x1D478, "M", "q"), (0x1D479, "M", "r"), (0x1D47A, "M", "s"), (0x1D47B, "M", "t"), (0x1D47C, "M", "u"), (0x1D47D, "M", "v"), (0x1D47E, "M", "w"), (0x1D47F, "M", "x"), (0x1D480, "M", "y"), (0x1D481, "M", "z"), (0x1D482, "M", "a"), (0x1D483, "M", "b"), (0x1D484, "M", "c"), (0x1D485, "M", "d"), (0x1D486, "M", "e"), (0x1D487, "M", "f"), (0x1D488, "M", "g"), (0x1D489, "M", "h"), (0x1D48A, "M", "i"), (0x1D48B, "M", "j"), (0x1D48C, "M", "k"), (0x1D48D, "M", "l"), (0x1D48E, "M", "m"), (0x1D48F, "M", "n"), (0x1D490, "M", "o"), (0x1D491, "M", "p"), (0x1D492, "M", "q"), (0x1D493, "M", "r"), (0x1D494, "M", "s"), (0x1D495, "M", "t"), (0x1D496, "M", "u"), (0x1D497, "M", "v"), (0x1D498, "M", "w"), (0x1D499, "M", "x"), (0x1D49A, "M", "y"), (0x1D49B, "M", "z"), (0x1D49C, "M", "a"), (0x1D49D, "X"), (0x1D49E, "M", "c"), (0x1D49F, "M", "d"), (0x1D4A0, "X"), (0x1D4A2, "M", "g"), (0x1D4A3, "X"), (0x1D4A5, "M", "j"), (0x1D4A6, "M", "k"), (0x1D4A7, "X"), (0x1D4A9, "M", "n"), (0x1D4AA, "M", "o"), (0x1D4AB, "M", "p"), (0x1D4AC, "M", "q"), (0x1D4AD, "X"), (0x1D4AE, "M", "s"), (0x1D4AF, "M", "t"), (0x1D4B0, "M", "u"), (0x1D4B1, "M", "v"), (0x1D4B2, "M", "w"), (0x1D4B3, "M", "x"), (0x1D4B4, "M", "y"), (0x1D4B5, "M", "z"), (0x1D4B6, "M", "a"), (0x1D4B7, "M", "b"), (0x1D4B8, "M", "c"), (0x1D4B9, "M", "d"), (0x1D4BA, "X"), (0x1D4BB, "M", "f"), (0x1D4BC, "X"), (0x1D4BD, "M", "h"), (0x1D4BE, "M", "i"), (0x1D4BF, "M", "j"), (0x1D4C0, "M", "k"), (0x1D4C1, "M", "l"), (0x1D4C2, "M", "m"), ] def _seg_64() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1D4C3, "M", "n"), (0x1D4C4, "X"), (0x1D4C5, "M", "p"), (0x1D4C6, "M", "q"), (0x1D4C7, "M", "r"), (0x1D4C8, "M", "s"), (0x1D4C9, "M", "t"), (0x1D4CA, "M", "u"), (0x1D4CB, "M", "v"), (0x1D4CC, "M", "w"), (0x1D4CD, "M", "x"), (0x1D4CE, "M", "y"), (0x1D4CF, "M", "z"), (0x1D4D0, "M", "a"), (0x1D4D1, "M", "b"), (0x1D4D2, "M", "c"), (0x1D4D3, "M", "d"), (0x1D4D4, "M", "e"), (0x1D4D5, "M", "f"), (0x1D4D6, "M", "g"), (0x1D4D7, "M", "h"), (0x1D4D8, "M", "i"), (0x1D4D9, "M", "j"), (0x1D4DA, "M", "k"), (0x1D4DB, "M", "l"), (0x1D4DC, "M", "m"), (0x1D4DD, "M", "n"), (0x1D4DE, "M", "o"), (0x1D4DF, "M", "p"), (0x1D4E0, "M", "q"), (0x1D4E1, "M", "r"), (0x1D4E2, "M", "s"), (0x1D4E3, "M", "t"), (0x1D4E4, "M", "u"), (0x1D4E5, "M", "v"), (0x1D4E6, "M", "w"), (0x1D4E7, "M", "x"), (0x1D4E8, "M", "y"), (0x1D4E9, "M", "z"), (0x1D4EA, "M", "a"), (0x1D4EB, "M", "b"), (0x1D4EC, "M", "c"), (0x1D4ED, "M", "d"), (0x1D4EE, "M", "e"), (0x1D4EF, "M", "f"), (0x1D4F0, "M", "g"), (0x1D4F1, "M", "h"), (0x1D4F2, "M", "i"), (0x1D4F3, "M", "j"), (0x1D4F4, "M", "k"), (0x1D4F5, "M", "l"), (0x1D4F6, "M", "m"), (0x1D4F7, "M", "n"), (0x1D4F8, "M", "o"), (0x1D4F9, "M", "p"), (0x1D4FA, "M", "q"), (0x1D4FB, "M", "r"), (0x1D4FC, "M", "s"), (0x1D4FD, "M", "t"), (0x1D4FE, "M", "u"), (0x1D4FF, "M", "v"), (0x1D500, "M", "w"), (0x1D501, "M", "x"), (0x1D502, "M", "y"), (0x1D503, "M", "z"), (0x1D504, "M", "a"), (0x1D505, "M", "b"), (0x1D506, "X"), (0x1D507, "M", "d"), (0x1D508, "M", "e"), (0x1D509, "M", "f"), (0x1D50A, "M", "g"), (0x1D50B, "X"), (0x1D50D, "M", "j"), (0x1D50E, "M", "k"), (0x1D50F, "M", "l"), (0x1D510, "M", "m"), (0x1D511, "M", "n"), (0x1D512, "M", "o"), (0x1D513, "M", "p"), (0x1D514, "M", "q"), (0x1D515, "X"), (0x1D516, "M", "s"), (0x1D517, "M", "t"), (0x1D518, "M", "u"), (0x1D519, "M", "v"), (0x1D51A, "M", "w"), (0x1D51B, "M", "x"), (0x1D51C, "M", "y"), (0x1D51D, "X"), (0x1D51E, "M", "a"), (0x1D51F, "M", "b"), (0x1D520, "M", "c"), (0x1D521, "M", "d"), (0x1D522, "M", "e"), (0x1D523, "M", "f"), (0x1D524, "M", "g"), (0x1D525, "M", "h"), (0x1D526, "M", "i"), (0x1D527, "M", "j"), ] def _seg_65() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1D528, "M", "k"), (0x1D529, "M", "l"), (0x1D52A, "M", "m"), (0x1D52B, "M", "n"), (0x1D52C, "M", "o"), (0x1D52D, "M", "p"), (0x1D52E, "M", "q"), (0x1D52F, "M", "r"), (0x1D530, "M", "s"), (0x1D531, "M", "t"), (0x1D532, "M", "u"), (0x1D533, "M", "v"), (0x1D534, "M", "w"), (0x1D535, "M", "x"), (0x1D536, "M", "y"), (0x1D537, "M", "z"), (0x1D538, "M", "a"), (0x1D539, "M", "b"), (0x1D53A, "X"), (0x1D53B, "M", "d"), (0x1D53C, "M", "e"), (0x1D53D, "M", "f"), (0x1D53E, "M", "g"), (0x1D53F, "X"), (0x1D540, "M", "i"), (0x1D541, "M", "j"), (0x1D542, "M", "k"), (0x1D543, "M", "l"), (0x1D544, "M", "m"), (0x1D545, "X"), (0x1D546, "M", "o"), (0x1D547, "X"), (0x1D54A, "M", "s"), (0x1D54B, "M", "t"), (0x1D54C, "M", "u"), (0x1D54D, "M", "v"), (0x1D54E, "M", "w"), (0x1D54F, "M", "x"), (0x1D550, "M", "y"), (0x1D551, "X"), (0x1D552, "M", "a"), (0x1D553, "M", "b"), (0x1D554, "M", "c"), (0x1D555, "M", "d"), (0x1D556, "M", "e"), (0x1D557, "M", "f"), (0x1D558, "M", "g"), (0x1D559, "M", "h"), (0x1D55A, "M", "i"), (0x1D55B, "M", "j"), (0x1D55C, "M", "k"), (0x1D55D, "M", "l"), (0x1D55E, "M", "m"), (0x1D55F, "M", "n"), (0x1D560, "M", "o"), (0x1D561, "M", "p"), (0x1D562, "M", "q"), (0x1D563, "M", "r"), (0x1D564, "M", "s"), (0x1D565, "M", "t"), (0x1D566, "M", "u"), (0x1D567, "M", "v"), (0x1D568, "M", "w"), (0x1D569, "M", "x"), (0x1D56A, "M", "y"), (0x1D56B, "M", "z"), (0x1D56C, "M", "a"), (0x1D56D, "M", "b"), (0x1D56E, "M", "c"), (0x1D56F, "M", "d"), (0x1D570, "M", "e"), (0x1D571, "M", "f"), (0x1D572, "M", "g"), (0x1D573, "M", "h"), (0x1D574, "M", "i"), (0x1D575, "M", "j"), (0x1D576, "M", "k"), (0x1D577, "M", "l"), (0x1D578, "M", "m"), (0x1D579, "M", "n"), (0x1D57A, "M", "o"), (0x1D57B, "M", "p"), (0x1D57C, "M", "q"), (0x1D57D, "M", "r"), (0x1D57E, "M", "s"), (0x1D57F, "M", "t"), (0x1D580, "M", "u"), (0x1D581, "M", "v"), (0x1D582, "M", "w"), (0x1D583, "M", "x"), (0x1D584, "M", "y"), (0x1D585, "M", "z"), (0x1D586, "M", "a"), (0x1D587, "M", "b"), (0x1D588, "M", "c"), (0x1D589, "M", "d"), (0x1D58A, "M", "e"), (0x1D58B, "M", "f"), (0x1D58C, "M", "g"), (0x1D58D, "M", "h"), ] def _seg_66() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1D58E, "M", "i"), (0x1D58F, "M", "j"), (0x1D590, "M", "k"), (0x1D591, "M", "l"), (0x1D592, "M", "m"), (0x1D593, "M", "n"), (0x1D594, "M", "o"), (0x1D595, "M", "p"), (0x1D596, "M", "q"), (0x1D597, "M", "r"), (0x1D598, "M", "s"), (0x1D599, "M", "t"), (0x1D59A, "M", "u"), (0x1D59B, "M", "v"), (0x1D59C, "M", "w"), (0x1D59D, "M", "x"), (0x1D59E, "M", "y"), (0x1D59F, "M", "z"), (0x1D5A0, "M", "a"), (0x1D5A1, "M", "b"), (0x1D5A2, "M", "c"), (0x1D5A3, "M", "d"), (0x1D5A4, "M", "e"), (0x1D5A5, "M", "f"), (0x1D5A6, "M", "g"), (0x1D5A7, "M", "h"), (0x1D5A8, "M", "i"), (0x1D5A9, "M", "j"), (0x1D5AA, "M", "k"), (0x1D5AB, "M", "l"), (0x1D5AC, "M", "m"), (0x1D5AD, "M", "n"), (0x1D5AE, "M", "o"), (0x1D5AF, "M", "p"), (0x1D5B0, "M", "q"), (0x1D5B1, "M", "r"), (0x1D5B2, "M", "s"), (0x1D5B3, "M", "t"), (0x1D5B4, "M", "u"), (0x1D5B5, "M", "v"), (0x1D5B6, "M", "w"), (0x1D5B7, "M", "x"), (0x1D5B8, "M", "y"), (0x1D5B9, "M", "z"), (0x1D5BA, "M", "a"), (0x1D5BB, "M", "b"), (0x1D5BC, "M", "c"), (0x1D5BD, "M", "d"), (0x1D5BE, "M", "e"), (0x1D5BF, "M", "f"), (0x1D5C0, "M", "g"), (0x1D5C1, "M", "h"), (0x1D5C2, "M", "i"), (0x1D5C3, "M", "j"), (0x1D5C4, "M", "k"), (0x1D5C5, "M", "l"), (0x1D5C6, "M", "m"), (0x1D5C7, "M", "n"), (0x1D5C8, "M", "o"), (0x1D5C9, "M", "p"), (0x1D5CA, "M", "q"), (0x1D5CB, "M", "r"), (0x1D5CC, "M", "s"), (0x1D5CD, "M", "t"), (0x1D5CE, "M", "u"), (0x1D5CF, "M", "v"), (0x1D5D0, "M", "w"), (0x1D5D1, "M", "x"), (0x1D5D2, "M", "y"), (0x1D5D3, "M", "z"), (0x1D5D4, "M", "a"), (0x1D5D5, "M", "b"), (0x1D5D6, "M", "c"), (0x1D5D7, "M", "d"), (0x1D5D8, "M", "e"), (0x1D5D9, "M", "f"), (0x1D5DA, "M", "g"), (0x1D5DB, "M", "h"), (0x1D5DC, "M", "i"), (0x1D5DD, "M", "j"), (0x1D5DE, "M", "k"), (0x1D5DF, "M", "l"), (0x1D5E0, "M", "m"), (0x1D5E1, "M", "n"), (0x1D5E2, "M", "o"), (0x1D5E3, "M", "p"), (0x1D5E4, "M", "q"), (0x1D5E5, "M", "r"), (0x1D5E6, "M", "s"), (0x1D5E7, "M", "t"), (0x1D5E8, "M", "u"), (0x1D5E9, "M", "v"), (0x1D5EA, "M", "w"), (0x1D5EB, "M", "x"), (0x1D5EC, "M", "y"), (0x1D5ED, "M", "z"), (0x1D5EE, "M", "a"), (0x1D5EF, "M", "b"), (0x1D5F0, "M", "c"), (0x1D5F1, "M", "d"), ] def _seg_67() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1D5F2, "M", "e"), (0x1D5F3, "M", "f"), (0x1D5F4, "M", "g"), (0x1D5F5, "M", "h"), (0x1D5F6, "M", "i"), (0x1D5F7, "M", "j"), (0x1D5F8, "M", "k"), (0x1D5F9, "M", "l"), (0x1D5FA, "M", "m"), (0x1D5FB, "M", "n"), (0x1D5FC, "M", "o"), (0x1D5FD, "M", "p"), (0x1D5FE, "M", "q"), (0x1D5FF, "M", "r"), (0x1D600, "M", "s"), (0x1D601, "M", "t"), (0x1D602, "M", "u"), (0x1D603, "M", "v"), (0x1D604, "M", "w"), (0x1D605, "M", "x"), (0x1D606, "M", "y"), (0x1D607, "M", "z"), (0x1D608, "M", "a"), (0x1D609, "M", "b"), (0x1D60A, "M", "c"), (0x1D60B, "M", "d"), (0x1D60C, "M", "e"), (0x1D60D, "M", "f"), (0x1D60E, "M", "g"), (0x1D60F, "M", "h"), (0x1D610, "M", "i"), (0x1D611, "M", "j"), (0x1D612, "M", "k"), (0x1D613, "M", "l"), (0x1D614, "M", "m"), (0x1D615, "M", "n"), (0x1D616, "M", "o"), (0x1D617, "M", "p"), (0x1D618, "M", "q"), (0x1D619, "M", "r"), (0x1D61A, "M", "s"), (0x1D61B, "M", "t"), (0x1D61C, "M", "u"), (0x1D61D, "M", "v"), (0x1D61E, "M", "w"), (0x1D61F, "M", "x"), (0x1D620, "M", "y"), (0x1D621, "M", "z"), (0x1D622, "M", "a"), (0x1D623, "M", "b"), (0x1D624, "M", "c"), (0x1D625, "M", "d"), (0x1D626, "M", "e"), (0x1D627, "M", "f"), (0x1D628, "M", "g"), (0x1D629, "M", "h"), (0x1D62A, "M", "i"), (0x1D62B, "M", "j"), (0x1D62C, "M", "k"), (0x1D62D, "M", "l"), (0x1D62E, "M", "m"), (0x1D62F, "M", "n"), (0x1D630, "M", "o"), (0x1D631, "M", "p"), (0x1D632, "M", "q"), (0x1D633, "M", "r"), (0x1D634, "M", "s"), (0x1D635, "M", "t"), (0x1D636, "M", "u"), (0x1D637, "M", "v"), (0x1D638, "M", "w"), (0x1D639, "M", "x"), (0x1D63A, "M", "y"), (0x1D63B, "M", "z"), (0x1D63C, "M", "a"), (0x1D63D, "M", "b"), (0x1D63E, "M", "c"), (0x1D63F, "M", "d"), (0x1D640, "M", "e"), (0x1D641, "M", "f"), (0x1D642, "M", "g"), (0x1D643, "M", "h"), (0x1D644, "M", "i"), (0x1D645, "M", "j"), (0x1D646, "M", "k"), (0x1D647, "M", "l"), (0x1D648, "M", "m"), (0x1D649, "M", "n"), (0x1D64A, "M", "o"), (0x1D64B, "M", "p"), (0x1D64C, "M", "q"), (0x1D64D, "M", "r"), (0x1D64E, "M", "s"), (0x1D64F, "M", "t"), (0x1D650, "M", "u"), (0x1D651, "M", "v"), (0x1D652, "M", "w"), (0x1D653, "M", "x"), (0x1D654, "M", "y"), (0x1D655, "M", "z"), ] def _seg_68() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1D656, "M", "a"), (0x1D657, "M", "b"), (0x1D658, "M", "c"), (0x1D659, "M", "d"), (0x1D65A, "M", "e"), (0x1D65B, "M", "f"), (0x1D65C, "M", "g"), (0x1D65D, "M", "h"), (0x1D65E, "M", "i"), (0x1D65F, "M", "j"), (0x1D660, "M", "k"), (0x1D661, "M", "l"), (0x1D662, "M", "m"), (0x1D663, "M", "n"), (0x1D664, "M", "o"), (0x1D665, "M", "p"), (0x1D666, "M", "q"), (0x1D667, "M", "r"), (0x1D668, "M", "s"), (0x1D669, "M", "t"), (0x1D66A, "M", "u"), (0x1D66B, "M", "v"), (0x1D66C, "M", "w"), (0x1D66D, "M", "x"), (0x1D66E, "M", "y"), (0x1D66F, "M", "z"), (0x1D670, "M", "a"), (0x1D671, "M", "b"), (0x1D672, "M", "c"), (0x1D673, "M", "d"), (0x1D674, "M", "e"), (0x1D675, "M", "f"), (0x1D676, "M", "g"), (0x1D677, "M", "h"), (0x1D678, "M", "i"), (0x1D679, "M", "j"), (0x1D67A, "M", "k"), (0x1D67B, "M", "l"), (0x1D67C, "M", "m"), (0x1D67D, "M", "n"), (0x1D67E, "M", "o"), (0x1D67F, "M", "p"), (0x1D680, "M", "q"), (0x1D681, "M", "r"), (0x1D682, "M", "s"), (0x1D683, "M", "t"), (0x1D684, "M", "u"), (0x1D685, "M", "v"), (0x1D686, "M", "w"), (0x1D687, "M", "x"), (0x1D688, "M", "y"), (0x1D689, "M", "z"), (0x1D68A, "M", "a"), (0x1D68B, "M", "b"), (0x1D68C, "M", "c"), (0x1D68D, "M", "d"), (0x1D68E, "M", "e"), (0x1D68F, "M", "f"), (0x1D690, "M", "g"), (0x1D691, "M", "h"), (0x1D692, "M", "i"), (0x1D693, "M", "j"), (0x1D694, "M", "k"), (0x1D695, "M", "l"), (0x1D696, "M", "m"), (0x1D697, "M", "n"), (0x1D698, "M", "o"), (0x1D699, "M", "p"), (0x1D69A, "M", "q"), (0x1D69B, "M", "r"), (0x1D69C, "M", "s"), (0x1D69D, "M", "t"), (0x1D69E, "M", "u"), (0x1D69F, "M", "v"), (0x1D6A0, "M", "w"), (0x1D6A1, "M", "x"), (0x1D6A2, "M", "y"), (0x1D6A3, "M", "z"), (0x1D6A4, "M", "ı"), (0x1D6A5, "M", "ȷ"), (0x1D6A6, "X"), (0x1D6A8, "M", "α"), (0x1D6A9, "M", "β"), (0x1D6AA, "M", "γ"), (0x1D6AB, "M", "δ"), (0x1D6AC, "M", "ε"), (0x1D6AD, "M", "ζ"), (0x1D6AE, "M", "η"), (0x1D6AF, "M", "θ"), (0x1D6B0, "M", "ι"), (0x1D6B1, "M", "κ"), (0x1D6B2, "M", "λ"), (0x1D6B3, "M", "μ"), (0x1D6B4, "M", "ν"), (0x1D6B5, "M", "ξ"), (0x1D6B6, "M", "ο"), (0x1D6B7, "M", "π"), (0x1D6B8, "M", "ρ"), (0x1D6B9, "M", "θ"), (0x1D6BA, "M", "σ"), ] def _seg_69() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1D6BB, "M", "τ"), (0x1D6BC, "M", "υ"), (0x1D6BD, "M", "φ"), (0x1D6BE, "M", "χ"), (0x1D6BF, "M", "ψ"), (0x1D6C0, "M", "ω"), (0x1D6C1, "M", "∇"), (0x1D6C2, "M", "α"), (0x1D6C3, "M", "β"), (0x1D6C4, "M", "γ"), (0x1D6C5, "M", "δ"), (0x1D6C6, "M", "ε"), (0x1D6C7, "M", "ζ"), (0x1D6C8, "M", "η"), (0x1D6C9, "M", "θ"), (0x1D6CA, "M", "ι"), (0x1D6CB, "M", "κ"), (0x1D6CC, "M", "λ"), (0x1D6CD, "M", "μ"), (0x1D6CE, "M", "ν"), (0x1D6CF, "M", "ξ"), (0x1D6D0, "M", "ο"), (0x1D6D1, "M", "π"), (0x1D6D2, "M", "ρ"), (0x1D6D3, "M", "σ"), (0x1D6D5, "M", "τ"), (0x1D6D6, "M", "υ"), (0x1D6D7, "M", "φ"), (0x1D6D8, "M", "χ"), (0x1D6D9, "M", "ψ"), (0x1D6DA, "M", "ω"), (0x1D6DB, "M", "∂"), (0x1D6DC, "M", "ε"), (0x1D6DD, "M", "θ"), (0x1D6DE, "M", "κ"), (0x1D6DF, "M", "φ"), (0x1D6E0, "M", "ρ"), (0x1D6E1, "M", "π"), (0x1D6E2, "M", "α"), (0x1D6E3, "M", "β"), (0x1D6E4, "M", "γ"), (0x1D6E5, "M", "δ"), (0x1D6E6, "M", "ε"), (0x1D6E7, "M", "ζ"), (0x1D6E8, "M", "η"), (0x1D6E9, "M", "θ"), (0x1D6EA, "M", "ι"), (0x1D6EB, "M", "κ"), (0x1D6EC, "M", "λ"), (0x1D6ED, "M", "μ"), (0x1D6EE, "M", "ν"), (0x1D6EF, "M", "ξ"), (0x1D6F0, "M", "ο"), (0x1D6F1, "M", "π"), (0x1D6F2, "M", "ρ"), (0x1D6F3, "M", "θ"), (0x1D6F4, "M", "σ"), (0x1D6F5, "M", "τ"), (0x1D6F6, "M", "υ"), (0x1D6F7, "M", "φ"), (0x1D6F8, "M", "χ"), (0x1D6F9, "M", "ψ"), (0x1D6FA, "M", "ω"), (0x1D6FB, "M", "∇"), (0x1D6FC, "M", "α"), (0x1D6FD, "M", "β"), (0x1D6FE, "M", "γ"), (0x1D6FF, "M", "δ"), (0x1D700, "M", "ε"), (0x1D701, "M", "ζ"), (0x1D702, "M", "η"), (0x1D703, "M", "θ"), (0x1D704, "M", "ι"), (0x1D705, "M", "κ"), (0x1D706, "M", "λ"), (0x1D707, "M", "μ"), (0x1D708, "M", "ν"), (0x1D709, "M", "ξ"), (0x1D70A, "M", "ο"), (0x1D70B, "M", "π"), (0x1D70C, "M", "ρ"), (0x1D70D, "M", "σ"), (0x1D70F, "M", "τ"), (0x1D710, "M", "υ"), (0x1D711, "M", "φ"), (0x1D712, "M", "χ"), (0x1D713, "M", "ψ"), (0x1D714, "M", "ω"), (0x1D715, "M", "∂"), (0x1D716, "M", "ε"), (0x1D717, "M", "θ"), (0x1D718, "M", "κ"), (0x1D719, "M", "φ"), (0x1D71A, "M", "ρ"), (0x1D71B, "M", "π"), (0x1D71C, "M", "α"), (0x1D71D, "M", "β"), (0x1D71E, "M", "γ"), (0x1D71F, "M", "δ"), (0x1D720, "M", "ε"), ] def _seg_70() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1D721, "M", "ζ"), (0x1D722, "M", "η"), (0x1D723, "M", "θ"), (0x1D724, "M", "ι"), (0x1D725, "M", "κ"), (0x1D726, "M", "λ"), (0x1D727, "M", "μ"), (0x1D728, "M", "ν"), (0x1D729, "M", "ξ"), (0x1D72A, "M", "ο"), (0x1D72B, "M", "π"), (0x1D72C, "M", "ρ"), (0x1D72D, "M", "θ"), (0x1D72E, "M", "σ"), (0x1D72F, "M", "τ"), (0x1D730, "M", "υ"), (0x1D731, "M", "φ"), (0x1D732, "M", "χ"), (0x1D733, "M", "ψ"), (0x1D734, "M", "ω"), (0x1D735, "M", "∇"), (0x1D736, "M", "α"), (0x1D737, "M", "β"), (0x1D738, "M", "γ"), (0x1D739, "M", "δ"), (0x1D73A, "M", "ε"), (0x1D73B, "M", "ζ"), (0x1D73C, "M", "η"), (0x1D73D, "M", "θ"), (0x1D73E, "M", "ι"), (0x1D73F, "M", "κ"), (0x1D740, "M", "λ"), (0x1D741, "M", "μ"), (0x1D742, "M", "ν"), (0x1D743, "M", "ξ"), (0x1D744, "M", "ο"), (0x1D745, "M", "π"), (0x1D746, "M", "ρ"), (0x1D747, "M", "σ"), (0x1D749, "M", "τ"), (0x1D74A, "M", "υ"), (0x1D74B, "M", "φ"), (0x1D74C, "M", "χ"), (0x1D74D, "M", "ψ"), (0x1D74E, "M", "ω"), (0x1D74F, "M", "∂"), (0x1D750, "M", "ε"), (0x1D751, "M", "θ"), (0x1D752, "M", "κ"), (0x1D753, "M", "φ"), (0x1D754, "M", "ρ"), (0x1D755, "M", "π"), (0x1D756, "M", "α"), (0x1D757, "M", "β"), (0x1D758, "M", "γ"), (0x1D759, "M", "δ"), (0x1D75A, "M", "ε"), (0x1D75B, "M", "ζ"), (0x1D75C, "M", "η"), (0x1D75D, "M", "θ"), (0x1D75E, "M", "ι"), (0x1D75F, "M", "κ"), (0x1D760, "M", "λ"), (0x1D761, "M", "μ"), (0x1D762, "M", "ν"), (0x1D763, "M", "ξ"), (0x1D764, "M", "ο"), (0x1D765, "M", "π"), (0x1D766, "M", "ρ"), (0x1D767, "M", "θ"), (0x1D768, "M", "σ"), (0x1D769, "M", "τ"), (0x1D76A, "M", "υ"), (0x1D76B, "M", "φ"), (0x1D76C, "M", "χ"), (0x1D76D, "M", "ψ"), (0x1D76E, "M", "ω"), (0x1D76F, "M", "∇"), (0x1D770, "M", "α"), (0x1D771, "M", "β"), (0x1D772, "M", "γ"), (0x1D773, "M", "δ"), (0x1D774, "M", "ε"), (0x1D775, "M", "ζ"), (0x1D776, "M", "η"), (0x1D777, "M", "θ"), (0x1D778, "M", "ι"), (0x1D779, "M", "κ"), (0x1D77A, "M", "λ"), (0x1D77B, "M", "μ"), (0x1D77C, "M", "ν"), (0x1D77D, "M", "ξ"), (0x1D77E, "M", "ο"), (0x1D77F, "M", "π"), (0x1D780, "M", "ρ"), (0x1D781, "M", "σ"), (0x1D783, "M", "τ"), (0x1D784, "M", "υ"), (0x1D785, "M", "φ"), (0x1D786, "M", "χ"), ] def _seg_71() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1D787, "M", "ψ"), (0x1D788, "M", "ω"), (0x1D789, "M", "∂"), (0x1D78A, "M", "ε"), (0x1D78B, "M", "θ"), (0x1D78C, "M", "κ"), (0x1D78D, "M", "φ"), (0x1D78E, "M", "ρ"), (0x1D78F, "M", "π"), (0x1D790, "M", "α"), (0x1D791, "M", "β"), (0x1D792, "M", "γ"), (0x1D793, "M", "δ"), (0x1D794, "M", "ε"), (0x1D795, "M", "ζ"), (0x1D796, "M", "η"), (0x1D797, "M", "θ"), (0x1D798, "M", "ι"), (0x1D799, "M", "κ"), (0x1D79A, "M", "λ"), (0x1D79B, "M", "μ"), (0x1D79C, "M", "ν"), (0x1D79D, "M", "ξ"), (0x1D79E, "M", "ο"), (0x1D79F, "M", "π"), (0x1D7A0, "M", "ρ"), (0x1D7A1, "M", "θ"), (0x1D7A2, "M", "σ"), (0x1D7A3, "M", "τ"), (0x1D7A4, "M", "υ"), (0x1D7A5, "M", "φ"), (0x1D7A6, "M", "χ"), (0x1D7A7, "M", "ψ"), (0x1D7A8, "M", "ω"), (0x1D7A9, "M", "∇"), (0x1D7AA, "M", "α"), (0x1D7AB, "M", "β"), (0x1D7AC, "M", "γ"), (0x1D7AD, "M", "δ"), (0x1D7AE, "M", "ε"), (0x1D7AF, "M", "ζ"), (0x1D7B0, "M", "η"), (0x1D7B1, "M", "θ"), (0x1D7B2, "M", "ι"), (0x1D7B3, "M", "κ"), (0x1D7B4, "M", "λ"), (0x1D7B5, "M", "μ"), (0x1D7B6, "M", "ν"), (0x1D7B7, "M", "ξ"), (0x1D7B8, "M", "ο"), (0x1D7B9, "M", "π"), (0x1D7BA, "M", "ρ"), (0x1D7BB, "M", "σ"), (0x1D7BD, "M", "τ"), (0x1D7BE, "M", "υ"), (0x1D7BF, "M", "φ"), (0x1D7C0, "M", "χ"), (0x1D7C1, "M", "ψ"), (0x1D7C2, "M", "ω"), (0x1D7C3, "M", "∂"), (0x1D7C4, "M", "ε"), (0x1D7C5, "M", "θ"), (0x1D7C6, "M", "κ"), (0x1D7C7, "M", "φ"), (0x1D7C8, "M", "ρ"), (0x1D7C9, "M", "π"), (0x1D7CA, "M", "ϝ"), (0x1D7CC, "X"), (0x1D7CE, "M", "0"), (0x1D7CF, "M", "1"), (0x1D7D0, "M", "2"), (0x1D7D1, "M", "3"), (0x1D7D2, "M", "4"), (0x1D7D3, "M", "5"), (0x1D7D4, "M", "6"), (0x1D7D5, "M", "7"), (0x1D7D6, "M", "8"), (0x1D7D7, "M", "9"), (0x1D7D8, "M", "0"), (0x1D7D9, "M", "1"), (0x1D7DA, "M", "2"), (0x1D7DB, "M", "3"), (0x1D7DC, "M", "4"), (0x1D7DD, "M", "5"), (0x1D7DE, "M", "6"), (0x1D7DF, "M", "7"), (0x1D7E0, "M", "8"), (0x1D7E1, "M", "9"), (0x1D7E2, "M", "0"), (0x1D7E3, "M", "1"), (0x1D7E4, "M", "2"), (0x1D7E5, "M", "3"), (0x1D7E6, "M", "4"), (0x1D7E7, "M", "5"), (0x1D7E8, "M", "6"), (0x1D7E9, "M", "7"), (0x1D7EA, "M", "8"), (0x1D7EB, "M", "9"), (0x1D7EC, "M", "0"), (0x1D7ED, "M", "1"), ] def _seg_72() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1D7EE, "M", "2"), (0x1D7EF, "M", "3"), (0x1D7F0, "M", "4"), (0x1D7F1, "M", "5"), (0x1D7F2, "M", "6"), (0x1D7F3, "M", "7"), (0x1D7F4, "M", "8"), (0x1D7F5, "M", "9"), (0x1D7F6, "M", "0"), (0x1D7F7, "M", "1"), (0x1D7F8, "M", "2"), (0x1D7F9, "M", "3"), (0x1D7FA, "M", "4"), (0x1D7FB, "M", "5"), (0x1D7FC, "M", "6"), (0x1D7FD, "M", "7"), (0x1D7FE, "M", "8"), (0x1D7FF, "M", "9"), (0x1D800, "V"), (0x1DA8C, "X"), (0x1DA9B, "V"), (0x1DAA0, "X"), (0x1DAA1, "V"), (0x1DAB0, "X"), (0x1DF00, "V"), (0x1DF1F, "X"), (0x1DF25, "V"), (0x1DF2B, "X"), (0x1E000, "V"), (0x1E007, "X"), (0x1E008, "V"), (0x1E019, "X"), (0x1E01B, "V"), (0x1E022, "X"), (0x1E023, "V"), (0x1E025, "X"), (0x1E026, "V"), (0x1E02B, "X"), (0x1E030, "M", "а"), (0x1E031, "M", "б"), (0x1E032, "M", "в"), (0x1E033, "M", "г"), (0x1E034, "M", "д"), (0x1E035, "M", "е"), (0x1E036, "M", "ж"), (0x1E037, "M", "з"), (0x1E038, "M", "и"), (0x1E039, "M", "к"), (0x1E03A, "M", "л"), (0x1E03B, "M", "м"), (0x1E03C, "M", "о"), (0x1E03D, "M", "п"), (0x1E03E, "M", "р"), (0x1E03F, "M", "с"), (0x1E040, "M", "т"), (0x1E041, "M", "у"), (0x1E042, "M", "ф"), (0x1E043, "M", "х"), (0x1E044, "M", "ц"), (0x1E045, "M", "ч"), (0x1E046, "M", "ш"), (0x1E047, "M", "ы"), (0x1E048, "M", "э"), (0x1E049, "M", "ю"), (0x1E04A, "M", "ꚉ"), (0x1E04B, "M", "ә"), (0x1E04C, "M", "і"), (0x1E04D, "M", "ј"), (0x1E04E, "M", "ө"), (0x1E04F, "M", "ү"), (0x1E050, "M", "ӏ"), (0x1E051, "M", "а"), (0x1E052, "M", "б"), (0x1E053, "M", "в"), (0x1E054, "M", "г"), (0x1E055, "M", "д"), (0x1E056, "M", "е"), (0x1E057, "M", "ж"), (0x1E058, "M", "з"), (0x1E059, "M", "и"), (0x1E05A, "M", "к"), (0x1E05B, "M", "л"), (0x1E05C, "M", "о"), (0x1E05D, "M", "п"), (0x1E05E, "M", "с"), (0x1E05F, "M", "у"), (0x1E060, "M", "ф"), (0x1E061, "M", "х"), (0x1E062, "M", "ц"), (0x1E063, "M", "ч"), (0x1E064, "M", "ш"), (0x1E065, "M", "ъ"), (0x1E066, "M", "ы"), (0x1E067, "M", "ґ"), (0x1E068, "M", "і"), (0x1E069, "M", "ѕ"), (0x1E06A, "M", "џ"), (0x1E06B, "M", "ҫ"), (0x1E06C, "M", "ꙑ"), (0x1E06D, "M", "ұ"), ] def _seg_73() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1E06E, "X"), (0x1E08F, "V"), (0x1E090, "X"), (0x1E100, "V"), (0x1E12D, "X"), (0x1E130, "V"), (0x1E13E, "X"), (0x1E140, "V"), (0x1E14A, "X"), (0x1E14E, "V"), (0x1E150, "X"), (0x1E290, "V"), (0x1E2AF, "X"), (0x1E2C0, "V"), (0x1E2FA, "X"), (0x1E2FF, "V"), (0x1E300, "X"), (0x1E4D0, "V"), (0x1E4FA, "X"), (0x1E5D0, "V"), (0x1E5FB, "X"), (0x1E5FF, "V"), (0x1E600, "X"), (0x1E7E0, "V"), (0x1E7E7, "X"), (0x1E7E8, "V"), (0x1E7EC, "X"), (0x1E7ED, "V"), (0x1E7EF, "X"), (0x1E7F0, "V"), (0x1E7FF, "X"), (0x1E800, "V"), (0x1E8C5, "X"), (0x1E8C7, "V"), (0x1E8D7, "X"), (0x1E900, "M", "𞤢"), (0x1E901, "M", "𞤣"), (0x1E902, "M", "𞤤"), (0x1E903, "M", "𞤥"), (0x1E904, "M", "𞤦"), (0x1E905, "M", "𞤧"), (0x1E906, "M", "𞤨"), (0x1E907, "M", "𞤩"), (0x1E908, "M", "𞤪"), (0x1E909, "M", "𞤫"), (0x1E90A, "M", "𞤬"), (0x1E90B, "M", "𞤭"), (0x1E90C, "M", "𞤮"), (0x1E90D, "M", "𞤯"), (0x1E90E, "M", "𞤰"), (0x1E90F, "M", "𞤱"), (0x1E910, "M", "𞤲"), (0x1E911, "M", "𞤳"), (0x1E912, "M", "𞤴"), (0x1E913, "M", "𞤵"), (0x1E914, "M", "𞤶"), (0x1E915, "M", "𞤷"), (0x1E916, "M", "𞤸"), (0x1E917, "M", "𞤹"), (0x1E918, "M", "𞤺"), (0x1E919, "M", "𞤻"), (0x1E91A, "M", "𞤼"), (0x1E91B, "M", "𞤽"), (0x1E91C, "M", "𞤾"), (0x1E91D, "M", "𞤿"), (0x1E91E, "M", "𞥀"), (0x1E91F, "M", "𞥁"), (0x1E920, "M", "𞥂"), (0x1E921, "M", "𞥃"), (0x1E922, "V"), (0x1E94C, "X"), (0x1E950, "V"), (0x1E95A, "X"), (0x1E95E, "V"), (0x1E960, "X"), (0x1EC71, "V"), (0x1ECB5, "X"), (0x1ED01, "V"), (0x1ED3E, "X"), (0x1EE00, "M", "ا"), (0x1EE01, "M", "ب"), (0x1EE02, "M", "ج"), (0x1EE03, "M", "د"), (0x1EE04, "X"), (0x1EE05, "M", "و"), (0x1EE06, "M", "ز"), (0x1EE07, "M", "ح"), (0x1EE08, "M", "ط"), (0x1EE09, "M", "ي"), (0x1EE0A, "M", "ك"), (0x1EE0B, "M", "ل"), (0x1EE0C, "M", "م"), (0x1EE0D, "M", "ن"), (0x1EE0E, "M", "س"), (0x1EE0F, "M", "ع"), (0x1EE10, "M", "ف"), (0x1EE11, "M", "ص"), (0x1EE12, "M", "ق"), (0x1EE13, "M", "ر"), (0x1EE14, "M", "ش"), ] def _seg_74() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1EE15, "M", "ت"), (0x1EE16, "M", "ث"), (0x1EE17, "M", "خ"), (0x1EE18, "M", "ذ"), (0x1EE19, "M", "ض"), (0x1EE1A, "M", "ظ"), (0x1EE1B, "M", "غ"), (0x1EE1C, "M", "ٮ"), (0x1EE1D, "M", "ں"), (0x1EE1E, "M", "ڡ"), (0x1EE1F, "M", "ٯ"), (0x1EE20, "X"), (0x1EE21, "M", "ب"), (0x1EE22, "M", "ج"), (0x1EE23, "X"), (0x1EE24, "M", "ه"), (0x1EE25, "X"), (0x1EE27, "M", "ح"), (0x1EE28, "X"), (0x1EE29, "M", "ي"), (0x1EE2A, "M", "ك"), (0x1EE2B, "M", "ل"), (0x1EE2C, "M", "م"), (0x1EE2D, "M", "ن"), (0x1EE2E, "M", "س"), (0x1EE2F, "M", "ع"), (0x1EE30, "M", "ف"), (0x1EE31, "M", "ص"), (0x1EE32, "M", "ق"), (0x1EE33, "X"), (0x1EE34, "M", "ش"), (0x1EE35, "M", "ت"), (0x1EE36, "M", "ث"), (0x1EE37, "M", "خ"), (0x1EE38, "X"), (0x1EE39, "M", "ض"), (0x1EE3A, "X"), (0x1EE3B, "M", "غ"), (0x1EE3C, "X"), (0x1EE42, "M", "ج"), (0x1EE43, "X"), (0x1EE47, "M", "ح"), (0x1EE48, "X"), (0x1EE49, "M", "ي"), (0x1EE4A, "X"), (0x1EE4B, "M", "ل"), (0x1EE4C, "X"), (0x1EE4D, "M", "ن"), (0x1EE4E, "M", "س"), (0x1EE4F, "M", "ع"), (0x1EE50, "X"), (0x1EE51, "M", "ص"), (0x1EE52, "M", "ق"), (0x1EE53, "X"), (0x1EE54, "M", "ش"), (0x1EE55, "X"), (0x1EE57, "M", "خ"), (0x1EE58, "X"), (0x1EE59, "M", "ض"), (0x1EE5A, "X"), (0x1EE5B, "M", "غ"), (0x1EE5C, "X"), (0x1EE5D, "M", "ں"), (0x1EE5E, "X"), (0x1EE5F, "M", "ٯ"), (0x1EE60, "X"), (0x1EE61, "M", "ب"), (0x1EE62, "M", "ج"), (0x1EE63, "X"), (0x1EE64, "M", "ه"), (0x1EE65, "X"), (0x1EE67, "M", "ح"), (0x1EE68, "M", "ط"), (0x1EE69, "M", "ي"), (0x1EE6A, "M", "ك"), (0x1EE6B, "X"), (0x1EE6C, "M", "م"), (0x1EE6D, "M", "ن"), (0x1EE6E, "M", "س"), (0x1EE6F, "M", "ع"), (0x1EE70, "M", "ف"), (0x1EE71, "M", "ص"), (0x1EE72, "M", "ق"), (0x1EE73, "X"), (0x1EE74, "M", "ش"), (0x1EE75, "M", "ت"), (0x1EE76, "M", "ث"), (0x1EE77, "M", "خ"), (0x1EE78, "X"), (0x1EE79, "M", "ض"), (0x1EE7A, "M", "ظ"), (0x1EE7B, "M", "غ"), (0x1EE7C, "M", "ٮ"), (0x1EE7D, "X"), (0x1EE7E, "M", "ڡ"), (0x1EE7F, "X"), (0x1EE80, "M", "ا"), (0x1EE81, "M", "ب"), (0x1EE82, "M", "ج"), (0x1EE83, "M", "د"), ] def _seg_75() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1EE84, "M", "ه"), (0x1EE85, "M", "و"), (0x1EE86, "M", "ز"), (0x1EE87, "M", "ح"), (0x1EE88, "M", "ط"), (0x1EE89, "M", "ي"), (0x1EE8A, "X"), (0x1EE8B, "M", "ل"), (0x1EE8C, "M", "م"), (0x1EE8D, "M", "ن"), (0x1EE8E, "M", "س"), (0x1EE8F, "M", "ع"), (0x1EE90, "M", "ف"), (0x1EE91, "M", "ص"), (0x1EE92, "M", "ق"), (0x1EE93, "M", "ر"), (0x1EE94, "M", "ش"), (0x1EE95, "M", "ت"), (0x1EE96, "M", "ث"), (0x1EE97, "M", "خ"), (0x1EE98, "M", "ذ"), (0x1EE99, "M", "ض"), (0x1EE9A, "M", "ظ"), (0x1EE9B, "M", "غ"), (0x1EE9C, "X"), (0x1EEA1, "M", "ب"), (0x1EEA2, "M", "ج"), (0x1EEA3, "M", "د"), (0x1EEA4, "X"), (0x1EEA5, "M", "و"), (0x1EEA6, "M", "ز"), (0x1EEA7, "M", "ح"), (0x1EEA8, "M", "ط"), (0x1EEA9, "M", "ي"), (0x1EEAA, "X"), (0x1EEAB, "M", "ل"), (0x1EEAC, "M", "م"), (0x1EEAD, "M", "ن"), (0x1EEAE, "M", "س"), (0x1EEAF, "M", "ع"), (0x1EEB0, "M", "ف"), (0x1EEB1, "M", "ص"), (0x1EEB2, "M", "ق"), (0x1EEB3, "M", "ر"), (0x1EEB4, "M", "ش"), (0x1EEB5, "M", "ت"), (0x1EEB6, "M", "ث"), (0x1EEB7, "M", "خ"), (0x1EEB8, "M", "ذ"), (0x1EEB9, "M", "ض"), (0x1EEBA, "M", "ظ"), (0x1EEBB, "M", "غ"), (0x1EEBC, "X"), (0x1EEF0, "V"), (0x1EEF2, "X"), (0x1F000, "V"), (0x1F02C, "X"), (0x1F030, "V"), (0x1F094, "X"), (0x1F0A0, "V"), (0x1F0AF, "X"), (0x1F0B1, "V"), (0x1F0C0, "X"), (0x1F0C1, "V"), (0x1F0D0, "X"), (0x1F0D1, "V"), (0x1F0F6, "X"), (0x1F101, "M", "0,"), (0x1F102, "M", "1,"), (0x1F103, "M", "2,"), (0x1F104, "M", "3,"), (0x1F105, "M", "4,"), (0x1F106, "M", "5,"), (0x1F107, "M", "6,"), (0x1F108, "M", "7,"), (0x1F109, "M", "8,"), (0x1F10A, "M", "9,"), (0x1F10B, "V"), (0x1F110, "M", "(a)"), (0x1F111, "M", "(b)"), (0x1F112, "M", "(c)"), (0x1F113, "M", "(d)"), (0x1F114, "M", "(e)"), (0x1F115, "M", "(f)"), (0x1F116, "M", "(g)"), (0x1F117, "M", "(h)"), (0x1F118, "M", "(i)"), (0x1F119, "M", "(j)"), (0x1F11A, "M", "(k)"), (0x1F11B, "M", "(l)"), (0x1F11C, "M", "(m)"), (0x1F11D, "M", "(n)"), (0x1F11E, "M", "(o)"), (0x1F11F, "M", "(p)"), (0x1F120, "M", "(q)"), (0x1F121, "M", "(r)"), (0x1F122, "M", "(s)"), (0x1F123, "M", "(t)"), (0x1F124, "M", "(u)"), (0x1F125, "M", "(v)"), ] def _seg_76() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1F126, "M", "(w)"), (0x1F127, "M", "(x)"), (0x1F128, "M", "(y)"), (0x1F129, "M", "(z)"), (0x1F12A, "M", "〔s〕"), (0x1F12B, "M", "c"), (0x1F12C, "M", "r"), (0x1F12D, "M", "cd"), (0x1F12E, "M", "wz"), (0x1F12F, "V"), (0x1F130, "M", "a"), (0x1F131, "M", "b"), (0x1F132, "M", "c"), (0x1F133, "M", "d"), (0x1F134, "M", "e"), (0x1F135, "M", "f"), (0x1F136, "M", "g"), (0x1F137, "M", "h"), (0x1F138, "M", "i"), (0x1F139, "M", "j"), (0x1F13A, "M", "k"), (0x1F13B, "M", "l"), (0x1F13C, "M", "m"), (0x1F13D, "M", "n"), (0x1F13E, "M", "o"), (0x1F13F, "M", "p"), (0x1F140, "M", "q"), (0x1F141, "M", "r"), (0x1F142, "M", "s"), (0x1F143, "M", "t"), (0x1F144, "M", "u"), (0x1F145, "M", "v"), (0x1F146, "M", "w"), (0x1F147, "M", "x"), (0x1F148, "M", "y"), (0x1F149, "M", "z"), (0x1F14A, "M", "hv"), (0x1F14B, "M", "mv"), (0x1F14C, "M", "sd"), (0x1F14D, "M", "ss"), (0x1F14E, "M", "ppv"), (0x1F14F, "M", "wc"), (0x1F150, "V"), (0x1F16A, "M", "mc"), (0x1F16B, "M", "md"), (0x1F16C, "M", "mr"), (0x1F16D, "V"), (0x1F190, "M", "dj"), (0x1F191, "V"), (0x1F1AE, "X"), (0x1F1E6, "V"), (0x1F200, "M", "ほか"), (0x1F201, "M", "ココ"), (0x1F202, "M", "サ"), (0x1F203, "X"), (0x1F210, "M", "手"), (0x1F211, "M", "字"), (0x1F212, "M", "双"), (0x1F213, "M", "デ"), (0x1F214, "M", "二"), (0x1F215, "M", "多"), (0x1F216, "M", "解"), (0x1F217, "M", "天"), (0x1F218, "M", "交"), (0x1F219, "M", "映"), (0x1F21A, "M", "無"), (0x1F21B, "M", "料"), (0x1F21C, "M", "前"), (0x1F21D, "M", "後"), (0x1F21E, "M", "再"), (0x1F21F, "M", "新"), (0x1F220, "M", "初"), (0x1F221, "M", "終"), (0x1F222, "M", "生"), (0x1F223, "M", "販"), (0x1F224, "M", "声"), (0x1F225, "M", "吹"), (0x1F226, "M", "演"), (0x1F227, "M", "投"), (0x1F228, "M", "捕"), (0x1F229, "M", "一"), (0x1F22A, "M", "三"), (0x1F22B, "M", "遊"), (0x1F22C, "M", "左"), (0x1F22D, "M", "中"), (0x1F22E, "M", "右"), (0x1F22F, "M", "指"), (0x1F230, "M", "走"), (0x1F231, "M", "打"), (0x1F232, "M", "禁"), (0x1F233, "M", "空"), (0x1F234, "M", "合"), (0x1F235, "M", "満"), (0x1F236, "M", "有"), (0x1F237, "M", "月"), (0x1F238, "M", "申"), (0x1F239, "M", "割"), (0x1F23A, "M", "営"), (0x1F23B, "M", "配"), (0x1F23C, "X"), ] def _seg_77() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x1F240, "M", "〔本〕"), (0x1F241, "M", "〔三〕"), (0x1F242, "M", "〔二〕"), (0x1F243, "M", "〔安〕"), (0x1F244, "M", "〔点〕"), (0x1F245, "M", "〔打〕"), (0x1F246, "M", "〔盗〕"), (0x1F247, "M", "〔勝〕"), (0x1F248, "M", "〔敗〕"), (0x1F249, "X"), (0x1F250, "M", "得"), (0x1F251, "M", "可"), (0x1F252, "X"), (0x1F260, "V"), (0x1F266, "X"), (0x1F300, "V"), (0x1F6D8, "X"), (0x1F6DC, "V"), (0x1F6ED, "X"), (0x1F6F0, "V"), (0x1F6FD, "X"), (0x1F700, "V"), (0x1F777, "X"), (0x1F77B, "V"), (0x1F7DA, "X"), (0x1F7E0, "V"), (0x1F7EC, "X"), (0x1F7F0, "V"), (0x1F7F1, "X"), (0x1F800, "V"), (0x1F80C, "X"), (0x1F810, "V"), (0x1F848, "X"), (0x1F850, "V"), (0x1F85A, "X"), (0x1F860, "V"), (0x1F888, "X"), (0x1F890, "V"), (0x1F8AE, "X"), (0x1F8B0, "V"), (0x1F8BC, "X"), (0x1F8C0, "V"), (0x1F8C2, "X"), (0x1F900, "V"), (0x1FA54, "X"), (0x1FA60, "V"), (0x1FA6E, "X"), (0x1FA70, "V"), (0x1FA7D, "X"), (0x1FA80, "V"), (0x1FA8A, "X"), (0x1FA8F, "V"), (0x1FAC7, "X"), (0x1FACE, "V"), (0x1FADD, "X"), (0x1FADF, "V"), (0x1FAEA, "X"), (0x1FAF0, "V"), (0x1FAF9, "X"), (0x1FB00, "V"), (0x1FB93, "X"), (0x1FB94, "V"), (0x1FBF0, "M", "0"), (0x1FBF1, "M", "1"), (0x1FBF2, "M", "2"), (0x1FBF3, "M", "3"), (0x1FBF4, "M", "4"), (0x1FBF5, "M", "5"), (0x1FBF6, "M", "6"), (0x1FBF7, "M", "7"), (0x1FBF8, "M", "8"), (0x1FBF9, "M", "9"), (0x1FBFA, "X"), (0x20000, "V"), (0x2A6E0, "X"), (0x2A700, "V"), (0x2B73A, "X"), (0x2B740, "V"), (0x2B81E, "X"), (0x2B820, "V"), (0x2CEA2, "X"), (0x2CEB0, "V"), (0x2EBE1, "X"), (0x2EBF0, "V"), (0x2EE5E, "X"), (0x2F800, "M", "丽"), (0x2F801, "M", "丸"), (0x2F802, "M", "乁"), (0x2F803, "M", "𠄢"), (0x2F804, "M", "你"), (0x2F805, "M", "侮"), (0x2F806, "M", "侻"), (0x2F807, "M", "倂"), (0x2F808, "M", "偺"), (0x2F809, "M", "備"), (0x2F80A, "M", "僧"), (0x2F80B, "M", "像"), (0x2F80C, "M", "㒞"), (0x2F80D, "M", "𠘺"), (0x2F80E, "M", "免"), ] def _seg_78() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x2F80F, "M", "兔"), (0x2F810, "M", "兤"), (0x2F811, "M", "具"), (0x2F812, "M", "𠔜"), (0x2F813, "M", "㒹"), (0x2F814, "M", "內"), (0x2F815, "M", "再"), (0x2F816, "M", "𠕋"), (0x2F817, "M", "冗"), (0x2F818, "M", "冤"), (0x2F819, "M", "仌"), (0x2F81A, "M", "冬"), (0x2F81B, "M", "况"), (0x2F81C, "M", "𩇟"), (0x2F81D, "M", "凵"), (0x2F81E, "M", "刃"), (0x2F81F, "M", "㓟"), (0x2F820, "M", "刻"), (0x2F821, "M", "剆"), (0x2F822, "M", "割"), (0x2F823, "M", "剷"), (0x2F824, "M", "㔕"), (0x2F825, "M", "勇"), (0x2F826, "M", "勉"), (0x2F827, "M", "勤"), (0x2F828, "M", "勺"), (0x2F829, "M", "包"), (0x2F82A, "M", "匆"), (0x2F82B, "M", "北"), (0x2F82C, "M", "卉"), (0x2F82D, "M", "卑"), (0x2F82E, "M", "博"), (0x2F82F, "M", "即"), (0x2F830, "M", "卽"), (0x2F831, "M", "卿"), (0x2F834, "M", "𠨬"), (0x2F835, "M", "灰"), (0x2F836, "M", "及"), (0x2F837, "M", "叟"), (0x2F838, "M", "𠭣"), (0x2F839, "M", "叫"), (0x2F83A, "M", "叱"), (0x2F83B, "M", "吆"), (0x2F83C, "M", "咞"), (0x2F83D, "M", "吸"), (0x2F83E, "M", "呈"), (0x2F83F, "M", "周"), (0x2F840, "M", "咢"), (0x2F841, "M", "哶"), (0x2F842, "M", "唐"), (0x2F843, "M", "啓"), (0x2F844, "M", "啣"), (0x2F845, "M", "善"), (0x2F847, "M", "喙"), (0x2F848, "M", "喫"), (0x2F849, "M", "喳"), (0x2F84A, "M", "嗂"), (0x2F84B, "M", "圖"), (0x2F84C, "M", "嘆"), (0x2F84D, "M", "圗"), (0x2F84E, "M", "噑"), (0x2F84F, "M", "噴"), (0x2F850, "M", "切"), (0x2F851, "M", "壮"), (0x2F852, "M", "城"), (0x2F853, "M", "埴"), (0x2F854, "M", "堍"), (0x2F855, "M", "型"), (0x2F856, "M", "堲"), (0x2F857, "M", "報"), (0x2F858, "M", "墬"), (0x2F859, "M", "𡓤"), (0x2F85A, "M", "売"), (0x2F85B, "M", "壷"), (0x2F85C, "M", "夆"), (0x2F85D, "M", "多"), (0x2F85E, "M", "夢"), (0x2F85F, "M", "奢"), (0x2F860, "M", "𡚨"), (0x2F861, "M", "𡛪"), (0x2F862, "M", "姬"), (0x2F863, "M", "娛"), (0x2F864, "M", "娧"), (0x2F865, "M", "姘"), (0x2F866, "M", "婦"), (0x2F867, "M", "㛮"), (0x2F868, "M", "㛼"), (0x2F869, "M", "嬈"), (0x2F86A, "M", "嬾"), (0x2F86C, "M", "𡧈"), (0x2F86D, "M", "寃"), (0x2F86E, "M", "寘"), (0x2F86F, "M", "寧"), (0x2F870, "M", "寳"), (0x2F871, "M", "𡬘"), (0x2F872, "M", "寿"), (0x2F873, "M", "将"), (0x2F874, "M", "当"), (0x2F875, "M", "尢"), (0x2F876, "M", "㞁"), ] def _seg_79() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x2F877, "M", "屠"), (0x2F878, "M", "屮"), (0x2F879, "M", "峀"), (0x2F87A, "M", "岍"), (0x2F87B, "M", "𡷤"), (0x2F87C, "M", "嵃"), (0x2F87D, "M", "𡷦"), (0x2F87E, "M", "嵮"), (0x2F87F, "M", "嵫"), (0x2F880, "M", "嵼"), (0x2F881, "M", "巡"), (0x2F882, "M", "巢"), (0x2F883, "M", "㠯"), (0x2F884, "M", "巽"), (0x2F885, "M", "帨"), (0x2F886, "M", "帽"), (0x2F887, "M", "幩"), (0x2F888, "M", "㡢"), (0x2F889, "M", "𢆃"), (0x2F88A, "M", "㡼"), (0x2F88B, "M", "庰"), (0x2F88C, "M", "庳"), (0x2F88D, "M", "庶"), (0x2F88E, "M", "廊"), (0x2F88F, "M", "𪎒"), (0x2F890, "M", "廾"), (0x2F891, "M", "𢌱"), (0x2F893, "M", "舁"), (0x2F894, "M", "弢"), (0x2F896, "M", "㣇"), (0x2F897, "M", "𣊸"), (0x2F898, "M", "𦇚"), (0x2F899, "M", "形"), (0x2F89A, "M", "彫"), (0x2F89B, "M", "㣣"), (0x2F89C, "M", "徚"), (0x2F89D, "M", "忍"), (0x2F89E, "M", "志"), (0x2F89F, "M", "忹"), (0x2F8A0, "M", "悁"), (0x2F8A1, "M", "㤺"), (0x2F8A2, "M", "㤜"), (0x2F8A3, "M", "悔"), (0x2F8A4, "M", "𢛔"), (0x2F8A5, "M", "惇"), (0x2F8A6, "M", "慈"), (0x2F8A7, "M", "慌"), (0x2F8A8, "M", "慎"), (0x2F8A9, "M", "慌"), (0x2F8AA, "M", "慺"), (0x2F8AB, "M", "憎"), (0x2F8AC, "M", "憲"), (0x2F8AD, "M", "憤"), (0x2F8AE, "M", "憯"), (0x2F8AF, "M", "懞"), (0x2F8B0, "M", "懲"), (0x2F8B1, "M", "懶"), (0x2F8B2, "M", "成"), (0x2F8B3, "M", "戛"), (0x2F8B4, "M", "扝"), (0x2F8B5, "M", "抱"), (0x2F8B6, "M", "拔"), (0x2F8B7, "M", "捐"), (0x2F8B8, "M", "𢬌"), (0x2F8B9, "M", "挽"), (0x2F8BA, "M", "拼"), (0x2F8BB, "M", "捨"), (0x2F8BC, "M", "掃"), (0x2F8BD, "M", "揤"), (0x2F8BE, "M", "𢯱"), (0x2F8BF, "M", "搢"), (0x2F8C0, "M", "揅"), (0x2F8C1, "M", "掩"), (0x2F8C2, "M", "㨮"), (0x2F8C3, "M", "摩"), (0x2F8C4, "M", "摾"), (0x2F8C5, "M", "撝"), (0x2F8C6, "M", "摷"), (0x2F8C7, "M", "㩬"), (0x2F8C8, "M", "敏"), (0x2F8C9, "M", "敬"), (0x2F8CA, "M", "𣀊"), (0x2F8CB, "M", "旣"), (0x2F8CC, "M", "書"), (0x2F8CD, "M", "晉"), (0x2F8CE, "M", "㬙"), (0x2F8CF, "M", "暑"), (0x2F8D0, "M", "㬈"), (0x2F8D1, "M", "㫤"), (0x2F8D2, "M", "冒"), (0x2F8D3, "M", "冕"), (0x2F8D4, "M", "最"), (0x2F8D5, "M", "暜"), (0x2F8D6, "M", "肭"), (0x2F8D7, "M", "䏙"), (0x2F8D8, "M", "朗"), (0x2F8D9, "M", "望"), (0x2F8DA, "M", "朡"), (0x2F8DB, "M", "杞"), (0x2F8DC, "M", "杓"), ] def _seg_80() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x2F8DD, "M", "𣏃"), (0x2F8DE, "M", "㭉"), (0x2F8DF, "M", "柺"), (0x2F8E0, "M", "枅"), (0x2F8E1, "M", "桒"), (0x2F8E2, "M", "梅"), (0x2F8E3, "M", "𣑭"), (0x2F8E4, "M", "梎"), (0x2F8E5, "M", "栟"), (0x2F8E6, "M", "椔"), (0x2F8E7, "M", "㮝"), (0x2F8E8, "M", "楂"), (0x2F8E9, "M", "榣"), (0x2F8EA, "M", "槪"), (0x2F8EB, "M", "檨"), (0x2F8EC, "M", "𣚣"), (0x2F8ED, "M", "櫛"), (0x2F8EE, "M", "㰘"), (0x2F8EF, "M", "次"), (0x2F8F0, "M", "𣢧"), (0x2F8F1, "M", "歔"), (0x2F8F2, "M", "㱎"), (0x2F8F3, "M", "歲"), (0x2F8F4, "M", "殟"), (0x2F8F5, "M", "殺"), (0x2F8F6, "M", "殻"), (0x2F8F7, "M", "𣪍"), (0x2F8F8, "M", "𡴋"), (0x2F8F9, "M", "𣫺"), (0x2F8FA, "M", "汎"), (0x2F8FB, "M", "𣲼"), (0x2F8FC, "M", "沿"), (0x2F8FD, "M", "泍"), (0x2F8FE, "M", "汧"), (0x2F8FF, "M", "洖"), (0x2F900, "M", "派"), (0x2F901, "M", "海"), (0x2F902, "M", "流"), (0x2F903, "M", "浩"), (0x2F904, "M", "浸"), (0x2F905, "M", "涅"), (0x2F906, "M", "𣴞"), (0x2F907, "M", "洴"), (0x2F908, "M", "港"), (0x2F909, "M", "湮"), (0x2F90A, "M", "㴳"), (0x2F90B, "M", "滋"), (0x2F90C, "M", "滇"), (0x2F90D, "M", "𣻑"), (0x2F90E, "M", "淹"), (0x2F90F, "M", "潮"), (0x2F910, "M", "𣽞"), (0x2F911, "M", "𣾎"), (0x2F912, "M", "濆"), (0x2F913, "M", "瀹"), (0x2F914, "M", "瀞"), (0x2F915, "M", "瀛"), (0x2F916, "M", "㶖"), (0x2F917, "M", "灊"), (0x2F918, "M", "災"), (0x2F919, "M", "灷"), (0x2F91A, "M", "炭"), (0x2F91B, "M", "𠔥"), (0x2F91C, "M", "煅"), (0x2F91D, "M", "𤉣"), (0x2F91E, "M", "熜"), (0x2F91F, "M", "𤎫"), (0x2F920, "M", "爨"), (0x2F921, "M", "爵"), (0x2F922, "M", "牐"), (0x2F923, "M", "𤘈"), (0x2F924, "M", "犀"), (0x2F925, "M", "犕"), (0x2F926, "M", "𤜵"), (0x2F927, "M", "𤠔"), (0x2F928, "M", "獺"), (0x2F929, "M", "王"), (0x2F92A, "M", "㺬"), (0x2F92B, "M", "玥"), (0x2F92C, "M", "㺸"), (0x2F92E, "M", "瑇"), (0x2F92F, "M", "瑜"), (0x2F930, "M", "瑱"), (0x2F931, "M", "璅"), (0x2F932, "M", "瓊"), (0x2F933, "M", "㼛"), (0x2F934, "M", "甤"), (0x2F935, "M", "𤰶"), (0x2F936, "M", "甾"), (0x2F937, "M", "𤲒"), (0x2F938, "M", "異"), (0x2F939, "M", "𢆟"), (0x2F93A, "M", "瘐"), (0x2F93B, "M", "𤾡"), (0x2F93C, "M", "𤾸"), (0x2F93D, "M", "𥁄"), (0x2F93E, "M", "㿼"), (0x2F93F, "M", "䀈"), (0x2F940, "M", "直"), (0x2F941, "M", "𥃳"), ] def _seg_81() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x2F942, "M", "𥃲"), (0x2F943, "M", "𥄙"), (0x2F944, "M", "𥄳"), (0x2F945, "M", "眞"), (0x2F946, "M", "真"), (0x2F948, "M", "睊"), (0x2F949, "M", "䀹"), (0x2F94A, "M", "瞋"), (0x2F94B, "M", "䁆"), (0x2F94C, "M", "䂖"), (0x2F94D, "M", "𥐝"), (0x2F94E, "M", "硎"), (0x2F94F, "M", "碌"), (0x2F950, "M", "磌"), (0x2F951, "M", "䃣"), (0x2F952, "M", "𥘦"), (0x2F953, "M", "祖"), (0x2F954, "M", "𥚚"), (0x2F955, "M", "𥛅"), (0x2F956, "M", "福"), (0x2F957, "M", "秫"), (0x2F958, "M", "䄯"), (0x2F959, "M", "穀"), (0x2F95A, "M", "穊"), (0x2F95B, "M", "穏"), (0x2F95C, "M", "𥥼"), (0x2F95D, "M", "𥪧"), (0x2F95F, "M", "竮"), (0x2F960, "M", "䈂"), (0x2F961, "M", "𥮫"), (0x2F962, "M", "篆"), (0x2F963, "M", "築"), (0x2F964, "M", "䈧"), (0x2F965, "M", "𥲀"), (0x2F966, "M", "糒"), (0x2F967, "M", "䊠"), (0x2F968, "M", "糨"), (0x2F969, "M", "糣"), (0x2F96A, "M", "紀"), (0x2F96B, "M", "𥾆"), (0x2F96C, "M", "絣"), (0x2F96D, "M", "䌁"), (0x2F96E, "M", "緇"), (0x2F96F, "M", "縂"), (0x2F970, "M", "繅"), (0x2F971, "M", "䌴"), (0x2F972, "M", "𦈨"), (0x2F973, "M", "𦉇"), (0x2F974, "M", "䍙"), (0x2F975, "M", "𦋙"), (0x2F976, "M", "罺"), (0x2F977, "M", "𦌾"), (0x2F978, "M", "羕"), (0x2F979, "M", "翺"), (0x2F97A, "M", "者"), (0x2F97B, "M", "𦓚"), (0x2F97C, "M", "𦔣"), (0x2F97D, "M", "聠"), (0x2F97E, "M", "𦖨"), (0x2F97F, "M", "聰"), (0x2F980, "M", "𣍟"), (0x2F981, "M", "䏕"), (0x2F982, "M", "育"), (0x2F983, "M", "脃"), (0x2F984, "M", "䐋"), (0x2F985, "M", "脾"), (0x2F986, "M", "媵"), (0x2F987, "M", "𦞧"), (0x2F988, "M", "𦞵"), (0x2F989, "M", "𣎓"), (0x2F98A, "M", "𣎜"), (0x2F98B, "M", "舁"), (0x2F98C, "M", "舄"), (0x2F98D, "M", "辞"), (0x2F98E, "M", "䑫"), (0x2F98F, "M", "芑"), (0x2F990, "M", "芋"), (0x2F991, "M", "芝"), (0x2F992, "M", "劳"), (0x2F993, "M", "花"), (0x2F994, "M", "芳"), (0x2F995, "M", "芽"), (0x2F996, "M", "苦"), (0x2F997, "M", "𦬼"), (0x2F998, "M", "若"), (0x2F999, "M", "茝"), (0x2F99A, "M", "荣"), (0x2F99B, "M", "莭"), (0x2F99C, "M", "茣"), (0x2F99D, "M", "莽"), (0x2F99E, "M", "菧"), (0x2F99F, "M", "著"), (0x2F9A0, "M", "荓"), (0x2F9A1, "M", "菊"), (0x2F9A2, "M", "菌"), (0x2F9A3, "M", "菜"), (0x2F9A4, "M", "𦰶"), (0x2F9A5, "M", "𦵫"), (0x2F9A6, "M", "𦳕"), (0x2F9A7, "M", "䔫"), ] def _seg_82() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x2F9A8, "M", "蓱"), (0x2F9A9, "M", "蓳"), (0x2F9AA, "M", "蔖"), (0x2F9AB, "M", "𧏊"), (0x2F9AC, "M", "蕤"), (0x2F9AD, "M", "𦼬"), (0x2F9AE, "M", "䕝"), (0x2F9AF, "M", "䕡"), (0x2F9B0, "M", "𦾱"), (0x2F9B1, "M", "𧃒"), (0x2F9B2, "M", "䕫"), (0x2F9B3, "M", "虐"), (0x2F9B4, "M", "虜"), (0x2F9B5, "M", "虧"), (0x2F9B6, "M", "虩"), (0x2F9B7, "M", "蚩"), (0x2F9B8, "M", "蚈"), (0x2F9B9, "M", "蜎"), (0x2F9BA, "M", "蛢"), (0x2F9BB, "M", "蝹"), (0x2F9BC, "M", "蜨"), (0x2F9BD, "M", "蝫"), (0x2F9BE, "M", "螆"), (0x2F9BF, "M", "䗗"), (0x2F9C0, "M", "蟡"), (0x2F9C1, "M", "蠁"), (0x2F9C2, "M", "䗹"), (0x2F9C3, "M", "衠"), (0x2F9C4, "M", "衣"), (0x2F9C5, "M", "𧙧"), (0x2F9C6, "M", "裗"), (0x2F9C7, "M", "裞"), (0x2F9C8, "M", "䘵"), (0x2F9C9, "M", "裺"), (0x2F9CA, "M", "㒻"), (0x2F9CB, "M", "𧢮"), (0x2F9CC, "M", "𧥦"), (0x2F9CD, "M", "䚾"), (0x2F9CE, "M", "䛇"), (0x2F9CF, "M", "誠"), (0x2F9D0, "M", "諭"), (0x2F9D1, "M", "變"), (0x2F9D2, "M", "豕"), (0x2F9D3, "M", "𧲨"), (0x2F9D4, "M", "貫"), (0x2F9D5, "M", "賁"), (0x2F9D6, "M", "贛"), (0x2F9D7, "M", "起"), (0x2F9D8, "M", "𧼯"), (0x2F9D9, "M", "𠠄"), (0x2F9DA, "M", "跋"), (0x2F9DB, "M", "趼"), (0x2F9DC, "M", "跰"), (0x2F9DD, "M", "𠣞"), (0x2F9DE, "M", "軔"), (0x2F9DF, "M", "輸"), (0x2F9E0, "M", "𨗒"), (0x2F9E1, "M", "𨗭"), (0x2F9E2, "M", "邔"), (0x2F9E3, "M", "郱"), (0x2F9E4, "M", "鄑"), (0x2F9E5, "M", "𨜮"), (0x2F9E6, "M", "鄛"), (0x2F9E7, "M", "鈸"), (0x2F9E8, "M", "鋗"), (0x2F9E9, "M", "鋘"), (0x2F9EA, "M", "鉼"), (0x2F9EB, "M", "鏹"), (0x2F9EC, "M", "鐕"), (0x2F9ED, "M", "𨯺"), (0x2F9EE, "M", "開"), (0x2F9EF, "M", "䦕"), (0x2F9F0, "M", "閷"), (0x2F9F1, "M", "𨵷"), (0x2F9F2, "M", "䧦"), (0x2F9F3, "M", "雃"), (0x2F9F4, "M", "嶲"), (0x2F9F5, "M", "霣"), (0x2F9F6, "M", "𩅅"), (0x2F9F7, "M", "𩈚"), (0x2F9F8, "M", "䩮"), (0x2F9F9, "M", "䩶"), (0x2F9FA, "M", "韠"), (0x2F9FB, "M", "𩐊"), (0x2F9FC, "M", "䪲"), (0x2F9FD, "M", "𩒖"), (0x2F9FE, "M", "頋"), (0x2FA00, "M", "頩"), (0x2FA01, "M", "𩖶"), (0x2FA02, "M", "飢"), (0x2FA03, "M", "䬳"), (0x2FA04, "M", "餩"), (0x2FA05, "M", "馧"), (0x2FA06, "M", "駂"), (0x2FA07, "M", "駾"), (0x2FA08, "M", "䯎"), (0x2FA09, "M", "𩬰"), (0x2FA0A, "M", "鬒"), (0x2FA0B, "M", "鱀"), (0x2FA0C, "M", "鳽"), ] def _seg_83() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: return [ (0x2FA0D, "M", "䳎"), (0x2FA0E, "M", "䳭"), (0x2FA0F, "M", "鵧"), (0x2FA10, "M", "𪃎"), (0x2FA11, "M", "䳸"), (0x2FA12, "M", "𪄅"), (0x2FA13, "M", "𪈎"), (0x2FA14, "M", "𪊑"), (0x2FA15, "M", "麻"), (0x2FA16, "M", "䵖"), (0x2FA17, "M", "黹"), (0x2FA18, "M", "黾"), (0x2FA19, "M", "鼅"), (0x2FA1A, "M", "鼏"), (0x2FA1B, "M", "鼖"), (0x2FA1C, "M", "鼻"), (0x2FA1D, "M", "𪘀"), (0x2FA1E, "X"), (0x30000, "V"), (0x3134B, "X"), (0x31350, "V"), (0x323B0, "X"), (0xE0100, "I"), (0xE01F0, "X"), ] uts46data = tuple( _seg_0() + _seg_1() + _seg_2() + _seg_3() + _seg_4() + _seg_5() + _seg_6() + _seg_7() + _seg_8() + _seg_9() + _seg_10() + _seg_11() + _seg_12() + _seg_13() + _seg_14() + _seg_15() + _seg_16() + _seg_17() + _seg_18() + _seg_19() + _seg_20() + _seg_21() + _seg_22() + _seg_23() + _seg_24() + _seg_25() + _seg_26() + _seg_27() + _seg_28() + _seg_29() + _seg_30() + _seg_31() + _seg_32() + _seg_33() + _seg_34() + _seg_35() + _seg_36() + _seg_37() + _seg_38() + _seg_39() + _seg_40() + _seg_41() + _seg_42() + _seg_43() + _seg_44() + _seg_45() + _seg_46() + _seg_47() + _seg_48() + _seg_49() + _seg_50() + _seg_51() + _seg_52() + _seg_53() + _seg_54() + _seg_55() + _seg_56() + _seg_57() + _seg_58() + _seg_59() + _seg_60() + _seg_61() + _seg_62() + _seg_63() + _seg_64() + _seg_65() + _seg_66() + _seg_67() + _seg_68() + _seg_69() + _seg_70() + _seg_71() + _seg_72() + _seg_73() + _seg_74() + _seg_75() + _seg_76() + _seg_77() + _seg_78() + _seg_79() + _seg_80() + _seg_81() + _seg_82() + _seg_83() ) # type: Tuple[Union[Tuple[int, str], Tuple[int, str, str]], ...] ================================================ FILE: src/pip/_vendor/msgpack/COPYING ================================================ Copyright (C) 2008-2011 INADA Naoki Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: src/pip/_vendor/msgpack/__init__.py ================================================ # ruff: noqa: F401 import os from .exceptions import * # noqa: F403 from .ext import ExtType, Timestamp version = (1, 1, 2) __version__ = "1.1.2" if os.environ.get("MSGPACK_PUREPYTHON"): from .fallback import Packer, Unpacker, unpackb else: try: from ._cmsgpack import Packer, Unpacker, unpackb except ImportError: from .fallback import Packer, Unpacker, unpackb def pack(o, stream, **kwargs): """ Pack object `o` and write it to `stream` See :class:`Packer` for options. """ packer = Packer(**kwargs) stream.write(packer.pack(o)) def packb(o, **kwargs): """ Pack object `o` and return packed bytes See :class:`Packer` for options. """ return Packer(**kwargs).pack(o) def unpack(stream, **kwargs): """ Unpack an object from `stream`. Raises `ExtraData` when `stream` contains extra bytes. See :class:`Unpacker` for options. """ data = stream.read() return unpackb(data, **kwargs) # alias for compatibility to simplejson/marshal/pickle. load = unpack loads = unpackb dump = pack dumps = packb ================================================ FILE: src/pip/_vendor/msgpack/exceptions.py ================================================ class UnpackException(Exception): """Base class for some exceptions raised while unpacking. NOTE: unpack may raise exception other than subclass of UnpackException. If you want to catch all error, catch Exception instead. """ class BufferFull(UnpackException): pass class OutOfData(UnpackException): pass class FormatError(ValueError, UnpackException): """Invalid msgpack format""" class StackError(ValueError, UnpackException): """Too nested""" # Deprecated. Use ValueError instead UnpackValueError = ValueError class ExtraData(UnpackValueError): """ExtraData is raised when there is trailing data. This exception is raised while only one-shot (not streaming) unpack. """ def __init__(self, unpacked, extra): self.unpacked = unpacked self.extra = extra def __str__(self): return "unpack(b) received extra data." # Deprecated. Use Exception instead to catch all exception during packing. PackException = Exception PackValueError = ValueError PackOverflowError = OverflowError ================================================ FILE: src/pip/_vendor/msgpack/ext.py ================================================ import datetime import struct from collections import namedtuple class ExtType(namedtuple("ExtType", "code data")): """ExtType represents ext type in msgpack.""" def __new__(cls, code, data): if not isinstance(code, int): raise TypeError("code must be int") if not isinstance(data, bytes): raise TypeError("data must be bytes") if not 0 <= code <= 127: raise ValueError("code must be 0~127") return super().__new__(cls, code, data) class Timestamp: """Timestamp represents the Timestamp extension type in msgpack. When built with Cython, msgpack uses C methods to pack and unpack `Timestamp`. When using pure-Python msgpack, :func:`to_bytes` and :func:`from_bytes` are used to pack and unpack `Timestamp`. This class is immutable: Do not override seconds and nanoseconds. """ __slots__ = ["seconds", "nanoseconds"] def __init__(self, seconds, nanoseconds=0): """Initialize a Timestamp object. :param int seconds: Number of seconds since the UNIX epoch (00:00:00 UTC Jan 1 1970, minus leap seconds). May be negative. :param int nanoseconds: Number of nanoseconds to add to `seconds` to get fractional time. Maximum is 999_999_999. Default is 0. Note: Negative times (before the UNIX epoch) are represented as neg. seconds + pos. ns. """ if not isinstance(seconds, int): raise TypeError("seconds must be an integer") if not isinstance(nanoseconds, int): raise TypeError("nanoseconds must be an integer") if not (0 <= nanoseconds < 10**9): raise ValueError("nanoseconds must be a non-negative integer less than 999999999.") self.seconds = seconds self.nanoseconds = nanoseconds def __repr__(self): """String representation of Timestamp.""" return f"Timestamp(seconds={self.seconds}, nanoseconds={self.nanoseconds})" def __eq__(self, other): """Check for equality with another Timestamp object""" if type(other) is self.__class__: return self.seconds == other.seconds and self.nanoseconds == other.nanoseconds return False def __ne__(self, other): """not-equals method (see :func:`__eq__()`)""" return not self.__eq__(other) def __hash__(self): return hash((self.seconds, self.nanoseconds)) @staticmethod def from_bytes(b): """Unpack bytes into a `Timestamp` object. Used for pure-Python msgpack unpacking. :param b: Payload from msgpack ext message with code -1 :type b: bytes :returns: Timestamp object unpacked from msgpack ext payload :rtype: Timestamp """ if len(b) == 4: seconds = struct.unpack("!L", b)[0] nanoseconds = 0 elif len(b) == 8: data64 = struct.unpack("!Q", b)[0] seconds = data64 & 0x00000003FFFFFFFF nanoseconds = data64 >> 34 elif len(b) == 12: nanoseconds, seconds = struct.unpack("!Iq", b) else: raise ValueError( "Timestamp type can only be created from 32, 64, or 96-bit byte objects" ) return Timestamp(seconds, nanoseconds) def to_bytes(self): """Pack this Timestamp object into bytes. Used for pure-Python msgpack packing. :returns data: Payload for EXT message with code -1 (timestamp type) :rtype: bytes """ if (self.seconds >> 34) == 0: # seconds is non-negative and fits in 34 bits data64 = self.nanoseconds << 34 | self.seconds if data64 & 0xFFFFFFFF00000000 == 0: # nanoseconds is zero and seconds < 2**32, so timestamp 32 data = struct.pack("!L", data64) else: # timestamp 64 data = struct.pack("!Q", data64) else: # timestamp 96 data = struct.pack("!Iq", self.nanoseconds, self.seconds) return data @staticmethod def from_unix(unix_sec): """Create a Timestamp from posix timestamp in seconds. :param unix_float: Posix timestamp in seconds. :type unix_float: int or float """ seconds = int(unix_sec // 1) nanoseconds = int((unix_sec % 1) * 10**9) return Timestamp(seconds, nanoseconds) def to_unix(self): """Get the timestamp as a floating-point value. :returns: posix timestamp :rtype: float """ return self.seconds + self.nanoseconds / 1e9 @staticmethod def from_unix_nano(unix_ns): """Create a Timestamp from posix timestamp in nanoseconds. :param int unix_ns: Posix timestamp in nanoseconds. :rtype: Timestamp """ return Timestamp(*divmod(unix_ns, 10**9)) def to_unix_nano(self): """Get the timestamp as a unixtime in nanoseconds. :returns: posix timestamp in nanoseconds :rtype: int """ return self.seconds * 10**9 + self.nanoseconds def to_datetime(self): """Get the timestamp as a UTC datetime. :rtype: `datetime.datetime` """ utc = datetime.timezone.utc return datetime.datetime.fromtimestamp(0, utc) + datetime.timedelta( seconds=self.seconds, microseconds=self.nanoseconds // 1000 ) @staticmethod def from_datetime(dt): """Create a Timestamp from datetime with tzinfo. :rtype: Timestamp """ return Timestamp(seconds=int(dt.timestamp()), nanoseconds=dt.microsecond * 1000) ================================================ FILE: src/pip/_vendor/msgpack/fallback.py ================================================ """Fallback pure Python implementation of msgpack""" import struct import sys from datetime import datetime as _DateTime if hasattr(sys, "pypy_version_info"): from __pypy__ import newlist_hint from __pypy__.builders import BytesBuilder _USING_STRINGBUILDER = True class BytesIO: def __init__(self, s=b""): if s: self.builder = BytesBuilder(len(s)) self.builder.append(s) else: self.builder = BytesBuilder() def write(self, s): if isinstance(s, memoryview): s = s.tobytes() elif isinstance(s, bytearray): s = bytes(s) self.builder.append(s) def getvalue(self): return self.builder.build() else: from io import BytesIO _USING_STRINGBUILDER = False def newlist_hint(size): return [] from .exceptions import BufferFull, ExtraData, FormatError, OutOfData, StackError from .ext import ExtType, Timestamp EX_SKIP = 0 EX_CONSTRUCT = 1 EX_READ_ARRAY_HEADER = 2 EX_READ_MAP_HEADER = 3 TYPE_IMMEDIATE = 0 TYPE_ARRAY = 1 TYPE_MAP = 2 TYPE_RAW = 3 TYPE_BIN = 4 TYPE_EXT = 5 DEFAULT_RECURSE_LIMIT = 511 def _check_type_strict(obj, t, type=type, tuple=tuple): if type(t) is tuple: return type(obj) in t else: return type(obj) is t def _get_data_from_buffer(obj): view = memoryview(obj) if view.itemsize != 1: raise ValueError("cannot unpack from multi-byte object") return view def unpackb(packed, **kwargs): """ Unpack an object from `packed`. Raises ``ExtraData`` when *packed* contains extra bytes. Raises ``ValueError`` when *packed* is incomplete. Raises ``FormatError`` when *packed* is not valid msgpack. Raises ``StackError`` when *packed* contains too nested. Other exceptions can be raised during unpacking. See :class:`Unpacker` for options. """ unpacker = Unpacker(None, max_buffer_size=len(packed), **kwargs) unpacker.feed(packed) try: ret = unpacker._unpack() except OutOfData: raise ValueError("Unpack failed: incomplete input") except RecursionError: raise StackError if unpacker._got_extradata(): raise ExtraData(ret, unpacker._get_extradata()) return ret _NO_FORMAT_USED = "" _MSGPACK_HEADERS = { 0xC4: (1, _NO_FORMAT_USED, TYPE_BIN), 0xC5: (2, ">H", TYPE_BIN), 0xC6: (4, ">I", TYPE_BIN), 0xC7: (2, "Bb", TYPE_EXT), 0xC8: (3, ">Hb", TYPE_EXT), 0xC9: (5, ">Ib", TYPE_EXT), 0xCA: (4, ">f"), 0xCB: (8, ">d"), 0xCC: (1, _NO_FORMAT_USED), 0xCD: (2, ">H"), 0xCE: (4, ">I"), 0xCF: (8, ">Q"), 0xD0: (1, "b"), 0xD1: (2, ">h"), 0xD2: (4, ">i"), 0xD3: (8, ">q"), 0xD4: (1, "b1s", TYPE_EXT), 0xD5: (2, "b2s", TYPE_EXT), 0xD6: (4, "b4s", TYPE_EXT), 0xD7: (8, "b8s", TYPE_EXT), 0xD8: (16, "b16s", TYPE_EXT), 0xD9: (1, _NO_FORMAT_USED, TYPE_RAW), 0xDA: (2, ">H", TYPE_RAW), 0xDB: (4, ">I", TYPE_RAW), 0xDC: (2, ">H", TYPE_ARRAY), 0xDD: (4, ">I", TYPE_ARRAY), 0xDE: (2, ">H", TYPE_MAP), 0xDF: (4, ">I", TYPE_MAP), } class Unpacker: """Streaming unpacker. Arguments: :param file_like: File-like object having `.read(n)` method. If specified, unpacker reads serialized data from it and `.feed()` is not usable. :param int read_size: Used as `file_like.read(read_size)`. (default: `min(16*1024, max_buffer_size)`) :param bool use_list: If true, unpack msgpack array to Python list. Otherwise, unpack to Python tuple. (default: True) :param bool raw: If true, unpack msgpack raw to Python bytes. Otherwise, unpack to Python str by decoding with UTF-8 encoding (default). :param int timestamp: Control how timestamp type is unpacked: 0 - Timestamp 1 - float (Seconds from the EPOCH) 2 - int (Nanoseconds from the EPOCH) 3 - datetime.datetime (UTC). :param bool strict_map_key: If true (default), only str or bytes are accepted for map (dict) keys. :param object_hook: When specified, it should be callable. Unpacker calls it with a dict argument after unpacking msgpack map. (See also simplejson) :param object_pairs_hook: When specified, it should be callable. Unpacker calls it with a list of key-value pairs after unpacking msgpack map. (See also simplejson) :param str unicode_errors: The error handler for decoding unicode. (default: 'strict') This option should be used only when you have msgpack data which contains invalid UTF-8 string. :param int max_buffer_size: Limits size of data waiting unpacked. 0 means 2**32-1. The default value is 100*1024*1024 (100MiB). Raises `BufferFull` exception when it is insufficient. You should set this parameter when unpacking data from untrusted source. :param int max_str_len: Deprecated, use *max_buffer_size* instead. Limits max length of str. (default: max_buffer_size) :param int max_bin_len: Deprecated, use *max_buffer_size* instead. Limits max length of bin. (default: max_buffer_size) :param int max_array_len: Limits max length of array. (default: max_buffer_size) :param int max_map_len: Limits max length of map. (default: max_buffer_size//2) :param int max_ext_len: Deprecated, use *max_buffer_size* instead. Limits max size of ext type. (default: max_buffer_size) Example of streaming deserialize from file-like object:: unpacker = Unpacker(file_like) for o in unpacker: process(o) Example of streaming deserialize from socket:: unpacker = Unpacker() while True: buf = sock.recv(1024**2) if not buf: break unpacker.feed(buf) for o in unpacker: process(o) Raises ``ExtraData`` when *packed* contains extra bytes. Raises ``OutOfData`` when *packed* is incomplete. Raises ``FormatError`` when *packed* is not valid msgpack. Raises ``StackError`` when *packed* contains too nested. Other exceptions can be raised during unpacking. """ def __init__( self, file_like=None, *, read_size=0, use_list=True, raw=False, timestamp=0, strict_map_key=True, object_hook=None, object_pairs_hook=None, list_hook=None, unicode_errors=None, max_buffer_size=100 * 1024 * 1024, ext_hook=ExtType, max_str_len=-1, max_bin_len=-1, max_array_len=-1, max_map_len=-1, max_ext_len=-1, ): if unicode_errors is None: unicode_errors = "strict" if file_like is None: self._feeding = True else: if not callable(file_like.read): raise TypeError("`file_like.read` must be callable") self.file_like = file_like self._feeding = False #: array of bytes fed. self._buffer = bytearray() #: Which position we currently reads self._buff_i = 0 # When Unpacker is used as an iterable, between the calls to next(), # the buffer is not "consumed" completely, for efficiency sake. # Instead, it is done sloppily. To make sure we raise BufferFull at # the correct moments, we have to keep track of how sloppy we were. # Furthermore, when the buffer is incomplete (that is: in the case # we raise an OutOfData) we need to rollback the buffer to the correct # state, which _buf_checkpoint records. self._buf_checkpoint = 0 if not max_buffer_size: max_buffer_size = 2**31 - 1 if max_str_len == -1: max_str_len = max_buffer_size if max_bin_len == -1: max_bin_len = max_buffer_size if max_array_len == -1: max_array_len = max_buffer_size if max_map_len == -1: max_map_len = max_buffer_size // 2 if max_ext_len == -1: max_ext_len = max_buffer_size self._max_buffer_size = max_buffer_size if read_size > self._max_buffer_size: raise ValueError("read_size must be smaller than max_buffer_size") self._read_size = read_size or min(self._max_buffer_size, 16 * 1024) self._raw = bool(raw) self._strict_map_key = bool(strict_map_key) self._unicode_errors = unicode_errors self._use_list = use_list if not (0 <= timestamp <= 3): raise ValueError("timestamp must be 0..3") self._timestamp = timestamp self._list_hook = list_hook self._object_hook = object_hook self._object_pairs_hook = object_pairs_hook self._ext_hook = ext_hook self._max_str_len = max_str_len self._max_bin_len = max_bin_len self._max_array_len = max_array_len self._max_map_len = max_map_len self._max_ext_len = max_ext_len self._stream_offset = 0 if list_hook is not None and not callable(list_hook): raise TypeError("`list_hook` is not callable") if object_hook is not None and not callable(object_hook): raise TypeError("`object_hook` is not callable") if object_pairs_hook is not None and not callable(object_pairs_hook): raise TypeError("`object_pairs_hook` is not callable") if object_hook is not None and object_pairs_hook is not None: raise TypeError("object_pairs_hook and object_hook are mutually exclusive") if not callable(ext_hook): raise TypeError("`ext_hook` is not callable") def feed(self, next_bytes): assert self._feeding view = _get_data_from_buffer(next_bytes) if len(self._buffer) - self._buff_i + len(view) > self._max_buffer_size: raise BufferFull # Strip buffer before checkpoint before reading file. if self._buf_checkpoint > 0: del self._buffer[: self._buf_checkpoint] self._buff_i -= self._buf_checkpoint self._buf_checkpoint = 0 # Use extend here: INPLACE_ADD += doesn't reliably typecast memoryview in jython self._buffer.extend(view) view.release() def _consume(self): """Gets rid of the used parts of the buffer.""" self._stream_offset += self._buff_i - self._buf_checkpoint self._buf_checkpoint = self._buff_i def _got_extradata(self): return self._buff_i < len(self._buffer) def _get_extradata(self): return self._buffer[self._buff_i :] def read_bytes(self, n): ret = self._read(n, raise_outofdata=False) self._consume() return ret def _read(self, n, raise_outofdata=True): # (int) -> bytearray self._reserve(n, raise_outofdata=raise_outofdata) i = self._buff_i ret = self._buffer[i : i + n] self._buff_i = i + len(ret) return ret def _reserve(self, n, raise_outofdata=True): remain_bytes = len(self._buffer) - self._buff_i - n # Fast path: buffer has n bytes already if remain_bytes >= 0: return if self._feeding: self._buff_i = self._buf_checkpoint raise OutOfData # Strip buffer before checkpoint before reading file. if self._buf_checkpoint > 0: del self._buffer[: self._buf_checkpoint] self._buff_i -= self._buf_checkpoint self._buf_checkpoint = 0 # Read from file remain_bytes = -remain_bytes if remain_bytes + len(self._buffer) > self._max_buffer_size: raise BufferFull while remain_bytes > 0: to_read_bytes = max(self._read_size, remain_bytes) read_data = self.file_like.read(to_read_bytes) if not read_data: break assert isinstance(read_data, bytes) self._buffer += read_data remain_bytes -= len(read_data) if len(self._buffer) < n + self._buff_i and raise_outofdata: self._buff_i = 0 # rollback raise OutOfData def _read_header(self): typ = TYPE_IMMEDIATE n = 0 obj = None self._reserve(1) b = self._buffer[self._buff_i] self._buff_i += 1 if b & 0b10000000 == 0: obj = b elif b & 0b11100000 == 0b11100000: obj = -1 - (b ^ 0xFF) elif b & 0b11100000 == 0b10100000: n = b & 0b00011111 typ = TYPE_RAW if n > self._max_str_len: raise ValueError(f"{n} exceeds max_str_len({self._max_str_len})") obj = self._read(n) elif b & 0b11110000 == 0b10010000: n = b & 0b00001111 typ = TYPE_ARRAY if n > self._max_array_len: raise ValueError(f"{n} exceeds max_array_len({self._max_array_len})") elif b & 0b11110000 == 0b10000000: n = b & 0b00001111 typ = TYPE_MAP if n > self._max_map_len: raise ValueError(f"{n} exceeds max_map_len({self._max_map_len})") elif b == 0xC0: obj = None elif b == 0xC2: obj = False elif b == 0xC3: obj = True elif 0xC4 <= b <= 0xC6: size, fmt, typ = _MSGPACK_HEADERS[b] self._reserve(size) if len(fmt) > 0: n = struct.unpack_from(fmt, self._buffer, self._buff_i)[0] else: n = self._buffer[self._buff_i] self._buff_i += size if n > self._max_bin_len: raise ValueError(f"{n} exceeds max_bin_len({self._max_bin_len})") obj = self._read(n) elif 0xC7 <= b <= 0xC9: size, fmt, typ = _MSGPACK_HEADERS[b] self._reserve(size) L, n = struct.unpack_from(fmt, self._buffer, self._buff_i) self._buff_i += size if L > self._max_ext_len: raise ValueError(f"{L} exceeds max_ext_len({self._max_ext_len})") obj = self._read(L) elif 0xCA <= b <= 0xD3: size, fmt = _MSGPACK_HEADERS[b] self._reserve(size) if len(fmt) > 0: obj = struct.unpack_from(fmt, self._buffer, self._buff_i)[0] else: obj = self._buffer[self._buff_i] self._buff_i += size elif 0xD4 <= b <= 0xD8: size, fmt, typ = _MSGPACK_HEADERS[b] if self._max_ext_len < size: raise ValueError(f"{size} exceeds max_ext_len({self._max_ext_len})") self._reserve(size + 1) n, obj = struct.unpack_from(fmt, self._buffer, self._buff_i) self._buff_i += size + 1 elif 0xD9 <= b <= 0xDB: size, fmt, typ = _MSGPACK_HEADERS[b] self._reserve(size) if len(fmt) > 0: (n,) = struct.unpack_from(fmt, self._buffer, self._buff_i) else: n = self._buffer[self._buff_i] self._buff_i += size if n > self._max_str_len: raise ValueError(f"{n} exceeds max_str_len({self._max_str_len})") obj = self._read(n) elif 0xDC <= b <= 0xDD: size, fmt, typ = _MSGPACK_HEADERS[b] self._reserve(size) (n,) = struct.unpack_from(fmt, self._buffer, self._buff_i) self._buff_i += size if n > self._max_array_len: raise ValueError(f"{n} exceeds max_array_len({self._max_array_len})") elif 0xDE <= b <= 0xDF: size, fmt, typ = _MSGPACK_HEADERS[b] self._reserve(size) (n,) = struct.unpack_from(fmt, self._buffer, self._buff_i) self._buff_i += size if n > self._max_map_len: raise ValueError(f"{n} exceeds max_map_len({self._max_map_len})") else: raise FormatError("Unknown header: 0x%x" % b) return typ, n, obj def _unpack(self, execute=EX_CONSTRUCT): typ, n, obj = self._read_header() if execute == EX_READ_ARRAY_HEADER: if typ != TYPE_ARRAY: raise ValueError("Expected array") return n if execute == EX_READ_MAP_HEADER: if typ != TYPE_MAP: raise ValueError("Expected map") return n # TODO should we eliminate the recursion? if typ == TYPE_ARRAY: if execute == EX_SKIP: for i in range(n): # TODO check whether we need to call `list_hook` self._unpack(EX_SKIP) return ret = newlist_hint(n) for i in range(n): ret.append(self._unpack(EX_CONSTRUCT)) if self._list_hook is not None: ret = self._list_hook(ret) # TODO is the interaction between `list_hook` and `use_list` ok? return ret if self._use_list else tuple(ret) if typ == TYPE_MAP: if execute == EX_SKIP: for i in range(n): # TODO check whether we need to call hooks self._unpack(EX_SKIP) self._unpack(EX_SKIP) return if self._object_pairs_hook is not None: ret = self._object_pairs_hook( (self._unpack(EX_CONSTRUCT), self._unpack(EX_CONSTRUCT)) for _ in range(n) ) else: ret = {} for _ in range(n): key = self._unpack(EX_CONSTRUCT) if self._strict_map_key and type(key) not in (str, bytes): raise ValueError("%s is not allowed for map key" % str(type(key))) if isinstance(key, str): key = sys.intern(key) ret[key] = self._unpack(EX_CONSTRUCT) if self._object_hook is not None: ret = self._object_hook(ret) return ret if execute == EX_SKIP: return if typ == TYPE_RAW: if self._raw: obj = bytes(obj) else: obj = obj.decode("utf_8", self._unicode_errors) return obj if typ == TYPE_BIN: return bytes(obj) if typ == TYPE_EXT: if n == -1: # timestamp ts = Timestamp.from_bytes(bytes(obj)) if self._timestamp == 1: return ts.to_unix() elif self._timestamp == 2: return ts.to_unix_nano() elif self._timestamp == 3: return ts.to_datetime() else: return ts else: return self._ext_hook(n, bytes(obj)) assert typ == TYPE_IMMEDIATE return obj def __iter__(self): return self def __next__(self): try: ret = self._unpack(EX_CONSTRUCT) self._consume() return ret except OutOfData: self._consume() raise StopIteration except RecursionError: raise StackError next = __next__ def skip(self): self._unpack(EX_SKIP) self._consume() def unpack(self): try: ret = self._unpack(EX_CONSTRUCT) except RecursionError: raise StackError self._consume() return ret def read_array_header(self): ret = self._unpack(EX_READ_ARRAY_HEADER) self._consume() return ret def read_map_header(self): ret = self._unpack(EX_READ_MAP_HEADER) self._consume() return ret def tell(self): return self._stream_offset class Packer: """ MessagePack Packer Usage:: packer = Packer() astream.write(packer.pack(a)) astream.write(packer.pack(b)) Packer's constructor has some keyword arguments: :param default: When specified, it should be callable. Convert user type to builtin type that Packer supports. See also simplejson's document. :param bool use_single_float: Use single precision float type for float. (default: False) :param bool autoreset: Reset buffer after each pack and return its content as `bytes`. (default: True). If set this to false, use `bytes()` to get content and `.reset()` to clear buffer. :param bool use_bin_type: Use bin type introduced in msgpack spec 2.0 for bytes. It also enables str8 type for unicode. (default: True) :param bool strict_types: If set to true, types will be checked to be exact. Derived classes from serializable types will not be serialized and will be treated as unsupported type and forwarded to default. Additionally tuples will not be serialized as lists. This is useful when trying to implement accurate serialization for python types. :param bool datetime: If set to true, datetime with tzinfo is packed into Timestamp type. Note that the tzinfo is stripped in the timestamp. You can get UTC datetime with `timestamp=3` option of the Unpacker. :param str unicode_errors: The error handler for encoding unicode. (default: 'strict') DO NOT USE THIS!! This option is kept for very specific usage. :param int buf_size: Internal buffer size. This option is used only for C implementation. """ def __init__( self, *, default=None, use_single_float=False, autoreset=True, use_bin_type=True, strict_types=False, datetime=False, unicode_errors=None, buf_size=None, ): self._strict_types = strict_types self._use_float = use_single_float self._autoreset = autoreset self._use_bin_type = use_bin_type self._buffer = BytesIO() self._datetime = bool(datetime) self._unicode_errors = unicode_errors or "strict" if default is not None and not callable(default): raise TypeError("default must be callable") self._default = default def _pack( self, obj, nest_limit=DEFAULT_RECURSE_LIMIT, check=isinstance, check_type_strict=_check_type_strict, ): default_used = False if self._strict_types: check = check_type_strict list_types = list else: list_types = (list, tuple) while True: if nest_limit < 0: raise ValueError("recursion limit exceeded") if obj is None: return self._buffer.write(b"\xc0") if check(obj, bool): if obj: return self._buffer.write(b"\xc3") return self._buffer.write(b"\xc2") if check(obj, int): if 0 <= obj < 0x80: return self._buffer.write(struct.pack("B", obj)) if -0x20 <= obj < 0: return self._buffer.write(struct.pack("b", obj)) if 0x80 <= obj <= 0xFF: return self._buffer.write(struct.pack("BB", 0xCC, obj)) if -0x80 <= obj < 0: return self._buffer.write(struct.pack(">Bb", 0xD0, obj)) if 0xFF < obj <= 0xFFFF: return self._buffer.write(struct.pack(">BH", 0xCD, obj)) if -0x8000 <= obj < -0x80: return self._buffer.write(struct.pack(">Bh", 0xD1, obj)) if 0xFFFF < obj <= 0xFFFFFFFF: return self._buffer.write(struct.pack(">BI", 0xCE, obj)) if -0x80000000 <= obj < -0x8000: return self._buffer.write(struct.pack(">Bi", 0xD2, obj)) if 0xFFFFFFFF < obj <= 0xFFFFFFFFFFFFFFFF: return self._buffer.write(struct.pack(">BQ", 0xCF, obj)) if -0x8000000000000000 <= obj < -0x80000000: return self._buffer.write(struct.pack(">Bq", 0xD3, obj)) if not default_used and self._default is not None: obj = self._default(obj) default_used = True continue raise OverflowError("Integer value out of range") if check(obj, (bytes, bytearray)): n = len(obj) if n >= 2**32: raise ValueError("%s is too large" % type(obj).__name__) self._pack_bin_header(n) return self._buffer.write(obj) if check(obj, str): obj = obj.encode("utf-8", self._unicode_errors) n = len(obj) if n >= 2**32: raise ValueError("String is too large") self._pack_raw_header(n) return self._buffer.write(obj) if check(obj, memoryview): n = obj.nbytes if n >= 2**32: raise ValueError("Memoryview is too large") self._pack_bin_header(n) return self._buffer.write(obj) if check(obj, float): if self._use_float: return self._buffer.write(struct.pack(">Bf", 0xCA, obj)) return self._buffer.write(struct.pack(">Bd", 0xCB, obj)) if check(obj, (ExtType, Timestamp)): if check(obj, Timestamp): code = -1 data = obj.to_bytes() else: code = obj.code data = obj.data assert isinstance(code, int) assert isinstance(data, bytes) L = len(data) if L == 1: self._buffer.write(b"\xd4") elif L == 2: self._buffer.write(b"\xd5") elif L == 4: self._buffer.write(b"\xd6") elif L == 8: self._buffer.write(b"\xd7") elif L == 16: self._buffer.write(b"\xd8") elif L <= 0xFF: self._buffer.write(struct.pack(">BB", 0xC7, L)) elif L <= 0xFFFF: self._buffer.write(struct.pack(">BH", 0xC8, L)) else: self._buffer.write(struct.pack(">BI", 0xC9, L)) self._buffer.write(struct.pack("b", code)) self._buffer.write(data) return if check(obj, list_types): n = len(obj) self._pack_array_header(n) for i in range(n): self._pack(obj[i], nest_limit - 1) return if check(obj, dict): return self._pack_map_pairs(len(obj), obj.items(), nest_limit - 1) if self._datetime and check(obj, _DateTime) and obj.tzinfo is not None: obj = Timestamp.from_datetime(obj) default_used = 1 continue if not default_used and self._default is not None: obj = self._default(obj) default_used = 1 continue if self._datetime and check(obj, _DateTime): raise ValueError(f"Cannot serialize {obj!r} where tzinfo=None") raise TypeError(f"Cannot serialize {obj!r}") def pack(self, obj): try: self._pack(obj) except: self._buffer = BytesIO() # force reset raise if self._autoreset: ret = self._buffer.getvalue() self._buffer = BytesIO() return ret def pack_map_pairs(self, pairs): self._pack_map_pairs(len(pairs), pairs) if self._autoreset: ret = self._buffer.getvalue() self._buffer = BytesIO() return ret def pack_array_header(self, n): if n >= 2**32: raise ValueError self._pack_array_header(n) if self._autoreset: ret = self._buffer.getvalue() self._buffer = BytesIO() return ret def pack_map_header(self, n): if n >= 2**32: raise ValueError self._pack_map_header(n) if self._autoreset: ret = self._buffer.getvalue() self._buffer = BytesIO() return ret def pack_ext_type(self, typecode, data): if not isinstance(typecode, int): raise TypeError("typecode must have int type.") if not 0 <= typecode <= 127: raise ValueError("typecode should be 0-127") if not isinstance(data, bytes): raise TypeError("data must have bytes type") L = len(data) if L > 0xFFFFFFFF: raise ValueError("Too large data") if L == 1: self._buffer.write(b"\xd4") elif L == 2: self._buffer.write(b"\xd5") elif L == 4: self._buffer.write(b"\xd6") elif L == 8: self._buffer.write(b"\xd7") elif L == 16: self._buffer.write(b"\xd8") elif L <= 0xFF: self._buffer.write(b"\xc7" + struct.pack("B", L)) elif L <= 0xFFFF: self._buffer.write(b"\xc8" + struct.pack(">H", L)) else: self._buffer.write(b"\xc9" + struct.pack(">I", L)) self._buffer.write(struct.pack("B", typecode)) self._buffer.write(data) def _pack_array_header(self, n): if n <= 0x0F: return self._buffer.write(struct.pack("B", 0x90 + n)) if n <= 0xFFFF: return self._buffer.write(struct.pack(">BH", 0xDC, n)) if n <= 0xFFFFFFFF: return self._buffer.write(struct.pack(">BI", 0xDD, n)) raise ValueError("Array is too large") def _pack_map_header(self, n): if n <= 0x0F: return self._buffer.write(struct.pack("B", 0x80 + n)) if n <= 0xFFFF: return self._buffer.write(struct.pack(">BH", 0xDE, n)) if n <= 0xFFFFFFFF: return self._buffer.write(struct.pack(">BI", 0xDF, n)) raise ValueError("Dict is too large") def _pack_map_pairs(self, n, pairs, nest_limit=DEFAULT_RECURSE_LIMIT): self._pack_map_header(n) for k, v in pairs: self._pack(k, nest_limit - 1) self._pack(v, nest_limit - 1) def _pack_raw_header(self, n): if n <= 0x1F: self._buffer.write(struct.pack("B", 0xA0 + n)) elif self._use_bin_type and n <= 0xFF: self._buffer.write(struct.pack(">BB", 0xD9, n)) elif n <= 0xFFFF: self._buffer.write(struct.pack(">BH", 0xDA, n)) elif n <= 0xFFFFFFFF: self._buffer.write(struct.pack(">BI", 0xDB, n)) else: raise ValueError("Raw is too large") def _pack_bin_header(self, n): if not self._use_bin_type: return self._pack_raw_header(n) elif n <= 0xFF: return self._buffer.write(struct.pack(">BB", 0xC4, n)) elif n <= 0xFFFF: return self._buffer.write(struct.pack(">BH", 0xC5, n)) elif n <= 0xFFFFFFFF: return self._buffer.write(struct.pack(">BI", 0xC6, n)) else: raise ValueError("Bin is too large") def bytes(self): """Return internal buffer contents as bytes object""" return self._buffer.getvalue() def reset(self): """Reset internal buffer. This method is useful only when autoreset=False. """ self._buffer = BytesIO() def getbuffer(self): """Return view of internal buffer.""" if _USING_STRINGBUILDER: return memoryview(self.bytes()) else: return self._buffer.getbuffer() ================================================ FILE: src/pip/_vendor/msgpack.pyi ================================================ from msgpack import * ================================================ FILE: src/pip/_vendor/packaging/LICENSE ================================================ This software is made available under the terms of *either* of the licenses found in LICENSE.APACHE or LICENSE.BSD. Contributions to this software is made under the terms of *both* these licenses. ================================================ FILE: src/pip/_vendor/packaging/LICENSE.APACHE ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS ================================================ FILE: src/pip/_vendor/packaging/LICENSE.BSD ================================================ Copyright (c) Donald Stufft and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: src/pip/_vendor/packaging/__init__.py ================================================ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. __title__ = "packaging" __summary__ = "Core utilities for Python packages" __uri__ = "https://github.com/pypa/packaging" __version__ = "26.0" __author__ = "Donald Stufft and individual contributors" __email__ = "donald@stufft.io" __license__ = "BSD-2-Clause or Apache-2.0" __copyright__ = f"2014 {__author__}" ================================================ FILE: src/pip/_vendor/packaging/_elffile.py ================================================ """ ELF file parser. This provides a class ``ELFFile`` that parses an ELF executable in a similar interface to ``ZipFile``. Only the read interface is implemented. ELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html """ from __future__ import annotations import enum import os import struct from typing import IO class ELFInvalid(ValueError): pass class EIClass(enum.IntEnum): C32 = 1 C64 = 2 class EIData(enum.IntEnum): Lsb = 1 Msb = 2 class EMachine(enum.IntEnum): I386 = 3 S390 = 22 Arm = 40 X8664 = 62 AArc64 = 183 class ELFFile: """ Representation of an ELF executable. """ def __init__(self, f: IO[bytes]) -> None: self._f = f try: ident = self._read("16B") except struct.error as e: raise ELFInvalid("unable to parse identification") from e magic = bytes(ident[:4]) if magic != b"\x7fELF": raise ELFInvalid(f"invalid magic: {magic!r}") self.capacity = ident[4] # Format for program header (bitness). self.encoding = ident[5] # Data structure encoding (endianness). try: # e_fmt: Format for program header. # p_fmt: Format for section header. # p_idx: Indexes to find p_type, p_offset, and p_filesz. e_fmt, self._p_fmt, self._p_idx = { (1, 1): ("HHIIIIIHHH", ">IIIIIIII", (0, 1, 4)), # 32-bit MSB. (2, 1): ("HHIQQQIHHH", ">IIQQQQQQ", (0, 2, 5)), # 64-bit MSB. }[(self.capacity, self.encoding)] except KeyError as e: raise ELFInvalid( f"unrecognized capacity ({self.capacity}) or encoding ({self.encoding})" ) from e try: ( _, self.machine, # Architecture type. _, _, self._e_phoff, # Offset of program header. _, self.flags, # Processor-specific flags. _, self._e_phentsize, # Size of section. self._e_phnum, # Number of sections. ) = self._read(e_fmt) except struct.error as e: raise ELFInvalid("unable to parse machine and section information") from e def _read(self, fmt: str) -> tuple[int, ...]: return struct.unpack(fmt, self._f.read(struct.calcsize(fmt))) @property def interpreter(self) -> str | None: """ The path recorded in the ``PT_INTERP`` section header. """ for index in range(self._e_phnum): self._f.seek(self._e_phoff + self._e_phentsize * index) try: data = self._read(self._p_fmt) except struct.error: continue if data[self._p_idx[0]] != 3: # Not PT_INTERP. continue self._f.seek(data[self._p_idx[1]]) return os.fsdecode(self._f.read(data[self._p_idx[2]])).strip("\0") return None ================================================ FILE: src/pip/_vendor/packaging/_manylinux.py ================================================ from __future__ import annotations import collections import contextlib import functools import os import re import sys import warnings from typing import Generator, Iterator, NamedTuple, Sequence from ._elffile import EIClass, EIData, ELFFile, EMachine EF_ARM_ABIMASK = 0xFF000000 EF_ARM_ABI_VER5 = 0x05000000 EF_ARM_ABI_FLOAT_HARD = 0x00000400 _ALLOWED_ARCHS = { "x86_64", "aarch64", "ppc64", "ppc64le", "s390x", "loongarch64", "riscv64", } # `os.PathLike` not a generic type until Python 3.9, so sticking with `str` # as the type for `path` until then. @contextlib.contextmanager def _parse_elf(path: str) -> Generator[ELFFile | None, None, None]: try: with open(path, "rb") as f: yield ELFFile(f) except (OSError, TypeError, ValueError): yield None def _is_linux_armhf(executable: str) -> bool: # hard-float ABI can be detected from the ELF header of the running # process # https://static.docs.arm.com/ihi0044/g/aaelf32.pdf with _parse_elf(executable) as f: return ( f is not None and f.capacity == EIClass.C32 and f.encoding == EIData.Lsb and f.machine == EMachine.Arm and f.flags & EF_ARM_ABIMASK == EF_ARM_ABI_VER5 and f.flags & EF_ARM_ABI_FLOAT_HARD == EF_ARM_ABI_FLOAT_HARD ) def _is_linux_i686(executable: str) -> bool: with _parse_elf(executable) as f: return ( f is not None and f.capacity == EIClass.C32 and f.encoding == EIData.Lsb and f.machine == EMachine.I386 ) def _have_compatible_abi(executable: str, archs: Sequence[str]) -> bool: if "armv7l" in archs: return _is_linux_armhf(executable) if "i686" in archs: return _is_linux_i686(executable) return any(arch in _ALLOWED_ARCHS for arch in archs) # If glibc ever changes its major version, we need to know what the last # minor version was, so we can build the complete list of all versions. # For now, guess what the highest minor version might be, assume it will # be 50 for testing. Once this actually happens, update the dictionary # with the actual value. _LAST_GLIBC_MINOR: dict[int, int] = collections.defaultdict(lambda: 50) class _GLibCVersion(NamedTuple): major: int minor: int def _glibc_version_string_confstr() -> str | None: """ Primary implementation of glibc_version_string using os.confstr. """ # os.confstr is quite a bit faster than ctypes.DLL. It's also less likely # to be broken or missing. This strategy is used in the standard library # platform module. # https://github.com/python/cpython/blob/fcf1d003bf4f0100c/Lib/platform.py#L175-L183 try: # Should be a string like "glibc 2.17". version_string: str | None = os.confstr("CS_GNU_LIBC_VERSION") assert version_string is not None _, version = version_string.rsplit() except (AssertionError, AttributeError, OSError, ValueError): # os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)... return None return version def _glibc_version_string_ctypes() -> str | None: """ Fallback implementation of glibc_version_string using ctypes. """ try: import ctypes # noqa: PLC0415 except ImportError: return None # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen # manpage says, "If filename is NULL, then the returned handle is for the # main program". This way we can let the linker do the work to figure out # which libc our process is actually using. # # We must also handle the special case where the executable is not a # dynamically linked executable. This can occur when using musl libc, # for example. In this situation, dlopen() will error, leading to an # OSError. Interestingly, at least in the case of musl, there is no # errno set on the OSError. The single string argument used to construct # OSError comes from libc itself and is therefore not portable to # hard code here. In any case, failure to call dlopen() means we # can proceed, so we bail on our attempt. try: process_namespace = ctypes.CDLL(None) except OSError: return None try: gnu_get_libc_version = process_namespace.gnu_get_libc_version except AttributeError: # Symbol doesn't exist -> therefore, we are not linked to # glibc. return None # Call gnu_get_libc_version, which returns a string like "2.5" gnu_get_libc_version.restype = ctypes.c_char_p version_str: str = gnu_get_libc_version() # py2 / py3 compatibility: if not isinstance(version_str, str): version_str = version_str.decode("ascii") return version_str def _glibc_version_string() -> str | None: """Returns glibc version string, or None if not using glibc.""" return _glibc_version_string_confstr() or _glibc_version_string_ctypes() def _parse_glibc_version(version_str: str) -> _GLibCVersion: """Parse glibc version. We use a regexp instead of str.split because we want to discard any random junk that might come after the minor version -- this might happen in patched/forked versions of glibc (e.g. Linaro's version of glibc uses version strings like "2.20-2014.11"). See gh-3588. """ m = re.match(r"(?P[0-9]+)\.(?P[0-9]+)", version_str) if not m: warnings.warn( f"Expected glibc version with 2 components major.minor, got: {version_str}", RuntimeWarning, stacklevel=2, ) return _GLibCVersion(-1, -1) return _GLibCVersion(int(m.group("major")), int(m.group("minor"))) @functools.lru_cache def _get_glibc_version() -> _GLibCVersion: version_str = _glibc_version_string() if version_str is None: return _GLibCVersion(-1, -1) return _parse_glibc_version(version_str) # From PEP 513, PEP 600 def _is_compatible(arch: str, version: _GLibCVersion) -> bool: sys_glibc = _get_glibc_version() if sys_glibc < version: return False # Check for presence of _manylinux module. try: import _manylinux # noqa: PLC0415 except ImportError: return True if hasattr(_manylinux, "manylinux_compatible"): result = _manylinux.manylinux_compatible(version[0], version[1], arch) if result is not None: return bool(result) return True if version == _GLibCVersion(2, 5) and hasattr(_manylinux, "manylinux1_compatible"): return bool(_manylinux.manylinux1_compatible) if version == _GLibCVersion(2, 12) and hasattr( _manylinux, "manylinux2010_compatible" ): return bool(_manylinux.manylinux2010_compatible) if version == _GLibCVersion(2, 17) and hasattr( _manylinux, "manylinux2014_compatible" ): return bool(_manylinux.manylinux2014_compatible) return True _LEGACY_MANYLINUX_MAP: dict[_GLibCVersion, str] = { # CentOS 7 w/ glibc 2.17 (PEP 599) _GLibCVersion(2, 17): "manylinux2014", # CentOS 6 w/ glibc 2.12 (PEP 571) _GLibCVersion(2, 12): "manylinux2010", # CentOS 5 w/ glibc 2.5 (PEP 513) _GLibCVersion(2, 5): "manylinux1", } def platform_tags(archs: Sequence[str]) -> Iterator[str]: """Generate manylinux tags compatible to the current platform. :param archs: Sequence of compatible architectures. The first one shall be the closest to the actual architecture and be the part of platform tag after the ``linux_`` prefix, e.g. ``x86_64``. The ``linux_`` prefix is assumed as a prerequisite for the current platform to be manylinux-compatible. :returns: An iterator of compatible manylinux tags. """ if not _have_compatible_abi(sys.executable, archs): return # Oldest glibc to be supported regardless of architecture is (2, 17). too_old_glibc2 = _GLibCVersion(2, 16) if set(archs) & {"x86_64", "i686"}: # On x86/i686 also oldest glibc to be supported is (2, 5). too_old_glibc2 = _GLibCVersion(2, 4) current_glibc = _GLibCVersion(*_get_glibc_version()) glibc_max_list = [current_glibc] # We can assume compatibility across glibc major versions. # https://sourceware.org/bugzilla/show_bug.cgi?id=24636 # # Build a list of maximum glibc versions so that we can # output the canonical list of all glibc from current_glibc # down to too_old_glibc2, including all intermediary versions. for glibc_major in range(current_glibc.major - 1, 1, -1): glibc_minor = _LAST_GLIBC_MINOR[glibc_major] glibc_max_list.append(_GLibCVersion(glibc_major, glibc_minor)) for arch in archs: for glibc_max in glibc_max_list: if glibc_max.major == too_old_glibc2.major: min_minor = too_old_glibc2.minor else: # For other glibc major versions oldest supported is (x, 0). min_minor = -1 for glibc_minor in range(glibc_max.minor, min_minor, -1): glibc_version = _GLibCVersion(glibc_max.major, glibc_minor) if _is_compatible(arch, glibc_version): yield "manylinux_{}_{}_{}".format(*glibc_version, arch) # Handle the legacy manylinux1, manylinux2010, manylinux2014 tags. if legacy_tag := _LEGACY_MANYLINUX_MAP.get(glibc_version): yield f"{legacy_tag}_{arch}" ================================================ FILE: src/pip/_vendor/packaging/_musllinux.py ================================================ """PEP 656 support. This module implements logic to detect if the currently running Python is linked against musl, and what musl version is used. """ from __future__ import annotations import functools import re import subprocess import sys from typing import Iterator, NamedTuple, Sequence from ._elffile import ELFFile class _MuslVersion(NamedTuple): major: int minor: int def _parse_musl_version(output: str) -> _MuslVersion | None: lines = [n for n in (n.strip() for n in output.splitlines()) if n] if len(lines) < 2 or lines[0][:4] != "musl": return None m = re.match(r"Version (\d+)\.(\d+)", lines[1]) if not m: return None return _MuslVersion(major=int(m.group(1)), minor=int(m.group(2))) @functools.lru_cache def _get_musl_version(executable: str) -> _MuslVersion | None: """Detect currently-running musl runtime version. This is done by checking the specified executable's dynamic linking information, and invoking the loader to parse its output for a version string. If the loader is musl, the output would be something like:: musl libc (x86_64) Version 1.2.2 Dynamic Program Loader """ try: with open(executable, "rb") as f: ld = ELFFile(f).interpreter except (OSError, TypeError, ValueError): return None if ld is None or "musl" not in ld: return None proc = subprocess.run([ld], check=False, stderr=subprocess.PIPE, text=True) return _parse_musl_version(proc.stderr) def platform_tags(archs: Sequence[str]) -> Iterator[str]: """Generate musllinux tags compatible to the current platform. :param archs: Sequence of compatible architectures. The first one shall be the closest to the actual architecture and be the part of platform tag after the ``linux_`` prefix, e.g. ``x86_64``. The ``linux_`` prefix is assumed as a prerequisite for the current platform to be musllinux-compatible. :returns: An iterator of compatible musllinux tags. """ sys_musl = _get_musl_version(sys.executable) if sys_musl is None: # Python not dynamically linked against musl. return for arch in archs: for minor in range(sys_musl.minor, -1, -1): yield f"musllinux_{sys_musl.major}_{minor}_{arch}" if __name__ == "__main__": # pragma: no cover import sysconfig plat = sysconfig.get_platform() assert plat.startswith("linux-"), "not linux" print("plat:", plat) print("musl:", _get_musl_version(sys.executable)) print("tags:", end=" ") for t in platform_tags(re.sub(r"[.-]", "_", plat.split("-", 1)[-1])): print(t, end="\n ") ================================================ FILE: src/pip/_vendor/packaging/_parser.py ================================================ """Handwritten parser of dependency specifiers. The docstring for each __parse_* function contains EBNF-inspired grammar representing the implementation. """ from __future__ import annotations import ast from typing import List, Literal, NamedTuple, Sequence, Tuple, Union from ._tokenizer import DEFAULT_RULES, Tokenizer class Node: __slots__ = ("value",) def __init__(self, value: str) -> None: self.value = value def __str__(self) -> str: return self.value def __repr__(self) -> str: return f"<{self.__class__.__name__}({self.value!r})>" def serialize(self) -> str: raise NotImplementedError class Variable(Node): __slots__ = () def serialize(self) -> str: return str(self) class Value(Node): __slots__ = () def serialize(self) -> str: return f'"{self}"' class Op(Node): __slots__ = () def serialize(self) -> str: return str(self) MarkerLogical = Literal["and", "or"] MarkerVar = Union[Variable, Value] MarkerItem = Tuple[MarkerVar, Op, MarkerVar] MarkerAtom = Union[MarkerItem, Sequence["MarkerAtom"]] MarkerList = List[Union["MarkerList", MarkerAtom, MarkerLogical]] class ParsedRequirement(NamedTuple): name: str url: str extras: list[str] specifier: str marker: MarkerList | None # -------------------------------------------------------------------------------------- # Recursive descent parser for dependency specifier # -------------------------------------------------------------------------------------- def parse_requirement(source: str) -> ParsedRequirement: return _parse_requirement(Tokenizer(source, rules=DEFAULT_RULES)) def _parse_requirement(tokenizer: Tokenizer) -> ParsedRequirement: """ requirement = WS? IDENTIFIER WS? extras WS? requirement_details """ tokenizer.consume("WS") name_token = tokenizer.expect( "IDENTIFIER", expected="package name at the start of dependency specifier" ) name = name_token.text tokenizer.consume("WS") extras = _parse_extras(tokenizer) tokenizer.consume("WS") url, specifier, marker = _parse_requirement_details(tokenizer) tokenizer.expect("END", expected="end of dependency specifier") return ParsedRequirement(name, url, extras, specifier, marker) def _parse_requirement_details( tokenizer: Tokenizer, ) -> tuple[str, str, MarkerList | None]: """ requirement_details = AT URL (WS requirement_marker?)? | specifier WS? (requirement_marker)? """ specifier = "" url = "" marker = None if tokenizer.check("AT"): tokenizer.read() tokenizer.consume("WS") url_start = tokenizer.position url = tokenizer.expect("URL", expected="URL after @").text if tokenizer.check("END", peek=True): return (url, specifier, marker) tokenizer.expect("WS", expected="whitespace after URL") # The input might end after whitespace. if tokenizer.check("END", peek=True): return (url, specifier, marker) marker = _parse_requirement_marker( tokenizer, span_start=url_start, expected="semicolon (after URL and whitespace)", ) else: specifier_start = tokenizer.position specifier = _parse_specifier(tokenizer) tokenizer.consume("WS") if tokenizer.check("END", peek=True): return (url, specifier, marker) marker = _parse_requirement_marker( tokenizer, span_start=specifier_start, expected=( "comma (within version specifier), semicolon (after version specifier)" if specifier else "semicolon (after name with no version specifier)" ), ) return (url, specifier, marker) def _parse_requirement_marker( tokenizer: Tokenizer, *, span_start: int, expected: str ) -> MarkerList: """ requirement_marker = SEMICOLON marker WS? """ if not tokenizer.check("SEMICOLON"): tokenizer.raise_syntax_error( f"Expected {expected} or end", span_start=span_start, span_end=None, ) tokenizer.read() marker = _parse_marker(tokenizer) tokenizer.consume("WS") return marker def _parse_extras(tokenizer: Tokenizer) -> list[str]: """ extras = (LEFT_BRACKET wsp* extras_list? wsp* RIGHT_BRACKET)? """ if not tokenizer.check("LEFT_BRACKET", peek=True): return [] with tokenizer.enclosing_tokens( "LEFT_BRACKET", "RIGHT_BRACKET", around="extras", ): tokenizer.consume("WS") extras = _parse_extras_list(tokenizer) tokenizer.consume("WS") return extras def _parse_extras_list(tokenizer: Tokenizer) -> list[str]: """ extras_list = identifier (wsp* ',' wsp* identifier)* """ extras: list[str] = [] if not tokenizer.check("IDENTIFIER"): return extras extras.append(tokenizer.read().text) while True: tokenizer.consume("WS") if tokenizer.check("IDENTIFIER", peek=True): tokenizer.raise_syntax_error("Expected comma between extra names") elif not tokenizer.check("COMMA"): break tokenizer.read() tokenizer.consume("WS") extra_token = tokenizer.expect("IDENTIFIER", expected="extra name after comma") extras.append(extra_token.text) return extras def _parse_specifier(tokenizer: Tokenizer) -> str: """ specifier = LEFT_PARENTHESIS WS? version_many WS? RIGHT_PARENTHESIS | WS? version_many WS? """ with tokenizer.enclosing_tokens( "LEFT_PARENTHESIS", "RIGHT_PARENTHESIS", around="version specifier", ): tokenizer.consume("WS") parsed_specifiers = _parse_version_many(tokenizer) tokenizer.consume("WS") return parsed_specifiers def _parse_version_many(tokenizer: Tokenizer) -> str: """ version_many = (SPECIFIER (WS? COMMA WS? SPECIFIER)*)? """ parsed_specifiers = "" while tokenizer.check("SPECIFIER"): span_start = tokenizer.position parsed_specifiers += tokenizer.read().text if tokenizer.check("VERSION_PREFIX_TRAIL", peek=True): tokenizer.raise_syntax_error( ".* suffix can only be used with `==` or `!=` operators", span_start=span_start, span_end=tokenizer.position + 1, ) if tokenizer.check("VERSION_LOCAL_LABEL_TRAIL", peek=True): tokenizer.raise_syntax_error( "Local version label can only be used with `==` or `!=` operators", span_start=span_start, span_end=tokenizer.position, ) tokenizer.consume("WS") if not tokenizer.check("COMMA"): break parsed_specifiers += tokenizer.read().text tokenizer.consume("WS") return parsed_specifiers # -------------------------------------------------------------------------------------- # Recursive descent parser for marker expression # -------------------------------------------------------------------------------------- def parse_marker(source: str) -> MarkerList: return _parse_full_marker(Tokenizer(source, rules=DEFAULT_RULES)) def _parse_full_marker(tokenizer: Tokenizer) -> MarkerList: retval = _parse_marker(tokenizer) tokenizer.expect("END", expected="end of marker expression") return retval def _parse_marker(tokenizer: Tokenizer) -> MarkerList: """ marker = marker_atom (BOOLOP marker_atom)+ """ expression = [_parse_marker_atom(tokenizer)] while tokenizer.check("BOOLOP"): token = tokenizer.read() expr_right = _parse_marker_atom(tokenizer) expression.extend((token.text, expr_right)) return expression def _parse_marker_atom(tokenizer: Tokenizer) -> MarkerAtom: """ marker_atom = WS? LEFT_PARENTHESIS WS? marker WS? RIGHT_PARENTHESIS WS? | WS? marker_item WS? """ tokenizer.consume("WS") if tokenizer.check("LEFT_PARENTHESIS", peek=True): with tokenizer.enclosing_tokens( "LEFT_PARENTHESIS", "RIGHT_PARENTHESIS", around="marker expression", ): tokenizer.consume("WS") marker: MarkerAtom = _parse_marker(tokenizer) tokenizer.consume("WS") else: marker = _parse_marker_item(tokenizer) tokenizer.consume("WS") return marker def _parse_marker_item(tokenizer: Tokenizer) -> MarkerItem: """ marker_item = WS? marker_var WS? marker_op WS? marker_var WS? """ tokenizer.consume("WS") marker_var_left = _parse_marker_var(tokenizer) tokenizer.consume("WS") marker_op = _parse_marker_op(tokenizer) tokenizer.consume("WS") marker_var_right = _parse_marker_var(tokenizer) tokenizer.consume("WS") return (marker_var_left, marker_op, marker_var_right) def _parse_marker_var(tokenizer: Tokenizer) -> MarkerVar: # noqa: RET503 """ marker_var = VARIABLE | QUOTED_STRING """ if tokenizer.check("VARIABLE"): return process_env_var(tokenizer.read().text.replace(".", "_")) elif tokenizer.check("QUOTED_STRING"): return process_python_str(tokenizer.read().text) else: tokenizer.raise_syntax_error( message="Expected a marker variable or quoted string" ) def process_env_var(env_var: str) -> Variable: if env_var in ("platform_python_implementation", "python_implementation"): return Variable("platform_python_implementation") else: return Variable(env_var) def process_python_str(python_str: str) -> Value: value = ast.literal_eval(python_str) return Value(str(value)) def _parse_marker_op(tokenizer: Tokenizer) -> Op: """ marker_op = IN | NOT IN | OP """ if tokenizer.check("IN"): tokenizer.read() return Op("in") elif tokenizer.check("NOT"): tokenizer.read() tokenizer.expect("WS", expected="whitespace after 'not'") tokenizer.expect("IN", expected="'in' after 'not'") return Op("not in") elif tokenizer.check("OP"): return Op(tokenizer.read().text) else: return tokenizer.raise_syntax_error( "Expected marker operator, one of <=, <, !=, ==, >=, >, ~=, ===, in, not in" ) ================================================ FILE: src/pip/_vendor/packaging/_structures.py ================================================ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. import typing @typing.final class InfinityType: __slots__ = () def __repr__(self) -> str: return "Infinity" def __hash__(self) -> int: return hash(repr(self)) def __lt__(self, other: object) -> bool: return False def __le__(self, other: object) -> bool: return False def __eq__(self, other: object) -> bool: return isinstance(other, self.__class__) def __gt__(self, other: object) -> bool: return True def __ge__(self, other: object) -> bool: return True def __neg__(self: object) -> "NegativeInfinityType": return NegativeInfinity Infinity = InfinityType() @typing.final class NegativeInfinityType: __slots__ = () def __repr__(self) -> str: return "-Infinity" def __hash__(self) -> int: return hash(repr(self)) def __lt__(self, other: object) -> bool: return True def __le__(self, other: object) -> bool: return True def __eq__(self, other: object) -> bool: return isinstance(other, self.__class__) def __gt__(self, other: object) -> bool: return False def __ge__(self, other: object) -> bool: return False def __neg__(self: object) -> InfinityType: return Infinity NegativeInfinity = NegativeInfinityType() ================================================ FILE: src/pip/_vendor/packaging/_tokenizer.py ================================================ from __future__ import annotations import contextlib import re from dataclasses import dataclass from typing import Generator, Mapping, NoReturn from .specifiers import Specifier @dataclass class Token: name: str text: str position: int class ParserSyntaxError(Exception): """The provided source text could not be parsed correctly.""" def __init__( self, message: str, *, source: str, span: tuple[int, int], ) -> None: self.span = span self.message = message self.source = source super().__init__() def __str__(self) -> str: marker = " " * self.span[0] + "~" * (self.span[1] - self.span[0]) + "^" return f"{self.message}\n {self.source}\n {marker}" DEFAULT_RULES: dict[str, re.Pattern[str]] = { "LEFT_PARENTHESIS": re.compile(r"\("), "RIGHT_PARENTHESIS": re.compile(r"\)"), "LEFT_BRACKET": re.compile(r"\["), "RIGHT_BRACKET": re.compile(r"\]"), "SEMICOLON": re.compile(r";"), "COMMA": re.compile(r","), "QUOTED_STRING": re.compile( r""" ( ('[^']*') | ("[^"]*") ) """, re.VERBOSE, ), "OP": re.compile(r"(===|==|~=|!=|<=|>=|<|>)"), "BOOLOP": re.compile(r"\b(or|and)\b"), "IN": re.compile(r"\bin\b"), "NOT": re.compile(r"\bnot\b"), "VARIABLE": re.compile( r""" \b( python_version |python_full_version |os[._]name |sys[._]platform |platform_(release|system) |platform[._](version|machine|python_implementation) |python_implementation |implementation_(name|version) |extras? |dependency_groups )\b """, re.VERBOSE, ), "SPECIFIER": re.compile( Specifier._operator_regex_str + Specifier._version_regex_str, re.VERBOSE | re.IGNORECASE, ), "AT": re.compile(r"\@"), "URL": re.compile(r"[^ \t]+"), "IDENTIFIER": re.compile(r"\b[a-zA-Z0-9][a-zA-Z0-9._-]*\b"), "VERSION_PREFIX_TRAIL": re.compile(r"\.\*"), "VERSION_LOCAL_LABEL_TRAIL": re.compile(r"\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*"), "WS": re.compile(r"[ \t]+"), "END": re.compile(r"$"), } class Tokenizer: """Context-sensitive token parsing. Provides methods to examine the input stream to check whether the next token matches. """ def __init__( self, source: str, *, rules: Mapping[str, re.Pattern[str]], ) -> None: self.source = source self.rules = rules self.next_token: Token | None = None self.position = 0 def consume(self, name: str) -> None: """Move beyond provided token name, if at current position.""" if self.check(name): self.read() def check(self, name: str, *, peek: bool = False) -> bool: """Check whether the next token has the provided name. By default, if the check succeeds, the token *must* be read before another check. If `peek` is set to `True`, the token is not loaded and would need to be checked again. """ assert self.next_token is None, ( f"Cannot check for {name!r}, already have {self.next_token!r}" ) assert name in self.rules, f"Unknown token name: {name!r}" expression = self.rules[name] match = expression.match(self.source, self.position) if match is None: return False if not peek: self.next_token = Token(name, match[0], self.position) return True def expect(self, name: str, *, expected: str) -> Token: """Expect a certain token name next, failing with a syntax error otherwise. The token is *not* read. """ if not self.check(name): raise self.raise_syntax_error(f"Expected {expected}") return self.read() def read(self) -> Token: """Consume the next token and return it.""" token = self.next_token assert token is not None self.position += len(token.text) self.next_token = None return token def raise_syntax_error( self, message: str, *, span_start: int | None = None, span_end: int | None = None, ) -> NoReturn: """Raise ParserSyntaxError at the given position.""" span = ( self.position if span_start is None else span_start, self.position if span_end is None else span_end, ) raise ParserSyntaxError( message, source=self.source, span=span, ) @contextlib.contextmanager def enclosing_tokens( self, open_token: str, close_token: str, *, around: str ) -> Generator[None, None, None]: if self.check(open_token): open_position = self.position self.read() else: open_position = None yield if open_position is None: return if not self.check(close_token): self.raise_syntax_error( f"Expected matching {close_token} for {open_token}, after {around}", span_start=open_position, ) self.read() ================================================ FILE: src/pip/_vendor/packaging/licenses/__init__.py ================================================ ####################################################################################### # # Adapted from: # https://github.com/pypa/hatch/blob/5352e44/backend/src/hatchling/licenses/parse.py # # MIT License # # Copyright (c) 2017-present Ofek Lev # # Permission is hereby granted, free of charge, to any person obtaining a copy of this # software and associated documentation files (the "Software"), to deal in the Software # without restriction, including without limitation the rights to use, copy, modify, # merge, publish, distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be included in all copies # or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A # PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF # CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # # With additional allowance of arbitrary `LicenseRef-` identifiers, not just # `LicenseRef-Public-Domain` and `LicenseRef-Proprietary`. # ####################################################################################### from __future__ import annotations import re from typing import NewType, cast from ._spdx import EXCEPTIONS, LICENSES __all__ = [ "InvalidLicenseExpression", "NormalizedLicenseExpression", "canonicalize_license_expression", ] license_ref_allowed = re.compile("^[A-Za-z0-9.-]*$") NormalizedLicenseExpression = NewType("NormalizedLicenseExpression", str) class InvalidLicenseExpression(ValueError): """Raised when a license-expression string is invalid >>> canonicalize_license_expression("invalid") Traceback (most recent call last): ... packaging.licenses.InvalidLicenseExpression: Invalid license expression: 'invalid' """ def canonicalize_license_expression( raw_license_expression: str, ) -> NormalizedLicenseExpression: if not raw_license_expression: message = f"Invalid license expression: {raw_license_expression!r}" raise InvalidLicenseExpression(message) # Pad any parentheses so tokenization can be achieved by merely splitting on # whitespace. license_expression = raw_license_expression.replace("(", " ( ").replace(")", " ) ") licenseref_prefix = "LicenseRef-" license_refs = { ref.lower(): "LicenseRef-" + ref[len(licenseref_prefix) :] for ref in license_expression.split() if ref.lower().startswith(licenseref_prefix.lower()) } # Normalize to lower case so we can look up licenses/exceptions # and so boolean operators are Python-compatible. license_expression = license_expression.lower() tokens = license_expression.split() # Rather than implementing a parenthesis/boolean logic parser, create an # expression that Python can parse. Everything that is not involved with the # grammar itself is replaced with the placeholder `False` and the resultant # expression should become a valid Python expression. python_tokens = [] for token in tokens: if token not in {"or", "and", "with", "(", ")"}: python_tokens.append("False") elif token == "with": python_tokens.append("or") elif ( token == "(" and python_tokens and python_tokens[-1] not in {"or", "and", "("} ) or (token == ")" and python_tokens and python_tokens[-1] == "("): message = f"Invalid license expression: {raw_license_expression!r}" raise InvalidLicenseExpression(message) else: python_tokens.append(token) python_expression = " ".join(python_tokens) try: compile(python_expression, "", "eval") except SyntaxError: message = f"Invalid license expression: {raw_license_expression!r}" raise InvalidLicenseExpression(message) from None # Take a final pass to check for unknown licenses/exceptions. normalized_tokens = [] for token in tokens: if token in {"or", "and", "with", "(", ")"}: normalized_tokens.append(token.upper()) continue if normalized_tokens and normalized_tokens[-1] == "WITH": if token not in EXCEPTIONS: message = f"Unknown license exception: {token!r}" raise InvalidLicenseExpression(message) normalized_tokens.append(EXCEPTIONS[token]["id"]) else: if token.endswith("+"): final_token = token[:-1] suffix = "+" else: final_token = token suffix = "" if final_token.startswith("licenseref-"): if not license_ref_allowed.match(final_token): message = f"Invalid licenseref: {final_token!r}" raise InvalidLicenseExpression(message) normalized_tokens.append(license_refs[final_token] + suffix) else: if final_token not in LICENSES: message = f"Unknown license: {final_token!r}" raise InvalidLicenseExpression(message) normalized_tokens.append(LICENSES[final_token]["id"] + suffix) normalized_expression = " ".join(normalized_tokens) return cast( "NormalizedLicenseExpression", normalized_expression.replace("( ", "(").replace(" )", ")"), ) ================================================ FILE: src/pip/_vendor/packaging/licenses/_spdx.py ================================================ from __future__ import annotations from typing import TypedDict class SPDXLicense(TypedDict): id: str deprecated: bool class SPDXException(TypedDict): id: str deprecated: bool VERSION = '3.27.0' LICENSES: dict[str, SPDXLicense] = { '0bsd': {'id': '0BSD', 'deprecated': False}, '3d-slicer-1.0': {'id': '3D-Slicer-1.0', 'deprecated': False}, 'aal': {'id': 'AAL', 'deprecated': False}, 'abstyles': {'id': 'Abstyles', 'deprecated': False}, 'adacore-doc': {'id': 'AdaCore-doc', 'deprecated': False}, 'adobe-2006': {'id': 'Adobe-2006', 'deprecated': False}, 'adobe-display-postscript': {'id': 'Adobe-Display-PostScript', 'deprecated': False}, 'adobe-glyph': {'id': 'Adobe-Glyph', 'deprecated': False}, 'adobe-utopia': {'id': 'Adobe-Utopia', 'deprecated': False}, 'adsl': {'id': 'ADSL', 'deprecated': False}, 'afl-1.1': {'id': 'AFL-1.1', 'deprecated': False}, 'afl-1.2': {'id': 'AFL-1.2', 'deprecated': False}, 'afl-2.0': {'id': 'AFL-2.0', 'deprecated': False}, 'afl-2.1': {'id': 'AFL-2.1', 'deprecated': False}, 'afl-3.0': {'id': 'AFL-3.0', 'deprecated': False}, 'afmparse': {'id': 'Afmparse', 'deprecated': False}, 'agpl-1.0': {'id': 'AGPL-1.0', 'deprecated': True}, 'agpl-1.0-only': {'id': 'AGPL-1.0-only', 'deprecated': False}, 'agpl-1.0-or-later': {'id': 'AGPL-1.0-or-later', 'deprecated': False}, 'agpl-3.0': {'id': 'AGPL-3.0', 'deprecated': True}, 'agpl-3.0-only': {'id': 'AGPL-3.0-only', 'deprecated': False}, 'agpl-3.0-or-later': {'id': 'AGPL-3.0-or-later', 'deprecated': False}, 'aladdin': {'id': 'Aladdin', 'deprecated': False}, 'amd-newlib': {'id': 'AMD-newlib', 'deprecated': False}, 'amdplpa': {'id': 'AMDPLPA', 'deprecated': False}, 'aml': {'id': 'AML', 'deprecated': False}, 'aml-glslang': {'id': 'AML-glslang', 'deprecated': False}, 'ampas': {'id': 'AMPAS', 'deprecated': False}, 'antlr-pd': {'id': 'ANTLR-PD', 'deprecated': False}, 'antlr-pd-fallback': {'id': 'ANTLR-PD-fallback', 'deprecated': False}, 'any-osi': {'id': 'any-OSI', 'deprecated': False}, 'any-osi-perl-modules': {'id': 'any-OSI-perl-modules', 'deprecated': False}, 'apache-1.0': {'id': 'Apache-1.0', 'deprecated': False}, 'apache-1.1': {'id': 'Apache-1.1', 'deprecated': False}, 'apache-2.0': {'id': 'Apache-2.0', 'deprecated': False}, 'apafml': {'id': 'APAFML', 'deprecated': False}, 'apl-1.0': {'id': 'APL-1.0', 'deprecated': False}, 'app-s2p': {'id': 'App-s2p', 'deprecated': False}, 'apsl-1.0': {'id': 'APSL-1.0', 'deprecated': False}, 'apsl-1.1': {'id': 'APSL-1.1', 'deprecated': False}, 'apsl-1.2': {'id': 'APSL-1.2', 'deprecated': False}, 'apsl-2.0': {'id': 'APSL-2.0', 'deprecated': False}, 'arphic-1999': {'id': 'Arphic-1999', 'deprecated': False}, 'artistic-1.0': {'id': 'Artistic-1.0', 'deprecated': False}, 'artistic-1.0-cl8': {'id': 'Artistic-1.0-cl8', 'deprecated': False}, 'artistic-1.0-perl': {'id': 'Artistic-1.0-Perl', 'deprecated': False}, 'artistic-2.0': {'id': 'Artistic-2.0', 'deprecated': False}, 'artistic-dist': {'id': 'Artistic-dist', 'deprecated': False}, 'aspell-ru': {'id': 'Aspell-RU', 'deprecated': False}, 'aswf-digital-assets-1.0': {'id': 'ASWF-Digital-Assets-1.0', 'deprecated': False}, 'aswf-digital-assets-1.1': {'id': 'ASWF-Digital-Assets-1.1', 'deprecated': False}, 'baekmuk': {'id': 'Baekmuk', 'deprecated': False}, 'bahyph': {'id': 'Bahyph', 'deprecated': False}, 'barr': {'id': 'Barr', 'deprecated': False}, 'bcrypt-solar-designer': {'id': 'bcrypt-Solar-Designer', 'deprecated': False}, 'beerware': {'id': 'Beerware', 'deprecated': False}, 'bitstream-charter': {'id': 'Bitstream-Charter', 'deprecated': False}, 'bitstream-vera': {'id': 'Bitstream-Vera', 'deprecated': False}, 'bittorrent-1.0': {'id': 'BitTorrent-1.0', 'deprecated': False}, 'bittorrent-1.1': {'id': 'BitTorrent-1.1', 'deprecated': False}, 'blessing': {'id': 'blessing', 'deprecated': False}, 'blueoak-1.0.0': {'id': 'BlueOak-1.0.0', 'deprecated': False}, 'boehm-gc': {'id': 'Boehm-GC', 'deprecated': False}, 'boehm-gc-without-fee': {'id': 'Boehm-GC-without-fee', 'deprecated': False}, 'borceux': {'id': 'Borceux', 'deprecated': False}, 'brian-gladman-2-clause': {'id': 'Brian-Gladman-2-Clause', 'deprecated': False}, 'brian-gladman-3-clause': {'id': 'Brian-Gladman-3-Clause', 'deprecated': False}, 'bsd-1-clause': {'id': 'BSD-1-Clause', 'deprecated': False}, 'bsd-2-clause': {'id': 'BSD-2-Clause', 'deprecated': False}, 'bsd-2-clause-darwin': {'id': 'BSD-2-Clause-Darwin', 'deprecated': False}, 'bsd-2-clause-first-lines': {'id': 'BSD-2-Clause-first-lines', 'deprecated': False}, 'bsd-2-clause-freebsd': {'id': 'BSD-2-Clause-FreeBSD', 'deprecated': True}, 'bsd-2-clause-netbsd': {'id': 'BSD-2-Clause-NetBSD', 'deprecated': True}, 'bsd-2-clause-patent': {'id': 'BSD-2-Clause-Patent', 'deprecated': False}, 'bsd-2-clause-pkgconf-disclaimer': {'id': 'BSD-2-Clause-pkgconf-disclaimer', 'deprecated': False}, 'bsd-2-clause-views': {'id': 'BSD-2-Clause-Views', 'deprecated': False}, 'bsd-3-clause': {'id': 'BSD-3-Clause', 'deprecated': False}, 'bsd-3-clause-acpica': {'id': 'BSD-3-Clause-acpica', 'deprecated': False}, 'bsd-3-clause-attribution': {'id': 'BSD-3-Clause-Attribution', 'deprecated': False}, 'bsd-3-clause-clear': {'id': 'BSD-3-Clause-Clear', 'deprecated': False}, 'bsd-3-clause-flex': {'id': 'BSD-3-Clause-flex', 'deprecated': False}, 'bsd-3-clause-hp': {'id': 'BSD-3-Clause-HP', 'deprecated': False}, 'bsd-3-clause-lbnl': {'id': 'BSD-3-Clause-LBNL', 'deprecated': False}, 'bsd-3-clause-modification': {'id': 'BSD-3-Clause-Modification', 'deprecated': False}, 'bsd-3-clause-no-military-license': {'id': 'BSD-3-Clause-No-Military-License', 'deprecated': False}, 'bsd-3-clause-no-nuclear-license': {'id': 'BSD-3-Clause-No-Nuclear-License', 'deprecated': False}, 'bsd-3-clause-no-nuclear-license-2014': {'id': 'BSD-3-Clause-No-Nuclear-License-2014', 'deprecated': False}, 'bsd-3-clause-no-nuclear-warranty': {'id': 'BSD-3-Clause-No-Nuclear-Warranty', 'deprecated': False}, 'bsd-3-clause-open-mpi': {'id': 'BSD-3-Clause-Open-MPI', 'deprecated': False}, 'bsd-3-clause-sun': {'id': 'BSD-3-Clause-Sun', 'deprecated': False}, 'bsd-4-clause': {'id': 'BSD-4-Clause', 'deprecated': False}, 'bsd-4-clause-shortened': {'id': 'BSD-4-Clause-Shortened', 'deprecated': False}, 'bsd-4-clause-uc': {'id': 'BSD-4-Clause-UC', 'deprecated': False}, 'bsd-4.3reno': {'id': 'BSD-4.3RENO', 'deprecated': False}, 'bsd-4.3tahoe': {'id': 'BSD-4.3TAHOE', 'deprecated': False}, 'bsd-advertising-acknowledgement': {'id': 'BSD-Advertising-Acknowledgement', 'deprecated': False}, 'bsd-attribution-hpnd-disclaimer': {'id': 'BSD-Attribution-HPND-disclaimer', 'deprecated': False}, 'bsd-inferno-nettverk': {'id': 'BSD-Inferno-Nettverk', 'deprecated': False}, 'bsd-protection': {'id': 'BSD-Protection', 'deprecated': False}, 'bsd-source-beginning-file': {'id': 'BSD-Source-beginning-file', 'deprecated': False}, 'bsd-source-code': {'id': 'BSD-Source-Code', 'deprecated': False}, 'bsd-systemics': {'id': 'BSD-Systemics', 'deprecated': False}, 'bsd-systemics-w3works': {'id': 'BSD-Systemics-W3Works', 'deprecated': False}, 'bsl-1.0': {'id': 'BSL-1.0', 'deprecated': False}, 'busl-1.1': {'id': 'BUSL-1.1', 'deprecated': False}, 'bzip2-1.0.5': {'id': 'bzip2-1.0.5', 'deprecated': True}, 'bzip2-1.0.6': {'id': 'bzip2-1.0.6', 'deprecated': False}, 'c-uda-1.0': {'id': 'C-UDA-1.0', 'deprecated': False}, 'cal-1.0': {'id': 'CAL-1.0', 'deprecated': False}, 'cal-1.0-combined-work-exception': {'id': 'CAL-1.0-Combined-Work-Exception', 'deprecated': False}, 'caldera': {'id': 'Caldera', 'deprecated': False}, 'caldera-no-preamble': {'id': 'Caldera-no-preamble', 'deprecated': False}, 'catharon': {'id': 'Catharon', 'deprecated': False}, 'catosl-1.1': {'id': 'CATOSL-1.1', 'deprecated': False}, 'cc-by-1.0': {'id': 'CC-BY-1.0', 'deprecated': False}, 'cc-by-2.0': {'id': 'CC-BY-2.0', 'deprecated': False}, 'cc-by-2.5': {'id': 'CC-BY-2.5', 'deprecated': False}, 'cc-by-2.5-au': {'id': 'CC-BY-2.5-AU', 'deprecated': False}, 'cc-by-3.0': {'id': 'CC-BY-3.0', 'deprecated': False}, 'cc-by-3.0-at': {'id': 'CC-BY-3.0-AT', 'deprecated': False}, 'cc-by-3.0-au': {'id': 'CC-BY-3.0-AU', 'deprecated': False}, 'cc-by-3.0-de': {'id': 'CC-BY-3.0-DE', 'deprecated': False}, 'cc-by-3.0-igo': {'id': 'CC-BY-3.0-IGO', 'deprecated': False}, 'cc-by-3.0-nl': {'id': 'CC-BY-3.0-NL', 'deprecated': False}, 'cc-by-3.0-us': {'id': 'CC-BY-3.0-US', 'deprecated': False}, 'cc-by-4.0': {'id': 'CC-BY-4.0', 'deprecated': False}, 'cc-by-nc-1.0': {'id': 'CC-BY-NC-1.0', 'deprecated': False}, 'cc-by-nc-2.0': {'id': 'CC-BY-NC-2.0', 'deprecated': False}, 'cc-by-nc-2.5': {'id': 'CC-BY-NC-2.5', 'deprecated': False}, 'cc-by-nc-3.0': {'id': 'CC-BY-NC-3.0', 'deprecated': False}, 'cc-by-nc-3.0-de': {'id': 'CC-BY-NC-3.0-DE', 'deprecated': False}, 'cc-by-nc-4.0': {'id': 'CC-BY-NC-4.0', 'deprecated': False}, 'cc-by-nc-nd-1.0': {'id': 'CC-BY-NC-ND-1.0', 'deprecated': False}, 'cc-by-nc-nd-2.0': {'id': 'CC-BY-NC-ND-2.0', 'deprecated': False}, 'cc-by-nc-nd-2.5': {'id': 'CC-BY-NC-ND-2.5', 'deprecated': False}, 'cc-by-nc-nd-3.0': {'id': 'CC-BY-NC-ND-3.0', 'deprecated': False}, 'cc-by-nc-nd-3.0-de': {'id': 'CC-BY-NC-ND-3.0-DE', 'deprecated': False}, 'cc-by-nc-nd-3.0-igo': {'id': 'CC-BY-NC-ND-3.0-IGO', 'deprecated': False}, 'cc-by-nc-nd-4.0': {'id': 'CC-BY-NC-ND-4.0', 'deprecated': False}, 'cc-by-nc-sa-1.0': {'id': 'CC-BY-NC-SA-1.0', 'deprecated': False}, 'cc-by-nc-sa-2.0': {'id': 'CC-BY-NC-SA-2.0', 'deprecated': False}, 'cc-by-nc-sa-2.0-de': {'id': 'CC-BY-NC-SA-2.0-DE', 'deprecated': False}, 'cc-by-nc-sa-2.0-fr': {'id': 'CC-BY-NC-SA-2.0-FR', 'deprecated': False}, 'cc-by-nc-sa-2.0-uk': {'id': 'CC-BY-NC-SA-2.0-UK', 'deprecated': False}, 'cc-by-nc-sa-2.5': {'id': 'CC-BY-NC-SA-2.5', 'deprecated': False}, 'cc-by-nc-sa-3.0': {'id': 'CC-BY-NC-SA-3.0', 'deprecated': False}, 'cc-by-nc-sa-3.0-de': {'id': 'CC-BY-NC-SA-3.0-DE', 'deprecated': False}, 'cc-by-nc-sa-3.0-igo': {'id': 'CC-BY-NC-SA-3.0-IGO', 'deprecated': False}, 'cc-by-nc-sa-4.0': {'id': 'CC-BY-NC-SA-4.0', 'deprecated': False}, 'cc-by-nd-1.0': {'id': 'CC-BY-ND-1.0', 'deprecated': False}, 'cc-by-nd-2.0': {'id': 'CC-BY-ND-2.0', 'deprecated': False}, 'cc-by-nd-2.5': {'id': 'CC-BY-ND-2.5', 'deprecated': False}, 'cc-by-nd-3.0': {'id': 'CC-BY-ND-3.0', 'deprecated': False}, 'cc-by-nd-3.0-de': {'id': 'CC-BY-ND-3.0-DE', 'deprecated': False}, 'cc-by-nd-4.0': {'id': 'CC-BY-ND-4.0', 'deprecated': False}, 'cc-by-sa-1.0': {'id': 'CC-BY-SA-1.0', 'deprecated': False}, 'cc-by-sa-2.0': {'id': 'CC-BY-SA-2.0', 'deprecated': False}, 'cc-by-sa-2.0-uk': {'id': 'CC-BY-SA-2.0-UK', 'deprecated': False}, 'cc-by-sa-2.1-jp': {'id': 'CC-BY-SA-2.1-JP', 'deprecated': False}, 'cc-by-sa-2.5': {'id': 'CC-BY-SA-2.5', 'deprecated': False}, 'cc-by-sa-3.0': {'id': 'CC-BY-SA-3.0', 'deprecated': False}, 'cc-by-sa-3.0-at': {'id': 'CC-BY-SA-3.0-AT', 'deprecated': False}, 'cc-by-sa-3.0-de': {'id': 'CC-BY-SA-3.0-DE', 'deprecated': False}, 'cc-by-sa-3.0-igo': {'id': 'CC-BY-SA-3.0-IGO', 'deprecated': False}, 'cc-by-sa-4.0': {'id': 'CC-BY-SA-4.0', 'deprecated': False}, 'cc-pddc': {'id': 'CC-PDDC', 'deprecated': False}, 'cc-pdm-1.0': {'id': 'CC-PDM-1.0', 'deprecated': False}, 'cc-sa-1.0': {'id': 'CC-SA-1.0', 'deprecated': False}, 'cc0-1.0': {'id': 'CC0-1.0', 'deprecated': False}, 'cddl-1.0': {'id': 'CDDL-1.0', 'deprecated': False}, 'cddl-1.1': {'id': 'CDDL-1.1', 'deprecated': False}, 'cdl-1.0': {'id': 'CDL-1.0', 'deprecated': False}, 'cdla-permissive-1.0': {'id': 'CDLA-Permissive-1.0', 'deprecated': False}, 'cdla-permissive-2.0': {'id': 'CDLA-Permissive-2.0', 'deprecated': False}, 'cdla-sharing-1.0': {'id': 'CDLA-Sharing-1.0', 'deprecated': False}, 'cecill-1.0': {'id': 'CECILL-1.0', 'deprecated': False}, 'cecill-1.1': {'id': 'CECILL-1.1', 'deprecated': False}, 'cecill-2.0': {'id': 'CECILL-2.0', 'deprecated': False}, 'cecill-2.1': {'id': 'CECILL-2.1', 'deprecated': False}, 'cecill-b': {'id': 'CECILL-B', 'deprecated': False}, 'cecill-c': {'id': 'CECILL-C', 'deprecated': False}, 'cern-ohl-1.1': {'id': 'CERN-OHL-1.1', 'deprecated': False}, 'cern-ohl-1.2': {'id': 'CERN-OHL-1.2', 'deprecated': False}, 'cern-ohl-p-2.0': {'id': 'CERN-OHL-P-2.0', 'deprecated': False}, 'cern-ohl-s-2.0': {'id': 'CERN-OHL-S-2.0', 'deprecated': False}, 'cern-ohl-w-2.0': {'id': 'CERN-OHL-W-2.0', 'deprecated': False}, 'cfitsio': {'id': 'CFITSIO', 'deprecated': False}, 'check-cvs': {'id': 'check-cvs', 'deprecated': False}, 'checkmk': {'id': 'checkmk', 'deprecated': False}, 'clartistic': {'id': 'ClArtistic', 'deprecated': False}, 'clips': {'id': 'Clips', 'deprecated': False}, 'cmu-mach': {'id': 'CMU-Mach', 'deprecated': False}, 'cmu-mach-nodoc': {'id': 'CMU-Mach-nodoc', 'deprecated': False}, 'cnri-jython': {'id': 'CNRI-Jython', 'deprecated': False}, 'cnri-python': {'id': 'CNRI-Python', 'deprecated': False}, 'cnri-python-gpl-compatible': {'id': 'CNRI-Python-GPL-Compatible', 'deprecated': False}, 'coil-1.0': {'id': 'COIL-1.0', 'deprecated': False}, 'community-spec-1.0': {'id': 'Community-Spec-1.0', 'deprecated': False}, 'condor-1.1': {'id': 'Condor-1.1', 'deprecated': False}, 'copyleft-next-0.3.0': {'id': 'copyleft-next-0.3.0', 'deprecated': False}, 'copyleft-next-0.3.1': {'id': 'copyleft-next-0.3.1', 'deprecated': False}, 'cornell-lossless-jpeg': {'id': 'Cornell-Lossless-JPEG', 'deprecated': False}, 'cpal-1.0': {'id': 'CPAL-1.0', 'deprecated': False}, 'cpl-1.0': {'id': 'CPL-1.0', 'deprecated': False}, 'cpol-1.02': {'id': 'CPOL-1.02', 'deprecated': False}, 'cronyx': {'id': 'Cronyx', 'deprecated': False}, 'crossword': {'id': 'Crossword', 'deprecated': False}, 'cryptoswift': {'id': 'CryptoSwift', 'deprecated': False}, 'crystalstacker': {'id': 'CrystalStacker', 'deprecated': False}, 'cua-opl-1.0': {'id': 'CUA-OPL-1.0', 'deprecated': False}, 'cube': {'id': 'Cube', 'deprecated': False}, 'curl': {'id': 'curl', 'deprecated': False}, 'cve-tou': {'id': 'cve-tou', 'deprecated': False}, 'd-fsl-1.0': {'id': 'D-FSL-1.0', 'deprecated': False}, 'dec-3-clause': {'id': 'DEC-3-Clause', 'deprecated': False}, 'diffmark': {'id': 'diffmark', 'deprecated': False}, 'dl-de-by-2.0': {'id': 'DL-DE-BY-2.0', 'deprecated': False}, 'dl-de-zero-2.0': {'id': 'DL-DE-ZERO-2.0', 'deprecated': False}, 'doc': {'id': 'DOC', 'deprecated': False}, 'docbook-dtd': {'id': 'DocBook-DTD', 'deprecated': False}, 'docbook-schema': {'id': 'DocBook-Schema', 'deprecated': False}, 'docbook-stylesheet': {'id': 'DocBook-Stylesheet', 'deprecated': False}, 'docbook-xml': {'id': 'DocBook-XML', 'deprecated': False}, 'dotseqn': {'id': 'Dotseqn', 'deprecated': False}, 'drl-1.0': {'id': 'DRL-1.0', 'deprecated': False}, 'drl-1.1': {'id': 'DRL-1.1', 'deprecated': False}, 'dsdp': {'id': 'DSDP', 'deprecated': False}, 'dtoa': {'id': 'dtoa', 'deprecated': False}, 'dvipdfm': {'id': 'dvipdfm', 'deprecated': False}, 'ecl-1.0': {'id': 'ECL-1.0', 'deprecated': False}, 'ecl-2.0': {'id': 'ECL-2.0', 'deprecated': False}, 'ecos-2.0': {'id': 'eCos-2.0', 'deprecated': True}, 'efl-1.0': {'id': 'EFL-1.0', 'deprecated': False}, 'efl-2.0': {'id': 'EFL-2.0', 'deprecated': False}, 'egenix': {'id': 'eGenix', 'deprecated': False}, 'elastic-2.0': {'id': 'Elastic-2.0', 'deprecated': False}, 'entessa': {'id': 'Entessa', 'deprecated': False}, 'epics': {'id': 'EPICS', 'deprecated': False}, 'epl-1.0': {'id': 'EPL-1.0', 'deprecated': False}, 'epl-2.0': {'id': 'EPL-2.0', 'deprecated': False}, 'erlpl-1.1': {'id': 'ErlPL-1.1', 'deprecated': False}, 'etalab-2.0': {'id': 'etalab-2.0', 'deprecated': False}, 'eudatagrid': {'id': 'EUDatagrid', 'deprecated': False}, 'eupl-1.0': {'id': 'EUPL-1.0', 'deprecated': False}, 'eupl-1.1': {'id': 'EUPL-1.1', 'deprecated': False}, 'eupl-1.2': {'id': 'EUPL-1.2', 'deprecated': False}, 'eurosym': {'id': 'Eurosym', 'deprecated': False}, 'fair': {'id': 'Fair', 'deprecated': False}, 'fbm': {'id': 'FBM', 'deprecated': False}, 'fdk-aac': {'id': 'FDK-AAC', 'deprecated': False}, 'ferguson-twofish': {'id': 'Ferguson-Twofish', 'deprecated': False}, 'frameworx-1.0': {'id': 'Frameworx-1.0', 'deprecated': False}, 'freebsd-doc': {'id': 'FreeBSD-DOC', 'deprecated': False}, 'freeimage': {'id': 'FreeImage', 'deprecated': False}, 'fsfap': {'id': 'FSFAP', 'deprecated': False}, 'fsfap-no-warranty-disclaimer': {'id': 'FSFAP-no-warranty-disclaimer', 'deprecated': False}, 'fsful': {'id': 'FSFUL', 'deprecated': False}, 'fsfullr': {'id': 'FSFULLR', 'deprecated': False}, 'fsfullrsd': {'id': 'FSFULLRSD', 'deprecated': False}, 'fsfullrwd': {'id': 'FSFULLRWD', 'deprecated': False}, 'fsl-1.1-alv2': {'id': 'FSL-1.1-ALv2', 'deprecated': False}, 'fsl-1.1-mit': {'id': 'FSL-1.1-MIT', 'deprecated': False}, 'ftl': {'id': 'FTL', 'deprecated': False}, 'furuseth': {'id': 'Furuseth', 'deprecated': False}, 'fwlw': {'id': 'fwlw', 'deprecated': False}, 'game-programming-gems': {'id': 'Game-Programming-Gems', 'deprecated': False}, 'gcr-docs': {'id': 'GCR-docs', 'deprecated': False}, 'gd': {'id': 'GD', 'deprecated': False}, 'generic-xts': {'id': 'generic-xts', 'deprecated': False}, 'gfdl-1.1': {'id': 'GFDL-1.1', 'deprecated': True}, 'gfdl-1.1-invariants-only': {'id': 'GFDL-1.1-invariants-only', 'deprecated': False}, 'gfdl-1.1-invariants-or-later': {'id': 'GFDL-1.1-invariants-or-later', 'deprecated': False}, 'gfdl-1.1-no-invariants-only': {'id': 'GFDL-1.1-no-invariants-only', 'deprecated': False}, 'gfdl-1.1-no-invariants-or-later': {'id': 'GFDL-1.1-no-invariants-or-later', 'deprecated': False}, 'gfdl-1.1-only': {'id': 'GFDL-1.1-only', 'deprecated': False}, 'gfdl-1.1-or-later': {'id': 'GFDL-1.1-or-later', 'deprecated': False}, 'gfdl-1.2': {'id': 'GFDL-1.2', 'deprecated': True}, 'gfdl-1.2-invariants-only': {'id': 'GFDL-1.2-invariants-only', 'deprecated': False}, 'gfdl-1.2-invariants-or-later': {'id': 'GFDL-1.2-invariants-or-later', 'deprecated': False}, 'gfdl-1.2-no-invariants-only': {'id': 'GFDL-1.2-no-invariants-only', 'deprecated': False}, 'gfdl-1.2-no-invariants-or-later': {'id': 'GFDL-1.2-no-invariants-or-later', 'deprecated': False}, 'gfdl-1.2-only': {'id': 'GFDL-1.2-only', 'deprecated': False}, 'gfdl-1.2-or-later': {'id': 'GFDL-1.2-or-later', 'deprecated': False}, 'gfdl-1.3': {'id': 'GFDL-1.3', 'deprecated': True}, 'gfdl-1.3-invariants-only': {'id': 'GFDL-1.3-invariants-only', 'deprecated': False}, 'gfdl-1.3-invariants-or-later': {'id': 'GFDL-1.3-invariants-or-later', 'deprecated': False}, 'gfdl-1.3-no-invariants-only': {'id': 'GFDL-1.3-no-invariants-only', 'deprecated': False}, 'gfdl-1.3-no-invariants-or-later': {'id': 'GFDL-1.3-no-invariants-or-later', 'deprecated': False}, 'gfdl-1.3-only': {'id': 'GFDL-1.3-only', 'deprecated': False}, 'gfdl-1.3-or-later': {'id': 'GFDL-1.3-or-later', 'deprecated': False}, 'giftware': {'id': 'Giftware', 'deprecated': False}, 'gl2ps': {'id': 'GL2PS', 'deprecated': False}, 'glide': {'id': 'Glide', 'deprecated': False}, 'glulxe': {'id': 'Glulxe', 'deprecated': False}, 'glwtpl': {'id': 'GLWTPL', 'deprecated': False}, 'gnuplot': {'id': 'gnuplot', 'deprecated': False}, 'gpl-1.0': {'id': 'GPL-1.0', 'deprecated': True}, 'gpl-1.0+': {'id': 'GPL-1.0+', 'deprecated': True}, 'gpl-1.0-only': {'id': 'GPL-1.0-only', 'deprecated': False}, 'gpl-1.0-or-later': {'id': 'GPL-1.0-or-later', 'deprecated': False}, 'gpl-2.0': {'id': 'GPL-2.0', 'deprecated': True}, 'gpl-2.0+': {'id': 'GPL-2.0+', 'deprecated': True}, 'gpl-2.0-only': {'id': 'GPL-2.0-only', 'deprecated': False}, 'gpl-2.0-or-later': {'id': 'GPL-2.0-or-later', 'deprecated': False}, 'gpl-2.0-with-autoconf-exception': {'id': 'GPL-2.0-with-autoconf-exception', 'deprecated': True}, 'gpl-2.0-with-bison-exception': {'id': 'GPL-2.0-with-bison-exception', 'deprecated': True}, 'gpl-2.0-with-classpath-exception': {'id': 'GPL-2.0-with-classpath-exception', 'deprecated': True}, 'gpl-2.0-with-font-exception': {'id': 'GPL-2.0-with-font-exception', 'deprecated': True}, 'gpl-2.0-with-gcc-exception': {'id': 'GPL-2.0-with-GCC-exception', 'deprecated': True}, 'gpl-3.0': {'id': 'GPL-3.0', 'deprecated': True}, 'gpl-3.0+': {'id': 'GPL-3.0+', 'deprecated': True}, 'gpl-3.0-only': {'id': 'GPL-3.0-only', 'deprecated': False}, 'gpl-3.0-or-later': {'id': 'GPL-3.0-or-later', 'deprecated': False}, 'gpl-3.0-with-autoconf-exception': {'id': 'GPL-3.0-with-autoconf-exception', 'deprecated': True}, 'gpl-3.0-with-gcc-exception': {'id': 'GPL-3.0-with-GCC-exception', 'deprecated': True}, 'graphics-gems': {'id': 'Graphics-Gems', 'deprecated': False}, 'gsoap-1.3b': {'id': 'gSOAP-1.3b', 'deprecated': False}, 'gtkbook': {'id': 'gtkbook', 'deprecated': False}, 'gutmann': {'id': 'Gutmann', 'deprecated': False}, 'haskellreport': {'id': 'HaskellReport', 'deprecated': False}, 'hdf5': {'id': 'HDF5', 'deprecated': False}, 'hdparm': {'id': 'hdparm', 'deprecated': False}, 'hidapi': {'id': 'HIDAPI', 'deprecated': False}, 'hippocratic-2.1': {'id': 'Hippocratic-2.1', 'deprecated': False}, 'hp-1986': {'id': 'HP-1986', 'deprecated': False}, 'hp-1989': {'id': 'HP-1989', 'deprecated': False}, 'hpnd': {'id': 'HPND', 'deprecated': False}, 'hpnd-dec': {'id': 'HPND-DEC', 'deprecated': False}, 'hpnd-doc': {'id': 'HPND-doc', 'deprecated': False}, 'hpnd-doc-sell': {'id': 'HPND-doc-sell', 'deprecated': False}, 'hpnd-export-us': {'id': 'HPND-export-US', 'deprecated': False}, 'hpnd-export-us-acknowledgement': {'id': 'HPND-export-US-acknowledgement', 'deprecated': False}, 'hpnd-export-us-modify': {'id': 'HPND-export-US-modify', 'deprecated': False}, 'hpnd-export2-us': {'id': 'HPND-export2-US', 'deprecated': False}, 'hpnd-fenneberg-livingston': {'id': 'HPND-Fenneberg-Livingston', 'deprecated': False}, 'hpnd-inria-imag': {'id': 'HPND-INRIA-IMAG', 'deprecated': False}, 'hpnd-intel': {'id': 'HPND-Intel', 'deprecated': False}, 'hpnd-kevlin-henney': {'id': 'HPND-Kevlin-Henney', 'deprecated': False}, 'hpnd-markus-kuhn': {'id': 'HPND-Markus-Kuhn', 'deprecated': False}, 'hpnd-merchantability-variant': {'id': 'HPND-merchantability-variant', 'deprecated': False}, 'hpnd-mit-disclaimer': {'id': 'HPND-MIT-disclaimer', 'deprecated': False}, 'hpnd-netrek': {'id': 'HPND-Netrek', 'deprecated': False}, 'hpnd-pbmplus': {'id': 'HPND-Pbmplus', 'deprecated': False}, 'hpnd-sell-mit-disclaimer-xserver': {'id': 'HPND-sell-MIT-disclaimer-xserver', 'deprecated': False}, 'hpnd-sell-regexpr': {'id': 'HPND-sell-regexpr', 'deprecated': False}, 'hpnd-sell-variant': {'id': 'HPND-sell-variant', 'deprecated': False}, 'hpnd-sell-variant-mit-disclaimer': {'id': 'HPND-sell-variant-MIT-disclaimer', 'deprecated': False}, 'hpnd-sell-variant-mit-disclaimer-rev': {'id': 'HPND-sell-variant-MIT-disclaimer-rev', 'deprecated': False}, 'hpnd-uc': {'id': 'HPND-UC', 'deprecated': False}, 'hpnd-uc-export-us': {'id': 'HPND-UC-export-US', 'deprecated': False}, 'htmltidy': {'id': 'HTMLTIDY', 'deprecated': False}, 'ibm-pibs': {'id': 'IBM-pibs', 'deprecated': False}, 'icu': {'id': 'ICU', 'deprecated': False}, 'iec-code-components-eula': {'id': 'IEC-Code-Components-EULA', 'deprecated': False}, 'ijg': {'id': 'IJG', 'deprecated': False}, 'ijg-short': {'id': 'IJG-short', 'deprecated': False}, 'imagemagick': {'id': 'ImageMagick', 'deprecated': False}, 'imatix': {'id': 'iMatix', 'deprecated': False}, 'imlib2': {'id': 'Imlib2', 'deprecated': False}, 'info-zip': {'id': 'Info-ZIP', 'deprecated': False}, 'inner-net-2.0': {'id': 'Inner-Net-2.0', 'deprecated': False}, 'innosetup': {'id': 'InnoSetup', 'deprecated': False}, 'intel': {'id': 'Intel', 'deprecated': False}, 'intel-acpi': {'id': 'Intel-ACPI', 'deprecated': False}, 'interbase-1.0': {'id': 'Interbase-1.0', 'deprecated': False}, 'ipa': {'id': 'IPA', 'deprecated': False}, 'ipl-1.0': {'id': 'IPL-1.0', 'deprecated': False}, 'isc': {'id': 'ISC', 'deprecated': False}, 'isc-veillard': {'id': 'ISC-Veillard', 'deprecated': False}, 'jam': {'id': 'Jam', 'deprecated': False}, 'jasper-2.0': {'id': 'JasPer-2.0', 'deprecated': False}, 'jove': {'id': 'jove', 'deprecated': False}, 'jpl-image': {'id': 'JPL-image', 'deprecated': False}, 'jpnic': {'id': 'JPNIC', 'deprecated': False}, 'json': {'id': 'JSON', 'deprecated': False}, 'kastrup': {'id': 'Kastrup', 'deprecated': False}, 'kazlib': {'id': 'Kazlib', 'deprecated': False}, 'knuth-ctan': {'id': 'Knuth-CTAN', 'deprecated': False}, 'lal-1.2': {'id': 'LAL-1.2', 'deprecated': False}, 'lal-1.3': {'id': 'LAL-1.3', 'deprecated': False}, 'latex2e': {'id': 'Latex2e', 'deprecated': False}, 'latex2e-translated-notice': {'id': 'Latex2e-translated-notice', 'deprecated': False}, 'leptonica': {'id': 'Leptonica', 'deprecated': False}, 'lgpl-2.0': {'id': 'LGPL-2.0', 'deprecated': True}, 'lgpl-2.0+': {'id': 'LGPL-2.0+', 'deprecated': True}, 'lgpl-2.0-only': {'id': 'LGPL-2.0-only', 'deprecated': False}, 'lgpl-2.0-or-later': {'id': 'LGPL-2.0-or-later', 'deprecated': False}, 'lgpl-2.1': {'id': 'LGPL-2.1', 'deprecated': True}, 'lgpl-2.1+': {'id': 'LGPL-2.1+', 'deprecated': True}, 'lgpl-2.1-only': {'id': 'LGPL-2.1-only', 'deprecated': False}, 'lgpl-2.1-or-later': {'id': 'LGPL-2.1-or-later', 'deprecated': False}, 'lgpl-3.0': {'id': 'LGPL-3.0', 'deprecated': True}, 'lgpl-3.0+': {'id': 'LGPL-3.0+', 'deprecated': True}, 'lgpl-3.0-only': {'id': 'LGPL-3.0-only', 'deprecated': False}, 'lgpl-3.0-or-later': {'id': 'LGPL-3.0-or-later', 'deprecated': False}, 'lgpllr': {'id': 'LGPLLR', 'deprecated': False}, 'libpng': {'id': 'Libpng', 'deprecated': False}, 'libpng-1.6.35': {'id': 'libpng-1.6.35', 'deprecated': False}, 'libpng-2.0': {'id': 'libpng-2.0', 'deprecated': False}, 'libselinux-1.0': {'id': 'libselinux-1.0', 'deprecated': False}, 'libtiff': {'id': 'libtiff', 'deprecated': False}, 'libutil-david-nugent': {'id': 'libutil-David-Nugent', 'deprecated': False}, 'liliq-p-1.1': {'id': 'LiLiQ-P-1.1', 'deprecated': False}, 'liliq-r-1.1': {'id': 'LiLiQ-R-1.1', 'deprecated': False}, 'liliq-rplus-1.1': {'id': 'LiLiQ-Rplus-1.1', 'deprecated': False}, 'linux-man-pages-1-para': {'id': 'Linux-man-pages-1-para', 'deprecated': False}, 'linux-man-pages-copyleft': {'id': 'Linux-man-pages-copyleft', 'deprecated': False}, 'linux-man-pages-copyleft-2-para': {'id': 'Linux-man-pages-copyleft-2-para', 'deprecated': False}, 'linux-man-pages-copyleft-var': {'id': 'Linux-man-pages-copyleft-var', 'deprecated': False}, 'linux-openib': {'id': 'Linux-OpenIB', 'deprecated': False}, 'loop': {'id': 'LOOP', 'deprecated': False}, 'lpd-document': {'id': 'LPD-document', 'deprecated': False}, 'lpl-1.0': {'id': 'LPL-1.0', 'deprecated': False}, 'lpl-1.02': {'id': 'LPL-1.02', 'deprecated': False}, 'lppl-1.0': {'id': 'LPPL-1.0', 'deprecated': False}, 'lppl-1.1': {'id': 'LPPL-1.1', 'deprecated': False}, 'lppl-1.2': {'id': 'LPPL-1.2', 'deprecated': False}, 'lppl-1.3a': {'id': 'LPPL-1.3a', 'deprecated': False}, 'lppl-1.3c': {'id': 'LPPL-1.3c', 'deprecated': False}, 'lsof': {'id': 'lsof', 'deprecated': False}, 'lucida-bitmap-fonts': {'id': 'Lucida-Bitmap-Fonts', 'deprecated': False}, 'lzma-sdk-9.11-to-9.20': {'id': 'LZMA-SDK-9.11-to-9.20', 'deprecated': False}, 'lzma-sdk-9.22': {'id': 'LZMA-SDK-9.22', 'deprecated': False}, 'mackerras-3-clause': {'id': 'Mackerras-3-Clause', 'deprecated': False}, 'mackerras-3-clause-acknowledgment': {'id': 'Mackerras-3-Clause-acknowledgment', 'deprecated': False}, 'magaz': {'id': 'magaz', 'deprecated': False}, 'mailprio': {'id': 'mailprio', 'deprecated': False}, 'makeindex': {'id': 'MakeIndex', 'deprecated': False}, 'man2html': {'id': 'man2html', 'deprecated': False}, 'martin-birgmeier': {'id': 'Martin-Birgmeier', 'deprecated': False}, 'mcphee-slideshow': {'id': 'McPhee-slideshow', 'deprecated': False}, 'metamail': {'id': 'metamail', 'deprecated': False}, 'minpack': {'id': 'Minpack', 'deprecated': False}, 'mips': {'id': 'MIPS', 'deprecated': False}, 'miros': {'id': 'MirOS', 'deprecated': False}, 'mit': {'id': 'MIT', 'deprecated': False}, 'mit-0': {'id': 'MIT-0', 'deprecated': False}, 'mit-advertising': {'id': 'MIT-advertising', 'deprecated': False}, 'mit-click': {'id': 'MIT-Click', 'deprecated': False}, 'mit-cmu': {'id': 'MIT-CMU', 'deprecated': False}, 'mit-enna': {'id': 'MIT-enna', 'deprecated': False}, 'mit-feh': {'id': 'MIT-feh', 'deprecated': False}, 'mit-festival': {'id': 'MIT-Festival', 'deprecated': False}, 'mit-khronos-old': {'id': 'MIT-Khronos-old', 'deprecated': False}, 'mit-modern-variant': {'id': 'MIT-Modern-Variant', 'deprecated': False}, 'mit-open-group': {'id': 'MIT-open-group', 'deprecated': False}, 'mit-testregex': {'id': 'MIT-testregex', 'deprecated': False}, 'mit-wu': {'id': 'MIT-Wu', 'deprecated': False}, 'mitnfa': {'id': 'MITNFA', 'deprecated': False}, 'mmixware': {'id': 'MMIXware', 'deprecated': False}, 'motosoto': {'id': 'Motosoto', 'deprecated': False}, 'mpeg-ssg': {'id': 'MPEG-SSG', 'deprecated': False}, 'mpi-permissive': {'id': 'mpi-permissive', 'deprecated': False}, 'mpich2': {'id': 'mpich2', 'deprecated': False}, 'mpl-1.0': {'id': 'MPL-1.0', 'deprecated': False}, 'mpl-1.1': {'id': 'MPL-1.1', 'deprecated': False}, 'mpl-2.0': {'id': 'MPL-2.0', 'deprecated': False}, 'mpl-2.0-no-copyleft-exception': {'id': 'MPL-2.0-no-copyleft-exception', 'deprecated': False}, 'mplus': {'id': 'mplus', 'deprecated': False}, 'ms-lpl': {'id': 'MS-LPL', 'deprecated': False}, 'ms-pl': {'id': 'MS-PL', 'deprecated': False}, 'ms-rl': {'id': 'MS-RL', 'deprecated': False}, 'mtll': {'id': 'MTLL', 'deprecated': False}, 'mulanpsl-1.0': {'id': 'MulanPSL-1.0', 'deprecated': False}, 'mulanpsl-2.0': {'id': 'MulanPSL-2.0', 'deprecated': False}, 'multics': {'id': 'Multics', 'deprecated': False}, 'mup': {'id': 'Mup', 'deprecated': False}, 'naist-2003': {'id': 'NAIST-2003', 'deprecated': False}, 'nasa-1.3': {'id': 'NASA-1.3', 'deprecated': False}, 'naumen': {'id': 'Naumen', 'deprecated': False}, 'nbpl-1.0': {'id': 'NBPL-1.0', 'deprecated': False}, 'ncbi-pd': {'id': 'NCBI-PD', 'deprecated': False}, 'ncgl-uk-2.0': {'id': 'NCGL-UK-2.0', 'deprecated': False}, 'ncl': {'id': 'NCL', 'deprecated': False}, 'ncsa': {'id': 'NCSA', 'deprecated': False}, 'net-snmp': {'id': 'Net-SNMP', 'deprecated': True}, 'netcdf': {'id': 'NetCDF', 'deprecated': False}, 'newsletr': {'id': 'Newsletr', 'deprecated': False}, 'ngpl': {'id': 'NGPL', 'deprecated': False}, 'ngrep': {'id': 'ngrep', 'deprecated': False}, 'nicta-1.0': {'id': 'NICTA-1.0', 'deprecated': False}, 'nist-pd': {'id': 'NIST-PD', 'deprecated': False}, 'nist-pd-fallback': {'id': 'NIST-PD-fallback', 'deprecated': False}, 'nist-software': {'id': 'NIST-Software', 'deprecated': False}, 'nlod-1.0': {'id': 'NLOD-1.0', 'deprecated': False}, 'nlod-2.0': {'id': 'NLOD-2.0', 'deprecated': False}, 'nlpl': {'id': 'NLPL', 'deprecated': False}, 'nokia': {'id': 'Nokia', 'deprecated': False}, 'nosl': {'id': 'NOSL', 'deprecated': False}, 'noweb': {'id': 'Noweb', 'deprecated': False}, 'npl-1.0': {'id': 'NPL-1.0', 'deprecated': False}, 'npl-1.1': {'id': 'NPL-1.1', 'deprecated': False}, 'nposl-3.0': {'id': 'NPOSL-3.0', 'deprecated': False}, 'nrl': {'id': 'NRL', 'deprecated': False}, 'ntia-pd': {'id': 'NTIA-PD', 'deprecated': False}, 'ntp': {'id': 'NTP', 'deprecated': False}, 'ntp-0': {'id': 'NTP-0', 'deprecated': False}, 'nunit': {'id': 'Nunit', 'deprecated': True}, 'o-uda-1.0': {'id': 'O-UDA-1.0', 'deprecated': False}, 'oar': {'id': 'OAR', 'deprecated': False}, 'occt-pl': {'id': 'OCCT-PL', 'deprecated': False}, 'oclc-2.0': {'id': 'OCLC-2.0', 'deprecated': False}, 'odbl-1.0': {'id': 'ODbL-1.0', 'deprecated': False}, 'odc-by-1.0': {'id': 'ODC-By-1.0', 'deprecated': False}, 'offis': {'id': 'OFFIS', 'deprecated': False}, 'ofl-1.0': {'id': 'OFL-1.0', 'deprecated': False}, 'ofl-1.0-no-rfn': {'id': 'OFL-1.0-no-RFN', 'deprecated': False}, 'ofl-1.0-rfn': {'id': 'OFL-1.0-RFN', 'deprecated': False}, 'ofl-1.1': {'id': 'OFL-1.1', 'deprecated': False}, 'ofl-1.1-no-rfn': {'id': 'OFL-1.1-no-RFN', 'deprecated': False}, 'ofl-1.1-rfn': {'id': 'OFL-1.1-RFN', 'deprecated': False}, 'ogc-1.0': {'id': 'OGC-1.0', 'deprecated': False}, 'ogdl-taiwan-1.0': {'id': 'OGDL-Taiwan-1.0', 'deprecated': False}, 'ogl-canada-2.0': {'id': 'OGL-Canada-2.0', 'deprecated': False}, 'ogl-uk-1.0': {'id': 'OGL-UK-1.0', 'deprecated': False}, 'ogl-uk-2.0': {'id': 'OGL-UK-2.0', 'deprecated': False}, 'ogl-uk-3.0': {'id': 'OGL-UK-3.0', 'deprecated': False}, 'ogtsl': {'id': 'OGTSL', 'deprecated': False}, 'oldap-1.1': {'id': 'OLDAP-1.1', 'deprecated': False}, 'oldap-1.2': {'id': 'OLDAP-1.2', 'deprecated': False}, 'oldap-1.3': {'id': 'OLDAP-1.3', 'deprecated': False}, 'oldap-1.4': {'id': 'OLDAP-1.4', 'deprecated': False}, 'oldap-2.0': {'id': 'OLDAP-2.0', 'deprecated': False}, 'oldap-2.0.1': {'id': 'OLDAP-2.0.1', 'deprecated': False}, 'oldap-2.1': {'id': 'OLDAP-2.1', 'deprecated': False}, 'oldap-2.2': {'id': 'OLDAP-2.2', 'deprecated': False}, 'oldap-2.2.1': {'id': 'OLDAP-2.2.1', 'deprecated': False}, 'oldap-2.2.2': {'id': 'OLDAP-2.2.2', 'deprecated': False}, 'oldap-2.3': {'id': 'OLDAP-2.3', 'deprecated': False}, 'oldap-2.4': {'id': 'OLDAP-2.4', 'deprecated': False}, 'oldap-2.5': {'id': 'OLDAP-2.5', 'deprecated': False}, 'oldap-2.6': {'id': 'OLDAP-2.6', 'deprecated': False}, 'oldap-2.7': {'id': 'OLDAP-2.7', 'deprecated': False}, 'oldap-2.8': {'id': 'OLDAP-2.8', 'deprecated': False}, 'olfl-1.3': {'id': 'OLFL-1.3', 'deprecated': False}, 'oml': {'id': 'OML', 'deprecated': False}, 'openpbs-2.3': {'id': 'OpenPBS-2.3', 'deprecated': False}, 'openssl': {'id': 'OpenSSL', 'deprecated': False}, 'openssl-standalone': {'id': 'OpenSSL-standalone', 'deprecated': False}, 'openvision': {'id': 'OpenVision', 'deprecated': False}, 'opl-1.0': {'id': 'OPL-1.0', 'deprecated': False}, 'opl-uk-3.0': {'id': 'OPL-UK-3.0', 'deprecated': False}, 'opubl-1.0': {'id': 'OPUBL-1.0', 'deprecated': False}, 'oset-pl-2.1': {'id': 'OSET-PL-2.1', 'deprecated': False}, 'osl-1.0': {'id': 'OSL-1.0', 'deprecated': False}, 'osl-1.1': {'id': 'OSL-1.1', 'deprecated': False}, 'osl-2.0': {'id': 'OSL-2.0', 'deprecated': False}, 'osl-2.1': {'id': 'OSL-2.1', 'deprecated': False}, 'osl-3.0': {'id': 'OSL-3.0', 'deprecated': False}, 'padl': {'id': 'PADL', 'deprecated': False}, 'parity-6.0.0': {'id': 'Parity-6.0.0', 'deprecated': False}, 'parity-7.0.0': {'id': 'Parity-7.0.0', 'deprecated': False}, 'pddl-1.0': {'id': 'PDDL-1.0', 'deprecated': False}, 'php-3.0': {'id': 'PHP-3.0', 'deprecated': False}, 'php-3.01': {'id': 'PHP-3.01', 'deprecated': False}, 'pixar': {'id': 'Pixar', 'deprecated': False}, 'pkgconf': {'id': 'pkgconf', 'deprecated': False}, 'plexus': {'id': 'Plexus', 'deprecated': False}, 'pnmstitch': {'id': 'pnmstitch', 'deprecated': False}, 'polyform-noncommercial-1.0.0': {'id': 'PolyForm-Noncommercial-1.0.0', 'deprecated': False}, 'polyform-small-business-1.0.0': {'id': 'PolyForm-Small-Business-1.0.0', 'deprecated': False}, 'postgresql': {'id': 'PostgreSQL', 'deprecated': False}, 'ppl': {'id': 'PPL', 'deprecated': False}, 'psf-2.0': {'id': 'PSF-2.0', 'deprecated': False}, 'psfrag': {'id': 'psfrag', 'deprecated': False}, 'psutils': {'id': 'psutils', 'deprecated': False}, 'python-2.0': {'id': 'Python-2.0', 'deprecated': False}, 'python-2.0.1': {'id': 'Python-2.0.1', 'deprecated': False}, 'python-ldap': {'id': 'python-ldap', 'deprecated': False}, 'qhull': {'id': 'Qhull', 'deprecated': False}, 'qpl-1.0': {'id': 'QPL-1.0', 'deprecated': False}, 'qpl-1.0-inria-2004': {'id': 'QPL-1.0-INRIA-2004', 'deprecated': False}, 'radvd': {'id': 'radvd', 'deprecated': False}, 'rdisc': {'id': 'Rdisc', 'deprecated': False}, 'rhecos-1.1': {'id': 'RHeCos-1.1', 'deprecated': False}, 'rpl-1.1': {'id': 'RPL-1.1', 'deprecated': False}, 'rpl-1.5': {'id': 'RPL-1.5', 'deprecated': False}, 'rpsl-1.0': {'id': 'RPSL-1.0', 'deprecated': False}, 'rsa-md': {'id': 'RSA-MD', 'deprecated': False}, 'rscpl': {'id': 'RSCPL', 'deprecated': False}, 'ruby': {'id': 'Ruby', 'deprecated': False}, 'ruby-pty': {'id': 'Ruby-pty', 'deprecated': False}, 'sax-pd': {'id': 'SAX-PD', 'deprecated': False}, 'sax-pd-2.0': {'id': 'SAX-PD-2.0', 'deprecated': False}, 'saxpath': {'id': 'Saxpath', 'deprecated': False}, 'scea': {'id': 'SCEA', 'deprecated': False}, 'schemereport': {'id': 'SchemeReport', 'deprecated': False}, 'sendmail': {'id': 'Sendmail', 'deprecated': False}, 'sendmail-8.23': {'id': 'Sendmail-8.23', 'deprecated': False}, 'sendmail-open-source-1.1': {'id': 'Sendmail-Open-Source-1.1', 'deprecated': False}, 'sgi-b-1.0': {'id': 'SGI-B-1.0', 'deprecated': False}, 'sgi-b-1.1': {'id': 'SGI-B-1.1', 'deprecated': False}, 'sgi-b-2.0': {'id': 'SGI-B-2.0', 'deprecated': False}, 'sgi-opengl': {'id': 'SGI-OpenGL', 'deprecated': False}, 'sgp4': {'id': 'SGP4', 'deprecated': False}, 'shl-0.5': {'id': 'SHL-0.5', 'deprecated': False}, 'shl-0.51': {'id': 'SHL-0.51', 'deprecated': False}, 'simpl-2.0': {'id': 'SimPL-2.0', 'deprecated': False}, 'sissl': {'id': 'SISSL', 'deprecated': False}, 'sissl-1.2': {'id': 'SISSL-1.2', 'deprecated': False}, 'sl': {'id': 'SL', 'deprecated': False}, 'sleepycat': {'id': 'Sleepycat', 'deprecated': False}, 'smail-gpl': {'id': 'SMAIL-GPL', 'deprecated': False}, 'smlnj': {'id': 'SMLNJ', 'deprecated': False}, 'smppl': {'id': 'SMPPL', 'deprecated': False}, 'snia': {'id': 'SNIA', 'deprecated': False}, 'snprintf': {'id': 'snprintf', 'deprecated': False}, 'sofa': {'id': 'SOFA', 'deprecated': False}, 'softsurfer': {'id': 'softSurfer', 'deprecated': False}, 'soundex': {'id': 'Soundex', 'deprecated': False}, 'spencer-86': {'id': 'Spencer-86', 'deprecated': False}, 'spencer-94': {'id': 'Spencer-94', 'deprecated': False}, 'spencer-99': {'id': 'Spencer-99', 'deprecated': False}, 'spl-1.0': {'id': 'SPL-1.0', 'deprecated': False}, 'ssh-keyscan': {'id': 'ssh-keyscan', 'deprecated': False}, 'ssh-openssh': {'id': 'SSH-OpenSSH', 'deprecated': False}, 'ssh-short': {'id': 'SSH-short', 'deprecated': False}, 'ssleay-standalone': {'id': 'SSLeay-standalone', 'deprecated': False}, 'sspl-1.0': {'id': 'SSPL-1.0', 'deprecated': False}, 'standardml-nj': {'id': 'StandardML-NJ', 'deprecated': True}, 'sugarcrm-1.1.3': {'id': 'SugarCRM-1.1.3', 'deprecated': False}, 'sul-1.0': {'id': 'SUL-1.0', 'deprecated': False}, 'sun-ppp': {'id': 'Sun-PPP', 'deprecated': False}, 'sun-ppp-2000': {'id': 'Sun-PPP-2000', 'deprecated': False}, 'sunpro': {'id': 'SunPro', 'deprecated': False}, 'swl': {'id': 'SWL', 'deprecated': False}, 'swrule': {'id': 'swrule', 'deprecated': False}, 'symlinks': {'id': 'Symlinks', 'deprecated': False}, 'tapr-ohl-1.0': {'id': 'TAPR-OHL-1.0', 'deprecated': False}, 'tcl': {'id': 'TCL', 'deprecated': False}, 'tcp-wrappers': {'id': 'TCP-wrappers', 'deprecated': False}, 'termreadkey': {'id': 'TermReadKey', 'deprecated': False}, 'tgppl-1.0': {'id': 'TGPPL-1.0', 'deprecated': False}, 'thirdeye': {'id': 'ThirdEye', 'deprecated': False}, 'threeparttable': {'id': 'threeparttable', 'deprecated': False}, 'tmate': {'id': 'TMate', 'deprecated': False}, 'torque-1.1': {'id': 'TORQUE-1.1', 'deprecated': False}, 'tosl': {'id': 'TOSL', 'deprecated': False}, 'tpdl': {'id': 'TPDL', 'deprecated': False}, 'tpl-1.0': {'id': 'TPL-1.0', 'deprecated': False}, 'trustedqsl': {'id': 'TrustedQSL', 'deprecated': False}, 'ttwl': {'id': 'TTWL', 'deprecated': False}, 'ttyp0': {'id': 'TTYP0', 'deprecated': False}, 'tu-berlin-1.0': {'id': 'TU-Berlin-1.0', 'deprecated': False}, 'tu-berlin-2.0': {'id': 'TU-Berlin-2.0', 'deprecated': False}, 'ubuntu-font-1.0': {'id': 'Ubuntu-font-1.0', 'deprecated': False}, 'ucar': {'id': 'UCAR', 'deprecated': False}, 'ucl-1.0': {'id': 'UCL-1.0', 'deprecated': False}, 'ulem': {'id': 'ulem', 'deprecated': False}, 'umich-merit': {'id': 'UMich-Merit', 'deprecated': False}, 'unicode-3.0': {'id': 'Unicode-3.0', 'deprecated': False}, 'unicode-dfs-2015': {'id': 'Unicode-DFS-2015', 'deprecated': False}, 'unicode-dfs-2016': {'id': 'Unicode-DFS-2016', 'deprecated': False}, 'unicode-tou': {'id': 'Unicode-TOU', 'deprecated': False}, 'unixcrypt': {'id': 'UnixCrypt', 'deprecated': False}, 'unlicense': {'id': 'Unlicense', 'deprecated': False}, 'unlicense-libtelnet': {'id': 'Unlicense-libtelnet', 'deprecated': False}, 'unlicense-libwhirlpool': {'id': 'Unlicense-libwhirlpool', 'deprecated': False}, 'upl-1.0': {'id': 'UPL-1.0', 'deprecated': False}, 'urt-rle': {'id': 'URT-RLE', 'deprecated': False}, 'vim': {'id': 'Vim', 'deprecated': False}, 'vostrom': {'id': 'VOSTROM', 'deprecated': False}, 'vsl-1.0': {'id': 'VSL-1.0', 'deprecated': False}, 'w3c': {'id': 'W3C', 'deprecated': False}, 'w3c-19980720': {'id': 'W3C-19980720', 'deprecated': False}, 'w3c-20150513': {'id': 'W3C-20150513', 'deprecated': False}, 'w3m': {'id': 'w3m', 'deprecated': False}, 'watcom-1.0': {'id': 'Watcom-1.0', 'deprecated': False}, 'widget-workshop': {'id': 'Widget-Workshop', 'deprecated': False}, 'wsuipa': {'id': 'Wsuipa', 'deprecated': False}, 'wtfpl': {'id': 'WTFPL', 'deprecated': False}, 'wwl': {'id': 'wwl', 'deprecated': False}, 'wxwindows': {'id': 'wxWindows', 'deprecated': True}, 'x11': {'id': 'X11', 'deprecated': False}, 'x11-distribute-modifications-variant': {'id': 'X11-distribute-modifications-variant', 'deprecated': False}, 'x11-swapped': {'id': 'X11-swapped', 'deprecated': False}, 'xdebug-1.03': {'id': 'Xdebug-1.03', 'deprecated': False}, 'xerox': {'id': 'Xerox', 'deprecated': False}, 'xfig': {'id': 'Xfig', 'deprecated': False}, 'xfree86-1.1': {'id': 'XFree86-1.1', 'deprecated': False}, 'xinetd': {'id': 'xinetd', 'deprecated': False}, 'xkeyboard-config-zinoviev': {'id': 'xkeyboard-config-Zinoviev', 'deprecated': False}, 'xlock': {'id': 'xlock', 'deprecated': False}, 'xnet': {'id': 'Xnet', 'deprecated': False}, 'xpp': {'id': 'xpp', 'deprecated': False}, 'xskat': {'id': 'XSkat', 'deprecated': False}, 'xzoom': {'id': 'xzoom', 'deprecated': False}, 'ypl-1.0': {'id': 'YPL-1.0', 'deprecated': False}, 'ypl-1.1': {'id': 'YPL-1.1', 'deprecated': False}, 'zed': {'id': 'Zed', 'deprecated': False}, 'zeeff': {'id': 'Zeeff', 'deprecated': False}, 'zend-2.0': {'id': 'Zend-2.0', 'deprecated': False}, 'zimbra-1.3': {'id': 'Zimbra-1.3', 'deprecated': False}, 'zimbra-1.4': {'id': 'Zimbra-1.4', 'deprecated': False}, 'zlib': {'id': 'Zlib', 'deprecated': False}, 'zlib-acknowledgement': {'id': 'zlib-acknowledgement', 'deprecated': False}, 'zpl-1.1': {'id': 'ZPL-1.1', 'deprecated': False}, 'zpl-2.0': {'id': 'ZPL-2.0', 'deprecated': False}, 'zpl-2.1': {'id': 'ZPL-2.1', 'deprecated': False}, } EXCEPTIONS: dict[str, SPDXException] = { '389-exception': {'id': '389-exception', 'deprecated': False}, 'asterisk-exception': {'id': 'Asterisk-exception', 'deprecated': False}, 'asterisk-linking-protocols-exception': {'id': 'Asterisk-linking-protocols-exception', 'deprecated': False}, 'autoconf-exception-2.0': {'id': 'Autoconf-exception-2.0', 'deprecated': False}, 'autoconf-exception-3.0': {'id': 'Autoconf-exception-3.0', 'deprecated': False}, 'autoconf-exception-generic': {'id': 'Autoconf-exception-generic', 'deprecated': False}, 'autoconf-exception-generic-3.0': {'id': 'Autoconf-exception-generic-3.0', 'deprecated': False}, 'autoconf-exception-macro': {'id': 'Autoconf-exception-macro', 'deprecated': False}, 'bison-exception-1.24': {'id': 'Bison-exception-1.24', 'deprecated': False}, 'bison-exception-2.2': {'id': 'Bison-exception-2.2', 'deprecated': False}, 'bootloader-exception': {'id': 'Bootloader-exception', 'deprecated': False}, 'cgal-linking-exception': {'id': 'CGAL-linking-exception', 'deprecated': False}, 'classpath-exception-2.0': {'id': 'Classpath-exception-2.0', 'deprecated': False}, 'clisp-exception-2.0': {'id': 'CLISP-exception-2.0', 'deprecated': False}, 'cryptsetup-openssl-exception': {'id': 'cryptsetup-OpenSSL-exception', 'deprecated': False}, 'digia-qt-lgpl-exception-1.1': {'id': 'Digia-Qt-LGPL-exception-1.1', 'deprecated': False}, 'digirule-foss-exception': {'id': 'DigiRule-FOSS-exception', 'deprecated': False}, 'ecos-exception-2.0': {'id': 'eCos-exception-2.0', 'deprecated': False}, 'erlang-otp-linking-exception': {'id': 'erlang-otp-linking-exception', 'deprecated': False}, 'fawkes-runtime-exception': {'id': 'Fawkes-Runtime-exception', 'deprecated': False}, 'fltk-exception': {'id': 'FLTK-exception', 'deprecated': False}, 'fmt-exception': {'id': 'fmt-exception', 'deprecated': False}, 'font-exception-2.0': {'id': 'Font-exception-2.0', 'deprecated': False}, 'freertos-exception-2.0': {'id': 'freertos-exception-2.0', 'deprecated': False}, 'gcc-exception-2.0': {'id': 'GCC-exception-2.0', 'deprecated': False}, 'gcc-exception-2.0-note': {'id': 'GCC-exception-2.0-note', 'deprecated': False}, 'gcc-exception-3.1': {'id': 'GCC-exception-3.1', 'deprecated': False}, 'gmsh-exception': {'id': 'Gmsh-exception', 'deprecated': False}, 'gnat-exception': {'id': 'GNAT-exception', 'deprecated': False}, 'gnome-examples-exception': {'id': 'GNOME-examples-exception', 'deprecated': False}, 'gnu-compiler-exception': {'id': 'GNU-compiler-exception', 'deprecated': False}, 'gnu-javamail-exception': {'id': 'gnu-javamail-exception', 'deprecated': False}, 'gpl-3.0-389-ds-base-exception': {'id': 'GPL-3.0-389-ds-base-exception', 'deprecated': False}, 'gpl-3.0-interface-exception': {'id': 'GPL-3.0-interface-exception', 'deprecated': False}, 'gpl-3.0-linking-exception': {'id': 'GPL-3.0-linking-exception', 'deprecated': False}, 'gpl-3.0-linking-source-exception': {'id': 'GPL-3.0-linking-source-exception', 'deprecated': False}, 'gpl-cc-1.0': {'id': 'GPL-CC-1.0', 'deprecated': False}, 'gstreamer-exception-2005': {'id': 'GStreamer-exception-2005', 'deprecated': False}, 'gstreamer-exception-2008': {'id': 'GStreamer-exception-2008', 'deprecated': False}, 'harbour-exception': {'id': 'harbour-exception', 'deprecated': False}, 'i2p-gpl-java-exception': {'id': 'i2p-gpl-java-exception', 'deprecated': False}, 'independent-modules-exception': {'id': 'Independent-modules-exception', 'deprecated': False}, 'kicad-libraries-exception': {'id': 'KiCad-libraries-exception', 'deprecated': False}, 'lgpl-3.0-linking-exception': {'id': 'LGPL-3.0-linking-exception', 'deprecated': False}, 'libpri-openh323-exception': {'id': 'libpri-OpenH323-exception', 'deprecated': False}, 'libtool-exception': {'id': 'Libtool-exception', 'deprecated': False}, 'linux-syscall-note': {'id': 'Linux-syscall-note', 'deprecated': False}, 'llgpl': {'id': 'LLGPL', 'deprecated': False}, 'llvm-exception': {'id': 'LLVM-exception', 'deprecated': False}, 'lzma-exception': {'id': 'LZMA-exception', 'deprecated': False}, 'mif-exception': {'id': 'mif-exception', 'deprecated': False}, 'mxml-exception': {'id': 'mxml-exception', 'deprecated': False}, 'nokia-qt-exception-1.1': {'id': 'Nokia-Qt-exception-1.1', 'deprecated': True}, 'ocaml-lgpl-linking-exception': {'id': 'OCaml-LGPL-linking-exception', 'deprecated': False}, 'occt-exception-1.0': {'id': 'OCCT-exception-1.0', 'deprecated': False}, 'openjdk-assembly-exception-1.0': {'id': 'OpenJDK-assembly-exception-1.0', 'deprecated': False}, 'openvpn-openssl-exception': {'id': 'openvpn-openssl-exception', 'deprecated': False}, 'pcre2-exception': {'id': 'PCRE2-exception', 'deprecated': False}, 'polyparse-exception': {'id': 'polyparse-exception', 'deprecated': False}, 'ps-or-pdf-font-exception-20170817': {'id': 'PS-or-PDF-font-exception-20170817', 'deprecated': False}, 'qpl-1.0-inria-2004-exception': {'id': 'QPL-1.0-INRIA-2004-exception', 'deprecated': False}, 'qt-gpl-exception-1.0': {'id': 'Qt-GPL-exception-1.0', 'deprecated': False}, 'qt-lgpl-exception-1.1': {'id': 'Qt-LGPL-exception-1.1', 'deprecated': False}, 'qwt-exception-1.0': {'id': 'Qwt-exception-1.0', 'deprecated': False}, 'romic-exception': {'id': 'romic-exception', 'deprecated': False}, 'rrdtool-floss-exception-2.0': {'id': 'RRDtool-FLOSS-exception-2.0', 'deprecated': False}, 'sane-exception': {'id': 'SANE-exception', 'deprecated': False}, 'shl-2.0': {'id': 'SHL-2.0', 'deprecated': False}, 'shl-2.1': {'id': 'SHL-2.1', 'deprecated': False}, 'stunnel-exception': {'id': 'stunnel-exception', 'deprecated': False}, 'swi-exception': {'id': 'SWI-exception', 'deprecated': False}, 'swift-exception': {'id': 'Swift-exception', 'deprecated': False}, 'texinfo-exception': {'id': 'Texinfo-exception', 'deprecated': False}, 'u-boot-exception-2.0': {'id': 'u-boot-exception-2.0', 'deprecated': False}, 'ubdl-exception': {'id': 'UBDL-exception', 'deprecated': False}, 'universal-foss-exception-1.0': {'id': 'Universal-FOSS-exception-1.0', 'deprecated': False}, 'vsftpd-openssl-exception': {'id': 'vsftpd-openssl-exception', 'deprecated': False}, 'wxwindows-exception-3.1': {'id': 'WxWindows-exception-3.1', 'deprecated': False}, 'x11vnc-openssl-exception': {'id': 'x11vnc-openssl-exception', 'deprecated': False}, } ================================================ FILE: src/pip/_vendor/packaging/markers.py ================================================ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. from __future__ import annotations import operator import os import platform import sys from typing import AbstractSet, Callable, Literal, Mapping, TypedDict, Union, cast from ._parser import MarkerAtom, MarkerList, Op, Value, Variable from ._parser import parse_marker as _parse_marker from ._tokenizer import ParserSyntaxError from .specifiers import InvalidSpecifier, Specifier from .utils import canonicalize_name __all__ = [ "Environment", "EvaluateContext", "InvalidMarker", "Marker", "UndefinedComparison", "UndefinedEnvironmentName", "default_environment", ] Operator = Callable[[str, Union[str, AbstractSet[str]]], bool] EvaluateContext = Literal["metadata", "lock_file", "requirement"] MARKERS_ALLOWING_SET = {"extras", "dependency_groups"} MARKERS_REQUIRING_VERSION = { "implementation_version", "platform_release", "python_full_version", "python_version", } class InvalidMarker(ValueError): """ An invalid marker was found, users should refer to PEP 508. """ class UndefinedComparison(ValueError): """ An invalid operation was attempted on a value that doesn't support it. """ class UndefinedEnvironmentName(ValueError): """ A name was attempted to be used that does not exist inside of the environment. """ class Environment(TypedDict): implementation_name: str """The implementation's identifier, e.g. ``'cpython'``.""" implementation_version: str """ The implementation's version, e.g. ``'3.13.0a2'`` for CPython 3.13.0a2, or ``'7.3.13'`` for PyPy3.10 v7.3.13. """ os_name: str """ The value of :py:data:`os.name`. The name of the operating system dependent module imported, e.g. ``'posix'``. """ platform_machine: str """ Returns the machine type, e.g. ``'i386'``. An empty string if the value cannot be determined. """ platform_release: str """ The system's release, e.g. ``'2.2.0'`` or ``'NT'``. An empty string if the value cannot be determined. """ platform_system: str """ The system/OS name, e.g. ``'Linux'``, ``'Windows'`` or ``'Java'``. An empty string if the value cannot be determined. """ platform_version: str """ The system's release version, e.g. ``'#3 on degas'``. An empty string if the value cannot be determined. """ python_full_version: str """ The Python version as string ``'major.minor.patchlevel'``. Note that unlike the Python :py:data:`sys.version`, this value will always include the patchlevel (it defaults to 0). """ platform_python_implementation: str """ A string identifying the Python implementation, e.g. ``'CPython'``. """ python_version: str """The Python version as string ``'major.minor'``.""" sys_platform: str """ This string contains a platform identifier that can be used to append platform-specific components to :py:data:`sys.path`, for instance. For Unix systems, except on Linux and AIX, this is the lowercased OS name as returned by ``uname -s`` with the first part of the version as returned by ``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, at the time when Python was built. """ def _normalize_extras( result: MarkerList | MarkerAtom | str, ) -> MarkerList | MarkerAtom | str: if not isinstance(result, tuple): return result lhs, op, rhs = result if isinstance(lhs, Variable) and lhs.value == "extra": normalized_extra = canonicalize_name(rhs.value) rhs = Value(normalized_extra) elif isinstance(rhs, Variable) and rhs.value == "extra": normalized_extra = canonicalize_name(lhs.value) lhs = Value(normalized_extra) return lhs, op, rhs def _normalize_extra_values(results: MarkerList) -> MarkerList: """ Normalize extra values. """ return [_normalize_extras(r) for r in results] def _format_marker( marker: list[str] | MarkerAtom | str, first: bool | None = True ) -> str: assert isinstance(marker, (list, tuple, str)) # Sometimes we have a structure like [[...]] which is a single item list # where the single item is itself it's own list. In that case we want skip # the rest of this function so that we don't get extraneous () on the # outside. if ( isinstance(marker, list) and len(marker) == 1 and isinstance(marker[0], (list, tuple)) ): return _format_marker(marker[0]) if isinstance(marker, list): inner = (_format_marker(m, first=False) for m in marker) if first: return " ".join(inner) else: return "(" + " ".join(inner) + ")" elif isinstance(marker, tuple): return " ".join([m.serialize() for m in marker]) else: return marker _operators: dict[str, Operator] = { "in": lambda lhs, rhs: lhs in rhs, "not in": lambda lhs, rhs: lhs not in rhs, "<": lambda _lhs, _rhs: False, "<=": operator.eq, "==": operator.eq, "!=": operator.ne, ">=": operator.eq, ">": lambda _lhs, _rhs: False, } def _eval_op(lhs: str, op: Op, rhs: str | AbstractSet[str], *, key: str) -> bool: op_str = op.serialize() if key in MARKERS_REQUIRING_VERSION: try: spec = Specifier(f"{op_str}{rhs}") except InvalidSpecifier: pass else: return spec.contains(lhs, prereleases=True) oper: Operator | None = _operators.get(op_str) if oper is None: raise UndefinedComparison(f"Undefined {op!r} on {lhs!r} and {rhs!r}.") return oper(lhs, rhs) def _normalize( lhs: str, rhs: str | AbstractSet[str], key: str ) -> tuple[str, str | AbstractSet[str]]: # PEP 685 - Comparison of extra names for optional distribution dependencies # https://peps.python.org/pep-0685/ # > When comparing extra names, tools MUST normalize the names being # > compared using the semantics outlined in PEP 503 for names if key == "extra": assert isinstance(rhs, str), "extra value must be a string" # Both sides are normalized at this point already return (lhs, rhs) if key in MARKERS_ALLOWING_SET: if isinstance(rhs, str): # pragma: no cover return (canonicalize_name(lhs), canonicalize_name(rhs)) else: return (canonicalize_name(lhs), {canonicalize_name(v) for v in rhs}) # other environment markers don't have such standards return lhs, rhs def _evaluate_markers( markers: MarkerList, environment: dict[str, str | AbstractSet[str]] ) -> bool: groups: list[list[bool]] = [[]] for marker in markers: if isinstance(marker, list): groups[-1].append(_evaluate_markers(marker, environment)) elif isinstance(marker, tuple): lhs, op, rhs = marker if isinstance(lhs, Variable): environment_key = lhs.value lhs_value = environment[environment_key] rhs_value = rhs.value else: lhs_value = lhs.value environment_key = rhs.value rhs_value = environment[environment_key] assert isinstance(lhs_value, str), "lhs must be a string" lhs_value, rhs_value = _normalize(lhs_value, rhs_value, key=environment_key) groups[-1].append(_eval_op(lhs_value, op, rhs_value, key=environment_key)) elif marker == "or": groups.append([]) elif marker == "and": pass else: # pragma: nocover raise TypeError(f"Unexpected marker {marker!r}") return any(all(item) for item in groups) def format_full_version(info: sys._version_info) -> str: version = f"{info.major}.{info.minor}.{info.micro}" kind = info.releaselevel if kind != "final": version += kind[0] + str(info.serial) return version def default_environment() -> Environment: iver = format_full_version(sys.implementation.version) implementation_name = sys.implementation.name return { "implementation_name": implementation_name, "implementation_version": iver, "os_name": os.name, "platform_machine": platform.machine(), "platform_release": platform.release(), "platform_system": platform.system(), "platform_version": platform.version(), "python_full_version": platform.python_version(), "platform_python_implementation": platform.python_implementation(), "python_version": ".".join(platform.python_version_tuple()[:2]), "sys_platform": sys.platform, } class Marker: def __init__(self, marker: str) -> None: # Note: We create a Marker object without calling this constructor in # packaging.requirements.Requirement. If any additional logic is # added here, make sure to mirror/adapt Requirement. # If this fails and throws an error, the repr still expects _markers to # be defined. self._markers: MarkerList = [] try: self._markers = _normalize_extra_values(_parse_marker(marker)) # The attribute `_markers` can be described in terms of a recursive type: # MarkerList = List[Union[Tuple[Node, ...], str, MarkerList]] # # For example, the following expression: # python_version > "3.6" or (python_version == "3.6" and os_name == "unix") # # is parsed into: # [ # (, ')>, ), # 'and', # [ # (, , ), # 'or', # (, , ) # ] # ] except ParserSyntaxError as e: raise InvalidMarker(str(e)) from e def __str__(self) -> str: return _format_marker(self._markers) def __repr__(self) -> str: return f"<{self.__class__.__name__}('{self}')>" def __hash__(self) -> int: return hash(str(self)) def __eq__(self, other: object) -> bool: if not isinstance(other, Marker): return NotImplemented return str(self) == str(other) def evaluate( self, environment: Mapping[str, str | AbstractSet[str]] | None = None, context: EvaluateContext = "metadata", ) -> bool: """Evaluate a marker. Return the boolean from evaluating the given marker against the environment. environment is an optional argument to override all or part of the determined environment. The *context* parameter specifies what context the markers are being evaluated for, which influences what markers are considered valid. Acceptable values are "metadata" (for core metadata; default), "lock_file", and "requirement" (i.e. all other situations). The environment is determined from the current Python process. """ current_environment = cast( "dict[str, str | AbstractSet[str]]", default_environment() ) if context == "lock_file": current_environment.update( extras=frozenset(), dependency_groups=frozenset() ) elif context == "metadata": current_environment["extra"] = "" if environment is not None: current_environment.update(environment) if "extra" in current_environment: # The API used to allow setting extra to None. We need to handle # this case for backwards compatibility. Also skip running # normalize name if extra is empty. extra = cast("str | None", current_environment["extra"]) current_environment["extra"] = canonicalize_name(extra) if extra else "" return _evaluate_markers( self._markers, _repair_python_full_version(current_environment) ) def _repair_python_full_version( env: dict[str, str | AbstractSet[str]], ) -> dict[str, str | AbstractSet[str]]: """ Work around platform.python_version() returning something that is not PEP 440 compliant for non-tagged Python builds. """ python_full_version = cast("str", env["python_full_version"]) if python_full_version.endswith("+"): env["python_full_version"] = f"{python_full_version}local" return env ================================================ FILE: src/pip/_vendor/packaging/metadata.py ================================================ from __future__ import annotations import email.feedparser import email.header import email.message import email.parser import email.policy import keyword import pathlib import sys import typing from typing import ( Any, Callable, Generic, Literal, TypedDict, cast, ) from . import licenses, requirements, specifiers, utils from . import version as version_module if typing.TYPE_CHECKING: from .licenses import NormalizedLicenseExpression T = typing.TypeVar("T") if sys.version_info >= (3, 11): # pragma: no cover ExceptionGroup = ExceptionGroup # noqa: F821 else: # pragma: no cover class ExceptionGroup(Exception): """A minimal implementation of :external:exc:`ExceptionGroup` from Python 3.11. If :external:exc:`ExceptionGroup` is already defined by Python itself, that version is used instead. """ message: str exceptions: list[Exception] def __init__(self, message: str, exceptions: list[Exception]) -> None: self.message = message self.exceptions = exceptions def __repr__(self) -> str: return f"{self.__class__.__name__}({self.message!r}, {self.exceptions!r})" class InvalidMetadata(ValueError): """A metadata field contains invalid data.""" field: str """The name of the field that contains invalid data.""" def __init__(self, field: str, message: str) -> None: self.field = field super().__init__(message) # The RawMetadata class attempts to make as few assumptions about the underlying # serialization formats as possible. The idea is that as long as a serialization # formats offer some very basic primitives in *some* way then we can support # serializing to and from that format. class RawMetadata(TypedDict, total=False): """A dictionary of raw core metadata. Each field in core metadata maps to a key of this dictionary (when data is provided). The key is lower-case and underscores are used instead of dashes compared to the equivalent core metadata field. Any core metadata field that can be specified multiple times or can hold multiple values in a single field have a key with a plural name. See :class:`Metadata` whose attributes match the keys of this dictionary. Core metadata fields that can be specified multiple times are stored as a list or dict depending on which is appropriate for the field. Any fields which hold multiple values in a single field are stored as a list. """ # Metadata 1.0 - PEP 241 metadata_version: str name: str version: str platforms: list[str] summary: str description: str keywords: list[str] home_page: str author: str author_email: str license: str # Metadata 1.1 - PEP 314 supported_platforms: list[str] download_url: str classifiers: list[str] requires: list[str] provides: list[str] obsoletes: list[str] # Metadata 1.2 - PEP 345 maintainer: str maintainer_email: str requires_dist: list[str] provides_dist: list[str] obsoletes_dist: list[str] requires_python: str requires_external: list[str] project_urls: dict[str, str] # Metadata 2.0 # PEP 426 attempted to completely revamp the metadata format # but got stuck without ever being able to build consensus on # it and ultimately ended up withdrawn. # # However, a number of tools had started emitting METADATA with # `2.0` Metadata-Version, so for historical reasons, this version # was skipped. # Metadata 2.1 - PEP 566 description_content_type: str provides_extra: list[str] # Metadata 2.2 - PEP 643 dynamic: list[str] # Metadata 2.3 - PEP 685 # No new fields were added in PEP 685, just some edge case were # tightened up to provide better interoperability. # Metadata 2.4 - PEP 639 license_expression: str license_files: list[str] # Metadata 2.5 - PEP 794 import_names: list[str] import_namespaces: list[str] # 'keywords' is special as it's a string in the core metadata spec, but we # represent it as a list. _STRING_FIELDS = { "author", "author_email", "description", "description_content_type", "download_url", "home_page", "license", "license_expression", "maintainer", "maintainer_email", "metadata_version", "name", "requires_python", "summary", "version", } _LIST_FIELDS = { "classifiers", "dynamic", "license_files", "obsoletes", "obsoletes_dist", "platforms", "provides", "provides_dist", "provides_extra", "requires", "requires_dist", "requires_external", "supported_platforms", "import_names", "import_namespaces", } _DICT_FIELDS = { "project_urls", } def _parse_keywords(data: str) -> list[str]: """Split a string of comma-separated keywords into a list of keywords.""" return [k.strip() for k in data.split(",")] def _parse_project_urls(data: list[str]) -> dict[str, str]: """Parse a list of label/URL string pairings separated by a comma.""" urls = {} for pair in data: # Our logic is slightly tricky here as we want to try and do # *something* reasonable with malformed data. # # The main thing that we have to worry about, is data that does # not have a ',' at all to split the label from the Value. There # isn't a singular right answer here, and we will fail validation # later on (if the caller is validating) so it doesn't *really* # matter, but since the missing value has to be an empty str # and our return value is dict[str, str], if we let the key # be the missing value, then they'd have multiple '' values that # overwrite each other in a accumulating dict. # # The other potential issue is that it's possible to have the # same label multiple times in the metadata, with no solid "right" # answer with what to do in that case. As such, we'll do the only # thing we can, which is treat the field as unparsable and add it # to our list of unparsed fields. # # TODO: The spec doesn't say anything about if the keys should be # considered case sensitive or not... logically they should # be case-preserving and case-insensitive, but doing that # would open up more cases where we might have duplicate # entries. label, _, url = (s.strip() for s in pair.partition(",")) if label in urls: # The label already exists in our set of urls, so this field # is unparsable, and we can just add the whole thing to our # unparsable data and stop processing it. raise KeyError("duplicate labels in project urls") urls[label] = url return urls def _get_payload(msg: email.message.Message, source: bytes | str) -> str: """Get the body of the message.""" # If our source is a str, then our caller has managed encodings for us, # and we don't need to deal with it. if isinstance(source, str): payload = msg.get_payload() assert isinstance(payload, str) return payload # If our source is a bytes, then we're managing the encoding and we need # to deal with it. else: bpayload = msg.get_payload(decode=True) assert isinstance(bpayload, bytes) try: return bpayload.decode("utf8", "strict") except UnicodeDecodeError as exc: raise ValueError("payload in an invalid encoding") from exc # The various parse_FORMAT functions here are intended to be as lenient as # possible in their parsing, while still returning a correctly typed # RawMetadata. # # To aid in this, we also generally want to do as little touching of the # data as possible, except where there are possibly some historic holdovers # that make valid data awkward to work with. # # While this is a lower level, intermediate format than our ``Metadata`` # class, some light touch ups can make a massive difference in usability. # Map METADATA fields to RawMetadata. _EMAIL_TO_RAW_MAPPING = { "author": "author", "author-email": "author_email", "classifier": "classifiers", "description": "description", "description-content-type": "description_content_type", "download-url": "download_url", "dynamic": "dynamic", "home-page": "home_page", "import-name": "import_names", "import-namespace": "import_namespaces", "keywords": "keywords", "license": "license", "license-expression": "license_expression", "license-file": "license_files", "maintainer": "maintainer", "maintainer-email": "maintainer_email", "metadata-version": "metadata_version", "name": "name", "obsoletes": "obsoletes", "obsoletes-dist": "obsoletes_dist", "platform": "platforms", "project-url": "project_urls", "provides": "provides", "provides-dist": "provides_dist", "provides-extra": "provides_extra", "requires": "requires", "requires-dist": "requires_dist", "requires-external": "requires_external", "requires-python": "requires_python", "summary": "summary", "supported-platform": "supported_platforms", "version": "version", } _RAW_TO_EMAIL_MAPPING = {raw: email for email, raw in _EMAIL_TO_RAW_MAPPING.items()} # This class is for writing RFC822 messages class RFC822Policy(email.policy.EmailPolicy): """ This is :class:`email.policy.EmailPolicy`, but with a simple ``header_store_parse`` implementation that handles multi-line values, and some nice defaults. """ utf8 = True mangle_from_ = False max_line_length = 0 def header_store_parse(self, name: str, value: str) -> tuple[str, str]: size = len(name) + 2 value = value.replace("\n", "\n" + " " * size) return (name, value) # This class is for writing RFC822 messages class RFC822Message(email.message.EmailMessage): """ This is :class:`email.message.EmailMessage` with two small changes: it defaults to our `RFC822Policy`, and it correctly writes unicode when being called with `bytes()`. """ def __init__(self) -> None: super().__init__(policy=RFC822Policy()) def as_bytes( self, unixfrom: bool = False, policy: email.policy.Policy | None = None ) -> bytes: """ Return the bytes representation of the message. This handles unicode encoding. """ return self.as_string(unixfrom, policy=policy).encode("utf-8") def parse_email(data: bytes | str) -> tuple[RawMetadata, dict[str, list[str]]]: """Parse a distribution's metadata stored as email headers (e.g. from ``METADATA``). This function returns a two-item tuple of dicts. The first dict is of recognized fields from the core metadata specification. Fields that can be parsed and translated into Python's built-in types are converted appropriately. All other fields are left as-is. Fields that are allowed to appear multiple times are stored as lists. The second dict contains all other fields from the metadata. This includes any unrecognized fields. It also includes any fields which are expected to be parsed into a built-in type but were not formatted appropriately. Finally, any fields that are expected to appear only once but are repeated are included in this dict. """ raw: dict[str, str | list[str] | dict[str, str]] = {} unparsed: dict[str, list[str]] = {} if isinstance(data, str): parsed = email.parser.Parser(policy=email.policy.compat32).parsestr(data) else: parsed = email.parser.BytesParser(policy=email.policy.compat32).parsebytes(data) # We have to wrap parsed.keys() in a set, because in the case of multiple # values for a key (a list), the key will appear multiple times in the # list of keys, but we're avoiding that by using get_all(). for name_with_case in frozenset(parsed.keys()): # Header names in RFC are case insensitive, so we'll normalize to all # lower case to make comparisons easier. name = name_with_case.lower() # We use get_all() here, even for fields that aren't multiple use, # because otherwise someone could have e.g. two Name fields, and we # would just silently ignore it rather than doing something about it. headers = parsed.get_all(name) or [] # The way the email module works when parsing bytes is that it # unconditionally decodes the bytes as ascii using the surrogateescape # handler. When you pull that data back out (such as with get_all() ), # it looks to see if the str has any surrogate escapes, and if it does # it wraps it in a Header object instead of returning the string. # # As such, we'll look for those Header objects, and fix up the encoding. value = [] # Flag if we have run into any issues processing the headers, thus # signalling that the data belongs in 'unparsed'. valid_encoding = True for h in headers: # It's unclear if this can return more types than just a Header or # a str, so we'll just assert here to make sure. assert isinstance(h, (email.header.Header, str)) # If it's a header object, we need to do our little dance to get # the real data out of it. In cases where there is invalid data # we're going to end up with mojibake, but there's no obvious, good # way around that without reimplementing parts of the Header object # ourselves. # # That should be fine since, if mojibacked happens, this key is # going into the unparsed dict anyways. if isinstance(h, email.header.Header): # The Header object stores it's data as chunks, and each chunk # can be independently encoded, so we'll need to check each # of them. chunks: list[tuple[bytes, str | None]] = [] for binary, _encoding in email.header.decode_header(h): try: binary.decode("utf8", "strict") except UnicodeDecodeError: # Enable mojibake. encoding = "latin1" valid_encoding = False else: encoding = "utf8" chunks.append((binary, encoding)) # Turn our chunks back into a Header object, then let that # Header object do the right thing to turn them into a # string for us. value.append(str(email.header.make_header(chunks))) # This is already a string, so just add it. else: value.append(h) # We've processed all of our values to get them into a list of str, # but we may have mojibake data, in which case this is an unparsed # field. if not valid_encoding: unparsed[name] = value continue raw_name = _EMAIL_TO_RAW_MAPPING.get(name) if raw_name is None: # This is a bit of a weird situation, we've encountered a key that # we don't know what it means, so we don't know whether it's meant # to be a list or not. # # Since we can't really tell one way or another, we'll just leave it # as a list, even though it may be a single item list, because that's # what makes the most sense for email headers. unparsed[name] = value continue # If this is one of our string fields, then we'll check to see if our # value is a list of a single item. If it is then we'll assume that # it was emitted as a single string, and unwrap the str from inside # the list. # # If it's any other kind of data, then we haven't the faintest clue # what we should parse it as, and we have to just add it to our list # of unparsed stuff. if raw_name in _STRING_FIELDS and len(value) == 1: raw[raw_name] = value[0] # If this is import_names, we need to special case the empty field # case, which converts to an empty list instead of None. We can't let # the empty case slip through, as it will fail validation. elif raw_name == "import_names" and value == [""]: raw[raw_name] = [] # If this is one of our list of string fields, then we can just assign # the value, since email *only* has strings, and our get_all() call # above ensures that this is a list. elif raw_name in _LIST_FIELDS: raw[raw_name] = value # Special Case: Keywords # The keywords field is implemented in the metadata spec as a str, # but it conceptually is a list of strings, and is serialized using # ", ".join(keywords), so we'll do some light data massaging to turn # this into what it logically is. elif raw_name == "keywords" and len(value) == 1: raw[raw_name] = _parse_keywords(value[0]) # Special Case: Project-URL # The project urls is implemented in the metadata spec as a list of # specially-formatted strings that represent a key and a value, which # is fundamentally a mapping, however the email format doesn't support # mappings in a sane way, so it was crammed into a list of strings # instead. # # We will do a little light data massaging to turn this into a map as # it logically should be. elif raw_name == "project_urls": try: raw[raw_name] = _parse_project_urls(value) except KeyError: unparsed[name] = value # Nothing that we've done has managed to parse this, so it'll just # throw it in our unparsable data and move on. else: unparsed[name] = value # We need to support getting the Description from the message payload in # addition to getting it from the the headers. This does mean, though, there # is the possibility of it being set both ways, in which case we put both # in 'unparsed' since we don't know which is right. try: payload = _get_payload(parsed, data) except ValueError: unparsed.setdefault("description", []).append( parsed.get_payload(decode=isinstance(data, bytes)) # type: ignore[call-overload] ) else: if payload: # Check to see if we've already got a description, if so then both # it, and this body move to unparsable. if "description" in raw: description_header = cast("str", raw.pop("description")) unparsed.setdefault("description", []).extend( [description_header, payload] ) elif "description" in unparsed: unparsed["description"].append(payload) else: raw["description"] = payload # We need to cast our `raw` to a metadata, because a TypedDict only support # literal key names, but we're computing our key names on purpose, but the # way this function is implemented, our `TypedDict` can only have valid key # names. return cast("RawMetadata", raw), unparsed _NOT_FOUND = object() # Keep the two values in sync. _VALID_METADATA_VERSIONS = ["1.0", "1.1", "1.2", "2.1", "2.2", "2.3", "2.4", "2.5"] _MetadataVersion = Literal["1.0", "1.1", "1.2", "2.1", "2.2", "2.3", "2.4", "2.5"] _REQUIRED_ATTRS = frozenset(["metadata_version", "name", "version"]) class _Validator(Generic[T]): """Validate a metadata field. All _process_*() methods correspond to a core metadata field. The method is called with the field's raw value. If the raw value is valid it is returned in its "enriched" form (e.g. ``version.Version`` for the ``Version`` field). If the raw value is invalid, :exc:`InvalidMetadata` is raised (with a cause as appropriate). """ name: str raw_name: str added: _MetadataVersion def __init__( self, *, added: _MetadataVersion = "1.0", ) -> None: self.added = added def __set_name__(self, _owner: Metadata, name: str) -> None: self.name = name self.raw_name = _RAW_TO_EMAIL_MAPPING[name] def __get__(self, instance: Metadata, _owner: type[Metadata]) -> T: # With Python 3.8, the caching can be replaced with functools.cached_property(). # No need to check the cache as attribute lookup will resolve into the # instance's __dict__ before __get__ is called. cache = instance.__dict__ value = instance._raw.get(self.name) # To make the _process_* methods easier, we'll check if the value is None # and if this field is NOT a required attribute, and if both of those # things are true, we'll skip the the converter. This will mean that the # converters never have to deal with the None union. if self.name in _REQUIRED_ATTRS or value is not None: try: converter: Callable[[Any], T] = getattr(self, f"_process_{self.name}") except AttributeError: pass else: value = converter(value) cache[self.name] = value try: del instance._raw[self.name] # type: ignore[misc] except KeyError: pass return cast("T", value) def _invalid_metadata( self, msg: str, cause: Exception | None = None ) -> InvalidMetadata: exc = InvalidMetadata( self.raw_name, msg.format_map({"field": repr(self.raw_name)}) ) exc.__cause__ = cause return exc def _process_metadata_version(self, value: str) -> _MetadataVersion: # Implicitly makes Metadata-Version required. if value not in _VALID_METADATA_VERSIONS: raise self._invalid_metadata(f"{value!r} is not a valid metadata version") return cast("_MetadataVersion", value) def _process_name(self, value: str) -> str: if not value: raise self._invalid_metadata("{field} is a required field") # Validate the name as a side-effect. try: utils.canonicalize_name(value, validate=True) except utils.InvalidName as exc: raise self._invalid_metadata( f"{value!r} is invalid for {{field}}", cause=exc ) from exc else: return value def _process_version(self, value: str) -> version_module.Version: if not value: raise self._invalid_metadata("{field} is a required field") try: return version_module.parse(value) except version_module.InvalidVersion as exc: raise self._invalid_metadata( f"{value!r} is invalid for {{field}}", cause=exc ) from exc def _process_summary(self, value: str) -> str: """Check the field contains no newlines.""" if "\n" in value: raise self._invalid_metadata("{field} must be a single line") return value def _process_description_content_type(self, value: str) -> str: content_types = {"text/plain", "text/x-rst", "text/markdown"} message = email.message.EmailMessage() message["content-type"] = value content_type, parameters = ( # Defaults to `text/plain` if parsing failed. message.get_content_type().lower(), message["content-type"].params, ) # Check if content-type is valid or defaulted to `text/plain` and thus was # not parseable. if content_type not in content_types or content_type not in value.lower(): raise self._invalid_metadata( f"{{field}} must be one of {list(content_types)}, not {value!r}" ) charset = parameters.get("charset", "UTF-8") if charset != "UTF-8": raise self._invalid_metadata( f"{{field}} can only specify the UTF-8 charset, not {list(charset)}" ) markdown_variants = {"GFM", "CommonMark"} variant = parameters.get("variant", "GFM") # Use an acceptable default. if content_type == "text/markdown" and variant not in markdown_variants: raise self._invalid_metadata( f"valid Markdown variants for {{field}} are {list(markdown_variants)}, " f"not {variant!r}", ) return value def _process_dynamic(self, value: list[str]) -> list[str]: for dynamic_field in map(str.lower, value): if dynamic_field in {"name", "version", "metadata-version"}: raise self._invalid_metadata( f"{dynamic_field!r} is not allowed as a dynamic field" ) elif dynamic_field not in _EMAIL_TO_RAW_MAPPING: raise self._invalid_metadata( f"{dynamic_field!r} is not a valid dynamic field" ) return list(map(str.lower, value)) def _process_provides_extra( self, value: list[str], ) -> list[utils.NormalizedName]: normalized_names = [] try: for name in value: normalized_names.append(utils.canonicalize_name(name, validate=True)) except utils.InvalidName as exc: raise self._invalid_metadata( f"{name!r} is invalid for {{field}}", cause=exc ) from exc else: return normalized_names def _process_requires_python(self, value: str) -> specifiers.SpecifierSet: try: return specifiers.SpecifierSet(value) except specifiers.InvalidSpecifier as exc: raise self._invalid_metadata( f"{value!r} is invalid for {{field}}", cause=exc ) from exc def _process_requires_dist( self, value: list[str], ) -> list[requirements.Requirement]: reqs = [] try: for req in value: reqs.append(requirements.Requirement(req)) except requirements.InvalidRequirement as exc: raise self._invalid_metadata( f"{req!r} is invalid for {{field}}", cause=exc ) from exc else: return reqs def _process_license_expression(self, value: str) -> NormalizedLicenseExpression: try: return licenses.canonicalize_license_expression(value) except ValueError as exc: raise self._invalid_metadata( f"{value!r} is invalid for {{field}}", cause=exc ) from exc def _process_license_files(self, value: list[str]) -> list[str]: paths = [] for path in value: if ".." in path: raise self._invalid_metadata( f"{path!r} is invalid for {{field}}, " "parent directory indicators are not allowed" ) if "*" in path: raise self._invalid_metadata( f"{path!r} is invalid for {{field}}, paths must be resolved" ) if ( pathlib.PurePosixPath(path).is_absolute() or pathlib.PureWindowsPath(path).is_absolute() ): raise self._invalid_metadata( f"{path!r} is invalid for {{field}}, paths must be relative" ) if pathlib.PureWindowsPath(path).as_posix() != path: raise self._invalid_metadata( f"{path!r} is invalid for {{field}}, paths must use '/' delimiter" ) paths.append(path) return paths def _process_import_names(self, value: list[str]) -> list[str]: for import_name in value: name, semicolon, private = import_name.partition(";") name = name.rstrip() for identifier in name.split("."): if not identifier.isidentifier(): raise self._invalid_metadata( f"{name!r} is invalid for {{field}}; " f"{identifier!r} is not a valid identifier" ) elif keyword.iskeyword(identifier): raise self._invalid_metadata( f"{name!r} is invalid for {{field}}; " f"{identifier!r} is a keyword" ) if semicolon and private.lstrip() != "private": raise self._invalid_metadata( f"{import_name!r} is invalid for {{field}}; " "the only valid option is 'private'" ) return value _process_import_namespaces = _process_import_names class Metadata: """Representation of distribution metadata. Compared to :class:`RawMetadata`, this class provides objects representing metadata fields instead of only using built-in types. Any invalid metadata will cause :exc:`InvalidMetadata` to be raised (with a :py:attr:`~BaseException.__cause__` attribute as appropriate). """ _raw: RawMetadata @classmethod def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> Metadata: """Create an instance from :class:`RawMetadata`. If *validate* is true, all metadata will be validated. All exceptions related to validation will be gathered and raised as an :class:`ExceptionGroup`. """ ins = cls() ins._raw = data.copy() # Mutations occur due to caching enriched values. if validate: exceptions: list[Exception] = [] try: metadata_version = ins.metadata_version metadata_age = _VALID_METADATA_VERSIONS.index(metadata_version) except InvalidMetadata as metadata_version_exc: exceptions.append(metadata_version_exc) metadata_version = None # Make sure to check for the fields that are present, the required # fields (so their absence can be reported). fields_to_check = frozenset(ins._raw) | _REQUIRED_ATTRS # Remove fields that have already been checked. fields_to_check -= {"metadata_version"} for key in fields_to_check: try: if metadata_version: # Can't use getattr() as that triggers descriptor protocol which # will fail due to no value for the instance argument. try: field_metadata_version = cls.__dict__[key].added except KeyError: exc = InvalidMetadata(key, f"unrecognized field: {key!r}") exceptions.append(exc) continue field_age = _VALID_METADATA_VERSIONS.index( field_metadata_version ) if field_age > metadata_age: field = _RAW_TO_EMAIL_MAPPING[key] exc = InvalidMetadata( field, f"{field} introduced in metadata version " f"{field_metadata_version}, not {metadata_version}", ) exceptions.append(exc) continue getattr(ins, key) except InvalidMetadata as exc: exceptions.append(exc) if exceptions: raise ExceptionGroup("invalid metadata", exceptions) return ins @classmethod def from_email(cls, data: bytes | str, *, validate: bool = True) -> Metadata: """Parse metadata from email headers. If *validate* is true, the metadata will be validated. All exceptions related to validation will be gathered and raised as an :class:`ExceptionGroup`. """ raw, unparsed = parse_email(data) if validate: exceptions: list[Exception] = [] for unparsed_key in unparsed: if unparsed_key in _EMAIL_TO_RAW_MAPPING: message = f"{unparsed_key!r} has invalid data" else: message = f"unrecognized field: {unparsed_key!r}" exceptions.append(InvalidMetadata(unparsed_key, message)) if exceptions: raise ExceptionGroup("unparsed", exceptions) try: return cls.from_raw(raw, validate=validate) except ExceptionGroup as exc_group: raise ExceptionGroup( "invalid or unparsed metadata", exc_group.exceptions ) from None metadata_version: _Validator[_MetadataVersion] = _Validator() """:external:ref:`core-metadata-metadata-version` (required; validated to be a valid metadata version)""" # `name` is not normalized/typed to NormalizedName so as to provide access to # the original/raw name. name: _Validator[str] = _Validator() """:external:ref:`core-metadata-name` (required; validated using :func:`~packaging.utils.canonicalize_name` and its *validate* parameter)""" version: _Validator[version_module.Version] = _Validator() """:external:ref:`core-metadata-version` (required)""" dynamic: _Validator[list[str] | None] = _Validator( added="2.2", ) """:external:ref:`core-metadata-dynamic` (validated against core metadata field names and lowercased)""" platforms: _Validator[list[str] | None] = _Validator() """:external:ref:`core-metadata-platform`""" supported_platforms: _Validator[list[str] | None] = _Validator(added="1.1") """:external:ref:`core-metadata-supported-platform`""" summary: _Validator[str | None] = _Validator() """:external:ref:`core-metadata-summary` (validated to contain no newlines)""" description: _Validator[str | None] = _Validator() # TODO 2.1: can be in body """:external:ref:`core-metadata-description`""" description_content_type: _Validator[str | None] = _Validator(added="2.1") """:external:ref:`core-metadata-description-content-type` (validated)""" keywords: _Validator[list[str] | None] = _Validator() """:external:ref:`core-metadata-keywords`""" home_page: _Validator[str | None] = _Validator() """:external:ref:`core-metadata-home-page`""" download_url: _Validator[str | None] = _Validator(added="1.1") """:external:ref:`core-metadata-download-url`""" author: _Validator[str | None] = _Validator() """:external:ref:`core-metadata-author`""" author_email: _Validator[str | None] = _Validator() """:external:ref:`core-metadata-author-email`""" maintainer: _Validator[str | None] = _Validator(added="1.2") """:external:ref:`core-metadata-maintainer`""" maintainer_email: _Validator[str | None] = _Validator(added="1.2") """:external:ref:`core-metadata-maintainer-email`""" license: _Validator[str | None] = _Validator() """:external:ref:`core-metadata-license`""" license_expression: _Validator[NormalizedLicenseExpression | None] = _Validator( added="2.4" ) """:external:ref:`core-metadata-license-expression`""" license_files: _Validator[list[str] | None] = _Validator(added="2.4") """:external:ref:`core-metadata-license-file`""" classifiers: _Validator[list[str] | None] = _Validator(added="1.1") """:external:ref:`core-metadata-classifier`""" requires_dist: _Validator[list[requirements.Requirement] | None] = _Validator( added="1.2" ) """:external:ref:`core-metadata-requires-dist`""" requires_python: _Validator[specifiers.SpecifierSet | None] = _Validator( added="1.2" ) """:external:ref:`core-metadata-requires-python`""" # Because `Requires-External` allows for non-PEP 440 version specifiers, we # don't do any processing on the values. requires_external: _Validator[list[str] | None] = _Validator(added="1.2") """:external:ref:`core-metadata-requires-external`""" project_urls: _Validator[dict[str, str] | None] = _Validator(added="1.2") """:external:ref:`core-metadata-project-url`""" # PEP 685 lets us raise an error if an extra doesn't pass `Name` validation # regardless of metadata version. provides_extra: _Validator[list[utils.NormalizedName] | None] = _Validator( added="2.1", ) """:external:ref:`core-metadata-provides-extra`""" provides_dist: _Validator[list[str] | None] = _Validator(added="1.2") """:external:ref:`core-metadata-provides-dist`""" obsoletes_dist: _Validator[list[str] | None] = _Validator(added="1.2") """:external:ref:`core-metadata-obsoletes-dist`""" import_names: _Validator[list[str] | None] = _Validator(added="2.5") """:external:ref:`core-metadata-import-name`""" import_namespaces: _Validator[list[str] | None] = _Validator(added="2.5") """:external:ref:`core-metadata-import-namespace`""" requires: _Validator[list[str] | None] = _Validator(added="1.1") """``Requires`` (deprecated)""" provides: _Validator[list[str] | None] = _Validator(added="1.1") """``Provides`` (deprecated)""" obsoletes: _Validator[list[str] | None] = _Validator(added="1.1") """``Obsoletes`` (deprecated)""" def as_rfc822(self) -> RFC822Message: """ Return an RFC822 message with the metadata. """ message = RFC822Message() self._write_metadata(message) return message def _write_metadata(self, message: RFC822Message) -> None: """ Return an RFC822 message with the metadata. """ for name, validator in self.__class__.__dict__.items(): if isinstance(validator, _Validator) and name != "description": value = getattr(self, name) email_name = _RAW_TO_EMAIL_MAPPING[name] if value is not None: if email_name == "project-url": for label, url in value.items(): message[email_name] = f"{label}, {url}" elif email_name == "keywords": message[email_name] = ",".join(value) elif email_name == "import-name" and value == []: message[email_name] = "" elif isinstance(value, list): for item in value: message[email_name] = str(item) else: message[email_name] = str(value) # The description is a special case because it is in the body of the message. if self.description is not None: message.set_payload(self.description) ================================================ FILE: src/pip/_vendor/packaging/py.typed ================================================ ================================================ FILE: src/pip/_vendor/packaging/pylock.py ================================================ from __future__ import annotations import dataclasses import logging import re from collections.abc import Mapping, Sequence from dataclasses import dataclass from datetime import datetime from typing import ( TYPE_CHECKING, Any, Callable, Protocol, TypeVar, ) from .markers import Marker from .specifiers import SpecifierSet from .utils import NormalizedName, is_normalized_name from .version import Version if TYPE_CHECKING: # pragma: no cover from pathlib import Path from typing_extensions import Self _logger = logging.getLogger(__name__) __all__ = [ "Package", "PackageArchive", "PackageDirectory", "PackageSdist", "PackageVcs", "PackageWheel", "Pylock", "PylockUnsupportedVersionError", "PylockValidationError", "is_valid_pylock_path", ] _T = TypeVar("_T") _T2 = TypeVar("_T2") class _FromMappingProtocol(Protocol): # pragma: no cover @classmethod def _from_dict(cls, d: Mapping[str, Any]) -> Self: ... _FromMappingProtocolT = TypeVar("_FromMappingProtocolT", bound=_FromMappingProtocol) _PYLOCK_FILE_NAME_RE = re.compile(r"^pylock\.([^.]+)\.toml$") def is_valid_pylock_path(path: Path) -> bool: """Check if the given path is a valid pylock file path.""" return path.name == "pylock.toml" or bool(_PYLOCK_FILE_NAME_RE.match(path.name)) def _toml_key(key: str) -> str: return key.replace("_", "-") def _toml_value(key: str, value: Any) -> Any: # noqa: ANN401 if isinstance(value, (Version, Marker, SpecifierSet)): return str(value) if isinstance(value, Sequence) and key == "environments": return [str(v) for v in value] return value def _toml_dict_factory(data: list[tuple[str, Any]]) -> dict[str, Any]: return { _toml_key(key): _toml_value(key, value) for key, value in data if value is not None } def _get(d: Mapping[str, Any], expected_type: type[_T], key: str) -> _T | None: """Get a value from the dictionary and verify it's the expected type.""" if (value := d.get(key)) is None: return None if not isinstance(value, expected_type): raise PylockValidationError( f"Unexpected type {type(value).__name__} " f"(expected {expected_type.__name__})", context=key, ) return value def _get_required(d: Mapping[str, Any], expected_type: type[_T], key: str) -> _T: """Get a required value from the dictionary and verify it's the expected type.""" if (value := _get(d, expected_type, key)) is None: raise _PylockRequiredKeyError(key) return value def _get_sequence( d: Mapping[str, Any], expected_item_type: type[_T], key: str ) -> Sequence[_T] | None: """Get a list value from the dictionary and verify it's the expected items type.""" if (value := _get(d, Sequence, key)) is None: # type: ignore[type-abstract] return None if isinstance(value, (str, bytes)): # special case: str and bytes are Sequences, but we want to reject it raise PylockValidationError( f"Unexpected type {type(value).__name__} (expected Sequence)", context=key, ) for i, item in enumerate(value): if not isinstance(item, expected_item_type): raise PylockValidationError( f"Unexpected type {type(item).__name__} " f"(expected {expected_item_type.__name__})", context=f"{key}[{i}]", ) return value def _get_as( d: Mapping[str, Any], expected_type: type[_T], target_type: Callable[[_T], _T2], key: str, ) -> _T2 | None: """Get a value from the dictionary, verify it's the expected type, and convert to the target type. This assumes the target_type constructor accepts the value. """ if (value := _get(d, expected_type, key)) is None: return None try: return target_type(value) except Exception as e: raise PylockValidationError(e, context=key) from e def _get_required_as( d: Mapping[str, Any], expected_type: type[_T], target_type: Callable[[_T], _T2], key: str, ) -> _T2: """Get a required value from the dict, verify it's the expected type, and convert to the target type.""" if (value := _get_as(d, expected_type, target_type, key)) is None: raise _PylockRequiredKeyError(key) return value def _get_sequence_as( d: Mapping[str, Any], expected_item_type: type[_T], target_item_type: Callable[[_T], _T2], key: str, ) -> list[_T2] | None: """Get list value from dictionary and verify expected items type.""" if (value := _get_sequence(d, expected_item_type, key)) is None: return None result = [] try: for item in value: typed_item = target_item_type(item) result.append(typed_item) except Exception as e: raise PylockValidationError(e, context=f"{key}[{len(result)}]") from e return result def _get_object( d: Mapping[str, Any], target_type: type[_FromMappingProtocolT], key: str ) -> _FromMappingProtocolT | None: """Get a dictionary value from the dictionary and convert it to a dataclass.""" if (value := _get(d, Mapping, key)) is None: # type: ignore[type-abstract] return None try: return target_type._from_dict(value) except Exception as e: raise PylockValidationError(e, context=key) from e def _get_sequence_of_objects( d: Mapping[str, Any], target_item_type: type[_FromMappingProtocolT], key: str ) -> list[_FromMappingProtocolT] | None: """Get a list value from the dictionary and convert its items to a dataclass.""" if (value := _get_sequence(d, Mapping, key)) is None: # type: ignore[type-abstract] return None result: list[_FromMappingProtocolT] = [] try: for item in value: typed_item = target_item_type._from_dict(item) result.append(typed_item) except Exception as e: raise PylockValidationError(e, context=f"{key}[{len(result)}]") from e return result def _get_required_sequence_of_objects( d: Mapping[str, Any], target_item_type: type[_FromMappingProtocolT], key: str ) -> Sequence[_FromMappingProtocolT]: """Get a required list value from the dictionary and convert its items to a dataclass.""" if (result := _get_sequence_of_objects(d, target_item_type, key)) is None: raise _PylockRequiredKeyError(key) return result def _validate_normalized_name(name: str) -> NormalizedName: """Validate that a string is a NormalizedName.""" if not is_normalized_name(name): raise PylockValidationError(f"Name {name!r} is not normalized") return NormalizedName(name) def _validate_path_url(path: str | None, url: str | None) -> None: if not path and not url: raise PylockValidationError("path or url must be provided") def _validate_hashes(hashes: Mapping[str, Any]) -> Mapping[str, Any]: if not hashes: raise PylockValidationError("At least one hash must be provided") if not all(isinstance(hash_val, str) for hash_val in hashes.values()): raise PylockValidationError("Hash values must be strings") return hashes class PylockValidationError(Exception): """Raised when when input data is not spec-compliant.""" context: str | None = None message: str def __init__( self, cause: str | Exception, *, context: str | None = None, ) -> None: if isinstance(cause, PylockValidationError): if cause.context: self.context = ( f"{context}.{cause.context}" if context else cause.context ) else: self.context = context self.message = cause.message else: self.context = context self.message = str(cause) def __str__(self) -> str: if self.context: return f"{self.message} in {self.context!r}" return self.message class _PylockRequiredKeyError(PylockValidationError): def __init__(self, key: str) -> None: super().__init__("Missing required value", context=key) class PylockUnsupportedVersionError(PylockValidationError): """Raised when encountering an unsupported `lock_version`.""" @dataclass(frozen=True, init=False) class PackageVcs: type: str url: str | None = None path: str | None = None requested_revision: str | None = None commit_id: str # type: ignore[misc] subdirectory: str | None = None def __init__( self, *, type: str, url: str | None = None, path: str | None = None, requested_revision: str | None = None, commit_id: str, subdirectory: str | None = None, ) -> None: # In Python 3.10+ make dataclass kw_only=True and remove __init__ object.__setattr__(self, "type", type) object.__setattr__(self, "url", url) object.__setattr__(self, "path", path) object.__setattr__(self, "requested_revision", requested_revision) object.__setattr__(self, "commit_id", commit_id) object.__setattr__(self, "subdirectory", subdirectory) @classmethod def _from_dict(cls, d: Mapping[str, Any]) -> Self: package_vcs = cls( type=_get_required(d, str, "type"), url=_get(d, str, "url"), path=_get(d, str, "path"), requested_revision=_get(d, str, "requested-revision"), commit_id=_get_required(d, str, "commit-id"), subdirectory=_get(d, str, "subdirectory"), ) _validate_path_url(package_vcs.path, package_vcs.url) return package_vcs @dataclass(frozen=True, init=False) class PackageDirectory: path: str editable: bool | None = None subdirectory: str | None = None def __init__( self, *, path: str, editable: bool | None = None, subdirectory: str | None = None, ) -> None: # In Python 3.10+ make dataclass kw_only=True and remove __init__ object.__setattr__(self, "path", path) object.__setattr__(self, "editable", editable) object.__setattr__(self, "subdirectory", subdirectory) @classmethod def _from_dict(cls, d: Mapping[str, Any]) -> Self: return cls( path=_get_required(d, str, "path"), editable=_get(d, bool, "editable"), subdirectory=_get(d, str, "subdirectory"), ) @dataclass(frozen=True, init=False) class PackageArchive: url: str | None = None path: str | None = None size: int | None = None upload_time: datetime | None = None hashes: Mapping[str, str] # type: ignore[misc] subdirectory: str | None = None def __init__( self, *, url: str | None = None, path: str | None = None, size: int | None = None, upload_time: datetime | None = None, hashes: Mapping[str, str], subdirectory: str | None = None, ) -> None: # In Python 3.10+ make dataclass kw_only=True and remove __init__ object.__setattr__(self, "url", url) object.__setattr__(self, "path", path) object.__setattr__(self, "size", size) object.__setattr__(self, "upload_time", upload_time) object.__setattr__(self, "hashes", hashes) object.__setattr__(self, "subdirectory", subdirectory) @classmethod def _from_dict(cls, d: Mapping[str, Any]) -> Self: package_archive = cls( url=_get(d, str, "url"), path=_get(d, str, "path"), size=_get(d, int, "size"), upload_time=_get(d, datetime, "upload-time"), hashes=_get_required_as(d, Mapping, _validate_hashes, "hashes"), # type: ignore[type-abstract] subdirectory=_get(d, str, "subdirectory"), ) _validate_path_url(package_archive.path, package_archive.url) return package_archive @dataclass(frozen=True, init=False) class PackageSdist: name: str | None = None upload_time: datetime | None = None url: str | None = None path: str | None = None size: int | None = None hashes: Mapping[str, str] # type: ignore[misc] def __init__( self, *, name: str | None = None, upload_time: datetime | None = None, url: str | None = None, path: str | None = None, size: int | None = None, hashes: Mapping[str, str], ) -> None: # In Python 3.10+ make dataclass kw_only=True and remove __init__ object.__setattr__(self, "name", name) object.__setattr__(self, "upload_time", upload_time) object.__setattr__(self, "url", url) object.__setattr__(self, "path", path) object.__setattr__(self, "size", size) object.__setattr__(self, "hashes", hashes) @classmethod def _from_dict(cls, d: Mapping[str, Any]) -> Self: package_sdist = cls( name=_get(d, str, "name"), upload_time=_get(d, datetime, "upload-time"), url=_get(d, str, "url"), path=_get(d, str, "path"), size=_get(d, int, "size"), hashes=_get_required_as(d, Mapping, _validate_hashes, "hashes"), # type: ignore[type-abstract] ) _validate_path_url(package_sdist.path, package_sdist.url) return package_sdist @dataclass(frozen=True, init=False) class PackageWheel: name: str | None = None upload_time: datetime | None = None url: str | None = None path: str | None = None size: int | None = None hashes: Mapping[str, str] # type: ignore[misc] def __init__( self, *, name: str | None = None, upload_time: datetime | None = None, url: str | None = None, path: str | None = None, size: int | None = None, hashes: Mapping[str, str], ) -> None: # In Python 3.10+ make dataclass kw_only=True and remove __init__ object.__setattr__(self, "name", name) object.__setattr__(self, "upload_time", upload_time) object.__setattr__(self, "url", url) object.__setattr__(self, "path", path) object.__setattr__(self, "size", size) object.__setattr__(self, "hashes", hashes) @classmethod def _from_dict(cls, d: Mapping[str, Any]) -> Self: package_wheel = cls( name=_get(d, str, "name"), upload_time=_get(d, datetime, "upload-time"), url=_get(d, str, "url"), path=_get(d, str, "path"), size=_get(d, int, "size"), hashes=_get_required_as(d, Mapping, _validate_hashes, "hashes"), # type: ignore[type-abstract] ) _validate_path_url(package_wheel.path, package_wheel.url) return package_wheel @dataclass(frozen=True, init=False) class Package: name: NormalizedName version: Version | None = None marker: Marker | None = None requires_python: SpecifierSet | None = None dependencies: Sequence[Mapping[str, Any]] | None = None vcs: PackageVcs | None = None directory: PackageDirectory | None = None archive: PackageArchive | None = None index: str | None = None sdist: PackageSdist | None = None wheels: Sequence[PackageWheel] | None = None attestation_identities: Sequence[Mapping[str, Any]] | None = None tool: Mapping[str, Any] | None = None def __init__( self, *, name: NormalizedName, version: Version | None = None, marker: Marker | None = None, requires_python: SpecifierSet | None = None, dependencies: Sequence[Mapping[str, Any]] | None = None, vcs: PackageVcs | None = None, directory: PackageDirectory | None = None, archive: PackageArchive | None = None, index: str | None = None, sdist: PackageSdist | None = None, wheels: Sequence[PackageWheel] | None = None, attestation_identities: Sequence[Mapping[str, Any]] | None = None, tool: Mapping[str, Any] | None = None, ) -> None: # In Python 3.10+ make dataclass kw_only=True and remove __init__ object.__setattr__(self, "name", name) object.__setattr__(self, "version", version) object.__setattr__(self, "marker", marker) object.__setattr__(self, "requires_python", requires_python) object.__setattr__(self, "dependencies", dependencies) object.__setattr__(self, "vcs", vcs) object.__setattr__(self, "directory", directory) object.__setattr__(self, "archive", archive) object.__setattr__(self, "index", index) object.__setattr__(self, "sdist", sdist) object.__setattr__(self, "wheels", wheels) object.__setattr__(self, "attestation_identities", attestation_identities) object.__setattr__(self, "tool", tool) @classmethod def _from_dict(cls, d: Mapping[str, Any]) -> Self: package = cls( name=_get_required_as(d, str, _validate_normalized_name, "name"), version=_get_as(d, str, Version, "version"), requires_python=_get_as(d, str, SpecifierSet, "requires-python"), dependencies=_get_sequence(d, Mapping, "dependencies"), # type: ignore[type-abstract] marker=_get_as(d, str, Marker, "marker"), vcs=_get_object(d, PackageVcs, "vcs"), directory=_get_object(d, PackageDirectory, "directory"), archive=_get_object(d, PackageArchive, "archive"), index=_get(d, str, "index"), sdist=_get_object(d, PackageSdist, "sdist"), wheels=_get_sequence_of_objects(d, PackageWheel, "wheels"), attestation_identities=_get_sequence(d, Mapping, "attestation-identities"), # type: ignore[type-abstract] tool=_get(d, Mapping, "tool"), # type: ignore[type-abstract] ) distributions = bool(package.sdist) + len(package.wheels or []) direct_urls = ( bool(package.vcs) + bool(package.directory) + bool(package.archive) ) if distributions > 0 and direct_urls > 0: raise PylockValidationError( "None of vcs, directory, archive must be set if sdist or wheels are set" ) if distributions == 0 and direct_urls != 1: raise PylockValidationError( "Exactly one of vcs, directory, archive must be set " "if sdist and wheels are not set" ) try: for i, attestation_identity in enumerate( # noqa: B007 package.attestation_identities or [] ): _get_required(attestation_identity, str, "kind") except Exception as e: raise PylockValidationError( e, context=f"attestation-identities[{i}]" ) from e return package @property def is_direct(self) -> bool: return not (self.sdist or self.wheels) @dataclass(frozen=True, init=False) class Pylock: """A class representing a pylock file.""" lock_version: Version environments: Sequence[Marker] | None = None requires_python: SpecifierSet | None = None extras: Sequence[NormalizedName] | None = None dependency_groups: Sequence[str] | None = None default_groups: Sequence[str] | None = None created_by: str # type: ignore[misc] packages: Sequence[Package] # type: ignore[misc] tool: Mapping[str, Any] | None = None def __init__( self, *, lock_version: Version, environments: Sequence[Marker] | None = None, requires_python: SpecifierSet | None = None, extras: Sequence[NormalizedName] | None = None, dependency_groups: Sequence[str] | None = None, default_groups: Sequence[str] | None = None, created_by: str, packages: Sequence[Package], tool: Mapping[str, Any] | None = None, ) -> None: # In Python 3.10+ make dataclass kw_only=True and remove __init__ object.__setattr__(self, "lock_version", lock_version) object.__setattr__(self, "environments", environments) object.__setattr__(self, "requires_python", requires_python) object.__setattr__(self, "extras", extras) object.__setattr__(self, "dependency_groups", dependency_groups) object.__setattr__(self, "default_groups", default_groups) object.__setattr__(self, "created_by", created_by) object.__setattr__(self, "packages", packages) object.__setattr__(self, "tool", tool) @classmethod def _from_dict(cls, d: Mapping[str, Any]) -> Self: pylock = cls( lock_version=_get_required_as(d, str, Version, "lock-version"), environments=_get_sequence_as(d, str, Marker, "environments"), extras=_get_sequence_as(d, str, _validate_normalized_name, "extras"), dependency_groups=_get_sequence(d, str, "dependency-groups"), default_groups=_get_sequence(d, str, "default-groups"), created_by=_get_required(d, str, "created-by"), requires_python=_get_as(d, str, SpecifierSet, "requires-python"), packages=_get_required_sequence_of_objects(d, Package, "packages"), tool=_get(d, Mapping, "tool"), # type: ignore[type-abstract] ) if not Version("1") <= pylock.lock_version < Version("2"): raise PylockUnsupportedVersionError( f"pylock version {pylock.lock_version} is not supported" ) if pylock.lock_version > Version("1.0"): _logger.warning( "pylock minor version %s is not supported", pylock.lock_version ) return pylock @classmethod def from_dict(cls, d: Mapping[str, Any], /) -> Self: """Create and validate a Pylock instance from a TOML dictionary. Raises :class:`PylockValidationError` if the input data is not spec-compliant. """ return cls._from_dict(d) def to_dict(self) -> Mapping[str, Any]: """Convert the Pylock instance to a TOML dictionary.""" return dataclasses.asdict(self, dict_factory=_toml_dict_factory) def validate(self) -> None: """Validate the Pylock instance against the specification. Raises :class:`PylockValidationError` otherwise.""" self.from_dict(self.to_dict()) ================================================ FILE: src/pip/_vendor/packaging/requirements.py ================================================ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. from __future__ import annotations from typing import Iterator from ._parser import parse_requirement as _parse_requirement from ._tokenizer import ParserSyntaxError from .markers import Marker, _normalize_extra_values from .specifiers import SpecifierSet from .utils import canonicalize_name class InvalidRequirement(ValueError): """ An invalid requirement was found, users should refer to PEP 508. """ class Requirement: """Parse a requirement. Parse a given requirement string into its parts, such as name, specifier, URL, and extras. Raises InvalidRequirement on a badly-formed requirement string. """ # TODO: Can we test whether something is contained within a requirement? # If so how do we do that? Do we need to test against the _name_ of # the thing as well as the version? What about the markers? # TODO: Can we normalize the name and extra name? def __init__(self, requirement_string: str) -> None: try: parsed = _parse_requirement(requirement_string) except ParserSyntaxError as e: raise InvalidRequirement(str(e)) from e self.name: str = parsed.name self.url: str | None = parsed.url or None self.extras: set[str] = set(parsed.extras or []) self.specifier: SpecifierSet = SpecifierSet(parsed.specifier) self.marker: Marker | None = None if parsed.marker is not None: self.marker = Marker.__new__(Marker) self.marker._markers = _normalize_extra_values(parsed.marker) def _iter_parts(self, name: str) -> Iterator[str]: yield name if self.extras: formatted_extras = ",".join(sorted(self.extras)) yield f"[{formatted_extras}]" if self.specifier: yield str(self.specifier) if self.url: yield f" @ {self.url}" if self.marker: yield " " if self.marker: yield f"; {self.marker}" def __str__(self) -> str: return "".join(self._iter_parts(self.name)) def __repr__(self) -> str: return f"<{self.__class__.__name__}('{self}')>" def __hash__(self) -> int: return hash(tuple(self._iter_parts(canonicalize_name(self.name)))) def __eq__(self, other: object) -> bool: if not isinstance(other, Requirement): return NotImplemented return ( canonicalize_name(self.name) == canonicalize_name(other.name) and self.extras == other.extras and self.specifier == other.specifier and self.url == other.url and self.marker == other.marker ) ================================================ FILE: src/pip/_vendor/packaging/specifiers.py ================================================ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. """ .. testsetup:: from pip._vendor.packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier from pip._vendor.packaging.version import Version """ from __future__ import annotations import abc import itertools import re from typing import Callable, Final, Iterable, Iterator, TypeVar, Union from .utils import canonicalize_version from .version import InvalidVersion, Version UnparsedVersion = Union[Version, str] UnparsedVersionVar = TypeVar("UnparsedVersionVar", bound=UnparsedVersion) CallableOperator = Callable[[Version, str], bool] def _coerce_version(version: UnparsedVersion) -> Version | None: if not isinstance(version, Version): try: version = Version(version) except InvalidVersion: return None return version def _public_version(version: Version) -> Version: return version.__replace__(local=None) def _base_version(version: Version) -> Version: return version.__replace__(pre=None, post=None, dev=None, local=None) class InvalidSpecifier(ValueError): """ Raised when attempting to create a :class:`Specifier` with a specifier string that is invalid. >>> Specifier("lolwat") Traceback (most recent call last): ... packaging.specifiers.InvalidSpecifier: Invalid specifier: 'lolwat' """ class BaseSpecifier(metaclass=abc.ABCMeta): __slots__ = () __match_args__ = ("_str",) @property def _str(self) -> str: """Internal property for match_args""" return str(self) @abc.abstractmethod def __str__(self) -> str: """ Returns the str representation of this Specifier-like object. This should be representative of the Specifier itself. """ @abc.abstractmethod def __hash__(self) -> int: """ Returns a hash value for this Specifier-like object. """ @abc.abstractmethod def __eq__(self, other: object) -> bool: """ Returns a boolean representing whether or not the two Specifier-like objects are equal. :param other: The other object to check against. """ @property @abc.abstractmethod def prereleases(self) -> bool | None: """Whether or not pre-releases as a whole are allowed. This can be set to either ``True`` or ``False`` to explicitly enable or disable prereleases or it can be set to ``None`` (the default) to use default semantics. """ @prereleases.setter # noqa: B027 def prereleases(self, value: bool) -> None: """Setter for :attr:`prereleases`. :param value: The value to set. """ @abc.abstractmethod def contains(self, item: str, prereleases: bool | None = None) -> bool: """ Determines if the given item is contained within this specifier. """ @abc.abstractmethod def filter( self, iterable: Iterable[UnparsedVersionVar], prereleases: bool | None = None ) -> Iterator[UnparsedVersionVar]: """ Takes an iterable of items and filters them so that only items which are contained within this specifier are allowed in it. """ class Specifier(BaseSpecifier): """This class abstracts handling of version specifiers. .. tip:: It is generally not required to instantiate this manually. You should instead prefer to work with :class:`SpecifierSet` instead, which can parse comma-separated version specifiers (which is what package metadata contains). """ __slots__ = ("_prereleases", "_spec", "_spec_version") _operator_regex_str = r""" (?P(~=|==|!=|<=|>=|<|>|===)) """ _version_regex_str = r""" (?P (?: # The identity operators allow for an escape hatch that will # do an exact string match of the version you wish to install. # This will not be parsed by PEP 440 and we cannot determine # any semantic meaning from it. This operator is discouraged # but included entirely as an escape hatch. (?<====) # Only match for the identity operator \s* [^\s;)]* # The arbitrary version can be just about anything, # we match everything except for whitespace, a # semi-colon for marker support, and a closing paren # since versions can be enclosed in them. ) | (?: # The (non)equality operators allow for wild card and local # versions to be specified so we have to define these two # operators separately to enable that. (?<===|!=) # Only match for equals and not equals \s* v? (?:[0-9]+!)? # epoch [0-9]+(?:\.[0-9]+)* # release # You cannot use a wild card and a pre-release, post-release, a dev or # local version together so group them with a | and make them optional. (?: \.\* # Wild card syntax of .* | (?: # pre release [-_\.]? (alpha|beta|preview|pre|a|b|c|rc) [-_\.]? [0-9]* )? (?: # post release (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) )? (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local )? ) | (?: # The compatible operator requires at least two digits in the # release segment. (?<=~=) # Only match for the compatible operator \s* v? (?:[0-9]+!)? # epoch [0-9]+(?:\.[0-9]+)+ # release (We have a + instead of a *) (?: # pre release [-_\.]? (alpha|beta|preview|pre|a|b|c|rc) [-_\.]? [0-9]* )? (?: # post release (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) )? (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release ) | (?: # All other operators only allow a sub set of what the # (non)equality operators do. Specifically they do not allow # local versions to be specified nor do they allow the prefix # matching wild cards. (?=": "greater_than_equal", "<": "less_than", ">": "greater_than", "===": "arbitrary", } def __init__(self, spec: str = "", prereleases: bool | None = None) -> None: """Initialize a Specifier instance. :param spec: The string representation of a specifier which will be parsed and normalized before use. :param prereleases: This tells the specifier if it should accept prerelease versions if applicable or not. The default of ``None`` will autodetect it from the given specifiers. :raises InvalidSpecifier: If the given specifier is invalid (i.e. bad syntax). """ match = self._regex.fullmatch(spec) if not match: raise InvalidSpecifier(f"Invalid specifier: {spec!r}") self._spec: tuple[str, str] = ( match.group("operator").strip(), match.group("version").strip(), ) # Store whether or not this Specifier should accept prereleases self._prereleases = prereleases # Specifier version cache self._spec_version: tuple[str, Version] | None = None def _get_spec_version(self, version: str) -> Version | None: """One element cache, as only one spec Version is needed per Specifier.""" if self._spec_version is not None and self._spec_version[0] == version: return self._spec_version[1] version_specifier = _coerce_version(version) if version_specifier is None: return None self._spec_version = (version, version_specifier) return version_specifier def _require_spec_version(self, version: str) -> Version: """Get spec version, asserting it's valid (not for === operator). This method should only be called for operators where version strings are guaranteed to be valid PEP 440 versions (not ===). """ spec_version = self._get_spec_version(version) assert spec_version is not None return spec_version @property def prereleases(self) -> bool | None: # If there is an explicit prereleases set for this, then we'll just # blindly use that. if self._prereleases is not None: return self._prereleases # Only the "!=" operator does not imply prereleases when # the version in the specifier is a prerelease. operator, version_str = self._spec if operator != "!=": # The == specifier with trailing .* cannot include prereleases # e.g. "==1.0a1.*" is not valid. if operator == "==" and version_str.endswith(".*"): return False # "===" can have arbitrary string versions, so we cannot parse # those, we take prereleases as unknown (None) for those. version = self._get_spec_version(version_str) if version is None: return None # For all other operators, use the check if spec Version # object implies pre-releases. if version.is_prerelease: return True return False @prereleases.setter def prereleases(self, value: bool | None) -> None: self._prereleases = value @property def operator(self) -> str: """The operator of this specifier. >>> Specifier("==1.2.3").operator '==' """ return self._spec[0] @property def version(self) -> str: """The version of this specifier. >>> Specifier("==1.2.3").version '1.2.3' """ return self._spec[1] def __repr__(self) -> str: """A representation of the Specifier that shows all internal state. >>> Specifier('>=1.0.0') =1.0.0')> >>> Specifier('>=1.0.0', prereleases=False) =1.0.0', prereleases=False)> >>> Specifier('>=1.0.0', prereleases=True) =1.0.0', prereleases=True)> """ pre = ( f", prereleases={self.prereleases!r}" if self._prereleases is not None else "" ) return f"<{self.__class__.__name__}({str(self)!r}{pre})>" def __str__(self) -> str: """A string representation of the Specifier that can be round-tripped. >>> str(Specifier('>=1.0.0')) '>=1.0.0' >>> str(Specifier('>=1.0.0', prereleases=False)) '>=1.0.0' """ return "{}{}".format(*self._spec) @property def _canonical_spec(self) -> tuple[str, str]: operator, version = self._spec if operator == "===" or version.endswith(".*"): return operator, version spec_version = self._require_spec_version(version) canonical_version = canonicalize_version( spec_version, strip_trailing_zero=(operator != "~=") ) return operator, canonical_version def __hash__(self) -> int: return hash(self._canonical_spec) def __eq__(self, other: object) -> bool: """Whether or not the two Specifier-like objects are equal. :param other: The other object to check against. The value of :attr:`prereleases` is ignored. >>> Specifier("==1.2.3") == Specifier("== 1.2.3.0") True >>> (Specifier("==1.2.3", prereleases=False) == ... Specifier("==1.2.3", prereleases=True)) True >>> Specifier("==1.2.3") == "==1.2.3" True >>> Specifier("==1.2.3") == Specifier("==1.2.4") False >>> Specifier("==1.2.3") == Specifier("~=1.2.3") False """ if isinstance(other, str): try: other = self.__class__(str(other)) except InvalidSpecifier: return NotImplemented elif not isinstance(other, self.__class__): return NotImplemented return self._canonical_spec == other._canonical_spec def _get_operator(self, op: str) -> CallableOperator: operator_callable: CallableOperator = getattr( self, f"_compare_{self._operators[op]}" ) return operator_callable def _compare_compatible(self, prospective: Version, spec: str) -> bool: # Compatible releases have an equivalent combination of >= and ==. That # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to # implement this in terms of the other specifiers instead of # implementing it ourselves. The only thing we need to do is construct # the other specifiers. # We want everything but the last item in the version, but we want to # ignore suffix segments. prefix = _version_join( list(itertools.takewhile(_is_not_suffix, _version_split(spec)))[:-1] ) # Add the prefix notation to the end of our string prefix += ".*" return self._get_operator(">=")(prospective, spec) and self._get_operator("==")( prospective, prefix ) def _compare_equal(self, prospective: Version, spec: str) -> bool: # We need special logic to handle prefix matching if spec.endswith(".*"): # In the case of prefix matching we want to ignore local segment. normalized_prospective = canonicalize_version( _public_version(prospective), strip_trailing_zero=False ) # Get the normalized version string ignoring the trailing .* normalized_spec = canonicalize_version(spec[:-2], strip_trailing_zero=False) # Split the spec out by bangs and dots, and pretend that there is # an implicit dot in between a release segment and a pre-release segment. split_spec = _version_split(normalized_spec) # Split the prospective version out by bangs and dots, and pretend # that there is an implicit dot in between a release segment and # a pre-release segment. split_prospective = _version_split(normalized_prospective) # 0-pad the prospective version before shortening it to get the correct # shortened version. padded_prospective, _ = _pad_version(split_prospective, split_spec) # Shorten the prospective version to be the same length as the spec # so that we can determine if the specifier is a prefix of the # prospective version or not. shortened_prospective = padded_prospective[: len(split_spec)] return shortened_prospective == split_spec else: # Convert our spec string into a Version spec_version = self._require_spec_version(spec) # If the specifier does not have a local segment, then we want to # act as if the prospective version also does not have a local # segment. if not spec_version.local: prospective = _public_version(prospective) return prospective == spec_version def _compare_not_equal(self, prospective: Version, spec: str) -> bool: return not self._compare_equal(prospective, spec) def _compare_less_than_equal(self, prospective: Version, spec: str) -> bool: # NB: Local version identifiers are NOT permitted in the version # specifier, so local version labels can be universally removed from # the prospective version. return _public_version(prospective) <= self._require_spec_version(spec) def _compare_greater_than_equal(self, prospective: Version, spec: str) -> bool: # NB: Local version identifiers are NOT permitted in the version # specifier, so local version labels can be universally removed from # the prospective version. return _public_version(prospective) >= self._require_spec_version(spec) def _compare_less_than(self, prospective: Version, spec_str: str) -> bool: # Convert our spec to a Version instance, since we'll want to work with # it as a version. spec = self._require_spec_version(spec_str) # Check to see if the prospective version is less than the spec # version. If it's not we can short circuit and just return False now # instead of doing extra unneeded work. if not prospective < spec: return False # This special case is here so that, unless the specifier itself # includes is a pre-release version, that we do not accept pre-release # versions for the version mentioned in the specifier (e.g. <3.1 should # not match 3.1.dev0, but should match 3.0.dev0). if ( not spec.is_prerelease and prospective.is_prerelease and _base_version(prospective) == _base_version(spec) ): return False # If we've gotten to here, it means that prospective version is both # less than the spec version *and* it's not a pre-release of the same # version in the spec. return True def _compare_greater_than(self, prospective: Version, spec_str: str) -> bool: # Convert our spec to a Version instance, since we'll want to work with # it as a version. spec = self._require_spec_version(spec_str) # Check to see if the prospective version is greater than the spec # version. If it's not we can short circuit and just return False now # instead of doing extra unneeded work. if not prospective > spec: return False # This special case is here so that, unless the specifier itself # includes is a post-release version, that we do not accept # post-release versions for the version mentioned in the specifier # (e.g. >3.1 should not match 3.0.post0, but should match 3.2.post0). if ( not spec.is_postrelease and prospective.is_postrelease and _base_version(prospective) == _base_version(spec) ): return False # Ensure that we do not allow a local version of the version mentioned # in the specifier, which is technically greater than, to match. if prospective.local is not None and _base_version( prospective ) == _base_version(spec): return False # If we've gotten to here, it means that prospective version is both # greater than the spec version *and* it's not a pre-release of the # same version in the spec. return True def _compare_arbitrary(self, prospective: Version | str, spec: str) -> bool: return str(prospective).lower() == str(spec).lower() def __contains__(self, item: str | Version) -> bool: """Return whether or not the item is contained in this specifier. :param item: The item to check for. This is used for the ``in`` operator and behaves the same as :meth:`contains` with no ``prereleases`` argument passed. >>> "1.2.3" in Specifier(">=1.2.3") True >>> Version("1.2.3") in Specifier(">=1.2.3") True >>> "1.0.0" in Specifier(">=1.2.3") False >>> "1.3.0a1" in Specifier(">=1.2.3") True >>> "1.3.0a1" in Specifier(">=1.2.3", prereleases=True) True """ return self.contains(item) def contains(self, item: UnparsedVersion, prereleases: bool | None = None) -> bool: """Return whether or not the item is contained in this specifier. :param item: The item to check for, which can be a version string or a :class:`Version` instance. :param prereleases: Whether or not to match prereleases with this Specifier. If set to ``None`` (the default), it will follow the recommendation from :pep:`440` and match prereleases, as there are no other versions. >>> Specifier(">=1.2.3").contains("1.2.3") True >>> Specifier(">=1.2.3").contains(Version("1.2.3")) True >>> Specifier(">=1.2.3").contains("1.0.0") False >>> Specifier(">=1.2.3").contains("1.3.0a1") True >>> Specifier(">=1.2.3", prereleases=False).contains("1.3.0a1") False >>> Specifier(">=1.2.3").contains("1.3.0a1") True """ return bool(list(self.filter([item], prereleases=prereleases))) def filter( self, iterable: Iterable[UnparsedVersionVar], prereleases: bool | None = None ) -> Iterator[UnparsedVersionVar]: """Filter items in the given iterable, that match the specifier. :param iterable: An iterable that can contain version strings and :class:`Version` instances. The items in the iterable will be filtered according to the specifier. :param prereleases: Whether or not to allow prereleases in the returned iterator. If set to ``None`` (the default), it will follow the recommendation from :pep:`440` and match prereleases if there are no other versions. >>> list(Specifier(">=1.2.3").filter(["1.2", "1.3", "1.5a1"])) ['1.3'] >>> list(Specifier(">=1.2.3").filter(["1.2", "1.2.3", "1.3", Version("1.4")])) ['1.2.3', '1.3', ] >>> list(Specifier(">=1.2.3").filter(["1.2", "1.5a1"])) ['1.5a1'] >>> list(Specifier(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True)) ['1.3', '1.5a1'] >>> list(Specifier(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"])) ['1.3', '1.5a1'] """ prereleases_versions = [] found_non_prereleases = False # Determine if to include prereleases by default include_prereleases = ( prereleases if prereleases is not None else self.prereleases ) # Get the matching operator operator_callable = self._get_operator(self.operator) # Filter versions for version in iterable: parsed_version = _coerce_version(version) if parsed_version is None: # === operator can match arbitrary (non-version) strings if self.operator == "===" and self._compare_arbitrary( version, self.version ): yield version elif operator_callable(parsed_version, self.version): # If it's not a prerelease or prereleases are allowed, yield it directly if not parsed_version.is_prerelease or include_prereleases: found_non_prereleases = True yield version # Otherwise collect prereleases for potential later use elif prereleases is None and self._prereleases is not False: prereleases_versions.append(version) # If no non-prereleases were found and prereleases weren't # explicitly forbidden, yield the collected prereleases if ( not found_non_prereleases and prereleases is None and self._prereleases is not False ): yield from prereleases_versions _prefix_regex = re.compile(r"([0-9]+)((?:a|b|c|rc)[0-9]+)") def _version_split(version: str) -> list[str]: """Split version into components. The split components are intended for version comparison. The logic does not attempt to retain the original version string, so joining the components back with :func:`_version_join` may not produce the original version string. """ result: list[str] = [] epoch, _, rest = version.rpartition("!") result.append(epoch or "0") for item in rest.split("."): match = _prefix_regex.fullmatch(item) if match: result.extend(match.groups()) else: result.append(item) return result def _version_join(components: list[str]) -> str: """Join split version components into a version string. This function assumes the input came from :func:`_version_split`, where the first component must be the epoch (either empty or numeric), and all other components numeric. """ epoch, *rest = components return f"{epoch}!{'.'.join(rest)}" def _is_not_suffix(segment: str) -> bool: return not any( segment.startswith(prefix) for prefix in ("dev", "a", "b", "rc", "post") ) def _pad_version(left: list[str], right: list[str]) -> tuple[list[str], list[str]]: left_split, right_split = [], [] # Get the release segment of our versions left_split.append(list(itertools.takewhile(lambda x: x.isdigit(), left))) right_split.append(list(itertools.takewhile(lambda x: x.isdigit(), right))) # Get the rest of our versions left_split.append(left[len(left_split[0]) :]) right_split.append(right[len(right_split[0]) :]) # Insert our padding left_split.insert(1, ["0"] * max(0, len(right_split[0]) - len(left_split[0]))) right_split.insert(1, ["0"] * max(0, len(left_split[0]) - len(right_split[0]))) return ( list(itertools.chain.from_iterable(left_split)), list(itertools.chain.from_iterable(right_split)), ) class SpecifierSet(BaseSpecifier): """This class abstracts handling of a set of version specifiers. It can be passed a single specifier (``>=3.0``), a comma-separated list of specifiers (``>=3.0,!=3.1``), or no specifier at all. """ __slots__ = ("_prereleases", "_specs") def __init__( self, specifiers: str | Iterable[Specifier] = "", prereleases: bool | None = None, ) -> None: """Initialize a SpecifierSet instance. :param specifiers: The string representation of a specifier or a comma-separated list of specifiers which will be parsed and normalized before use. May also be an iterable of ``Specifier`` instances, which will be used as is. :param prereleases: This tells the SpecifierSet if it should accept prerelease versions if applicable or not. The default of ``None`` will autodetect it from the given specifiers. :raises InvalidSpecifier: If the given ``specifiers`` are not parseable than this exception will be raised. """ if isinstance(specifiers, str): # Split on `,` to break each individual specifier into its own item, and # strip each item to remove leading/trailing whitespace. split_specifiers = [s.strip() for s in specifiers.split(",") if s.strip()] # Make each individual specifier a Specifier and save in a frozen set # for later. self._specs = frozenset(map(Specifier, split_specifiers)) else: # Save the supplied specifiers in a frozen set. self._specs = frozenset(specifiers) # Store our prereleases value so we can use it later to determine if # we accept prereleases or not. self._prereleases = prereleases @property def prereleases(self) -> bool | None: # If we have been given an explicit prerelease modifier, then we'll # pass that through here. if self._prereleases is not None: return self._prereleases # If we don't have any specifiers, and we don't have a forced value, # then we'll just return None since we don't know if this should have # pre-releases or not. if not self._specs: return None # Otherwise we'll see if any of the given specifiers accept # prereleases, if any of them do we'll return True, otherwise False. if any(s.prereleases for s in self._specs): return True return None @prereleases.setter def prereleases(self, value: bool | None) -> None: self._prereleases = value def __repr__(self) -> str: """A representation of the specifier set that shows all internal state. Note that the ordering of the individual specifiers within the set may not match the input string. >>> SpecifierSet('>=1.0.0,!=2.0.0') =1.0.0')> >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=False) =1.0.0', prereleases=False)> >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=True) =1.0.0', prereleases=True)> """ pre = ( f", prereleases={self.prereleases!r}" if self._prereleases is not None else "" ) return f"" def __str__(self) -> str: """A string representation of the specifier set that can be round-tripped. Note that the ordering of the individual specifiers within the set may not match the input string. >>> str(SpecifierSet(">=1.0.0,!=1.0.1")) '!=1.0.1,>=1.0.0' >>> str(SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False)) '!=1.0.1,>=1.0.0' """ return ",".join(sorted(str(s) for s in self._specs)) def __hash__(self) -> int: return hash(self._specs) def __and__(self, other: SpecifierSet | str) -> SpecifierSet: """Return a SpecifierSet which is a combination of the two sets. :param other: The other object to combine with. >>> SpecifierSet(">=1.0.0,!=1.0.1") & '<=2.0.0,!=2.0.1' =1.0.0')> >>> SpecifierSet(">=1.0.0,!=1.0.1") & SpecifierSet('<=2.0.0,!=2.0.1') =1.0.0')> """ if isinstance(other, str): other = SpecifierSet(other) elif not isinstance(other, SpecifierSet): return NotImplemented specifier = SpecifierSet() specifier._specs = frozenset(self._specs | other._specs) if self._prereleases is None and other._prereleases is not None: specifier._prereleases = other._prereleases elif ( self._prereleases is not None and other._prereleases is None ) or self._prereleases == other._prereleases: specifier._prereleases = self._prereleases else: raise ValueError( "Cannot combine SpecifierSets with True and False prerelease overrides." ) return specifier def __eq__(self, other: object) -> bool: """Whether or not the two SpecifierSet-like objects are equal. :param other: The other object to check against. The value of :attr:`prereleases` is ignored. >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.1") True >>> (SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False) == ... SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True)) True >>> SpecifierSet(">=1.0.0,!=1.0.1") == ">=1.0.0,!=1.0.1" True >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0") False >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.2") False """ if isinstance(other, (str, Specifier)): other = SpecifierSet(str(other)) elif not isinstance(other, SpecifierSet): return NotImplemented return self._specs == other._specs def __len__(self) -> int: """Returns the number of specifiers in this specifier set.""" return len(self._specs) def __iter__(self) -> Iterator[Specifier]: """ Returns an iterator over all the underlying :class:`Specifier` instances in this specifier set. >>> sorted(SpecifierSet(">=1.0.0,!=1.0.1"), key=str) [, =1.0.0')>] """ return iter(self._specs) def __contains__(self, item: UnparsedVersion) -> bool: """Return whether or not the item is contained in this specifier. :param item: The item to check for. This is used for the ``in`` operator and behaves the same as :meth:`contains` with no ``prereleases`` argument passed. >>> "1.2.3" in SpecifierSet(">=1.0.0,!=1.0.1") True >>> Version("1.2.3") in SpecifierSet(">=1.0.0,!=1.0.1") True >>> "1.0.1" in SpecifierSet(">=1.0.0,!=1.0.1") False >>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1") True >>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True) True """ return self.contains(item) def contains( self, item: UnparsedVersion, prereleases: bool | None = None, installed: bool | None = None, ) -> bool: """Return whether or not the item is contained in this SpecifierSet. :param item: The item to check for, which can be a version string or a :class:`Version` instance. :param prereleases: Whether or not to match prereleases with this SpecifierSet. If set to ``None`` (the default), it will follow the recommendation from :pep:`440` and match prereleases, as there are no other versions. :param installed: Whether or not the item is installed. If set to ``True``, it will accept prerelease versions even if the specifier does not allow them. >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.2.3") True >>> SpecifierSet(">=1.0.0,!=1.0.1").contains(Version("1.2.3")) True >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.0.1") False >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1") True >>> SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False).contains("1.3.0a1") False >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1", prereleases=True) True """ version = _coerce_version(item) if version is not None and installed and version.is_prerelease: prereleases = True check_item = item if version is None else version return bool(list(self.filter([check_item], prereleases=prereleases))) def filter( self, iterable: Iterable[UnparsedVersionVar], prereleases: bool | None = None ) -> Iterator[UnparsedVersionVar]: """Filter items in the given iterable, that match the specifiers in this set. :param iterable: An iterable that can contain version strings and :class:`Version` instances. The items in the iterable will be filtered according to the specifier. :param prereleases: Whether or not to allow prereleases in the returned iterator. If set to ``None`` (the default), it will follow the recommendation from :pep:`440` and match prereleases if there are no other versions. >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.3", "1.5a1"])) ['1.3'] >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.3", Version("1.4")])) ['1.3', ] >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.5a1"])) ['1.5a1'] >>> list(SpecifierSet(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True)) ['1.3', '1.5a1'] >>> list(SpecifierSet(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"])) ['1.3', '1.5a1'] An "empty" SpecifierSet will filter items based on the presence of prerelease versions in the set. >>> list(SpecifierSet("").filter(["1.3", "1.5a1"])) ['1.3'] >>> list(SpecifierSet("").filter(["1.5a1"])) ['1.5a1'] >>> list(SpecifierSet("", prereleases=True).filter(["1.3", "1.5a1"])) ['1.3', '1.5a1'] >>> list(SpecifierSet("").filter(["1.3", "1.5a1"], prereleases=True)) ['1.3', '1.5a1'] """ # Determine if we're forcing a prerelease or not, if we're not forcing # one for this particular filter call, then we'll use whatever the # SpecifierSet thinks for whether or not we should support prereleases. if prereleases is None and self.prereleases is not None: prereleases = self.prereleases # If we have any specifiers, then we want to wrap our iterable in the # filter method for each one, this will act as a logical AND amongst # each specifier. if self._specs: # When prereleases is None, we need to let all versions through # the individual filters, then decide about prereleases at the end # based on whether any non-prereleases matched ALL specs. for spec in self._specs: iterable = spec.filter( iterable, prereleases=True if prereleases is None else prereleases ) if prereleases is not None: # If we have a forced prereleases value, # we can immediately return the iterator. return iter(iterable) else: # Handle empty SpecifierSet cases where prereleases is not None. if prereleases is True: return iter(iterable) if prereleases is False: return ( item for item in iterable if (version := _coerce_version(item)) is None or not version.is_prerelease ) # Finally if prereleases is None, apply PEP 440 logic: # exclude prereleases unless there are no final releases that matched. filtered_items: list[UnparsedVersionVar] = [] found_prereleases: list[UnparsedVersionVar] = [] found_final_release = False for item in iterable: parsed_version = _coerce_version(item) # Arbitrary strings are always included as it is not # possible to determine if they are prereleases, # and they have already passed all specifiers. if parsed_version is None: filtered_items.append(item) found_prereleases.append(item) elif parsed_version.is_prerelease: found_prereleases.append(item) else: filtered_items.append(item) found_final_release = True return iter(filtered_items if found_final_release else found_prereleases) ================================================ FILE: src/pip/_vendor/packaging/tags.py ================================================ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. from __future__ import annotations import logging import platform import re import struct import subprocess import sys import sysconfig from importlib.machinery import EXTENSION_SUFFIXES from typing import ( Any, Iterable, Iterator, Sequence, Tuple, cast, ) from . import _manylinux, _musllinux logger = logging.getLogger(__name__) PythonVersion = Sequence[int] AppleVersion = Tuple[int, int] INTERPRETER_SHORT_NAMES: dict[str, str] = { "python": "py", # Generic. "cpython": "cp", "pypy": "pp", "ironpython": "ip", "jython": "jy", } _32_BIT_INTERPRETER = struct.calcsize("P") == 4 class Tag: """ A representation of the tag triple for a wheel. Instances are considered immutable and thus are hashable. Equality checking is also supported. """ __slots__ = ["_abi", "_hash", "_interpreter", "_platform"] def __init__(self, interpreter: str, abi: str, platform: str) -> None: self._interpreter = interpreter.lower() self._abi = abi.lower() self._platform = platform.lower() # The __hash__ of every single element in a Set[Tag] will be evaluated each time # that a set calls its `.disjoint()` method, which may be called hundreds of # times when scanning a page of links for packages with tags matching that # Set[Tag]. Pre-computing the value here produces significant speedups for # downstream consumers. self._hash = hash((self._interpreter, self._abi, self._platform)) @property def interpreter(self) -> str: return self._interpreter @property def abi(self) -> str: return self._abi @property def platform(self) -> str: return self._platform def __eq__(self, other: object) -> bool: if not isinstance(other, Tag): return NotImplemented return ( (self._hash == other._hash) # Short-circuit ASAP for perf reasons. and (self._platform == other._platform) and (self._abi == other._abi) and (self._interpreter == other._interpreter) ) def __hash__(self) -> int: return self._hash def __str__(self) -> str: return f"{self._interpreter}-{self._abi}-{self._platform}" def __repr__(self) -> str: return f"<{self} @ {id(self)}>" def __setstate__(self, state: tuple[None, dict[str, Any]]) -> None: # The cached _hash is wrong when unpickling. _, slots = state for k, v in slots.items(): setattr(self, k, v) self._hash = hash((self._interpreter, self._abi, self._platform)) def parse_tag(tag: str) -> frozenset[Tag]: """ Parses the provided tag (e.g. `py3-none-any`) into a frozenset of Tag instances. Returning a set is required due to the possibility that the tag is a compressed tag set. """ tags = set() interpreters, abis, platforms = tag.split("-") for interpreter in interpreters.split("."): for abi in abis.split("."): for platform_ in platforms.split("."): tags.add(Tag(interpreter, abi, platform_)) return frozenset(tags) def _get_config_var(name: str, warn: bool = False) -> int | str | None: value: int | str | None = sysconfig.get_config_var(name) if value is None and warn: logger.debug( "Config variable '%s' is unset, Python ABI tag may be incorrect", name ) return value def _normalize_string(string: str) -> str: return string.replace(".", "_").replace("-", "_").replace(" ", "_") def _is_threaded_cpython(abis: list[str]) -> bool: """ Determine if the ABI corresponds to a threaded (`--disable-gil`) build. The threaded builds are indicated by a "t" in the abiflags. """ if len(abis) == 0: return False # expect e.g., cp313 m = re.match(r"cp\d+(.*)", abis[0]) if not m: return False abiflags = m.group(1) return "t" in abiflags def _abi3_applies(python_version: PythonVersion, threading: bool) -> bool: """ Determine if the Python version supports abi3. PEP 384 was first implemented in Python 3.2. The threaded (`--disable-gil`) builds do not support abi3. """ return len(python_version) > 1 and tuple(python_version) >= (3, 2) and not threading def _cpython_abis(py_version: PythonVersion, warn: bool = False) -> list[str]: py_version = tuple(py_version) # To allow for version comparison. abis = [] version = _version_nodot(py_version[:2]) threading = debug = pymalloc = ucs4 = "" with_debug = _get_config_var("Py_DEBUG", warn) has_refcount = hasattr(sys, "gettotalrefcount") # Windows doesn't set Py_DEBUG, so checking for support of debug-compiled # extension modules is the best option. # https://github.com/pypa/pip/issues/3383#issuecomment-173267692 has_ext = "_d.pyd" in EXTENSION_SUFFIXES if with_debug or (with_debug is None and (has_refcount or has_ext)): debug = "d" if py_version >= (3, 13) and _get_config_var("Py_GIL_DISABLED", warn): threading = "t" if py_version < (3, 8): with_pymalloc = _get_config_var("WITH_PYMALLOC", warn) if with_pymalloc or with_pymalloc is None: pymalloc = "m" if py_version < (3, 3): unicode_size = _get_config_var("Py_UNICODE_SIZE", warn) if unicode_size == 4 or ( unicode_size is None and sys.maxunicode == 0x10FFFF ): ucs4 = "u" elif debug: # Debug builds can also load "normal" extension modules. # We can also assume no UCS-4 or pymalloc requirement. abis.append(f"cp{version}{threading}") abis.insert(0, f"cp{version}{threading}{debug}{pymalloc}{ucs4}") return abis def cpython_tags( python_version: PythonVersion | None = None, abis: Iterable[str] | None = None, platforms: Iterable[str] | None = None, *, warn: bool = False, ) -> Iterator[Tag]: """ Yields the tags for a CPython interpreter. The tags consist of: - cp-- - cp-abi3- - cp-none- - cp-abi3- # Older Python versions down to 3.2. If python_version only specifies a major version then user-provided ABIs and the 'none' ABItag will be used. If 'abi3' or 'none' are specified in 'abis' then they will be yielded at their normal position and not at the beginning. """ if not python_version: python_version = sys.version_info[:2] interpreter = f"cp{_version_nodot(python_version[:2])}" if abis is None: abis = _cpython_abis(python_version, warn) if len(python_version) > 1 else [] abis = list(abis) # 'abi3' and 'none' are explicitly handled later. for explicit_abi in ("abi3", "none"): try: abis.remove(explicit_abi) except ValueError: # noqa: PERF203 pass platforms = list(platforms or platform_tags()) for abi in abis: for platform_ in platforms: yield Tag(interpreter, abi, platform_) threading = _is_threaded_cpython(abis) use_abi3 = _abi3_applies(python_version, threading) if use_abi3: yield from (Tag(interpreter, "abi3", platform_) for platform_ in platforms) yield from (Tag(interpreter, "none", platform_) for platform_ in platforms) if use_abi3: for minor_version in range(python_version[1] - 1, 1, -1): for platform_ in platforms: version = _version_nodot((python_version[0], minor_version)) interpreter = f"cp{version}" yield Tag(interpreter, "abi3", platform_) def _generic_abi() -> list[str]: """ Return the ABI tag based on EXT_SUFFIX. """ # The following are examples of `EXT_SUFFIX`. # We want to keep the parts which are related to the ABI and remove the # parts which are related to the platform: # - linux: '.cpython-310-x86_64-linux-gnu.so' => cp310 # - mac: '.cpython-310-darwin.so' => cp310 # - win: '.cp310-win_amd64.pyd' => cp310 # - win: '.pyd' => cp37 (uses _cpython_abis()) # - pypy: '.pypy38-pp73-x86_64-linux-gnu.so' => pypy38_pp73 # - graalpy: '.graalpy-38-native-x86_64-darwin.dylib' # => graalpy_38_native ext_suffix = _get_config_var("EXT_SUFFIX", warn=True) if not isinstance(ext_suffix, str) or ext_suffix[0] != ".": raise SystemError("invalid sysconfig.get_config_var('EXT_SUFFIX')") parts = ext_suffix.split(".") if len(parts) < 3: # CPython3.7 and earlier uses ".pyd" on Windows. return _cpython_abis(sys.version_info[:2]) soabi = parts[1] if soabi.startswith("cpython"): # non-windows abi = "cp" + soabi.split("-")[1] elif soabi.startswith("cp"): # windows abi = soabi.split("-")[0] elif soabi.startswith("pypy"): abi = "-".join(soabi.split("-")[:2]) elif soabi.startswith("graalpy"): abi = "-".join(soabi.split("-")[:3]) elif soabi: # pyston, ironpython, others? abi = soabi else: return [] return [_normalize_string(abi)] def generic_tags( interpreter: str | None = None, abis: Iterable[str] | None = None, platforms: Iterable[str] | None = None, *, warn: bool = False, ) -> Iterator[Tag]: """ Yields the tags for a generic interpreter. The tags consist of: - -- The "none" ABI will be added if it was not explicitly provided. """ if not interpreter: interp_name = interpreter_name() interp_version = interpreter_version(warn=warn) interpreter = f"{interp_name}{interp_version}" abis = _generic_abi() if abis is None else list(abis) platforms = list(platforms or platform_tags()) if "none" not in abis: abis.append("none") for abi in abis: for platform_ in platforms: yield Tag(interpreter, abi, platform_) def _py_interpreter_range(py_version: PythonVersion) -> Iterator[str]: """ Yields Python versions in descending order. After the latest version, the major-only version will be yielded, and then all previous versions of that major version. """ if len(py_version) > 1: yield f"py{_version_nodot(py_version[:2])}" yield f"py{py_version[0]}" if len(py_version) > 1: for minor in range(py_version[1] - 1, -1, -1): yield f"py{_version_nodot((py_version[0], minor))}" def compatible_tags( python_version: PythonVersion | None = None, interpreter: str | None = None, platforms: Iterable[str] | None = None, ) -> Iterator[Tag]: """ Yields the sequence of tags that are compatible with a specific version of Python. The tags consist of: - py*-none- - -none-any # ... if `interpreter` is provided. - py*-none-any """ if not python_version: python_version = sys.version_info[:2] platforms = list(platforms or platform_tags()) for version in _py_interpreter_range(python_version): for platform_ in platforms: yield Tag(version, "none", platform_) if interpreter: yield Tag(interpreter, "none", "any") for version in _py_interpreter_range(python_version): yield Tag(version, "none", "any") def _mac_arch(arch: str, is_32bit: bool = _32_BIT_INTERPRETER) -> str: if not is_32bit: return arch if arch.startswith("ppc"): return "ppc" return "i386" def _mac_binary_formats(version: AppleVersion, cpu_arch: str) -> list[str]: formats = [cpu_arch] if cpu_arch == "x86_64": if version < (10, 4): return [] formats.extend(["intel", "fat64", "fat32"]) elif cpu_arch == "i386": if version < (10, 4): return [] formats.extend(["intel", "fat32", "fat"]) elif cpu_arch == "ppc64": # TODO: Need to care about 32-bit PPC for ppc64 through 10.2? if version > (10, 5) or version < (10, 4): return [] formats.append("fat64") elif cpu_arch == "ppc": if version > (10, 6): return [] formats.extend(["fat32", "fat"]) if cpu_arch in {"arm64", "x86_64"}: formats.append("universal2") if cpu_arch in {"x86_64", "i386", "ppc64", "ppc", "intel"}: formats.append("universal") return formats def mac_platforms( version: AppleVersion | None = None, arch: str | None = None ) -> Iterator[str]: """ Yields the platform tags for a macOS system. The `version` parameter is a two-item tuple specifying the macOS version to generate platform tags for. The `arch` parameter is the CPU architecture to generate platform tags for. Both parameters default to the appropriate value for the current system. """ version_str, _, cpu_arch = platform.mac_ver() if version is None: version = cast("AppleVersion", tuple(map(int, version_str.split(".")[:2]))) if version == (10, 16): # When built against an older macOS SDK, Python will report macOS 10.16 # instead of the real version. version_str = subprocess.run( [ sys.executable, "-sS", "-c", "import platform; print(platform.mac_ver()[0])", ], check=True, env={"SYSTEM_VERSION_COMPAT": "0"}, stdout=subprocess.PIPE, text=True, ).stdout version = cast("AppleVersion", tuple(map(int, version_str.split(".")[:2]))) if arch is None: arch = _mac_arch(cpu_arch) if (10, 0) <= version < (11, 0): # Prior to Mac OS 11, each yearly release of Mac OS bumped the # "minor" version number. The major version was always 10. major_version = 10 for minor_version in range(version[1], -1, -1): compat_version = major_version, minor_version binary_formats = _mac_binary_formats(compat_version, arch) for binary_format in binary_formats: yield f"macosx_{major_version}_{minor_version}_{binary_format}" if version >= (11, 0): # Starting with Mac OS 11, each yearly release bumps the major version # number. The minor versions are now the midyear updates. minor_version = 0 for major_version in range(version[0], 10, -1): compat_version = major_version, minor_version binary_formats = _mac_binary_formats(compat_version, arch) for binary_format in binary_formats: yield f"macosx_{major_version}_{minor_version}_{binary_format}" if version >= (11, 0): # Mac OS 11 on x86_64 is compatible with binaries from previous releases. # Arm64 support was introduced in 11.0, so no Arm binaries from previous # releases exist. # # However, the "universal2" binary format can have a # macOS version earlier than 11.0 when the x86_64 part of the binary supports # that version of macOS. major_version = 10 if arch == "x86_64": for minor_version in range(16, 3, -1): compat_version = major_version, minor_version binary_formats = _mac_binary_formats(compat_version, arch) for binary_format in binary_formats: yield f"macosx_{major_version}_{minor_version}_{binary_format}" else: for minor_version in range(16, 3, -1): compat_version = major_version, minor_version binary_format = "universal2" yield f"macosx_{major_version}_{minor_version}_{binary_format}" def ios_platforms( version: AppleVersion | None = None, multiarch: str | None = None ) -> Iterator[str]: """ Yields the platform tags for an iOS system. :param version: A two-item tuple specifying the iOS version to generate platform tags for. Defaults to the current iOS version. :param multiarch: The CPU architecture+ABI to generate platform tags for - (the value used by `sys.implementation._multiarch` e.g., `arm64_iphoneos` or `x84_64_iphonesimulator`). Defaults to the current multiarch value. """ if version is None: # if iOS is the current platform, ios_ver *must* be defined. However, # it won't exist for CPython versions before 3.13, which causes a mypy # error. _, release, _, _ = platform.ios_ver() # type: ignore[attr-defined, unused-ignore] version = cast("AppleVersion", tuple(map(int, release.split(".")[:2]))) if multiarch is None: multiarch = sys.implementation._multiarch multiarch = multiarch.replace("-", "_") ios_platform_template = "ios_{major}_{minor}_{multiarch}" # Consider any iOS major.minor version from the version requested, down to # 12.0. 12.0 is the first iOS version that is known to have enough features # to support CPython. Consider every possible minor release up to X.9. There # highest the minor has ever gone is 8 (14.8 and 15.8) but having some extra # candidates that won't ever match doesn't really hurt, and it saves us from # having to keep an explicit list of known iOS versions in the code. Return # the results descending order of version number. # If the requested major version is less than 12, there won't be any matches. if version[0] < 12: return # Consider the actual X.Y version that was requested. yield ios_platform_template.format( major=version[0], minor=version[1], multiarch=multiarch ) # Consider every minor version from X.0 to the minor version prior to the # version requested by the platform. for minor in range(version[1] - 1, -1, -1): yield ios_platform_template.format( major=version[0], minor=minor, multiarch=multiarch ) for major in range(version[0] - 1, 11, -1): for minor in range(9, -1, -1): yield ios_platform_template.format( major=major, minor=minor, multiarch=multiarch ) def android_platforms( api_level: int | None = None, abi: str | None = None ) -> Iterator[str]: """ Yields the :attr:`~Tag.platform` tags for Android. If this function is invoked on non-Android platforms, the ``api_level`` and ``abi`` arguments are required. :param int api_level: The maximum `API level `__ to return. Defaults to the current system's version, as returned by ``platform.android_ver``. :param str abi: The `Android ABI `__, e.g. ``arm64_v8a``. Defaults to the current system's ABI , as returned by ``sysconfig.get_platform``. Hyphens and periods will be replaced with underscores. """ if platform.system() != "Android" and (api_level is None or abi is None): raise TypeError( "on non-Android platforms, the api_level and abi arguments are required" ) if api_level is None: # Python 3.13 was the first version to return platform.system() == "Android", # and also the first version to define platform.android_ver(). api_level = platform.android_ver().api_level # type: ignore[attr-defined] if abi is None: abi = sysconfig.get_platform().split("-")[-1] abi = _normalize_string(abi) # 16 is the minimum API level known to have enough features to support CPython # without major patching. Yield every API level from the maximum down to the # minimum, inclusive. min_api_level = 16 for ver in range(api_level, min_api_level - 1, -1): yield f"android_{ver}_{abi}" def _linux_platforms(is_32bit: bool = _32_BIT_INTERPRETER) -> Iterator[str]: linux = _normalize_string(sysconfig.get_platform()) if not linux.startswith("linux_"): # we should never be here, just yield the sysconfig one and return yield linux return if is_32bit: if linux == "linux_x86_64": linux = "linux_i686" elif linux == "linux_aarch64": linux = "linux_armv8l" _, arch = linux.split("_", 1) archs = {"armv8l": ["armv8l", "armv7l"]}.get(arch, [arch]) yield from _manylinux.platform_tags(archs) yield from _musllinux.platform_tags(archs) for arch in archs: yield f"linux_{arch}" def _generic_platforms() -> Iterator[str]: yield _normalize_string(sysconfig.get_platform()) def platform_tags() -> Iterator[str]: """ Provides the platform tags for this installation. """ if platform.system() == "Darwin": return mac_platforms() elif platform.system() == "iOS": return ios_platforms() elif platform.system() == "Android": return android_platforms() elif platform.system() == "Linux": return _linux_platforms() else: return _generic_platforms() def interpreter_name() -> str: """ Returns the name of the running interpreter. Some implementations have a reserved, two-letter abbreviation which will be returned when appropriate. """ name = sys.implementation.name return INTERPRETER_SHORT_NAMES.get(name) or name def interpreter_version(*, warn: bool = False) -> str: """ Returns the version of the running interpreter. """ version = _get_config_var("py_version_nodot", warn=warn) return str(version) if version else _version_nodot(sys.version_info[:2]) def _version_nodot(version: PythonVersion) -> str: return "".join(map(str, version)) def sys_tags(*, warn: bool = False) -> Iterator[Tag]: """ Returns the sequence of tag triples for the running interpreter. The order of the sequence corresponds to priority order for the interpreter, from most to least important. """ interp_name = interpreter_name() if interp_name == "cp": yield from cpython_tags(warn=warn) else: yield from generic_tags() if interp_name == "pp": interp = "pp3" elif interp_name == "cp": interp = "cp" + interpreter_version(warn=warn) else: interp = None yield from compatible_tags(interpreter=interp) ================================================ FILE: src/pip/_vendor/packaging/utils.py ================================================ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. from __future__ import annotations import re from typing import NewType, Tuple, Union, cast from .tags import Tag, parse_tag from .version import InvalidVersion, Version, _TrimmedRelease BuildTag = Union[Tuple[()], Tuple[int, str]] NormalizedName = NewType("NormalizedName", str) class InvalidName(ValueError): """ An invalid distribution name; users should refer to the packaging user guide. """ class InvalidWheelFilename(ValueError): """ An invalid wheel filename was found, users should refer to PEP 427. """ class InvalidSdistFilename(ValueError): """ An invalid sdist filename was found, users should refer to the packaging user guide. """ # Core metadata spec for `Name` _validate_regex = re.compile(r"[A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9]", re.IGNORECASE) _normalized_regex = re.compile(r"[a-z0-9]|[a-z0-9]([a-z0-9-](?!--))*[a-z0-9]") # PEP 427: The build number must start with a digit. _build_tag_regex = re.compile(r"(\d+)(.*)") def canonicalize_name(name: str, *, validate: bool = False) -> NormalizedName: if validate and not _validate_regex.fullmatch(name): raise InvalidName(f"name is invalid: {name!r}") # Ensure all ``.`` and ``_`` are ``-`` # Emulates ``re.sub(r"[-_.]+", "-", name).lower()`` from PEP 503 # Much faster than re, and even faster than str.translate value = name.lower().replace("_", "-").replace(".", "-") # Condense repeats (faster than regex) while "--" in value: value = value.replace("--", "-") return cast("NormalizedName", value) def is_normalized_name(name: str) -> bool: return _normalized_regex.fullmatch(name) is not None def canonicalize_version( version: Version | str, *, strip_trailing_zero: bool = True ) -> str: """ Return a canonical form of a version as a string. >>> canonicalize_version('1.0.1') '1.0.1' Per PEP 625, versions may have multiple canonical forms, differing only by trailing zeros. >>> canonicalize_version('1.0.0') '1' >>> canonicalize_version('1.0.0', strip_trailing_zero=False) '1.0.0' Invalid versions are returned unaltered. >>> canonicalize_version('foo bar baz') 'foo bar baz' """ if isinstance(version, str): try: version = Version(version) except InvalidVersion: return str(version) return str(_TrimmedRelease(version) if strip_trailing_zero else version) def parse_wheel_filename( filename: str, ) -> tuple[NormalizedName, Version, BuildTag, frozenset[Tag]]: if not filename.endswith(".whl"): raise InvalidWheelFilename( f"Invalid wheel filename (extension must be '.whl'): {filename!r}" ) filename = filename[:-4] dashes = filename.count("-") if dashes not in (4, 5): raise InvalidWheelFilename( f"Invalid wheel filename (wrong number of parts): {filename!r}" ) parts = filename.split("-", dashes - 2) name_part = parts[0] # See PEP 427 for the rules on escaping the project name. if "__" in name_part or re.match(r"^[\w\d._]*$", name_part, re.UNICODE) is None: raise InvalidWheelFilename(f"Invalid project name: {filename!r}") name = canonicalize_name(name_part) try: version = Version(parts[1]) except InvalidVersion as e: raise InvalidWheelFilename( f"Invalid wheel filename (invalid version): {filename!r}" ) from e if dashes == 5: build_part = parts[2] build_match = _build_tag_regex.match(build_part) if build_match is None: raise InvalidWheelFilename( f"Invalid build number: {build_part} in {filename!r}" ) build = cast("BuildTag", (int(build_match.group(1)), build_match.group(2))) else: build = () tags = parse_tag(parts[-1]) return (name, version, build, tags) def parse_sdist_filename(filename: str) -> tuple[NormalizedName, Version]: if filename.endswith(".tar.gz"): file_stem = filename[: -len(".tar.gz")] elif filename.endswith(".zip"): file_stem = filename[: -len(".zip")] else: raise InvalidSdistFilename( f"Invalid sdist filename (extension must be '.tar.gz' or '.zip'):" f" {filename!r}" ) # We are requiring a PEP 440 version, which cannot contain dashes, # so we split on the last dash. name_part, sep, version_part = file_stem.rpartition("-") if not sep: raise InvalidSdistFilename(f"Invalid sdist filename: {filename!r}") name = canonicalize_name(name_part) try: version = Version(version_part) except InvalidVersion as e: raise InvalidSdistFilename( f"Invalid sdist filename (invalid version): {filename!r}" ) from e return (name, version) ================================================ FILE: src/pip/_vendor/packaging/version.py ================================================ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. """ .. testsetup:: from pip._vendor.packaging.version import parse, Version """ from __future__ import annotations import re import sys import typing from typing import ( Any, Callable, Literal, NamedTuple, SupportsInt, Tuple, TypedDict, Union, ) from ._structures import Infinity, InfinityType, NegativeInfinity, NegativeInfinityType if typing.TYPE_CHECKING: from typing_extensions import Self, Unpack if sys.version_info >= (3, 13): # pragma: no cover from warnings import deprecated as _deprecated elif typing.TYPE_CHECKING: from typing_extensions import deprecated as _deprecated else: # pragma: no cover import functools import warnings def _deprecated(message: str) -> object: def decorator(func: object) -> object: @functools.wraps(func) def wrapper(*args: object, **kwargs: object) -> object: warnings.warn( message, category=DeprecationWarning, stacklevel=2, ) return func(*args, **kwargs) return wrapper return decorator _LETTER_NORMALIZATION = { "alpha": "a", "beta": "b", "c": "rc", "pre": "rc", "preview": "rc", "rev": "post", "r": "post", } __all__ = ["VERSION_PATTERN", "InvalidVersion", "Version", "parse"] LocalType = Tuple[Union[int, str], ...] CmpPrePostDevType = Union[InfinityType, NegativeInfinityType, Tuple[str, int]] CmpLocalType = Union[ NegativeInfinityType, Tuple[Union[Tuple[int, str], Tuple[NegativeInfinityType, Union[int, str]]], ...], ] CmpKey = Tuple[ int, Tuple[int, ...], CmpPrePostDevType, CmpPrePostDevType, CmpPrePostDevType, CmpLocalType, ] VersionComparisonMethod = Callable[[CmpKey, CmpKey], bool] class _VersionReplace(TypedDict, total=False): epoch: int | None release: tuple[int, ...] | None pre: tuple[Literal["a", "b", "rc"], int] | None post: int | None dev: int | None local: str | None def parse(version: str) -> Version: """Parse the given version string. >>> parse('1.0.dev1') :param version: The version string to parse. :raises InvalidVersion: When the version string is not a valid version. """ return Version(version) class InvalidVersion(ValueError): """Raised when a version string is not a valid version. >>> Version("invalid") Traceback (most recent call last): ... packaging.version.InvalidVersion: Invalid version: 'invalid' """ class _BaseVersion: __slots__ = () # This can also be a normal member (see the packaging_legacy package); # we are just requiring it to be readable. Actually defining a property # has runtime effect on subclasses, so it's typing only. if typing.TYPE_CHECKING: @property def _key(self) -> tuple[Any, ...]: ... def __hash__(self) -> int: return hash(self._key) # Please keep the duplicated `isinstance` check # in the six comparisons hereunder # unless you find a way to avoid adding overhead function calls. def __lt__(self, other: _BaseVersion) -> bool: if not isinstance(other, _BaseVersion): return NotImplemented return self._key < other._key def __le__(self, other: _BaseVersion) -> bool: if not isinstance(other, _BaseVersion): return NotImplemented return self._key <= other._key def __eq__(self, other: object) -> bool: if not isinstance(other, _BaseVersion): return NotImplemented return self._key == other._key def __ge__(self, other: _BaseVersion) -> bool: if not isinstance(other, _BaseVersion): return NotImplemented return self._key >= other._key def __gt__(self, other: _BaseVersion) -> bool: if not isinstance(other, _BaseVersion): return NotImplemented return self._key > other._key def __ne__(self, other: object) -> bool: if not isinstance(other, _BaseVersion): return NotImplemented return self._key != other._key # Deliberately not anchored to the start and end of the string, to make it # easier for 3rd party code to reuse # Note that ++ doesn't behave identically on CPython and PyPy, so not using it here _VERSION_PATTERN = r""" v?+ # optional leading v (?: (?:(?P[0-9]+)!)?+ # epoch (?P[0-9]+(?:\.[0-9]+)*+) # release segment (?P
                                          # pre-release
            [._-]?+
            (?Palpha|a|beta|b|preview|pre|c|rc)
            [._-]?+
            (?P[0-9]+)?
        )?+
        (?P                                         # post release
            (?:-(?P[0-9]+))
            |
            (?:
                [._-]?
                (?Ppost|rev|r)
                [._-]?
                (?P[0-9]+)?
            )
        )?+
        (?P                                          # dev release
            [._-]?+
            (?Pdev)
            [._-]?+
            (?P[0-9]+)?
        )?+
    )
    (?:\+
        (?P                                        # local version
            [a-z0-9]+
            (?:[._-][a-z0-9]+)*+
        )
    )?+
"""

_VERSION_PATTERN_OLD = _VERSION_PATTERN.replace("*+", "*").replace("?+", "?")

# Possessive qualifiers were added in Python 3.11.
# CPython 3.11.0-3.11.4 had a bug: https://github.com/python/cpython/pull/107795
# Older PyPy also had a bug.
VERSION_PATTERN = (
    _VERSION_PATTERN_OLD
    if (sys.implementation.name == "cpython" and sys.version_info < (3, 11, 5))
    or (sys.implementation.name == "pypy" and sys.version_info < (3, 11, 13))
    or sys.version_info < (3, 11)
    else _VERSION_PATTERN
)
"""
A string containing the regular expression used to match a valid version.

The pattern is not anchored at either end, and is intended for embedding in larger
expressions (for example, matching a version number as part of a file name). The
regular expression should be compiled with the ``re.VERBOSE`` and ``re.IGNORECASE``
flags set.

:meta hide-value:
"""


# Validation pattern for local version in replace()
_LOCAL_PATTERN = re.compile(r"[a-z0-9]+(?:[._-][a-z0-9]+)*", re.IGNORECASE)


def _validate_epoch(value: object, /) -> int:
    epoch = value or 0
    if isinstance(epoch, int) and epoch >= 0:
        return epoch
    msg = f"epoch must be non-negative integer, got {epoch}"
    raise InvalidVersion(msg)


def _validate_release(value: object, /) -> tuple[int, ...]:
    release = (0,) if value is None else value
    if (
        isinstance(release, tuple)
        and len(release) > 0
        and all(isinstance(i, int) and i >= 0 for i in release)
    ):
        return release
    msg = f"release must be a non-empty tuple of non-negative integers, got {release}"
    raise InvalidVersion(msg)


def _validate_pre(value: object, /) -> tuple[Literal["a", "b", "rc"], int] | None:
    if value is None:
        return value
    if (
        isinstance(value, tuple)
        and len(value) == 2
        and value[0] in ("a", "b", "rc")
        and isinstance(value[1], int)
        and value[1] >= 0
    ):
        return value
    msg = f"pre must be a tuple of ('a'|'b'|'rc', non-negative int), got {value}"
    raise InvalidVersion(msg)


def _validate_post(value: object, /) -> tuple[Literal["post"], int] | None:
    if value is None:
        return value
    if isinstance(value, int) and value >= 0:
        return ("post", value)
    msg = f"post must be non-negative integer, got {value}"
    raise InvalidVersion(msg)


def _validate_dev(value: object, /) -> tuple[Literal["dev"], int] | None:
    if value is None:
        return value
    if isinstance(value, int) and value >= 0:
        return ("dev", value)
    msg = f"dev must be non-negative integer, got {value}"
    raise InvalidVersion(msg)


def _validate_local(value: object, /) -> LocalType | None:
    if value is None:
        return value
    if isinstance(value, str) and _LOCAL_PATTERN.fullmatch(value):
        return _parse_local_version(value)
    msg = f"local must be a valid version string, got {value!r}"
    raise InvalidVersion(msg)


# Backward compatibility for internals before 26.0. Do not use.
class _Version(NamedTuple):
    epoch: int
    release: tuple[int, ...]
    dev: tuple[str, int] | None
    pre: tuple[str, int] | None
    post: tuple[str, int] | None
    local: LocalType | None


class Version(_BaseVersion):
    """This class abstracts handling of a project's versions.

    A :class:`Version` instance is comparison aware and can be compared and
    sorted using the standard Python interfaces.

    >>> v1 = Version("1.0a5")
    >>> v2 = Version("1.0")
    >>> v1
    
    >>> v2
    
    >>> v1 < v2
    True
    >>> v1 == v2
    False
    >>> v1 > v2
    False
    >>> v1 >= v2
    False
    >>> v1 <= v2
    True
    """

    __slots__ = ("_dev", "_epoch", "_key_cache", "_local", "_post", "_pre", "_release")
    __match_args__ = ("_str",)

    _regex = re.compile(r"\s*" + VERSION_PATTERN + r"\s*", re.VERBOSE | re.IGNORECASE)

    _epoch: int
    _release: tuple[int, ...]
    _dev: tuple[str, int] | None
    _pre: tuple[str, int] | None
    _post: tuple[str, int] | None
    _local: LocalType | None

    _key_cache: CmpKey | None

    def __init__(self, version: str) -> None:
        """Initialize a Version object.

        :param version:
            The string representation of a version which will be parsed and normalized
            before use.
        :raises InvalidVersion:
            If the ``version`` does not conform to PEP 440 in any way then this
            exception will be raised.
        """
        # Validate the version and parse it into pieces
        match = self._regex.fullmatch(version)
        if not match:
            raise InvalidVersion(f"Invalid version: {version!r}")
        self._epoch = int(match.group("epoch")) if match.group("epoch") else 0
        self._release = tuple(map(int, match.group("release").split(".")))
        self._pre = _parse_letter_version(match.group("pre_l"), match.group("pre_n"))
        self._post = _parse_letter_version(
            match.group("post_l"), match.group("post_n1") or match.group("post_n2")
        )
        self._dev = _parse_letter_version(match.group("dev_l"), match.group("dev_n"))
        self._local = _parse_local_version(match.group("local"))

        # Key which will be used for sorting
        self._key_cache = None

    def __replace__(self, **kwargs: Unpack[_VersionReplace]) -> Self:
        epoch = _validate_epoch(kwargs["epoch"]) if "epoch" in kwargs else self._epoch
        release = (
            _validate_release(kwargs["release"])
            if "release" in kwargs
            else self._release
        )
        pre = _validate_pre(kwargs["pre"]) if "pre" in kwargs else self._pre
        post = _validate_post(kwargs["post"]) if "post" in kwargs else self._post
        dev = _validate_dev(kwargs["dev"]) if "dev" in kwargs else self._dev
        local = _validate_local(kwargs["local"]) if "local" in kwargs else self._local

        if (
            epoch == self._epoch
            and release == self._release
            and pre == self._pre
            and post == self._post
            and dev == self._dev
            and local == self._local
        ):
            return self

        new_version = self.__class__.__new__(self.__class__)
        new_version._key_cache = None
        new_version._epoch = epoch
        new_version._release = release
        new_version._pre = pre
        new_version._post = post
        new_version._dev = dev
        new_version._local = local

        return new_version

    @property
    def _key(self) -> CmpKey:
        if self._key_cache is None:
            self._key_cache = _cmpkey(
                self._epoch,
                self._release,
                self._pre,
                self._post,
                self._dev,
                self._local,
            )
        return self._key_cache

    @property
    @_deprecated("Version._version is private and will be removed soon")
    def _version(self) -> _Version:
        return _Version(
            self._epoch, self._release, self._dev, self._pre, self._post, self._local
        )

    @_version.setter
    @_deprecated("Version._version is private and will be removed soon")
    def _version(self, value: _Version) -> None:
        self._epoch = value.epoch
        self._release = value.release
        self._dev = value.dev
        self._pre = value.pre
        self._post = value.post
        self._local = value.local
        self._key_cache = None

    def __repr__(self) -> str:
        """A representation of the Version that shows all internal state.

        >>> Version('1.0.0')
        
        """
        return f""

    def __str__(self) -> str:
        """A string representation of the version that can be round-tripped.

        >>> str(Version("1.0a5"))
        '1.0a5'
        """
        # This is a hot function, so not calling self.base_version
        version = ".".join(map(str, self.release))

        # Epoch
        if self.epoch:
            version = f"{self.epoch}!{version}"

        # Pre-release
        if self.pre is not None:
            version += "".join(map(str, self.pre))

        # Post-release
        if self.post is not None:
            version += f".post{self.post}"

        # Development release
        if self.dev is not None:
            version += f".dev{self.dev}"

        # Local version segment
        if self.local is not None:
            version += f"+{self.local}"

        return version

    @property
    def _str(self) -> str:
        """Internal property for match_args"""
        return str(self)

    @property
    def epoch(self) -> int:
        """The epoch of the version.

        >>> Version("2.0.0").epoch
        0
        >>> Version("1!2.0.0").epoch
        1
        """
        return self._epoch

    @property
    def release(self) -> tuple[int, ...]:
        """The components of the "release" segment of the version.

        >>> Version("1.2.3").release
        (1, 2, 3)
        >>> Version("2.0.0").release
        (2, 0, 0)
        >>> Version("1!2.0.0.post0").release
        (2, 0, 0)

        Includes trailing zeroes but not the epoch or any pre-release / development /
        post-release suffixes.
        """
        return self._release

    @property
    def pre(self) -> tuple[str, int] | None:
        """The pre-release segment of the version.

        >>> print(Version("1.2.3").pre)
        None
        >>> Version("1.2.3a1").pre
        ('a', 1)
        >>> Version("1.2.3b1").pre
        ('b', 1)
        >>> Version("1.2.3rc1").pre
        ('rc', 1)
        """
        return self._pre

    @property
    def post(self) -> int | None:
        """The post-release number of the version.

        >>> print(Version("1.2.3").post)
        None
        >>> Version("1.2.3.post1").post
        1
        """
        return self._post[1] if self._post else None

    @property
    def dev(self) -> int | None:
        """The development number of the version.

        >>> print(Version("1.2.3").dev)
        None
        >>> Version("1.2.3.dev1").dev
        1
        """
        return self._dev[1] if self._dev else None

    @property
    def local(self) -> str | None:
        """The local version segment of the version.

        >>> print(Version("1.2.3").local)
        None
        >>> Version("1.2.3+abc").local
        'abc'
        """
        if self._local:
            return ".".join(str(x) for x in self._local)
        else:
            return None

    @property
    def public(self) -> str:
        """The public portion of the version.

        >>> Version("1.2.3").public
        '1.2.3'
        >>> Version("1.2.3+abc").public
        '1.2.3'
        >>> Version("1!1.2.3dev1+abc").public
        '1!1.2.3.dev1'
        """
        return str(self).split("+", 1)[0]

    @property
    def base_version(self) -> str:
        """The "base version" of the version.

        >>> Version("1.2.3").base_version
        '1.2.3'
        >>> Version("1.2.3+abc").base_version
        '1.2.3'
        >>> Version("1!1.2.3dev1+abc").base_version
        '1!1.2.3'

        The "base version" is the public version of the project without any pre or post
        release markers.
        """
        release_segment = ".".join(map(str, self.release))
        return f"{self.epoch}!{release_segment}" if self.epoch else release_segment

    @property
    def is_prerelease(self) -> bool:
        """Whether this version is a pre-release.

        >>> Version("1.2.3").is_prerelease
        False
        >>> Version("1.2.3a1").is_prerelease
        True
        >>> Version("1.2.3b1").is_prerelease
        True
        >>> Version("1.2.3rc1").is_prerelease
        True
        >>> Version("1.2.3dev1").is_prerelease
        True
        """
        return self.dev is not None or self.pre is not None

    @property
    def is_postrelease(self) -> bool:
        """Whether this version is a post-release.

        >>> Version("1.2.3").is_postrelease
        False
        >>> Version("1.2.3.post1").is_postrelease
        True
        """
        return self.post is not None

    @property
    def is_devrelease(self) -> bool:
        """Whether this version is a development release.

        >>> Version("1.2.3").is_devrelease
        False
        >>> Version("1.2.3.dev1").is_devrelease
        True
        """
        return self.dev is not None

    @property
    def major(self) -> int:
        """The first item of :attr:`release` or ``0`` if unavailable.

        >>> Version("1.2.3").major
        1
        """
        return self.release[0] if len(self.release) >= 1 else 0

    @property
    def minor(self) -> int:
        """The second item of :attr:`release` or ``0`` if unavailable.

        >>> Version("1.2.3").minor
        2
        >>> Version("1").minor
        0
        """
        return self.release[1] if len(self.release) >= 2 else 0

    @property
    def micro(self) -> int:
        """The third item of :attr:`release` or ``0`` if unavailable.

        >>> Version("1.2.3").micro
        3
        >>> Version("1").micro
        0
        """
        return self.release[2] if len(self.release) >= 3 else 0


class _TrimmedRelease(Version):
    __slots__ = ()

    def __init__(self, version: str | Version) -> None:
        if isinstance(version, Version):
            self._epoch = version._epoch
            self._release = version._release
            self._dev = version._dev
            self._pre = version._pre
            self._post = version._post
            self._local = version._local
            self._key_cache = version._key_cache
            return
        super().__init__(version)  # pragma: no cover

    @property
    def release(self) -> tuple[int, ...]:
        """
        Release segment without any trailing zeros.

        >>> _TrimmedRelease('1.0.0').release
        (1,)
        >>> _TrimmedRelease('0.0').release
        (0,)
        """
        # This leaves one 0.
        rel = super().release
        len_release = len(rel)
        i = len_release
        while i > 1 and rel[i - 1] == 0:
            i -= 1
        return rel if i == len_release else rel[:i]


def _parse_letter_version(
    letter: str | None, number: str | bytes | SupportsInt | None
) -> tuple[str, int] | None:
    if letter:
        # We normalize any letters to their lower case form
        letter = letter.lower()

        # We consider some words to be alternate spellings of other words and
        # in those cases we want to normalize the spellings to our preferred
        # spelling.
        letter = _LETTER_NORMALIZATION.get(letter, letter)

        # We consider there to be an implicit 0 in a pre-release if there is
        # not a numeral associated with it.
        return letter, int(number or 0)

    if number:
        # We assume if we are given a number, but we are not given a letter
        # then this is using the implicit post release syntax (e.g. 1.0-1)
        return "post", int(number)

    return None


_local_version_separators = re.compile(r"[\._-]")


def _parse_local_version(local: str | None) -> LocalType | None:
    """
    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
    """
    if local is not None:
        return tuple(
            part.lower() if not part.isdigit() else int(part)
            for part in _local_version_separators.split(local)
        )
    return None


def _cmpkey(
    epoch: int,
    release: tuple[int, ...],
    pre: tuple[str, int] | None,
    post: tuple[str, int] | None,
    dev: tuple[str, int] | None,
    local: LocalType | None,
) -> CmpKey:
    # When we compare a release version, we want to compare it with all of the
    # trailing zeros removed. We will use this for our sorting key.
    len_release = len(release)
    i = len_release
    while i and release[i - 1] == 0:
        i -= 1
    _release = release if i == len_release else release[:i]

    # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
    # We'll do this by abusing the pre segment, but we _only_ want to do this
    # if there is not a pre or a post segment. If we have one of those then
    # the normal sorting rules will handle this case correctly.
    if pre is None and post is None and dev is not None:
        _pre: CmpPrePostDevType = NegativeInfinity
    # Versions without a pre-release (except as noted above) should sort after
    # those with one.
    elif pre is None:
        _pre = Infinity
    else:
        _pre = pre

    # Versions without a post segment should sort before those with one.
    if post is None:
        _post: CmpPrePostDevType = NegativeInfinity

    else:
        _post = post

    # Versions without a development segment should sort after those with one.
    if dev is None:
        _dev: CmpPrePostDevType = Infinity

    else:
        _dev = dev

    if local is None:
        # Versions without a local segment should sort before those with one.
        _local: CmpLocalType = NegativeInfinity
    else:
        # Versions with a local segment need that segment parsed to implement
        # the sorting rules in PEP440.
        # - Alpha numeric segments sort before numeric segments
        # - Alpha numeric segments sort lexicographically
        # - Numeric segments sort numerically
        # - Shorter versions sort before longer versions when the prefixes
        #   match exactly
        _local = tuple(
            (i, "") if isinstance(i, int) else (NegativeInfinity, i) for i in local
        )

    return epoch, _release, _pre, _post, _dev, _local


================================================
FILE: src/pip/_vendor/pkg_resources/LICENSE
================================================
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.


================================================
FILE: src/pip/_vendor/pkg_resources/__init__.py
================================================
# TODO: Add Generic type annotations to initialized collections.
# For now we'd simply use implicit Any/Unknown which would add redundant annotations
# mypy: disable-error-code="var-annotated"
"""
Package resource API
--------------------

A resource is a logical file contained within a package, or a logical
subdirectory thereof.  The package resource API expects resource names
to have their path parts separated with ``/``, *not* whatever the local
path separator is.  Do not use os.path operations to manipulate resource
names being passed into the API.

The package resource API is designed to work with normal filesystem packages,
.egg files, and unpacked .egg files.  It can also work in a limited way with
.zip files and with custom PEP 302 loaders that support the ``get_data()``
method.

This module is deprecated. Users are directed to :mod:`importlib.resources`,
:mod:`importlib.metadata` and :pypi:`packaging` instead.
"""

from __future__ import annotations

import sys

if sys.version_info < (3, 8):  # noqa: UP036 # Check for unsupported versions
    raise RuntimeError("Python 3.8 or later is required")

import os
import io
import time
import re
import types
from typing import (
    Any,
    Literal,
    Dict,
    Iterator,
    Mapping,
    MutableSequence,
    NamedTuple,
    NoReturn,
    Tuple,
    Union,
    TYPE_CHECKING,
    Protocol,
    Callable,
    Iterable,
    TypeVar,
    overload,
)
import zipfile
import zipimport
import warnings
import stat
import functools
import pkgutil
import operator
import platform
import collections
import plistlib
import email.parser
import errno
import tempfile
import textwrap
import inspect
import ntpath
import posixpath
import importlib
import importlib.abc
import importlib.machinery
from pkgutil import get_importer

import _imp

# capture these to bypass sandboxing
from os import utime
from os import open as os_open
from os.path import isdir, split

try:
    from os import mkdir, rename, unlink

    WRITE_SUPPORT = True
except ImportError:
    # no write support, probably under GAE
    WRITE_SUPPORT = False

from pip._internal.utils._jaraco_text import (
    yield_lines,
    drop_comment,
    join_continuation,
)
from pip._vendor.packaging import markers as _packaging_markers
from pip._vendor.packaging import requirements as _packaging_requirements
from pip._vendor.packaging import utils as _packaging_utils
from pip._vendor.packaging import version as _packaging_version
from pip._vendor.platformdirs import user_cache_dir as _user_cache_dir

if TYPE_CHECKING:
    from _typeshed import BytesPath, StrPath, StrOrBytesPath
    from typing_extensions import Self


# Patch: Remove deprecation warning from vendored pkg_resources.
# Setting PYTHONWARNINGS=error to verify builds produce no warnings
# causes immediate exceptions.
# See https://github.com/pypa/pip/issues/12243


_T = TypeVar("_T")
_DistributionT = TypeVar("_DistributionT", bound="Distribution")
# Type aliases
_NestedStr = Union[str, Iterable[Union[str, Iterable["_NestedStr"]]]]
_InstallerTypeT = Callable[["Requirement"], "_DistributionT"]
_InstallerType = Callable[["Requirement"], Union["Distribution", None]]
_PkgReqType = Union[str, "Requirement"]
_EPDistType = Union["Distribution", _PkgReqType]
_MetadataType = Union["IResourceProvider", None]
_ResolvedEntryPoint = Any  # Can be any attribute in the module
_ResourceStream = Any  # TODO / Incomplete: A readable file-like object
# Any object works, but let's indicate we expect something like a module (optionally has __loader__ or __file__)
_ModuleLike = Union[object, types.ModuleType]
# Any: Should be _ModuleLike but we end up with issues where _ModuleLike doesn't have _ZipLoaderModule's __loader__
_ProviderFactoryType = Callable[[Any], "IResourceProvider"]
_DistFinderType = Callable[[_T, str, bool], Iterable["Distribution"]]
_NSHandlerType = Callable[[_T, str, str, types.ModuleType], Union[str, None]]
_AdapterT = TypeVar(
    "_AdapterT", _DistFinderType[Any], _ProviderFactoryType, _NSHandlerType[Any]
)


# Use _typeshed.importlib.LoaderProtocol once available https://github.com/python/typeshed/pull/11890
class _LoaderProtocol(Protocol):
    def load_module(self, fullname: str, /) -> types.ModuleType: ...


class _ZipLoaderModule(Protocol):
    __loader__: zipimport.zipimporter


_PEP440_FALLBACK = re.compile(r"^v?(?P(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.I)


class PEP440Warning(RuntimeWarning):
    """
    Used when there is an issue with a version or specifier not complying with
    PEP 440.
    """


parse_version = _packaging_version.Version


_state_vars: dict[str, str] = {}


def _declare_state(vartype: str, varname: str, initial_value: _T) -> _T:
    _state_vars[varname] = vartype
    return initial_value


def __getstate__() -> dict[str, Any]:
    state = {}
    g = globals()
    for k, v in _state_vars.items():
        state[k] = g['_sget_' + v](g[k])
    return state


def __setstate__(state: dict[str, Any]) -> dict[str, Any]:
    g = globals()
    for k, v in state.items():
        g['_sset_' + _state_vars[k]](k, g[k], v)
    return state


def _sget_dict(val):
    return val.copy()


def _sset_dict(key, ob, state):
    ob.clear()
    ob.update(state)


def _sget_object(val):
    return val.__getstate__()


def _sset_object(key, ob, state):
    ob.__setstate__(state)


_sget_none = _sset_none = lambda *args: None


def get_supported_platform():
    """Return this platform's maximum compatible version.

    distutils.util.get_platform() normally reports the minimum version
    of macOS that would be required to *use* extensions produced by
    distutils.  But what we want when checking compatibility is to know the
    version of macOS that we are *running*.  To allow usage of packages that
    explicitly require a newer version of macOS, we must also know the
    current version of the OS.

    If this condition occurs for any other platform with a version in its
    platform strings, this function should be extended accordingly.
    """
    plat = get_build_platform()
    m = macosVersionString.match(plat)
    if m is not None and sys.platform == "darwin":
        try:
            plat = 'macosx-%s-%s' % ('.'.join(_macos_vers()[:2]), m.group(3))
        except ValueError:
            # not macOS
            pass
    return plat


__all__ = [
    # Basic resource access and distribution/entry point discovery
    'require',
    'run_script',
    'get_provider',
    'get_distribution',
    'load_entry_point',
    'get_entry_map',
    'get_entry_info',
    'iter_entry_points',
    'resource_string',
    'resource_stream',
    'resource_filename',
    'resource_listdir',
    'resource_exists',
    'resource_isdir',
    # Environmental control
    'declare_namespace',
    'working_set',
    'add_activation_listener',
    'find_distributions',
    'set_extraction_path',
    'cleanup_resources',
    'get_default_cache',
    # Primary implementation classes
    'Environment',
    'WorkingSet',
    'ResourceManager',
    'Distribution',
    'Requirement',
    'EntryPoint',
    # Exceptions
    'ResolutionError',
    'VersionConflict',
    'DistributionNotFound',
    'UnknownExtra',
    'ExtractionError',
    # Warnings
    'PEP440Warning',
    # Parsing functions and string utilities
    'parse_requirements',
    'parse_version',
    'safe_name',
    'safe_version',
    'get_platform',
    'compatible_platforms',
    'yield_lines',
    'split_sections',
    'safe_extra',
    'to_filename',
    'invalid_marker',
    'evaluate_marker',
    # filesystem utilities
    'ensure_directory',
    'normalize_path',
    # Distribution "precedence" constants
    'EGG_DIST',
    'BINARY_DIST',
    'SOURCE_DIST',
    'CHECKOUT_DIST',
    'DEVELOP_DIST',
    # "Provider" interfaces, implementations, and registration/lookup APIs
    'IMetadataProvider',
    'IResourceProvider',
    'FileMetadata',
    'PathMetadata',
    'EggMetadata',
    'EmptyProvider',
    'empty_provider',
    'NullProvider',
    'EggProvider',
    'DefaultProvider',
    'ZipProvider',
    'register_finder',
    'register_namespace_handler',
    'register_loader_type',
    'fixup_namespace_packages',
    'get_importer',
    # Warnings
    'PkgResourcesDeprecationWarning',
    # Deprecated/backward compatibility only
    'run_main',
    'AvailableDistributions',
]


class ResolutionError(Exception):
    """Abstract base for dependency resolution errors"""

    def __repr__(self):
        return self.__class__.__name__ + repr(self.args)


class VersionConflict(ResolutionError):
    """
    An already-installed version conflicts with the requested version.

    Should be initialized with the installed Distribution and the requested
    Requirement.
    """

    _template = "{self.dist} is installed but {self.req} is required"

    @property
    def dist(self) -> Distribution:
        return self.args[0]

    @property
    def req(self) -> Requirement:
        return self.args[1]

    def report(self):
        return self._template.format(**locals())

    def with_context(self, required_by: set[Distribution | str]):
        """
        If required_by is non-empty, return a version of self that is a
        ContextualVersionConflict.
        """
        if not required_by:
            return self
        args = self.args + (required_by,)
        return ContextualVersionConflict(*args)


class ContextualVersionConflict(VersionConflict):
    """
    A VersionConflict that accepts a third parameter, the set of the
    requirements that required the installed Distribution.
    """

    _template = VersionConflict._template + ' by {self.required_by}'

    @property
    def required_by(self) -> set[str]:
        return self.args[2]


class DistributionNotFound(ResolutionError):
    """A requested distribution was not found"""

    _template = (
        "The '{self.req}' distribution was not found "
        "and is required by {self.requirers_str}"
    )

    @property
    def req(self) -> Requirement:
        return self.args[0]

    @property
    def requirers(self) -> set[str] | None:
        return self.args[1]

    @property
    def requirers_str(self):
        if not self.requirers:
            return 'the application'
        return ', '.join(self.requirers)

    def report(self):
        return self._template.format(**locals())

    def __str__(self):
        return self.report()


class UnknownExtra(ResolutionError):
    """Distribution doesn't have an "extra feature" of the given name"""


_provider_factories: dict[type[_ModuleLike], _ProviderFactoryType] = {}

PY_MAJOR = '{}.{}'.format(*sys.version_info)
EGG_DIST = 3
BINARY_DIST = 2
SOURCE_DIST = 1
CHECKOUT_DIST = 0
DEVELOP_DIST = -1


def register_loader_type(
    loader_type: type[_ModuleLike], provider_factory: _ProviderFactoryType
):
    """Register `provider_factory` to make providers for `loader_type`

    `loader_type` is the type or class of a PEP 302 ``module.__loader__``,
    and `provider_factory` is a function that, passed a *module* object,
    returns an ``IResourceProvider`` for that module.
    """
    _provider_factories[loader_type] = provider_factory


@overload
def get_provider(moduleOrReq: str) -> IResourceProvider: ...
@overload
def get_provider(moduleOrReq: Requirement) -> Distribution: ...
def get_provider(moduleOrReq: str | Requirement) -> IResourceProvider | Distribution:
    """Return an IResourceProvider for the named module or requirement"""
    if isinstance(moduleOrReq, Requirement):
        return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
    try:
        module = sys.modules[moduleOrReq]
    except KeyError:
        __import__(moduleOrReq)
        module = sys.modules[moduleOrReq]
    loader = getattr(module, '__loader__', None)
    return _find_adapter(_provider_factories, loader)(module)


@functools.lru_cache(maxsize=None)
def _macos_vers():
    version = platform.mac_ver()[0]
    # fallback for MacPorts
    if version == '':
        plist = '/System/Library/CoreServices/SystemVersion.plist'
        if os.path.exists(plist):
            with open(plist, 'rb') as fh:
                plist_content = plistlib.load(fh)
            if 'ProductVersion' in plist_content:
                version = plist_content['ProductVersion']
    return version.split('.')


def _macos_arch(machine):
    return {'PowerPC': 'ppc', 'Power_Macintosh': 'ppc'}.get(machine, machine)


def get_build_platform():
    """Return this platform's string for platform-specific distributions

    XXX Currently this is the same as ``distutils.util.get_platform()``, but it
    needs some hacks for Linux and macOS.
    """
    from sysconfig import get_platform

    plat = get_platform()
    if sys.platform == "darwin" and not plat.startswith('macosx-'):
        try:
            version = _macos_vers()
            machine = os.uname()[4].replace(" ", "_")
            return "macosx-%d.%d-%s" % (
                int(version[0]),
                int(version[1]),
                _macos_arch(machine),
            )
        except ValueError:
            # if someone is running a non-Mac darwin system, this will fall
            # through to the default implementation
            pass
    return plat


macosVersionString = re.compile(r"macosx-(\d+)\.(\d+)-(.*)")
darwinVersionString = re.compile(r"darwin-(\d+)\.(\d+)\.(\d+)-(.*)")
# XXX backward compat
get_platform = get_build_platform


def compatible_platforms(provided: str | None, required: str | None):
    """Can code for the `provided` platform run on the `required` platform?

    Returns true if either platform is ``None``, or the platforms are equal.

    XXX Needs compatibility checks for Linux and other unixy OSes.
    """
    if provided is None or required is None or provided == required:
        # easy case
        return True

    # macOS special cases
    reqMac = macosVersionString.match(required)
    if reqMac:
        provMac = macosVersionString.match(provided)

        # is this a Mac package?
        if not provMac:
            # this is backwards compatibility for packages built before
            # setuptools 0.6. All packages built after this point will
            # use the new macOS designation.
            provDarwin = darwinVersionString.match(provided)
            if provDarwin:
                dversion = int(provDarwin.group(1))
                macosversion = "%s.%s" % (reqMac.group(1), reqMac.group(2))
                if (
                    dversion == 7
                    and macosversion >= "10.3"
                    or dversion == 8
                    and macosversion >= "10.4"
                ):
                    return True
            # egg isn't macOS or legacy darwin
            return False

        # are they the same major version and machine type?
        if provMac.group(1) != reqMac.group(1) or provMac.group(3) != reqMac.group(3):
            return False

        # is the required OS major update >= the provided one?
        if int(provMac.group(2)) > int(reqMac.group(2)):
            return False

        return True

    # XXX Linux and other platforms' special cases should go here
    return False


@overload
def get_distribution(dist: _DistributionT) -> _DistributionT: ...
@overload
def get_distribution(dist: _PkgReqType) -> Distribution: ...
def get_distribution(dist: Distribution | _PkgReqType) -> Distribution:
    """Return a current distribution object for a Requirement or string"""
    if isinstance(dist, str):
        dist = Requirement.parse(dist)
    if isinstance(dist, Requirement):
        # Bad type narrowing, dist has to be a Requirement here, so get_provider has to return Distribution
        dist = get_provider(dist)  # type: ignore[assignment]
    if not isinstance(dist, Distribution):
        raise TypeError("Expected str, Requirement, or Distribution", dist)
    return dist


def load_entry_point(dist: _EPDistType, group: str, name: str) -> _ResolvedEntryPoint:
    """Return `name` entry point of `group` for `dist` or raise ImportError"""
    return get_distribution(dist).load_entry_point(group, name)


@overload
def get_entry_map(
    dist: _EPDistType, group: None = None
) -> dict[str, dict[str, EntryPoint]]: ...
@overload
def get_entry_map(dist: _EPDistType, group: str) -> dict[str, EntryPoint]: ...
def get_entry_map(dist: _EPDistType, group: str | None = None):
    """Return the entry point map for `group`, or the full entry map"""
    return get_distribution(dist).get_entry_map(group)


def get_entry_info(dist: _EPDistType, group: str, name: str):
    """Return the EntryPoint object for `group`+`name`, or ``None``"""
    return get_distribution(dist).get_entry_info(group, name)


class IMetadataProvider(Protocol):
    def has_metadata(self, name: str) -> bool:
        """Does the package's distribution contain the named metadata?"""

    def get_metadata(self, name: str) -> str:
        """The named metadata resource as a string"""

    def get_metadata_lines(self, name: str) -> Iterator[str]:
        """Yield named metadata resource as list of non-blank non-comment lines

        Leading and trailing whitespace is stripped from each line, and lines
        with ``#`` as the first non-blank character are omitted."""

    def metadata_isdir(self, name: str) -> bool:
        """Is the named metadata a directory?  (like ``os.path.isdir()``)"""

    def metadata_listdir(self, name: str) -> list[str]:
        """List of metadata names in the directory (like ``os.listdir()``)"""

    def run_script(self, script_name: str, namespace: dict[str, Any]) -> None:
        """Execute the named script in the supplied namespace dictionary"""


class IResourceProvider(IMetadataProvider, Protocol):
    """An object that provides access to package resources"""

    def get_resource_filename(
        self, manager: ResourceManager, resource_name: str
    ) -> str:
        """Return a true filesystem path for `resource_name`

        `manager` must be a ``ResourceManager``"""

    def get_resource_stream(
        self, manager: ResourceManager, resource_name: str
    ) -> _ResourceStream:
        """Return a readable file-like object for `resource_name`

        `manager` must be a ``ResourceManager``"""

    def get_resource_string(
        self, manager: ResourceManager, resource_name: str
    ) -> bytes:
        """Return the contents of `resource_name` as :obj:`bytes`

        `manager` must be a ``ResourceManager``"""

    def has_resource(self, resource_name: str) -> bool:
        """Does the package contain the named resource?"""

    def resource_isdir(self, resource_name: str) -> bool:
        """Is the named resource a directory?  (like ``os.path.isdir()``)"""

    def resource_listdir(self, resource_name: str) -> list[str]:
        """List of resource names in the directory (like ``os.listdir()``)"""


class WorkingSet:
    """A collection of active distributions on sys.path (or a similar list)"""

    def __init__(self, entries: Iterable[str] | None = None):
        """Create working set from list of path entries (default=sys.path)"""
        self.entries: list[str] = []
        self.entry_keys = {}
        self.by_key = {}
        self.normalized_to_canonical_keys = {}
        self.callbacks = []

        if entries is None:
            entries = sys.path

        for entry in entries:
            self.add_entry(entry)

    @classmethod
    def _build_master(cls):
        """
        Prepare the master working set.
        """
        ws = cls()
        try:
            from __main__ import __requires__
        except ImportError:
            # The main program does not list any requirements
            return ws

        # ensure the requirements are met
        try:
            ws.require(__requires__)
        except VersionConflict:
            return cls._build_from_requirements(__requires__)

        return ws

    @classmethod
    def _build_from_requirements(cls, req_spec):
        """
        Build a working set from a requirement spec. Rewrites sys.path.
        """
        # try it without defaults already on sys.path
        # by starting with an empty path
        ws = cls([])
        reqs = parse_requirements(req_spec)
        dists = ws.resolve(reqs, Environment())
        for dist in dists:
            ws.add(dist)

        # add any missing entries from sys.path
        for entry in sys.path:
            if entry not in ws.entries:
                ws.add_entry(entry)

        # then copy back to sys.path
        sys.path[:] = ws.entries
        return ws

    def add_entry(self, entry: str):
        """Add a path item to ``.entries``, finding any distributions on it

        ``find_distributions(entry, True)`` is used to find distributions
        corresponding to the path entry, and they are added.  `entry` is
        always appended to ``.entries``, even if it is already present.
        (This is because ``sys.path`` can contain the same value more than
        once, and the ``.entries`` of the ``sys.path`` WorkingSet should always
        equal ``sys.path``.)
        """
        self.entry_keys.setdefault(entry, [])
        self.entries.append(entry)
        for dist in find_distributions(entry, True):
            self.add(dist, entry, False)

    def __contains__(self, dist: Distribution) -> bool:
        """True if `dist` is the active distribution for its project"""
        return self.by_key.get(dist.key) == dist

    def find(self, req: Requirement) -> Distribution | None:
        """Find a distribution matching requirement `req`

        If there is an active distribution for the requested project, this
        returns it as long as it meets the version requirement specified by
        `req`.  But, if there is an active distribution for the project and it
        does *not* meet the `req` requirement, ``VersionConflict`` is raised.
        If there is no active distribution for the requested project, ``None``
        is returned.
        """
        dist = self.by_key.get(req.key)

        if dist is None:
            canonical_key = self.normalized_to_canonical_keys.get(req.key)

            if canonical_key is not None:
                req.key = canonical_key
                dist = self.by_key.get(canonical_key)

        if dist is not None and dist not in req:
            # XXX add more info
            raise VersionConflict(dist, req)
        return dist

    def iter_entry_points(self, group: str, name: str | None = None):
        """Yield entry point objects from `group` matching `name`

        If `name` is None, yields all entry points in `group` from all
        distributions in the working set, otherwise only ones matching
        both `group` and `name` are yielded (in distribution order).
        """
        return (
            entry
            for dist in self
            for entry in dist.get_entry_map(group).values()
            if name is None or name == entry.name
        )

    def run_script(self, requires: str, script_name: str):
        """Locate distribution for `requires` and run `script_name` script"""
        ns = sys._getframe(1).f_globals
        name = ns['__name__']
        ns.clear()
        ns['__name__'] = name
        self.require(requires)[0].run_script(script_name, ns)

    def __iter__(self) -> Iterator[Distribution]:
        """Yield distributions for non-duplicate projects in the working set

        The yield order is the order in which the items' path entries were
        added to the working set.
        """
        seen = set()
        for item in self.entries:
            if item not in self.entry_keys:
                # workaround a cache issue
                continue

            for key in self.entry_keys[item]:
                if key not in seen:
                    seen.add(key)
                    yield self.by_key[key]

    def add(
        self,
        dist: Distribution,
        entry: str | None = None,
        insert: bool = True,
        replace: bool = False,
    ):
        """Add `dist` to working set, associated with `entry`

        If `entry` is unspecified, it defaults to the ``.location`` of `dist`.
        On exit from this routine, `entry` is added to the end of the working
        set's ``.entries`` (if it wasn't already present).

        `dist` is only added to the working set if it's for a project that
        doesn't already have a distribution in the set, unless `replace=True`.
        If it's added, any callbacks registered with the ``subscribe()`` method
        will be called.
        """
        if insert:
            dist.insert_on(self.entries, entry, replace=replace)

        if entry is None:
            entry = dist.location
        keys = self.entry_keys.setdefault(entry, [])
        keys2 = self.entry_keys.setdefault(dist.location, [])
        if not replace and dist.key in self.by_key:
            # ignore hidden distros
            return

        self.by_key[dist.key] = dist
        normalized_name = _packaging_utils.canonicalize_name(dist.key)
        self.normalized_to_canonical_keys[normalized_name] = dist.key
        if dist.key not in keys:
            keys.append(dist.key)
        if dist.key not in keys2:
            keys2.append(dist.key)
        self._added_new(dist)

    @overload
    def resolve(
        self,
        requirements: Iterable[Requirement],
        env: Environment | None,
        installer: _InstallerTypeT[_DistributionT],
        replace_conflicting: bool = False,
        extras: tuple[str, ...] | None = None,
    ) -> list[_DistributionT]: ...
    @overload
    def resolve(
        self,
        requirements: Iterable[Requirement],
        env: Environment | None = None,
        *,
        installer: _InstallerTypeT[_DistributionT],
        replace_conflicting: bool = False,
        extras: tuple[str, ...] | None = None,
    ) -> list[_DistributionT]: ...
    @overload
    def resolve(
        self,
        requirements: Iterable[Requirement],
        env: Environment | None = None,
        installer: _InstallerType | None = None,
        replace_conflicting: bool = False,
        extras: tuple[str, ...] | None = None,
    ) -> list[Distribution]: ...
    def resolve(
        self,
        requirements: Iterable[Requirement],
        env: Environment | None = None,
        installer: _InstallerType | None | _InstallerTypeT[_DistributionT] = None,
        replace_conflicting: bool = False,
        extras: tuple[str, ...] | None = None,
    ) -> list[Distribution] | list[_DistributionT]:
        """List all distributions needed to (recursively) meet `requirements`

        `requirements` must be a sequence of ``Requirement`` objects.  `env`,
        if supplied, should be an ``Environment`` instance.  If
        not supplied, it defaults to all distributions available within any
        entry or distribution in the working set.  `installer`, if supplied,
        will be invoked with each requirement that cannot be met by an
        already-installed distribution; it should return a ``Distribution`` or
        ``None``.

        Unless `replace_conflicting=True`, raises a VersionConflict exception
        if
        any requirements are found on the path that have the correct name but
        the wrong version.  Otherwise, if an `installer` is supplied it will be
        invoked to obtain the correct version of the requirement and activate
        it.

        `extras` is a list of the extras to be used with these requirements.
        This is important because extra requirements may look like `my_req;
        extra = "my_extra"`, which would otherwise be interpreted as a purely
        optional requirement.  Instead, we want to be able to assert that these
        requirements are truly required.
        """

        # set up the stack
        requirements = list(requirements)[::-1]
        # set of processed requirements
        processed = set()
        # key -> dist
        best = {}
        to_activate = []

        req_extras = _ReqExtras()

        # Mapping of requirement to set of distributions that required it;
        # useful for reporting info about conflicts.
        required_by = collections.defaultdict(set)

        while requirements:
            # process dependencies breadth-first
            req = requirements.pop(0)
            if req in processed:
                # Ignore cyclic or redundant dependencies
                continue

            if not req_extras.markers_pass(req, extras):
                continue

            dist = self._resolve_dist(
                req, best, replace_conflicting, env, installer, required_by, to_activate
            )

            # push the new requirements onto the stack
            new_requirements = dist.requires(req.extras)[::-1]
            requirements.extend(new_requirements)

            # Register the new requirements needed by req
            for new_requirement in new_requirements:
                required_by[new_requirement].add(req.project_name)
                req_extras[new_requirement] = req.extras

            processed.add(req)

        # return list of distros to activate
        return to_activate

    def _resolve_dist(
        self, req, best, replace_conflicting, env, installer, required_by, to_activate
    ) -> Distribution:
        dist = best.get(req.key)
        if dist is None:
            # Find the best distribution and add it to the map
            dist = self.by_key.get(req.key)
            if dist is None or (dist not in req and replace_conflicting):
                ws = self
                if env is None:
                    if dist is None:
                        env = Environment(self.entries)
                    else:
                        # Use an empty environment and workingset to avoid
                        # any further conflicts with the conflicting
                        # distribution
                        env = Environment([])
                        ws = WorkingSet([])
                dist = best[req.key] = env.best_match(
                    req, ws, installer, replace_conflicting=replace_conflicting
                )
                if dist is None:
                    requirers = required_by.get(req, None)
                    raise DistributionNotFound(req, requirers)
            to_activate.append(dist)
        if dist not in req:
            # Oops, the "best" so far conflicts with a dependency
            dependent_req = required_by[req]
            raise VersionConflict(dist, req).with_context(dependent_req)
        return dist

    @overload
    def find_plugins(
        self,
        plugin_env: Environment,
        full_env: Environment | None,
        installer: _InstallerTypeT[_DistributionT],
        fallback: bool = True,
    ) -> tuple[list[_DistributionT], dict[Distribution, Exception]]: ...
    @overload
    def find_plugins(
        self,
        plugin_env: Environment,
        full_env: Environment | None = None,
        *,
        installer: _InstallerTypeT[_DistributionT],
        fallback: bool = True,
    ) -> tuple[list[_DistributionT], dict[Distribution, Exception]]: ...
    @overload
    def find_plugins(
        self,
        plugin_env: Environment,
        full_env: Environment | None = None,
        installer: _InstallerType | None = None,
        fallback: bool = True,
    ) -> tuple[list[Distribution], dict[Distribution, Exception]]: ...
    def find_plugins(
        self,
        plugin_env: Environment,
        full_env: Environment | None = None,
        installer: _InstallerType | None | _InstallerTypeT[_DistributionT] = None,
        fallback: bool = True,
    ) -> tuple[
        list[Distribution] | list[_DistributionT],
        dict[Distribution, Exception],
    ]:
        """Find all activatable distributions in `plugin_env`

        Example usage::

            distributions, errors = working_set.find_plugins(
                Environment(plugin_dirlist)
            )
            # add plugins+libs to sys.path
            map(working_set.add, distributions)
            # display errors
            print('Could not load', errors)

        The `plugin_env` should be an ``Environment`` instance that contains
        only distributions that are in the project's "plugin directory" or
        directories. The `full_env`, if supplied, should be an ``Environment``
        contains all currently-available distributions.  If `full_env` is not
        supplied, one is created automatically from the ``WorkingSet`` this
        method is called on, which will typically mean that every directory on
        ``sys.path`` will be scanned for distributions.

        `installer` is a standard installer callback as used by the
        ``resolve()`` method. The `fallback` flag indicates whether we should
        attempt to resolve older versions of a plugin if the newest version
        cannot be resolved.

        This method returns a 2-tuple: (`distributions`, `error_info`), where
        `distributions` is a list of the distributions found in `plugin_env`
        that were loadable, along with any other distributions that are needed
        to resolve their dependencies.  `error_info` is a dictionary mapping
        unloadable plugin distributions to an exception instance describing the
        error that occurred. Usually this will be a ``DistributionNotFound`` or
        ``VersionConflict`` instance.
        """

        plugin_projects = list(plugin_env)
        # scan project names in alphabetic order
        plugin_projects.sort()

        error_info: dict[Distribution, Exception] = {}
        distributions: dict[Distribution, Exception | None] = {}

        if full_env is None:
            env = Environment(self.entries)
            env += plugin_env
        else:
            env = full_env + plugin_env

        shadow_set = self.__class__([])
        # put all our entries in shadow_set
        list(map(shadow_set.add, self))

        for project_name in plugin_projects:
            for dist in plugin_env[project_name]:
                req = [dist.as_requirement()]

                try:
                    resolvees = shadow_set.resolve(req, env, installer)

                except ResolutionError as v:
                    # save error info
                    error_info[dist] = v
                    if fallback:
                        # try the next older version of project
                        continue
                    else:
                        # give up on this project, keep going
                        break

                else:
                    list(map(shadow_set.add, resolvees))
                    distributions.update(dict.fromkeys(resolvees))

                    # success, no need to try any more versions of this project
                    break

        sorted_distributions = list(distributions)
        sorted_distributions.sort()

        return sorted_distributions, error_info

    def require(self, *requirements: _NestedStr):
        """Ensure that distributions matching `requirements` are activated

        `requirements` must be a string or a (possibly-nested) sequence
        thereof, specifying the distributions and versions required.  The
        return value is a sequence of the distributions that needed to be
        activated to fulfill the requirements; all relevant distributions are
        included, even if they were already activated in this working set.
        """
        needed = self.resolve(parse_requirements(requirements))

        for dist in needed:
            self.add(dist)

        return needed

    def subscribe(
        self, callback: Callable[[Distribution], object], existing: bool = True
    ):
        """Invoke `callback` for all distributions

        If `existing=True` (default),
        call on all existing ones, as well.
        """
        if callback in self.callbacks:
            return
        self.callbacks.append(callback)
        if not existing:
            return
        for dist in self:
            callback(dist)

    def _added_new(self, dist):
        for callback in self.callbacks:
            callback(dist)

    def __getstate__(self):
        return (
            self.entries[:],
            self.entry_keys.copy(),
            self.by_key.copy(),
            self.normalized_to_canonical_keys.copy(),
            self.callbacks[:],
        )

    def __setstate__(self, e_k_b_n_c):
        entries, keys, by_key, normalized_to_canonical_keys, callbacks = e_k_b_n_c
        self.entries = entries[:]
        self.entry_keys = keys.copy()
        self.by_key = by_key.copy()
        self.normalized_to_canonical_keys = normalized_to_canonical_keys.copy()
        self.callbacks = callbacks[:]


class _ReqExtras(Dict["Requirement", Tuple[str, ...]]):
    """
    Map each requirement to the extras that demanded it.
    """

    def markers_pass(self, req: Requirement, extras: tuple[str, ...] | None = None):
        """
        Evaluate markers for req against each extra that
        demanded it.

        Return False if the req has a marker and fails
        evaluation. Otherwise, return True.
        """
        extra_evals = (
            req.marker.evaluate({'extra': extra})
            for extra in self.get(req, ()) + (extras or (None,))
        )
        return not req.marker or any(extra_evals)


class Environment:
    """Searchable snapshot of distributions on a search path"""

    def __init__(
        self,
        search_path: Iterable[str] | None = None,
        platform: str | None = get_supported_platform(),
        python: str | None = PY_MAJOR,
    ):
        """Snapshot distributions available on a search path

        Any distributions found on `search_path` are added to the environment.
        `search_path` should be a sequence of ``sys.path`` items.  If not
        supplied, ``sys.path`` is used.

        `platform` is an optional string specifying the name of the platform
        that platform-specific distributions must be compatible with.  If
        unspecified, it defaults to the current platform.  `python` is an
        optional string naming the desired version of Python (e.g. ``'3.6'``);
        it defaults to the current version.

        You may explicitly set `platform` (and/or `python`) to ``None`` if you
        wish to map *all* distributions, not just those compatible with the
        running platform or Python version.
        """
        self._distmap = {}
        self.platform = platform
        self.python = python
        self.scan(search_path)

    def can_add(self, dist: Distribution):
        """Is distribution `dist` acceptable for this environment?

        The distribution must match the platform and python version
        requirements specified when this environment was created, or False
        is returned.
        """
        py_compat = (
            self.python is None
            or dist.py_version is None
            or dist.py_version == self.python
        )
        return py_compat and compatible_platforms(dist.platform, self.platform)

    def remove(self, dist: Distribution):
        """Remove `dist` from the environment"""
        self._distmap[dist.key].remove(dist)

    def scan(self, search_path: Iterable[str] | None = None):
        """Scan `search_path` for distributions usable in this environment

        Any distributions found are added to the environment.
        `search_path` should be a sequence of ``sys.path`` items.  If not
        supplied, ``sys.path`` is used.  Only distributions conforming to
        the platform/python version defined at initialization are added.
        """
        if search_path is None:
            search_path = sys.path

        for item in search_path:
            for dist in find_distributions(item):
                self.add(dist)

    def __getitem__(self, project_name: str) -> list[Distribution]:
        """Return a newest-to-oldest list of distributions for `project_name`

        Uses case-insensitive `project_name` comparison, assuming all the
        project's distributions use their project's name converted to all
        lowercase as their key.

        """
        distribution_key = project_name.lower()
        return self._distmap.get(distribution_key, [])

    def add(self, dist: Distribution):
        """Add `dist` if we ``can_add()`` it and it has not already been added"""
        if self.can_add(dist) and dist.has_version():
            dists = self._distmap.setdefault(dist.key, [])
            if dist not in dists:
                dists.append(dist)
                dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)

    @overload
    def best_match(
        self,
        req: Requirement,
        working_set: WorkingSet,
        installer: _InstallerTypeT[_DistributionT],
        replace_conflicting: bool = False,
    ) -> _DistributionT: ...
    @overload
    def best_match(
        self,
        req: Requirement,
        working_set: WorkingSet,
        installer: _InstallerType | None = None,
        replace_conflicting: bool = False,
    ) -> Distribution | None: ...
    def best_match(
        self,
        req: Requirement,
        working_set: WorkingSet,
        installer: _InstallerType | None | _InstallerTypeT[_DistributionT] = None,
        replace_conflicting: bool = False,
    ) -> Distribution | None:
        """Find distribution best matching `req` and usable on `working_set`

        This calls the ``find(req)`` method of the `working_set` to see if a
        suitable distribution is already active.  (This may raise
        ``VersionConflict`` if an unsuitable version of the project is already
        active in the specified `working_set`.)  If a suitable distribution
        isn't active, this method returns the newest distribution in the
        environment that meets the ``Requirement`` in `req`.  If no suitable
        distribution is found, and `installer` is supplied, then the result of
        calling the environment's ``obtain(req, installer)`` method will be
        returned.
        """
        try:
            dist = working_set.find(req)
        except VersionConflict:
            if not replace_conflicting:
                raise
            dist = None
        if dist is not None:
            return dist
        for dist in self[req.key]:
            if dist in req:
                return dist
        # try to download/install
        return self.obtain(req, installer)

    @overload
    def obtain(
        self,
        requirement: Requirement,
        installer: _InstallerTypeT[_DistributionT],
    ) -> _DistributionT: ...
    @overload
    def obtain(
        self,
        requirement: Requirement,
        installer: Callable[[Requirement], None] | None = None,
    ) -> None: ...
    @overload
    def obtain(
        self,
        requirement: Requirement,
        installer: _InstallerType | None = None,
    ) -> Distribution | None: ...
    def obtain(
        self,
        requirement: Requirement,
        installer: Callable[[Requirement], None]
        | _InstallerType
        | None
        | _InstallerTypeT[_DistributionT] = None,
    ) -> Distribution | None:
        """Obtain a distribution matching `requirement` (e.g. via download)

        Obtain a distro that matches requirement (e.g. via download).  In the
        base ``Environment`` class, this routine just returns
        ``installer(requirement)``, unless `installer` is None, in which case
        None is returned instead.  This method is a hook that allows subclasses
        to attempt other ways of obtaining a distribution before falling back
        to the `installer` argument."""
        return installer(requirement) if installer else None

    def __iter__(self) -> Iterator[str]:
        """Yield the unique project names of the available distributions"""
        for key in self._distmap.keys():
            if self[key]:
                yield key

    def __iadd__(self, other: Distribution | Environment):
        """In-place addition of a distribution or environment"""
        if isinstance(other, Distribution):
            self.add(other)
        elif isinstance(other, Environment):
            for project in other:
                for dist in other[project]:
                    self.add(dist)
        else:
            raise TypeError("Can't add %r to environment" % (other,))
        return self

    def __add__(self, other: Distribution | Environment):
        """Add an environment or distribution to an environment"""
        new = self.__class__([], platform=None, python=None)
        for env in self, other:
            new += env
        return new


# XXX backward compatibility
AvailableDistributions = Environment


class ExtractionError(RuntimeError):
    """An error occurred extracting a resource

    The following attributes are available from instances of this exception:

    manager
        The resource manager that raised this exception

    cache_path
        The base directory for resource extraction

    original_error
        The exception instance that caused extraction to fail
    """

    manager: ResourceManager
    cache_path: str
    original_error: BaseException | None


class ResourceManager:
    """Manage resource extraction and packages"""

    extraction_path: str | None = None

    def __init__(self):
        self.cached_files = {}

    def resource_exists(self, package_or_requirement: _PkgReqType, resource_name: str):
        """Does the named resource exist?"""
        return get_provider(package_or_requirement).has_resource(resource_name)

    def resource_isdir(self, package_or_requirement: _PkgReqType, resource_name: str):
        """Is the named resource an existing directory?"""
        return get_provider(package_or_requirement).resource_isdir(resource_name)

    def resource_filename(
        self, package_or_requirement: _PkgReqType, resource_name: str
    ):
        """Return a true filesystem path for specified resource"""
        return get_provider(package_or_requirement).get_resource_filename(
            self, resource_name
        )

    def resource_stream(self, package_or_requirement: _PkgReqType, resource_name: str):
        """Return a readable file-like object for specified resource"""
        return get_provider(package_or_requirement).get_resource_stream(
            self, resource_name
        )

    def resource_string(
        self, package_or_requirement: _PkgReqType, resource_name: str
    ) -> bytes:
        """Return specified resource as :obj:`bytes`"""
        return get_provider(package_or_requirement).get_resource_string(
            self, resource_name
        )

    def resource_listdir(self, package_or_requirement: _PkgReqType, resource_name: str):
        """List the contents of the named resource directory"""
        return get_provider(package_or_requirement).resource_listdir(resource_name)

    def extraction_error(self) -> NoReturn:
        """Give an error message for problems extracting file(s)"""

        old_exc = sys.exc_info()[1]
        cache_path = self.extraction_path or get_default_cache()

        tmpl = textwrap.dedent(
            """
            Can't extract file(s) to egg cache

            The following error occurred while trying to extract file(s)
            to the Python egg cache:

              {old_exc}

            The Python egg cache directory is currently set to:

              {cache_path}

            Perhaps your account does not have write access to this directory?
            You can change the cache directory by setting the PYTHON_EGG_CACHE
            environment variable to point to an accessible directory.
            """
        ).lstrip()
        err = ExtractionError(tmpl.format(**locals()))
        err.manager = self
        err.cache_path = cache_path
        err.original_error = old_exc
        raise err

    def get_cache_path(self, archive_name: str, names: Iterable[StrPath] = ()):
        """Return absolute location in cache for `archive_name` and `names`

        The parent directory of the resulting path will be created if it does
        not already exist.  `archive_name` should be the base filename of the
        enclosing egg (which may not be the name of the enclosing zipfile!),
        including its ".egg" extension.  `names`, if provided, should be a
        sequence of path name parts "under" the egg's extraction location.

        This method should only be called by resource providers that need to
        obtain an extraction location, and only for names they intend to
        extract, as it tracks the generated names for possible cleanup later.
        """
        extract_path = self.extraction_path or get_default_cache()
        target_path = os.path.join(extract_path, archive_name + '-tmp', *names)
        try:
            _bypass_ensure_directory(target_path)
        except Exception:
            self.extraction_error()

        self._warn_unsafe_extraction_path(extract_path)

        self.cached_files[target_path] = True
        return target_path

    @staticmethod
    def _warn_unsafe_extraction_path(path):
        """
        If the default extraction path is overridden and set to an insecure
        location, such as /tmp, it opens up an opportunity for an attacker to
        replace an extracted file with an unauthorized payload. Warn the user
        if a known insecure location is used.

        See Distribute #375 for more details.
        """
        if os.name == 'nt' and not path.startswith(os.environ['windir']):
            # On Windows, permissions are generally restrictive by default
            #  and temp directories are not writable by other users, so
            #  bypass the warning.
            return
        mode = os.stat(path).st_mode
        if mode & stat.S_IWOTH or mode & stat.S_IWGRP:
            msg = (
                "Extraction path is writable by group/others "
                "and vulnerable to attack when "
                "used with get_resource_filename ({path}). "
                "Consider a more secure "
                "location (set with .set_extraction_path or the "
                "PYTHON_EGG_CACHE environment variable)."
            ).format(**locals())
            warnings.warn(msg, UserWarning)

    def postprocess(self, tempname: StrOrBytesPath, filename: StrOrBytesPath):
        """Perform any platform-specific postprocessing of `tempname`

        This is where Mac header rewrites should be done; other platforms don't
        have anything special they should do.

        Resource providers should call this method ONLY after successfully
        extracting a compressed resource.  They must NOT call it on resources
        that are already in the filesystem.

        `tempname` is the current (temporary) name of the file, and `filename`
        is the name it will be renamed to by the caller after this routine
        returns.
        """

        if os.name == 'posix':
            # Make the resource executable
            mode = ((os.stat(tempname).st_mode) | 0o555) & 0o7777
            os.chmod(tempname, mode)

    def set_extraction_path(self, path: str):
        """Set the base path where resources will be extracted to, if needed.

        If you do not call this routine before any extractions take place, the
        path defaults to the return value of ``get_default_cache()``.  (Which
        is based on the ``PYTHON_EGG_CACHE`` environment variable, with various
        platform-specific fallbacks.  See that routine's documentation for more
        details.)

        Resources are extracted to subdirectories of this path based upon
        information given by the ``IResourceProvider``.  You may set this to a
        temporary directory, but then you must call ``cleanup_resources()`` to
        delete the extracted files when done.  There is no guarantee that
        ``cleanup_resources()`` will be able to remove all extracted files.

        (Note: you may not change the extraction path for a given resource
        manager once resources have been extracted, unless you first call
        ``cleanup_resources()``.)
        """
        if self.cached_files:
            raise ValueError("Can't change extraction path, files already extracted")

        self.extraction_path = path

    def cleanup_resources(self, force: bool = False) -> list[str]:
        """
        Delete all extracted resource files and directories, returning a list
        of the file and directory names that could not be successfully removed.
        This function does not have any concurrency protection, so it should
        generally only be called when the extraction path is a temporary
        directory exclusive to a single process.  This method is not
        automatically called; you must call it explicitly or register it as an
        ``atexit`` function if you wish to ensure cleanup of a temporary
        directory used for extractions.
        """
        # XXX
        return []


def get_default_cache() -> str:
    """
    Return the ``PYTHON_EGG_CACHE`` environment variable
    or a platform-relevant user cache dir for an app
    named "Python-Eggs".
    """
    return os.environ.get('PYTHON_EGG_CACHE') or _user_cache_dir(appname='Python-Eggs')


def safe_name(name: str):
    """Convert an arbitrary string to a standard distribution name

    Any runs of non-alphanumeric/. characters are replaced with a single '-'.
    """
    return re.sub('[^A-Za-z0-9.]+', '-', name)


def safe_version(version: str):
    """
    Convert an arbitrary string to a standard version string
    """
    try:
        # normalize the version
        return str(_packaging_version.Version(version))
    except _packaging_version.InvalidVersion:
        version = version.replace(' ', '.')
        return re.sub('[^A-Za-z0-9.]+', '-', version)


def _forgiving_version(version):
    """Fallback when ``safe_version`` is not safe enough
    >>> parse_version(_forgiving_version('0.23ubuntu1'))
    
    >>> parse_version(_forgiving_version('0.23-'))
    
    >>> parse_version(_forgiving_version('0.-_'))
    
    >>> parse_version(_forgiving_version('42.+?1'))
    
    >>> parse_version(_forgiving_version('hello world'))
    
    """
    version = version.replace(' ', '.')
    match = _PEP440_FALLBACK.search(version)
    if match:
        safe = match["safe"]
        rest = version[len(safe) :]
    else:
        safe = "0"
        rest = version
    local = f"sanitized.{_safe_segment(rest)}".strip(".")
    return f"{safe}.dev0+{local}"


def _safe_segment(segment):
    """Convert an arbitrary string into a safe segment"""
    segment = re.sub('[^A-Za-z0-9.]+', '-', segment)
    segment = re.sub('-[^A-Za-z0-9]+', '-', segment)
    return re.sub(r'\.[^A-Za-z0-9]+', '.', segment).strip(".-")


def safe_extra(extra: str):
    """Convert an arbitrary string to a standard 'extra' name

    Any runs of non-alphanumeric characters are replaced with a single '_',
    and the result is always lowercased.
    """
    return re.sub('[^A-Za-z0-9.-]+', '_', extra).lower()


def to_filename(name: str):
    """Convert a project or version name to its filename-escaped form

    Any '-' characters are currently replaced with '_'.
    """
    return name.replace('-', '_')


def invalid_marker(text: str):
    """
    Validate text as a PEP 508 environment marker; return an exception
    if invalid or False otherwise.
    """
    try:
        evaluate_marker(text)
    except SyntaxError as e:
        e.filename = None
        e.lineno = None
        return e
    return False


def evaluate_marker(text: str, extra: str | None = None) -> bool:
    """
    Evaluate a PEP 508 environment marker.
    Return a boolean indicating the marker result in this environment.
    Raise SyntaxError if marker is invalid.

    This implementation uses the 'pyparsing' module.
    """
    try:
        marker = _packaging_markers.Marker(text)
        return marker.evaluate()
    except _packaging_markers.InvalidMarker as e:
        raise SyntaxError(e) from e


class NullProvider:
    """Try to implement resources and metadata for arbitrary PEP 302 loaders"""

    egg_name: str | None = None
    egg_info: str | None = None
    loader: _LoaderProtocol | None = None

    def __init__(self, module: _ModuleLike):
        self.loader = getattr(module, '__loader__', None)
        self.module_path = os.path.dirname(getattr(module, '__file__', ''))

    def get_resource_filename(self, manager: ResourceManager, resource_name: str):
        return self._fn(self.module_path, resource_name)

    def get_resource_stream(self, manager: ResourceManager, resource_name: str):
        return io.BytesIO(self.get_resource_string(manager, resource_name))

    def get_resource_string(
        self, manager: ResourceManager, resource_name: str
    ) -> bytes:
        return self._get(self._fn(self.module_path, resource_name))

    def has_resource(self, resource_name: str):
        return self._has(self._fn(self.module_path, resource_name))

    def _get_metadata_path(self, name):
        return self._fn(self.egg_info, name)

    def has_metadata(self, name: str) -> bool:
        if not self.egg_info:
            return False

        path = self._get_metadata_path(name)
        return self._has(path)

    def get_metadata(self, name: str):
        if not self.egg_info:
            return ""
        path = self._get_metadata_path(name)
        value = self._get(path)
        try:
            return value.decode('utf-8')
        except UnicodeDecodeError as exc:
            # Include the path in the error message to simplify
            # troubleshooting, and without changing the exception type.
            exc.reason += ' in {} file at path: {}'.format(name, path)
            raise

    def get_metadata_lines(self, name: str) -> Iterator[str]:
        return yield_lines(self.get_metadata(name))

    def resource_isdir(self, resource_name: str):
        return self._isdir(self._fn(self.module_path, resource_name))

    def metadata_isdir(self, name: str) -> bool:
        return bool(self.egg_info and self._isdir(self._fn(self.egg_info, name)))

    def resource_listdir(self, resource_name: str):
        return self._listdir(self._fn(self.module_path, resource_name))

    def metadata_listdir(self, name: str) -> list[str]:
        if self.egg_info:
            return self._listdir(self._fn(self.egg_info, name))
        return []

    def run_script(self, script_name: str, namespace: dict[str, Any]):
        script = 'scripts/' + script_name
        if not self.has_metadata(script):
            raise ResolutionError(
                "Script {script!r} not found in metadata at {self.egg_info!r}".format(
                    **locals()
                ),
            )

        script_text = self.get_metadata(script).replace('\r\n', '\n')
        script_text = script_text.replace('\r', '\n')
        script_filename = self._fn(self.egg_info, script)
        namespace['__file__'] = script_filename
        if os.path.exists(script_filename):
            source = _read_utf8_with_fallback(script_filename)
            code = compile(source, script_filename, 'exec')
            exec(code, namespace, namespace)
        else:
            from linecache import cache

            cache[script_filename] = (
                len(script_text),
                0,
                script_text.split('\n'),
                script_filename,
            )
            script_code = compile(script_text, script_filename, 'exec')
            exec(script_code, namespace, namespace)

    def _has(self, path) -> bool:
        raise NotImplementedError(
            "Can't perform this operation for unregistered loader type"
        )

    def _isdir(self, path) -> bool:
        raise NotImplementedError(
            "Can't perform this operation for unregistered loader type"
        )

    def _listdir(self, path) -> list[str]:
        raise NotImplementedError(
            "Can't perform this operation for unregistered loader type"
        )

    def _fn(self, base: str | None, resource_name: str):
        if base is None:
            raise TypeError(
                "`base` parameter in `_fn` is `None`. Either override this method or check the parameter first."
            )
        self._validate_resource_path(resource_name)
        if resource_name:
            return os.path.join(base, *resource_name.split('/'))
        return base

    @staticmethod
    def _validate_resource_path(path):
        """
        Validate the resource paths according to the docs.
        https://setuptools.pypa.io/en/latest/pkg_resources.html#basic-resource-access

        >>> warned = getfixture('recwarn')
        >>> warnings.simplefilter('always')
        >>> vrp = NullProvider._validate_resource_path
        >>> vrp('foo/bar.txt')
        >>> bool(warned)
        False
        >>> vrp('../foo/bar.txt')
        >>> bool(warned)
        True
        >>> warned.clear()
        >>> vrp('/foo/bar.txt')
        >>> bool(warned)
        True
        >>> vrp('foo/../../bar.txt')
        >>> bool(warned)
        True
        >>> warned.clear()
        >>> vrp('foo/f../bar.txt')
        >>> bool(warned)
        False

        Windows path separators are straight-up disallowed.
        >>> vrp(r'\\foo/bar.txt')
        Traceback (most recent call last):
        ...
        ValueError: Use of .. or absolute path in a resource path \
is not allowed.

        >>> vrp(r'C:\\foo/bar.txt')
        Traceback (most recent call last):
        ...
        ValueError: Use of .. or absolute path in a resource path \
is not allowed.

        Blank values are allowed

        >>> vrp('')
        >>> bool(warned)
        False

        Non-string values are not.

        >>> vrp(None)
        Traceback (most recent call last):
        ...
        AttributeError: ...
        """
        invalid = (
            os.path.pardir in path.split(posixpath.sep)
            or posixpath.isabs(path)
            or ntpath.isabs(path)
            or path.startswith("\\")
        )
        if not invalid:
            return

        msg = "Use of .. or absolute path in a resource path is not allowed."

        # Aggressively disallow Windows absolute paths
        if (path.startswith("\\") or ntpath.isabs(path)) and not posixpath.isabs(path):
            raise ValueError(msg)

        # for compatibility, warn; in future
        # raise ValueError(msg)
        issue_warning(
            msg[:-1] + " and will raise exceptions in a future release.",
            DeprecationWarning,
        )

    def _get(self, path) -> bytes:
        if hasattr(self.loader, 'get_data') and self.loader:
            # Already checked get_data exists
            return self.loader.get_data(path)  # type: ignore[attr-defined]
        raise NotImplementedError(
            "Can't perform this operation for loaders without 'get_data()'"
        )


register_loader_type(object, NullProvider)


def _parents(path):
    """
    yield all parents of path including path
    """
    last = None
    while path != last:
        yield path
        last = path
        path, _ = os.path.split(path)


class EggProvider(NullProvider):
    """Provider based on a virtual filesystem"""

    def __init__(self, module: _ModuleLike):
        super().__init__(module)
        self._setup_prefix()

    def _setup_prefix(self):
        # Assume that metadata may be nested inside a "basket"
        # of multiple eggs and use module_path instead of .archive.
        eggs = filter(_is_egg_path, _parents(self.module_path))
        egg = next(eggs, None)
        egg and self._set_egg(egg)

    def _set_egg(self, path: str):
        self.egg_name = os.path.basename(path)
        self.egg_info = os.path.join(path, 'EGG-INFO')
        self.egg_root = path


class DefaultProvider(EggProvider):
    """Provides access to package resources in the filesystem"""

    def _has(self, path) -> bool:
        return os.path.exists(path)

    def _isdir(self, path) -> bool:
        return os.path.isdir(path)

    def _listdir(self, path):
        return os.listdir(path)

    def get_resource_stream(self, manager: object, resource_name: str):
        return open(self._fn(self.module_path, resource_name), 'rb')

    def _get(self, path) -> bytes:
        with open(path, 'rb') as stream:
            return stream.read()

    @classmethod
    def _register(cls):
        loader_names = (
            'SourceFileLoader',
            'SourcelessFileLoader',
        )
        for name in loader_names:
            loader_cls = getattr(importlib.machinery, name, type(None))
            register_loader_type(loader_cls, cls)


DefaultProvider._register()


class EmptyProvider(NullProvider):
    """Provider that returns nothing for all requests"""

    # A special case, we don't want all Providers inheriting from NullProvider to have a potentially None module_path
    module_path: str | None = None  # type: ignore[assignment]

    _isdir = _has = lambda self, path: False

    def _get(self, path) -> bytes:
        return b''

    def _listdir(self, path):
        return []

    def __init__(self):
        pass


empty_provider = EmptyProvider()


class ZipManifests(Dict[str, "MemoizedZipManifests.manifest_mod"]):
    """
    zip manifest builder
    """

    # `path` could be `StrPath | IO[bytes]` but that violates the LSP for `MemoizedZipManifests.load`
    @classmethod
    def build(cls, path: str):
        """
        Build a dictionary similar to the zipimport directory
        caches, except instead of tuples, store ZipInfo objects.

        Use a platform-specific path separator (os.sep) for the path keys
        for compatibility with pypy on Windows.
        """
        with zipfile.ZipFile(path) as zfile:
            items = (
                (
                    name.replace('/', os.sep),
                    zfile.getinfo(name),
                )
                for name in zfile.namelist()
            )
            return dict(items)

    load = build


class MemoizedZipManifests(ZipManifests):
    """
    Memoized zipfile manifests.
    """

    class manifest_mod(NamedTuple):
        manifest: dict[str, zipfile.ZipInfo]
        mtime: float

    def load(self, path: str) -> dict[str, zipfile.ZipInfo]:  # type: ignore[override] # ZipManifests.load is a classmethod
        """
        Load a manifest at path or return a suitable manifest already loaded.
        """
        path = os.path.normpath(path)
        mtime = os.stat(path).st_mtime

        if path not in self or self[path].mtime != mtime:
            manifest = self.build(path)
            self[path] = self.manifest_mod(manifest, mtime)

        return self[path].manifest


class ZipProvider(EggProvider):
    """Resource support for zips and eggs"""

    eagers: list[str] | None = None
    _zip_manifests = MemoizedZipManifests()
    # ZipProvider's loader should always be a zipimporter or equivalent
    loader: zipimport.zipimporter

    def __init__(self, module: _ZipLoaderModule):
        super().__init__(module)
        self.zip_pre = self.loader.archive + os.sep

    def _zipinfo_name(self, fspath):
        # Convert a virtual filename (full path to file) into a zipfile subpath
        # usable with the zipimport directory cache for our target archive
        fspath = fspath.rstrip(os.sep)
        if fspath == self.loader.archive:
            return ''
        if fspath.startswith(self.zip_pre):
            return fspath[len(self.zip_pre) :]
        raise AssertionError("%s is not a subpath of %s" % (fspath, self.zip_pre))

    def _parts(self, zip_path):
        # Convert a zipfile subpath into an egg-relative path part list.
        # pseudo-fs path
        fspath = self.zip_pre + zip_path
        if fspath.startswith(self.egg_root + os.sep):
            return fspath[len(self.egg_root) + 1 :].split(os.sep)
        raise AssertionError("%s is not a subpath of %s" % (fspath, self.egg_root))

    @property
    def zipinfo(self):
        return self._zip_manifests.load(self.loader.archive)

    def get_resource_filename(self, manager: ResourceManager, resource_name: str):
        if not self.egg_name:
            raise NotImplementedError(
                "resource_filename() only supported for .egg, not .zip"
            )
        # no need to lock for extraction, since we use temp names
        zip_path = self._resource_to_zip(resource_name)
        eagers = self._get_eager_resources()
        if '/'.join(self._parts(zip_path)) in eagers:
            for name in eagers:
                self._extract_resource(manager, self._eager_to_zip(name))
        return self._extract_resource(manager, zip_path)

    @staticmethod
    def _get_date_and_size(zip_stat):
        size = zip_stat.file_size
        # ymdhms+wday, yday, dst
        date_time = zip_stat.date_time + (0, 0, -1)
        # 1980 offset already done
        timestamp = time.mktime(date_time)
        return timestamp, size

    # FIXME: 'ZipProvider._extract_resource' is too complex (12)
    def _extract_resource(self, manager: ResourceManager, zip_path) -> str:  # noqa: C901
        if zip_path in self._index():
            for name in self._index()[zip_path]:
                last = self._extract_resource(manager, os.path.join(zip_path, name))
            # return the extracted directory name
            return os.path.dirname(last)

        timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])

        if not WRITE_SUPPORT:
            raise OSError(
                '"os.rename" and "os.unlink" are not supported on this platform'
            )
        try:
            if not self.egg_name:
                raise OSError(
                    '"egg_name" is empty. This likely means no egg could be found from the "module_path".'
                )
            real_path = manager.get_cache_path(self.egg_name, self._parts(zip_path))

            if self._is_current(real_path, zip_path):
                return real_path

            outf, tmpnam = _mkstemp(
                ".$extract",
                dir=os.path.dirname(real_path),
            )
            os.write(outf, self.loader.get_data(zip_path))
            os.close(outf)
            utime(tmpnam, (timestamp, timestamp))
            manager.postprocess(tmpnam, real_path)

            try:
                rename(tmpnam, real_path)

            except OSError:
                if os.path.isfile(real_path):
                    if self._is_current(real_path, zip_path):
                        # the file became current since it was checked above,
                        #  so proceed.
                        return real_path
                    # Windows, del old file and retry
                    elif os.name == 'nt':
                        unlink(real_path)
                        rename(tmpnam, real_path)
                        return real_path
                raise

        except OSError:
            # report a user-friendly error
            manager.extraction_error()

        return real_path

    def _is_current(self, file_path, zip_path):
        """
        Return True if the file_path is current for this zip_path
        """
        timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
        if not os.path.isfile(file_path):
            return False
        stat = os.stat(file_path)
        if stat.st_size != size or stat.st_mtime != timestamp:
            return False
        # check that the contents match
        zip_contents = self.loader.get_data(zip_path)
        with open(file_path, 'rb') as f:
            file_contents = f.read()
        return zip_contents == file_contents

    def _get_eager_resources(self):
        if self.eagers is None:
            eagers = []
            for name in ('native_libs.txt', 'eager_resources.txt'):
                if self.has_metadata(name):
                    eagers.extend(self.get_metadata_lines(name))
            self.eagers = eagers
        return self.eagers

    def _index(self):
        try:
            return self._dirindex
        except AttributeError:
            ind = {}
            for path in self.zipinfo:
                parts = path.split(os.sep)
                while parts:
                    parent = os.sep.join(parts[:-1])
                    if parent in ind:
                        ind[parent].append(parts[-1])
                        break
                    else:
                        ind[parent] = [parts.pop()]
            self._dirindex = ind
            return ind

    def _has(self, fspath) -> bool:
        zip_path = self._zipinfo_name(fspath)
        return zip_path in self.zipinfo or zip_path in self._index()

    def _isdir(self, fspath) -> bool:
        return self._zipinfo_name(fspath) in self._index()

    def _listdir(self, fspath):
        return list(self._index().get(self._zipinfo_name(fspath), ()))

    def _eager_to_zip(self, resource_name: str):
        return self._zipinfo_name(self._fn(self.egg_root, resource_name))

    def _resource_to_zip(self, resource_name: str):
        return self._zipinfo_name(self._fn(self.module_path, resource_name))


register_loader_type(zipimport.zipimporter, ZipProvider)


class FileMetadata(EmptyProvider):
    """Metadata handler for standalone PKG-INFO files

    Usage::

        metadata = FileMetadata("/path/to/PKG-INFO")

    This provider rejects all data and metadata requests except for PKG-INFO,
    which is treated as existing, and will be the contents of the file at
    the provided location.
    """

    def __init__(self, path: StrPath):
        self.path = path

    def _get_metadata_path(self, name):
        return self.path

    def has_metadata(self, name: str) -> bool:
        return name == 'PKG-INFO' and os.path.isfile(self.path)

    def get_metadata(self, name: str):
        if name != 'PKG-INFO':
            raise KeyError("No metadata except PKG-INFO is available")

        with open(self.path, encoding='utf-8', errors="replace") as f:
            metadata = f.read()
        self._warn_on_replacement(metadata)
        return metadata

    def _warn_on_replacement(self, metadata):
        replacement_char = '�'
        if replacement_char in metadata:
            tmpl = "{self.path} could not be properly decoded in UTF-8"
            msg = tmpl.format(**locals())
            warnings.warn(msg)

    def get_metadata_lines(self, name: str) -> Iterator[str]:
        return yield_lines(self.get_metadata(name))


class PathMetadata(DefaultProvider):
    """Metadata provider for egg directories

    Usage::

        # Development eggs:

        egg_info = "/path/to/PackageName.egg-info"
        base_dir = os.path.dirname(egg_info)
        metadata = PathMetadata(base_dir, egg_info)
        dist_name = os.path.splitext(os.path.basename(egg_info))[0]
        dist = Distribution(basedir, project_name=dist_name, metadata=metadata)

        # Unpacked egg directories:

        egg_path = "/path/to/PackageName-ver-pyver-etc.egg"
        metadata = PathMetadata(egg_path, os.path.join(egg_path,'EGG-INFO'))
        dist = Distribution.from_filename(egg_path, metadata=metadata)
    """

    def __init__(self, path: str, egg_info: str):
        self.module_path = path
        self.egg_info = egg_info


class EggMetadata(ZipProvider):
    """Metadata provider for .egg files"""

    def __init__(self, importer: zipimport.zipimporter):
        """Create a metadata provider from a zipimporter"""

        self.zip_pre = importer.archive + os.sep
        self.loader = importer
        if importer.prefix:
            self.module_path = os.path.join(importer.archive, importer.prefix)
        else:
            self.module_path = importer.archive
        self._setup_prefix()


_distribution_finders: dict[type, _DistFinderType[Any]] = _declare_state(
    'dict', '_distribution_finders', {}
)


def register_finder(importer_type: type[_T], distribution_finder: _DistFinderType[_T]):
    """Register `distribution_finder` to find distributions in sys.path items

    `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item
    handler), and `distribution_finder` is a callable that, passed a path
    item and the importer instance, yields ``Distribution`` instances found on
    that path item.  See ``pkg_resources.find_on_path`` for an example."""
    _distribution_finders[importer_type] = distribution_finder


def find_distributions(path_item: str, only: bool = False):
    """Yield distributions accessible via `path_item`"""
    importer = get_importer(path_item)
    finder = _find_adapter(_distribution_finders, importer)
    return finder(importer, path_item, only)


def find_eggs_in_zip(
    importer: zipimport.zipimporter, path_item: str, only: bool = False
) -> Iterator[Distribution]:
    """
    Find eggs in zip files; possibly multiple nested eggs.
    """
    if importer.archive.endswith('.whl'):
        # wheels are not supported with this finder
        # they don't have PKG-INFO metadata, and won't ever contain eggs
        return
    metadata = EggMetadata(importer)
    if metadata.has_metadata('PKG-INFO'):
        yield Distribution.from_filename(path_item, metadata=metadata)
    if only:
        # don't yield nested distros
        return
    for subitem in metadata.resource_listdir(''):
        if _is_egg_path(subitem):
            subpath = os.path.join(path_item, subitem)
            dists = find_eggs_in_zip(zipimport.zipimporter(subpath), subpath)
            yield from dists
        elif subitem.lower().endswith(('.dist-info', '.egg-info')):
            subpath = os.path.join(path_item, subitem)
            submeta = EggMetadata(zipimport.zipimporter(subpath))
            submeta.egg_info = subpath
            yield Distribution.from_location(path_item, subitem, submeta)


register_finder(zipimport.zipimporter, find_eggs_in_zip)


def find_nothing(
    importer: object | None, path_item: str | None, only: bool | None = False
):
    return ()


register_finder(object, find_nothing)


def find_on_path(importer: object | None, path_item, only=False):
    """Yield distributions accessible on a sys.path directory"""
    path_item = _normalize_cached(path_item)

    if _is_unpacked_egg(path_item):
        yield Distribution.from_filename(
            path_item,
            metadata=PathMetadata(path_item, os.path.join(path_item, 'EGG-INFO')),
        )
        return

    entries = (os.path.join(path_item, child) for child in safe_listdir(path_item))

    # scan for .egg and .egg-info in directory
    for entry in sorted(entries):
        fullpath = os.path.join(path_item, entry)
        factory = dist_factory(path_item, entry, only)
        yield from factory(fullpath)


def dist_factory(path_item, entry, only):
    """Return a dist_factory for the given entry."""
    lower = entry.lower()
    is_egg_info = lower.endswith('.egg-info')
    is_dist_info = lower.endswith('.dist-info') and os.path.isdir(
        os.path.join(path_item, entry)
    )
    is_meta = is_egg_info or is_dist_info
    return (
        distributions_from_metadata
        if is_meta
        else find_distributions
        if not only and _is_egg_path(entry)
        else resolve_egg_link
        if not only and lower.endswith('.egg-link')
        else NoDists()
    )


class NoDists:
    """
    >>> bool(NoDists())
    False

    >>> list(NoDists()('anything'))
    []
    """

    def __bool__(self):
        return False

    def __call__(self, fullpath):
        return iter(())


def safe_listdir(path: StrOrBytesPath):
    """
    Attempt to list contents of path, but suppress some exceptions.
    """
    try:
        return os.listdir(path)
    except (PermissionError, NotADirectoryError):
        pass
    except OSError as e:
        # Ignore the directory if does not exist, not a directory or
        # permission denied
        if e.errno not in (errno.ENOTDIR, errno.EACCES, errno.ENOENT):
            raise
    return ()


def distributions_from_metadata(path: str):
    root = os.path.dirname(path)
    if os.path.isdir(path):
        if len(os.listdir(path)) == 0:
            # empty metadata dir; skip
            return
        metadata: _MetadataType = PathMetadata(root, path)
    else:
        metadata = FileMetadata(path)
    entry = os.path.basename(path)
    yield Distribution.from_location(
        root,
        entry,
        metadata,
        precedence=DEVELOP_DIST,
    )


def non_empty_lines(path):
    """
    Yield non-empty lines from file at path
    """
    for line in _read_utf8_with_fallback(path).splitlines():
        line = line.strip()
        if line:
            yield line


def resolve_egg_link(path):
    """
    Given a path to an .egg-link, resolve distributions
    present in the referenced path.
    """
    referenced_paths = non_empty_lines(path)
    resolved_paths = (
        os.path.join(os.path.dirname(path), ref) for ref in referenced_paths
    )
    dist_groups = map(find_distributions, resolved_paths)
    return next(dist_groups, ())


if hasattr(pkgutil, 'ImpImporter'):
    register_finder(pkgutil.ImpImporter, find_on_path)

register_finder(importlib.machinery.FileFinder, find_on_path)

_namespace_handlers: dict[type, _NSHandlerType[Any]] = _declare_state(
    'dict', '_namespace_handlers', {}
)
_namespace_packages: dict[str | None, list[str]] = _declare_state(
    'dict', '_namespace_packages', {}
)


def register_namespace_handler(
    importer_type: type[_T], namespace_handler: _NSHandlerType[_T]
):
    """Register `namespace_handler` to declare namespace packages

    `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item
    handler), and `namespace_handler` is a callable like this::

        def namespace_handler(importer, path_entry, moduleName, module):
            # return a path_entry to use for child packages

    Namespace handlers are only called if the importer object has already
    agreed that it can handle the relevant path item, and they should only
    return a subpath if the module __path__ does not already contain an
    equivalent subpath.  For an example namespace handler, see
    ``pkg_resources.file_ns_handler``.
    """
    _namespace_handlers[importer_type] = namespace_handler


def _handle_ns(packageName, path_item):
    """Ensure that named package includes a subpath of path_item (if needed)"""

    importer = get_importer(path_item)
    if importer is None:
        return None

    # use find_spec (PEP 451) and fall-back to find_module (PEP 302)
    try:
        spec = importer.find_spec(packageName)
    except AttributeError:
        # capture warnings due to #1111
        with warnings.catch_warnings():
            warnings.simplefilter("ignore")
            loader = importer.find_module(packageName)
    else:
        loader = spec.loader if spec else None

    if loader is None:
        return None
    module = sys.modules.get(packageName)
    if module is None:
        module = sys.modules[packageName] = types.ModuleType(packageName)
        module.__path__ = []
        _set_parent_ns(packageName)
    elif not hasattr(module, '__path__'):
        raise TypeError("Not a package:", packageName)
    handler = _find_adapter(_namespace_handlers, importer)
    subpath = handler(importer, path_item, packageName, module)
    if subpath is not None:
        path = module.__path__
        path.append(subpath)
        importlib.import_module(packageName)
        _rebuild_mod_path(path, packageName, module)
    return subpath


def _rebuild_mod_path(orig_path, package_name, module: types.ModuleType):
    """
    Rebuild module.__path__ ensuring that all entries are ordered
    corresponding to their sys.path order
    """
    sys_path = [_normalize_cached(p) for p in sys.path]

    def safe_sys_path_index(entry):
        """
        Workaround for #520 and #513.
        """
        try:
            return sys_path.index(entry)
        except ValueError:
            return float('inf')

    def position_in_sys_path(path):
        """
        Return the ordinal of the path based on its position in sys.path
        """
        path_parts = path.split(os.sep)
        module_parts = package_name.count('.') + 1
        parts = path_parts[:-module_parts]
        return safe_sys_path_index(_normalize_cached(os.sep.join(parts)))

    new_path = sorted(orig_path, key=position_in_sys_path)
    new_path = [_normalize_cached(p) for p in new_path]

    if isinstance(module.__path__, list):
        module.__path__[:] = new_path
    else:
        module.__path__ = new_path


def declare_namespace(packageName: str):
    """Declare that package 'packageName' is a namespace package"""

    msg = (
        f"Deprecated call to `pkg_resources.declare_namespace({packageName!r})`.\n"
        "Implementing implicit namespace packages (as specified in PEP 420) "
        "is preferred to `pkg_resources.declare_namespace`. "
        "See https://setuptools.pypa.io/en/latest/references/"
        "keywords.html#keyword-namespace-packages"
    )
    warnings.warn(msg, DeprecationWarning, stacklevel=2)

    _imp.acquire_lock()
    try:
        if packageName in _namespace_packages:
            return

        path: MutableSequence[str] = sys.path
        parent, _, _ = packageName.rpartition('.')

        if parent:
            declare_namespace(parent)
            if parent not in _namespace_packages:
                __import__(parent)
            try:
                path = sys.modules[parent].__path__
            except AttributeError as e:
                raise TypeError("Not a package:", parent) from e

        # Track what packages are namespaces, so when new path items are added,
        # they can be updated
        _namespace_packages.setdefault(parent or None, []).append(packageName)
        _namespace_packages.setdefault(packageName, [])

        for path_item in path:
            # Ensure all the parent's path items are reflected in the child,
            # if they apply
            _handle_ns(packageName, path_item)

    finally:
        _imp.release_lock()


def fixup_namespace_packages(path_item: str, parent: str | None = None):
    """Ensure that previously-declared namespace packages include path_item"""
    _imp.acquire_lock()
    try:
        for package in _namespace_packages.get(parent, ()):
            subpath = _handle_ns(package, path_item)
            if subpath:
                fixup_namespace_packages(subpath, package)
    finally:
        _imp.release_lock()


def file_ns_handler(
    importer: object,
    path_item: StrPath,
    packageName: str,
    module: types.ModuleType,
):
    """Compute an ns-package subpath for a filesystem or zipfile importer"""

    subpath = os.path.join(path_item, packageName.split('.')[-1])
    normalized = _normalize_cached(subpath)
    for item in module.__path__:
        if _normalize_cached(item) == normalized:
            break
    else:
        # Only return the path if it's not already there
        return subpath


if hasattr(pkgutil, 'ImpImporter'):
    register_namespace_handler(pkgutil.ImpImporter, file_ns_handler)

register_namespace_handler(zipimport.zipimporter, file_ns_handler)
register_namespace_handler(importlib.machinery.FileFinder, file_ns_handler)


def null_ns_handler(
    importer: object,
    path_item: str | None,
    packageName: str | None,
    module: _ModuleLike | None,
):
    return None


register_namespace_handler(object, null_ns_handler)


@overload
def normalize_path(filename: StrPath) -> str: ...
@overload
def normalize_path(filename: BytesPath) -> bytes: ...
def normalize_path(filename: StrOrBytesPath):
    """Normalize a file/dir name for comparison purposes"""
    return os.path.normcase(os.path.realpath(os.path.normpath(_cygwin_patch(filename))))


def _cygwin_patch(filename: StrOrBytesPath):  # pragma: nocover
    """
    Contrary to POSIX 2008, on Cygwin, getcwd (3) contains
    symlink components. Using
    os.path.abspath() works around this limitation. A fix in os.getcwd()
    would probably better, in Cygwin even more so, except
    that this seems to be by design...
    """
    return os.path.abspath(filename) if sys.platform == 'cygwin' else filename


if TYPE_CHECKING:
    # https://github.com/python/mypy/issues/16261
    # https://github.com/python/typeshed/issues/6347
    @overload
    def _normalize_cached(filename: StrPath) -> str: ...
    @overload
    def _normalize_cached(filename: BytesPath) -> bytes: ...
    def _normalize_cached(filename: StrOrBytesPath) -> str | bytes: ...
else:

    @functools.lru_cache(maxsize=None)
    def _normalize_cached(filename):
        return normalize_path(filename)


def _is_egg_path(path):
    """
    Determine if given path appears to be an egg.
    """
    return _is_zip_egg(path) or _is_unpacked_egg(path)


def _is_zip_egg(path):
    return (
        path.lower().endswith('.egg')
        and os.path.isfile(path)
        and zipfile.is_zipfile(path)
    )


def _is_unpacked_egg(path):
    """
    Determine if given path appears to be an unpacked egg.
    """
    return path.lower().endswith('.egg') and os.path.isfile(
        os.path.join(path, 'EGG-INFO', 'PKG-INFO')
    )


def _set_parent_ns(packageName):
    parts = packageName.split('.')
    name = parts.pop()
    if parts:
        parent = '.'.join(parts)
        setattr(sys.modules[parent], name, sys.modules[packageName])


MODULE = re.compile(r"\w+(\.\w+)*$").match
EGG_NAME = re.compile(
    r"""
    (?P[^-]+) (
        -(?P[^-]+) (
            -py(?P[^-]+) (
                -(?P.+)
            )?
        )?
    )?
    """,
    re.VERBOSE | re.IGNORECASE,
).match


class EntryPoint:
    """Object representing an advertised importable object"""

    def __init__(
        self,
        name: str,
        module_name: str,
        attrs: Iterable[str] = (),
        extras: Iterable[str] = (),
        dist: Distribution | None = None,
    ):
        if not MODULE(module_name):
            raise ValueError("Invalid module name", module_name)
        self.name = name
        self.module_name = module_name
        self.attrs = tuple(attrs)
        self.extras = tuple(extras)
        self.dist = dist

    def __str__(self):
        s = "%s = %s" % (self.name, self.module_name)
        if self.attrs:
            s += ':' + '.'.join(self.attrs)
        if self.extras:
            s += ' [%s]' % ','.join(self.extras)
        return s

    def __repr__(self):
        return "EntryPoint.parse(%r)" % str(self)

    @overload
    def load(
        self,
        require: Literal[True] = True,
        env: Environment | None = None,
        installer: _InstallerType | None = None,
    ) -> _ResolvedEntryPoint: ...
    @overload
    def load(
        self,
        require: Literal[False],
        *args: Any,
        **kwargs: Any,
    ) -> _ResolvedEntryPoint: ...
    def load(
        self,
        require: bool = True,
        *args: Environment | _InstallerType | None,
        **kwargs: Environment | _InstallerType | None,
    ) -> _ResolvedEntryPoint:
        """
        Require packages for this EntryPoint, then resolve it.
        """
        if not require or args or kwargs:
            warnings.warn(
                "Parameters to load are deprecated.  Call .resolve and "
                ".require separately.",
                PkgResourcesDeprecationWarning,
                stacklevel=2,
            )
        if require:
            # We could pass `env` and `installer` directly,
            # but keeping `*args` and `**kwargs` for backwards compatibility
            self.require(*args, **kwargs)  # type: ignore
        return self.resolve()

    def resolve(self) -> _ResolvedEntryPoint:
        """
        Resolve the entry point from its module and attrs.
        """
        module = __import__(self.module_name, fromlist=['__name__'], level=0)
        try:
            return functools.reduce(getattr, self.attrs, module)
        except AttributeError as exc:
            raise ImportError(str(exc)) from exc

    def require(
        self,
        env: Environment | None = None,
        installer: _InstallerType | None = None,
    ):
        if not self.dist:
            error_cls = UnknownExtra if self.extras else AttributeError
            raise error_cls("Can't require() without a distribution", self)

        # Get the requirements for this entry point with all its extras and
        # then resolve them. We have to pass `extras` along when resolving so
        # that the working set knows what extras we want. Otherwise, for
        # dist-info distributions, the working set will assume that the
        # requirements for that extra are purely optional and skip over them.
        reqs = self.dist.requires(self.extras)
        items = working_set.resolve(reqs, env, installer, extras=self.extras)
        list(map(working_set.add, items))

    pattern = re.compile(
        r'\s*'
        r'(?P.+?)\s*'
        r'=\s*'
        r'(?P[\w.]+)\s*'
        r'(:\s*(?P[\w.]+))?\s*'
        r'(?P\[.*\])?\s*$'
    )

    @classmethod
    def parse(cls, src: str, dist: Distribution | None = None):
        """Parse a single entry point from string `src`

        Entry point syntax follows the form::

            name = some.module:some.attr [extra1, extra2]

        The entry name and module name are required, but the ``:attrs`` and
        ``[extras]`` parts are optional
        """
        m = cls.pattern.match(src)
        if not m:
            msg = "EntryPoint must be in 'name=module:attrs [extras]' format"
            raise ValueError(msg, src)
        res = m.groupdict()
        extras = cls._parse_extras(res['extras'])
        attrs = res['attr'].split('.') if res['attr'] else ()
        return cls(res['name'], res['module'], attrs, extras, dist)

    @classmethod
    def _parse_extras(cls, extras_spec):
        if not extras_spec:
            return ()
        req = Requirement.parse('x' + extras_spec)
        if req.specs:
            raise ValueError
        return req.extras

    @classmethod
    def parse_group(
        cls,
        group: str,
        lines: _NestedStr,
        dist: Distribution | None = None,
    ):
        """Parse an entry point group"""
        if not MODULE(group):
            raise ValueError("Invalid group name", group)
        this: dict[str, Self] = {}
        for line in yield_lines(lines):
            ep = cls.parse(line, dist)
            if ep.name in this:
                raise ValueError("Duplicate entry point", group, ep.name)
            this[ep.name] = ep
        return this

    @classmethod
    def parse_map(
        cls,
        data: str | Iterable[str] | dict[str, str | Iterable[str]],
        dist: Distribution | None = None,
    ):
        """Parse a map of entry point groups"""
        _data: Iterable[tuple[str | None, str | Iterable[str]]]
        if isinstance(data, dict):
            _data = data.items()
        else:
            _data = split_sections(data)
        maps: dict[str, dict[str, Self]] = {}
        for group, lines in _data:
            if group is None:
                if not lines:
                    continue
                raise ValueError("Entry points must be listed in groups")
            group = group.strip()
            if group in maps:
                raise ValueError("Duplicate group name", group)
            maps[group] = cls.parse_group(group, lines, dist)
        return maps


def _version_from_file(lines):
    """
    Given an iterable of lines from a Metadata file, return
    the value of the Version field, if present, or None otherwise.
    """

    def is_version_line(line):
        return line.lower().startswith('version:')

    version_lines = filter(is_version_line, lines)
    line = next(iter(version_lines), '')
    _, _, value = line.partition(':')
    return safe_version(value.strip()) or None


class Distribution:
    """Wrap an actual or potential sys.path entry w/metadata"""

    PKG_INFO = 'PKG-INFO'

    def __init__(
        self,
        location: str | None = None,
        metadata: _MetadataType = None,
        project_name: str | None = None,
        version: str | None = None,
        py_version: str | None = PY_MAJOR,
        platform: str | None = None,
        precedence: int = EGG_DIST,
    ):
        self.project_name = safe_name(project_name or 'Unknown')
        if version is not None:
            self._version = safe_version(version)
        self.py_version = py_version
        self.platform = platform
        self.location = location
        self.precedence = precedence
        self._provider = metadata or empty_provider

    @classmethod
    def from_location(
        cls,
        location: str,
        basename: StrPath,
        metadata: _MetadataType = None,
        **kw: int,  # We could set `precedence` explicitly, but keeping this as `**kw` for full backwards and subclassing compatibility
    ) -> Distribution:
        project_name, version, py_version, platform = [None] * 4
        basename, ext = os.path.splitext(basename)
        if ext.lower() in _distributionImpl:
            cls = _distributionImpl[ext.lower()]

            match = EGG_NAME(basename)
            if match:
                project_name, version, py_version, platform = match.group(
                    'name', 'ver', 'pyver', 'plat'
                )
        return cls(
            location,
            metadata,
            project_name=project_name,
            version=version,
            py_version=py_version,
            platform=platform,
            **kw,
        )._reload_version()

    def _reload_version(self):
        return self

    @property
    def hashcmp(self):
        return (
            self._forgiving_parsed_version,
            self.precedence,
            self.key,
            self.location,
            self.py_version or '',
            self.platform or '',
        )

    def __hash__(self):
        return hash(self.hashcmp)

    def __lt__(self, other: Distribution):
        return self.hashcmp < other.hashcmp

    def __le__(self, other: Distribution):
        return self.hashcmp <= other.hashcmp

    def __gt__(self, other: Distribution):
        return self.hashcmp > other.hashcmp

    def __ge__(self, other: Distribution):
        return self.hashcmp >= other.hashcmp

    def __eq__(self, other: object):
        if not isinstance(other, self.__class__):
            # It's not a Distribution, so they are not equal
            return False
        return self.hashcmp == other.hashcmp

    def __ne__(self, other: object):
        return not self == other

    # These properties have to be lazy so that we don't have to load any
    # metadata until/unless it's actually needed.  (i.e., some distributions
    # may not know their name or version without loading PKG-INFO)

    @property
    def key(self):
        try:
            return self._key
        except AttributeError:
            self._key = key = self.project_name.lower()
            return key

    @property
    def parsed_version(self):
        if not hasattr(self, "_parsed_version"):
            try:
                self._parsed_version = parse_version(self.version)
            except _packaging_version.InvalidVersion as ex:
                info = f"(package: {self.project_name})"
                if hasattr(ex, "add_note"):
                    ex.add_note(info)  # PEP 678
                    raise
                raise _packaging_version.InvalidVersion(f"{str(ex)} {info}") from None

        return self._parsed_version

    @property
    def _forgiving_parsed_version(self):
        try:
            return self.parsed_version
        except _packaging_version.InvalidVersion as ex:
            self._parsed_version = parse_version(_forgiving_version(self.version))

            notes = "\n".join(getattr(ex, "__notes__", []))  # PEP 678
            msg = f"""!!\n\n
            *************************************************************************
            {str(ex)}\n{notes}

            This is a long overdue deprecation.
            For the time being, `pkg_resources` will use `{self._parsed_version}`
            as a replacement to avoid breaking existing environments,
            but no future compatibility is guaranteed.

            If you maintain package {self.project_name} you should implement
            the relevant changes to adequate the project to PEP 440 immediately.
            *************************************************************************
            \n\n!!
            """
            warnings.warn(msg, DeprecationWarning)

            return self._parsed_version

    @property
    def version(self):
        try:
            return self._version
        except AttributeError as e:
            version = self._get_version()
            if version is None:
                path = self._get_metadata_path_for_display(self.PKG_INFO)
                msg = ("Missing 'Version:' header and/or {} file at path: {}").format(
                    self.PKG_INFO, path
                )
                raise ValueError(msg, self) from e

            return version

    @property
    def _dep_map(self):
        """
        A map of extra to its list of (direct) requirements
        for this distribution, including the null extra.
        """
        try:
            return self.__dep_map
        except AttributeError:
            self.__dep_map = self._filter_extras(self._build_dep_map())
        return self.__dep_map

    @staticmethod
    def _filter_extras(dm: dict[str | None, list[Requirement]]):
        """
        Given a mapping of extras to dependencies, strip off
        environment markers and filter out any dependencies
        not matching the markers.
        """
        for extra in list(filter(None, dm)):
            new_extra: str | None = extra
            reqs = dm.pop(extra)
            new_extra, _, marker = extra.partition(':')
            fails_marker = marker and (
                invalid_marker(marker) or not evaluate_marker(marker)
            )
            if fails_marker:
                reqs = []
            new_extra = safe_extra(new_extra) or None

            dm.setdefault(new_extra, []).extend(reqs)
        return dm

    def _build_dep_map(self):
        dm = {}
        for name in 'requires.txt', 'depends.txt':
            for extra, reqs in split_sections(self._get_metadata(name)):
                dm.setdefault(extra, []).extend(parse_requirements(reqs))
        return dm

    def requires(self, extras: Iterable[str] = ()):
        """List of Requirements needed for this distro if `extras` are used"""
        dm = self._dep_map
        deps: list[Requirement] = []
        deps.extend(dm.get(None, ()))
        for ext in extras:
            try:
                deps.extend(dm[safe_extra(ext)])
            except KeyError as e:
                raise UnknownExtra(
                    "%s has no such extra feature %r" % (self, ext)
                ) from e
        return deps

    def _get_metadata_path_for_display(self, name):
        """
        Return the path to the given metadata file, if available.
        """
        try:
            # We need to access _get_metadata_path() on the provider object
            # directly rather than through this class's __getattr__()
            # since _get_metadata_path() is marked private.
            path = self._provider._get_metadata_path(name)

        # Handle exceptions e.g. in case the distribution's metadata
        # provider doesn't support _get_metadata_path().
        except Exception:
            return '[could not detect]'

        return path

    def _get_metadata(self, name):
        if self.has_metadata(name):
            yield from self.get_metadata_lines(name)

    def _get_version(self):
        lines = self._get_metadata(self.PKG_INFO)
        return _version_from_file(lines)

    def activate(self, path: list[str] | None = None, replace: bool = False):
        """Ensure distribution is importable on `path` (default=sys.path)"""
        if path is None:
            path = sys.path
        self.insert_on(path, replace=replace)
        if path is sys.path and self.location is not None:
            fixup_namespace_packages(self.location)
            for pkg in self._get_metadata('namespace_packages.txt'):
                if pkg in sys.modules:
                    declare_namespace(pkg)

    def egg_name(self):
        """Return what this distribution's standard .egg filename should be"""
        filename = "%s-%s-py%s" % (
            to_filename(self.project_name),
            to_filename(self.version),
            self.py_version or PY_MAJOR,
        )

        if self.platform:
            filename += '-' + self.platform
        return filename

    def __repr__(self):
        if self.location:
            return "%s (%s)" % (self, self.location)
        else:
            return str(self)

    def __str__(self):
        try:
            version = getattr(self, 'version', None)
        except ValueError:
            version = None
        version = version or "[unknown version]"
        return "%s %s" % (self.project_name, version)

    def __getattr__(self, attr):
        """Delegate all unrecognized public attributes to .metadata provider"""
        if attr.startswith('_'):
            raise AttributeError(attr)
        return getattr(self._provider, attr)

    def __dir__(self):
        return list(
            set(super().__dir__())
            | set(attr for attr in self._provider.__dir__() if not attr.startswith('_'))
        )

    @classmethod
    def from_filename(
        cls,
        filename: StrPath,
        metadata: _MetadataType = None,
        **kw: int,  # We could set `precedence` explicitly, but keeping this as `**kw` for full backwards and subclassing compatibility
    ):
        return cls.from_location(
            _normalize_cached(filename), os.path.basename(filename), metadata, **kw
        )

    def as_requirement(self):
        """Return a ``Requirement`` that matches this distribution exactly"""
        if isinstance(self.parsed_version, _packaging_version.Version):
            spec = "%s==%s" % (self.project_name, self.parsed_version)
        else:
            spec = "%s===%s" % (self.project_name, self.parsed_version)

        return Requirement.parse(spec)

    def load_entry_point(self, group: str, name: str) -> _ResolvedEntryPoint:
        """Return the `name` entry point of `group` or raise ImportError"""
        ep = self.get_entry_info(group, name)
        if ep is None:
            raise ImportError("Entry point %r not found" % ((group, name),))
        return ep.load()

    @overload
    def get_entry_map(self, group: None = None) -> dict[str, dict[str, EntryPoint]]: ...
    @overload
    def get_entry_map(self, group: str) -> dict[str, EntryPoint]: ...
    def get_entry_map(self, group: str | None = None):
        """Return the entry point map for `group`, or the full entry map"""
        if not hasattr(self, "_ep_map"):
            self._ep_map = EntryPoint.parse_map(
                self._get_metadata('entry_points.txt'), self
            )
        if group is not None:
            return self._ep_map.get(group, {})
        return self._ep_map

    def get_entry_info(self, group: str, name: str):
        """Return the EntryPoint object for `group`+`name`, or ``None``"""
        return self.get_entry_map(group).get(name)

    # FIXME: 'Distribution.insert_on' is too complex (13)
    def insert_on(  # noqa: C901
        self,
        path: list[str],
        loc=None,
        replace: bool = False,
    ):
        """Ensure self.location is on path

        If replace=False (default):
            - If location is already in path anywhere, do nothing.
            - Else:
              - If it's an egg and its parent directory is on path,
                insert just ahead of the parent.
              - Else: add to the end of path.
        If replace=True:
            - If location is already on path anywhere (not eggs)
              or higher priority than its parent (eggs)
              do nothing.
            - Else:
              - If it's an egg and its parent directory is on path,
                insert just ahead of the parent,
                removing any lower-priority entries.
              - Else: add it to the front of path.
        """

        loc = loc or self.location
        if not loc:
            return

        nloc = _normalize_cached(loc)
        bdir = os.path.dirname(nloc)
        npath = [(p and _normalize_cached(p) or p) for p in path]

        for p, item in enumerate(npath):
            if item == nloc:
                if replace:
                    break
                else:
                    # don't modify path (even removing duplicates) if
                    # found and not replace
                    return
            elif item == bdir and self.precedence == EGG_DIST:
                # if it's an .egg, give it precedence over its directory
                # UNLESS it's already been added to sys.path and replace=False
                if (not replace) and nloc in npath[p:]:
                    return
                if path is sys.path:
                    self.check_version_conflict()
                path.insert(p, loc)
                npath.insert(p, nloc)
                break
        else:
            if path is sys.path:
                self.check_version_conflict()
            if replace:
                path.insert(0, loc)
            else:
                path.append(loc)
            return

        # p is the spot where we found or inserted loc; now remove duplicates
        while True:
            try:
                np = npath.index(nloc, p + 1)
            except ValueError:
                break
            else:
                del npath[np], path[np]
                # ha!
                p = np

        return

    def check_version_conflict(self):
        if self.key == 'setuptools':
            # ignore the inevitable setuptools self-conflicts  :(
            return

        nsp = dict.fromkeys(self._get_metadata('namespace_packages.txt'))
        loc = normalize_path(self.location)
        for modname in self._get_metadata('top_level.txt'):
            if (
                modname not in sys.modules
                or modname in nsp
                or modname in _namespace_packages
            ):
                continue
            if modname in ('pkg_resources', 'setuptools', 'site'):
                continue
            fn = getattr(sys.modules[modname], '__file__', None)
            if fn and (
                normalize_path(fn).startswith(loc) or fn.startswith(self.location)
            ):
                continue
            issue_warning(
                "Module %s was already imported from %s, but %s is being added"
                " to sys.path" % (modname, fn, self.location),
            )

    def has_version(self):
        try:
            self.version
        except ValueError:
            issue_warning("Unbuilt egg for " + repr(self))
            return False
        except SystemError:
            # TODO: remove this except clause when python/cpython#103632 is fixed.
            return False
        return True

    def clone(self, **kw: str | int | IResourceProvider | None):
        """Copy this distribution, substituting in any changed keyword args"""
        names = 'project_name version py_version platform location precedence'
        for attr in names.split():
            kw.setdefault(attr, getattr(self, attr, None))
        kw.setdefault('metadata', self._provider)
        # Unsafely unpacking. But keeping **kw for backwards and subclassing compatibility
        return self.__class__(**kw)  # type:ignore[arg-type]

    @property
    def extras(self):
        return [dep for dep in self._dep_map if dep]


class EggInfoDistribution(Distribution):
    def _reload_version(self):
        """
        Packages installed by distutils (e.g. numpy or scipy),
        which uses an old safe_version, and so
        their version numbers can get mangled when
        converted to filenames (e.g., 1.11.0.dev0+2329eae to
        1.11.0.dev0_2329eae). These distributions will not be
        parsed properly
        downstream by Distribution and safe_version, so
        take an extra step and try to get the version number from
        the metadata file itself instead of the filename.
        """
        md_version = self._get_version()
        if md_version:
            self._version = md_version
        return self


class DistInfoDistribution(Distribution):
    """
    Wrap an actual or potential sys.path entry
    w/metadata, .dist-info style.
    """

    PKG_INFO = 'METADATA'
    EQEQ = re.compile(r"([\(,])\s*(\d.*?)\s*([,\)])")

    @property
    def _parsed_pkg_info(self):
        """Parse and cache metadata"""
        try:
            return self._pkg_info
        except AttributeError:
            metadata = self.get_metadata(self.PKG_INFO)
            self._pkg_info = email.parser.Parser().parsestr(metadata)
            return self._pkg_info

    @property
    def _dep_map(self):
        try:
            return self.__dep_map
        except AttributeError:
            self.__dep_map = self._compute_dependencies()
            return self.__dep_map

    def _compute_dependencies(self) -> dict[str | None, list[Requirement]]:
        """Recompute this distribution's dependencies."""
        self.__dep_map: dict[str | None, list[Requirement]] = {None: []}

        reqs: list[Requirement] = []
        # Including any condition expressions
        for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
            reqs.extend(parse_requirements(req))

        def reqs_for_extra(extra):
            for req in reqs:
                if not req.marker or req.marker.evaluate({'extra': extra}):
                    yield req

        common = types.MappingProxyType(dict.fromkeys(reqs_for_extra(None)))
        self.__dep_map[None].extend(common)

        for extra in self._parsed_pkg_info.get_all('Provides-Extra') or []:
            s_extra = safe_extra(extra.strip())
            self.__dep_map[s_extra] = [
                r for r in reqs_for_extra(extra) if r not in common
            ]

        return self.__dep_map


_distributionImpl = {
    '.egg': Distribution,
    '.egg-info': EggInfoDistribution,
    '.dist-info': DistInfoDistribution,
}


def issue_warning(*args, **kw):
    level = 1
    g = globals()
    try:
        # find the first stack frame that is *not* code in
        # the pkg_resources module, to use for the warning
        while sys._getframe(level).f_globals is g:
            level += 1
    except ValueError:
        pass
    warnings.warn(stacklevel=level + 1, *args, **kw)


def parse_requirements(strs: _NestedStr):
    """
    Yield ``Requirement`` objects for each specification in `strs`.

    `strs` must be a string, or a (possibly-nested) iterable thereof.
    """
    return map(Requirement, join_continuation(map(drop_comment, yield_lines(strs))))


class RequirementParseError(_packaging_requirements.InvalidRequirement):
    "Compatibility wrapper for InvalidRequirement"


class Requirement(_packaging_requirements.Requirement):
    def __init__(self, requirement_string: str):
        """DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!"""
        super().__init__(requirement_string)
        self.unsafe_name = self.name
        project_name = safe_name(self.name)
        self.project_name, self.key = project_name, project_name.lower()
        self.specs = [(spec.operator, spec.version) for spec in self.specifier]
        # packaging.requirements.Requirement uses a set for its extras. We use a variable-length tuple
        self.extras: tuple[str] = tuple(map(safe_extra, self.extras))
        self.hashCmp = (
            self.key,
            self.url,
            self.specifier,
            frozenset(self.extras),
            str(self.marker) if self.marker else None,
        )
        self.__hash = hash(self.hashCmp)

    def __eq__(self, other: object):
        return isinstance(other, Requirement) and self.hashCmp == other.hashCmp

    def __ne__(self, other):
        return not self == other

    def __contains__(self, item: Distribution | str | tuple[str, ...]) -> bool:
        if isinstance(item, Distribution):
            if item.key != self.key:
                return False

            item = item.version

        # Allow prereleases always in order to match the previous behavior of
        # this method. In the future this should be smarter and follow PEP 440
        # more accurately.
        return self.specifier.contains(item, prereleases=True)

    def __hash__(self):
        return self.__hash

    def __repr__(self):
        return "Requirement.parse(%r)" % str(self)

    @staticmethod
    def parse(s: str | Iterable[str]):
        (req,) = parse_requirements(s)
        return req


def _always_object(classes):
    """
    Ensure object appears in the mro even
    for old-style classes.
    """
    if object not in classes:
        return classes + (object,)
    return classes


def _find_adapter(registry: Mapping[type, _AdapterT], ob: object) -> _AdapterT:
    """Return an adapter factory for `ob` from `registry`"""
    types = _always_object(inspect.getmro(getattr(ob, '__class__', type(ob))))
    for t in types:
        if t in registry:
            return registry[t]
    # _find_adapter would previously return None, and immediately be called.
    # So we're raising a TypeError to keep backward compatibility if anyone depended on that behaviour.
    raise TypeError(f"Could not find adapter for {registry} and {ob}")


def ensure_directory(path: StrOrBytesPath):
    """Ensure that the parent directory of `path` exists"""
    dirname = os.path.dirname(path)
    os.makedirs(dirname, exist_ok=True)


def _bypass_ensure_directory(path):
    """Sandbox-bypassing version of ensure_directory()"""
    if not WRITE_SUPPORT:
        raise OSError('"os.mkdir" not supported on this platform.')
    dirname, filename = split(path)
    if dirname and filename and not isdir(dirname):
        _bypass_ensure_directory(dirname)
        try:
            mkdir(dirname, 0o755)
        except FileExistsError:
            pass


def split_sections(s: _NestedStr) -> Iterator[tuple[str | None, list[str]]]:
    """Split a string or iterable thereof into (section, content) pairs

    Each ``section`` is a stripped version of the section header ("[section]")
    and each ``content`` is a list of stripped lines excluding blank lines and
    comment-only lines.  If there are any such lines before the first section
    header, they're returned in a first ``section`` of ``None``.
    """
    section = None
    content = []
    for line in yield_lines(s):
        if line.startswith("["):
            if line.endswith("]"):
                if section or content:
                    yield section, content
                section = line[1:-1].strip()
                content = []
            else:
                raise ValueError("Invalid section heading", line)
        else:
            content.append(line)

    # wrap up last segment
    yield section, content


def _mkstemp(*args, **kw):
    old_open = os.open
    try:
        # temporarily bypass sandboxing
        os.open = os_open
        return tempfile.mkstemp(*args, **kw)
    finally:
        # and then put it back
        os.open = old_open


# Silence the PEP440Warning by default, so that end users don't get hit by it
# randomly just because they use pkg_resources. We want to append the rule
# because we want earlier uses of filterwarnings to take precedence over this
# one.
warnings.filterwarnings("ignore", category=PEP440Warning, append=True)


class PkgResourcesDeprecationWarning(Warning):
    """
    Base class for warning about deprecations in ``pkg_resources``

    This class is not derived from ``DeprecationWarning``, and as such is
    visible by default.
    """


# Ported from ``setuptools`` to avoid introducing an import inter-dependency:
_LOCALE_ENCODING = "locale" if sys.version_info >= (3, 10) else None


def _read_utf8_with_fallback(file: str, fallback_encoding=_LOCALE_ENCODING) -> str:
    """See setuptools.unicode_utils._read_utf8_with_fallback"""
    try:
        with open(file, "r", encoding="utf-8") as f:
            return f.read()
    except UnicodeDecodeError:  # pragma: no cover
        msg = f"""\
        ********************************************************************************
        `encoding="utf-8"` fails with {file!r}, trying `encoding={fallback_encoding!r}`.

        This fallback behaviour is considered **deprecated** and future versions of
        `setuptools/pkg_resources` may not implement it.

        Please encode {file!r} with "utf-8" to ensure future builds will succeed.

        If this file was produced by `setuptools` itself, cleaning up the cached files
        and re-building/re-installing the package with a newer version of `setuptools`
        (e.g. by updating `build-system.requires` in its `pyproject.toml`)
        might solve the problem.
        ********************************************************************************
        """
        # TODO: Add a deadline?
        #       See comment in setuptools.unicode_utils._Utf8EncodingNeeded
        warnings.warn(msg, PkgResourcesDeprecationWarning, stacklevel=2)
        with open(file, "r", encoding=fallback_encoding) as f:
            return f.read()


# from jaraco.functools 1.3
def _call_aside(f, *args, **kwargs):
    f(*args, **kwargs)
    return f


@_call_aside
def _initialize(g=globals()):
    "Set up global resource manager (deliberately not state-saved)"
    manager = ResourceManager()
    g['_manager'] = manager
    g.update(
        (name, getattr(manager, name))
        for name in dir(manager)
        if not name.startswith('_')
    )


@_call_aside
def _initialize_master_working_set():
    """
    Prepare the master working set and make the ``require()``
    API available.

    This function has explicit effects on the global state
    of pkg_resources. It is intended to be invoked once at
    the initialization of this module.

    Invocation by other packages is unsupported and done
    at their own risk.
    """
    working_set = _declare_state('object', 'working_set', WorkingSet._build_master())

    require = working_set.require
    iter_entry_points = working_set.iter_entry_points
    add_activation_listener = working_set.subscribe
    run_script = working_set.run_script
    # backward compatibility
    run_main = run_script
    # Activate all distributions already on sys.path with replace=False and
    # ensure that all distributions added to the working set in the future
    # (e.g. by calling ``require()``) will get activated as well,
    # with higher priority (replace=True).
    tuple(dist.activate(replace=False) for dist in working_set)
    add_activation_listener(
        lambda dist: dist.activate(replace=True),
        existing=False,
    )
    working_set.entries = []
    # match order
    list(map(working_set.add_entry, sys.path))
    globals().update(locals())


if TYPE_CHECKING:
    # All of these are set by the @_call_aside methods above
    __resource_manager = ResourceManager()  # Won't exist at runtime
    resource_exists = __resource_manager.resource_exists
    resource_isdir = __resource_manager.resource_isdir
    resource_filename = __resource_manager.resource_filename
    resource_stream = __resource_manager.resource_stream
    resource_string = __resource_manager.resource_string
    resource_listdir = __resource_manager.resource_listdir
    set_extraction_path = __resource_manager.set_extraction_path
    cleanup_resources = __resource_manager.cleanup_resources

    working_set = WorkingSet()
    require = working_set.require
    iter_entry_points = working_set.iter_entry_points
    add_activation_listener = working_set.subscribe
    run_script = working_set.run_script
    run_main = run_script


================================================
FILE: src/pip/_vendor/pkg_resources.pyi
================================================
from pkg_resources import *

================================================
FILE: src/pip/_vendor/platformdirs/LICENSE
================================================
MIT License

Copyright (c) 2010-202x The platformdirs developers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: src/pip/_vendor/platformdirs/__init__.py
================================================
"""
Utilities for determining application-specific dirs.

See  for details and usage.

"""

from __future__ import annotations

import os
import sys
from typing import TYPE_CHECKING

from .api import PlatformDirsABC
from .version import __version__
from .version import __version_tuple__ as __version_info__

if TYPE_CHECKING:
    from pathlib import Path
    from typing import Literal

if sys.platform == "win32":
    from pip._vendor.platformdirs.windows import Windows as _Result
elif sys.platform == "darwin":
    from pip._vendor.platformdirs.macos import MacOS as _Result
else:
    from pip._vendor.platformdirs.unix import Unix as _Result


def _set_platform_dir_class() -> type[PlatformDirsABC]:
    if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system":
        if os.getenv("SHELL") or os.getenv("PREFIX"):
            return _Result

        from pip._vendor.platformdirs.android import _android_folder  # noqa: PLC0415

        if _android_folder() is not None:
            from pip._vendor.platformdirs.android import Android  # noqa: PLC0415

            return Android  # return to avoid redefinition of a result

    return _Result


if TYPE_CHECKING:
    # Work around mypy issue: https://github.com/python/mypy/issues/10962
    PlatformDirs = _Result
else:
    PlatformDirs = _set_platform_dir_class()  #: Currently active platform
AppDirs = PlatformDirs  #: Backwards compatibility with appdirs


def user_data_dir(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    roaming: bool = False,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> str:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param roaming: See `roaming `.
    :param ensure_exists: See `ensure_exists `.
    :returns: data directory tied to the user
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        roaming=roaming,
        ensure_exists=ensure_exists,
    ).user_data_dir


def site_data_dir(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    multipath: bool = False,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> str:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param multipath: See `roaming `.
    :param ensure_exists: See `ensure_exists `.
    :returns: data directory shared by users
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        multipath=multipath,
        ensure_exists=ensure_exists,
    ).site_data_dir


def user_config_dir(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    roaming: bool = False,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> str:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param roaming: See `roaming `.
    :param ensure_exists: See `ensure_exists `.
    :returns: config directory tied to the user
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        roaming=roaming,
        ensure_exists=ensure_exists,
    ).user_config_dir


def site_config_dir(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    multipath: bool = False,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> str:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param multipath: See `roaming `.
    :param ensure_exists: See `ensure_exists `.
    :returns: config directory shared by the users
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        multipath=multipath,
        ensure_exists=ensure_exists,
    ).site_config_dir


def user_cache_dir(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    opinion: bool = True,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> str:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param opinion: See `roaming `.
    :param ensure_exists: See `ensure_exists `.
    :returns: cache directory tied to the user
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        opinion=opinion,
        ensure_exists=ensure_exists,
    ).user_cache_dir


def site_cache_dir(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    opinion: bool = True,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> str:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param opinion: See `opinion `.
    :param ensure_exists: See `ensure_exists `.
    :returns: cache directory tied to the user
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        opinion=opinion,
        ensure_exists=ensure_exists,
    ).site_cache_dir


def user_state_dir(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    roaming: bool = False,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> str:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param roaming: See `roaming `.
    :param ensure_exists: See `ensure_exists `.
    :returns: state directory tied to the user
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        roaming=roaming,
        ensure_exists=ensure_exists,
    ).user_state_dir


def user_log_dir(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    opinion: bool = True,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> str:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param opinion: See `roaming `.
    :param ensure_exists: See `ensure_exists `.
    :returns: log directory tied to the user
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        opinion=opinion,
        ensure_exists=ensure_exists,
    ).user_log_dir


def user_documents_dir() -> str:
    """:returns: documents directory tied to the user"""
    return PlatformDirs().user_documents_dir


def user_downloads_dir() -> str:
    """:returns: downloads directory tied to the user"""
    return PlatformDirs().user_downloads_dir


def user_pictures_dir() -> str:
    """:returns: pictures directory tied to the user"""
    return PlatformDirs().user_pictures_dir


def user_videos_dir() -> str:
    """:returns: videos directory tied to the user"""
    return PlatformDirs().user_videos_dir


def user_music_dir() -> str:
    """:returns: music directory tied to the user"""
    return PlatformDirs().user_music_dir


def user_desktop_dir() -> str:
    """:returns: desktop directory tied to the user"""
    return PlatformDirs().user_desktop_dir


def user_runtime_dir(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    opinion: bool = True,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> str:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param opinion: See `opinion `.
    :param ensure_exists: See `ensure_exists `.
    :returns: runtime directory tied to the user
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        opinion=opinion,
        ensure_exists=ensure_exists,
    ).user_runtime_dir


def site_runtime_dir(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    opinion: bool = True,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> str:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param opinion: See `opinion `.
    :param ensure_exists: See `ensure_exists `.
    :returns: runtime directory shared by users
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        opinion=opinion,
        ensure_exists=ensure_exists,
    ).site_runtime_dir


def user_data_path(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    roaming: bool = False,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> Path:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param roaming: See `roaming `.
    :param ensure_exists: See `ensure_exists `.
    :returns: data path tied to the user
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        roaming=roaming,
        ensure_exists=ensure_exists,
    ).user_data_path


def site_data_path(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    multipath: bool = False,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> Path:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param multipath: See `multipath `.
    :param ensure_exists: See `ensure_exists `.
    :returns: data path shared by users
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        multipath=multipath,
        ensure_exists=ensure_exists,
    ).site_data_path


def user_config_path(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    roaming: bool = False,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> Path:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param roaming: See `roaming `.
    :param ensure_exists: See `ensure_exists `.
    :returns: config path tied to the user
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        roaming=roaming,
        ensure_exists=ensure_exists,
    ).user_config_path


def site_config_path(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    multipath: bool = False,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> Path:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param multipath: See `roaming `.
    :param ensure_exists: See `ensure_exists `.
    :returns: config path shared by the users
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        multipath=multipath,
        ensure_exists=ensure_exists,
    ).site_config_path


def site_cache_path(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    opinion: bool = True,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> Path:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param opinion: See `opinion `.
    :param ensure_exists: See `ensure_exists `.
    :returns: cache directory tied to the user
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        opinion=opinion,
        ensure_exists=ensure_exists,
    ).site_cache_path


def user_cache_path(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    opinion: bool = True,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> Path:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param opinion: See `roaming `.
    :param ensure_exists: See `ensure_exists `.
    :returns: cache path tied to the user
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        opinion=opinion,
        ensure_exists=ensure_exists,
    ).user_cache_path


def user_state_path(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    roaming: bool = False,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> Path:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param roaming: See `roaming `.
    :param ensure_exists: See `ensure_exists `.
    :returns: state path tied to the user
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        roaming=roaming,
        ensure_exists=ensure_exists,
    ).user_state_path


def user_log_path(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    opinion: bool = True,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> Path:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param opinion: See `roaming `.
    :param ensure_exists: See `ensure_exists `.
    :returns: log path tied to the user
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        opinion=opinion,
        ensure_exists=ensure_exists,
    ).user_log_path


def user_documents_path() -> Path:
    """:returns: documents a path tied to the user"""
    return PlatformDirs().user_documents_path


def user_downloads_path() -> Path:
    """:returns: downloads path tied to the user"""
    return PlatformDirs().user_downloads_path


def user_pictures_path() -> Path:
    """:returns: pictures path tied to the user"""
    return PlatformDirs().user_pictures_path


def user_videos_path() -> Path:
    """:returns: videos path tied to the user"""
    return PlatformDirs().user_videos_path


def user_music_path() -> Path:
    """:returns: music path tied to the user"""
    return PlatformDirs().user_music_path


def user_desktop_path() -> Path:
    """:returns: desktop path tied to the user"""
    return PlatformDirs().user_desktop_path


def user_runtime_path(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    opinion: bool = True,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> Path:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param opinion: See `opinion `.
    :param ensure_exists: See `ensure_exists `.
    :returns: runtime path tied to the user
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        opinion=opinion,
        ensure_exists=ensure_exists,
    ).user_runtime_path


def site_runtime_path(
    appname: str | None = None,
    appauthor: str | Literal[False] | None = None,
    version: str | None = None,
    opinion: bool = True,  # noqa: FBT001, FBT002
    ensure_exists: bool = False,  # noqa: FBT001, FBT002
) -> Path:
    """
    :param appname: See `appname `.
    :param appauthor: See `appauthor `.
    :param version: See `version `.
    :param opinion: See `opinion `.
    :param ensure_exists: See `ensure_exists `.
    :returns: runtime path shared by users
    """
    return PlatformDirs(
        appname=appname,
        appauthor=appauthor,
        version=version,
        opinion=opinion,
        ensure_exists=ensure_exists,
    ).site_runtime_path


__all__ = [
    "AppDirs",
    "PlatformDirs",
    "PlatformDirsABC",
    "__version__",
    "__version_info__",
    "site_cache_dir",
    "site_cache_path",
    "site_config_dir",
    "site_config_path",
    "site_data_dir",
    "site_data_path",
    "site_runtime_dir",
    "site_runtime_path",
    "user_cache_dir",
    "user_cache_path",
    "user_config_dir",
    "user_config_path",
    "user_data_dir",
    "user_data_path",
    "user_desktop_dir",
    "user_desktop_path",
    "user_documents_dir",
    "user_documents_path",
    "user_downloads_dir",
    "user_downloads_path",
    "user_log_dir",
    "user_log_path",
    "user_music_dir",
    "user_music_path",
    "user_pictures_dir",
    "user_pictures_path",
    "user_runtime_dir",
    "user_runtime_path",
    "user_state_dir",
    "user_state_path",
    "user_videos_dir",
    "user_videos_path",
]


================================================
FILE: src/pip/_vendor/platformdirs/__main__.py
================================================
"""Main entry point."""

from __future__ import annotations

from pip._vendor.platformdirs import PlatformDirs, __version__

PROPS = (
    "user_data_dir",
    "user_config_dir",
    "user_cache_dir",
    "user_state_dir",
    "user_log_dir",
    "user_documents_dir",
    "user_downloads_dir",
    "user_pictures_dir",
    "user_videos_dir",
    "user_music_dir",
    "user_runtime_dir",
    "site_data_dir",
    "site_config_dir",
    "site_cache_dir",
    "site_runtime_dir",
)


def main() -> None:
    """Run the main entry point."""
    app_name = "MyApp"
    app_author = "MyCompany"

    print(f"-- platformdirs {__version__} --")  # noqa: T201

    print("-- app dirs (with optional 'version')")  # noqa: T201
    dirs = PlatformDirs(app_name, app_author, version="1.0")
    for prop in PROPS:
        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201

    print("\n-- app dirs (without optional 'version')")  # noqa: T201
    dirs = PlatformDirs(app_name, app_author)
    for prop in PROPS:
        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201

    print("\n-- app dirs (without optional 'appauthor')")  # noqa: T201
    dirs = PlatformDirs(app_name)
    for prop in PROPS:
        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201

    print("\n-- app dirs (with disabled 'appauthor')")  # noqa: T201
    dirs = PlatformDirs(app_name, appauthor=False)
    for prop in PROPS:
        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201


if __name__ == "__main__":
    main()


================================================
FILE: src/pip/_vendor/platformdirs/android.py
================================================
"""Android."""

from __future__ import annotations

import os
import re
import sys
from functools import lru_cache
from typing import TYPE_CHECKING, cast

from .api import PlatformDirsABC


class Android(PlatformDirsABC):
    """
    Follows the guidance `from here `_.

    Makes use of the `appname `, `version
    `, `ensure_exists `.

    """

    @property
    def user_data_dir(self) -> str:
        """:return: data directory tied to the user, e.g. ``/data/user///files/``"""
        return self._append_app_name_and_version(cast("str", _android_folder()), "files")

    @property
    def site_data_dir(self) -> str:
        """:return: data directory shared by users, same as `user_data_dir`"""
        return self.user_data_dir

    @property
    def user_config_dir(self) -> str:
        """
        :return: config directory tied to the user, e.g. \
        ``/data/user///shared_prefs/``
        """
        return self._append_app_name_and_version(cast("str", _android_folder()), "shared_prefs")

    @property
    def site_config_dir(self) -> str:
        """:return: config directory shared by the users, same as `user_config_dir`"""
        return self.user_config_dir

    @property
    def user_cache_dir(self) -> str:
        """:return: cache directory tied to the user, e.g.,``/data/user///cache/``"""
        return self._append_app_name_and_version(cast("str", _android_folder()), "cache")

    @property
    def site_cache_dir(self) -> str:
        """:return: cache directory shared by users, same as `user_cache_dir`"""
        return self.user_cache_dir

    @property
    def user_state_dir(self) -> str:
        """:return: state directory tied to the user, same as `user_data_dir`"""
        return self.user_data_dir

    @property
    def user_log_dir(self) -> str:
        """
        :return: log directory tied to the user, same as `user_cache_dir` if not opinionated else ``log`` in it,
          e.g. ``/data/user///cache//log``
        """
        path = self.user_cache_dir
        if self.opinion:
            path = os.path.join(path, "log")  # noqa: PTH118
        return path

    @property
    def user_documents_dir(self) -> str:
        """:return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents``"""
        return _android_documents_folder()

    @property
    def user_downloads_dir(self) -> str:
        """:return: downloads directory tied to the user e.g. ``/storage/emulated/0/Downloads``"""
        return _android_downloads_folder()

    @property
    def user_pictures_dir(self) -> str:
        """:return: pictures directory tied to the user e.g. ``/storage/emulated/0/Pictures``"""
        return _android_pictures_folder()

    @property
    def user_videos_dir(self) -> str:
        """:return: videos directory tied to the user e.g. ``/storage/emulated/0/DCIM/Camera``"""
        return _android_videos_folder()

    @property
    def user_music_dir(self) -> str:
        """:return: music directory tied to the user e.g. ``/storage/emulated/0/Music``"""
        return _android_music_folder()

    @property
    def user_desktop_dir(self) -> str:
        """:return: desktop directory tied to the user e.g. ``/storage/emulated/0/Desktop``"""
        return "/storage/emulated/0/Desktop"

    @property
    def user_runtime_dir(self) -> str:
        """
        :return: runtime directory tied to the user, same as `user_cache_dir` if not opinionated else ``tmp`` in it,
          e.g. ``/data/user///cache//tmp``
        """
        path = self.user_cache_dir
        if self.opinion:
            path = os.path.join(path, "tmp")  # noqa: PTH118
        return path

    @property
    def site_runtime_dir(self) -> str:
        """:return: runtime directory shared by users, same as `user_runtime_dir`"""
        return self.user_runtime_dir


@lru_cache(maxsize=1)
def _android_folder() -> str | None:  # noqa: C901
    """:return: base folder for the Android OS or None if it cannot be found"""
    result: str | None = None
    # type checker isn't happy with our "import android", just don't do this when type checking see
    # https://stackoverflow.com/a/61394121
    if not TYPE_CHECKING:
        try:
            # First try to get a path to android app using python4android (if available)...
            from android import mActivity  # noqa: PLC0415

            context = cast("android.content.Context", mActivity.getApplicationContext())  # noqa: F821
            result = context.getFilesDir().getParentFile().getAbsolutePath()
        except Exception:  # noqa: BLE001
            result = None
    if result is None:
        try:
            # ...and fall back to using plain pyjnius, if python4android isn't available or doesn't deliver any useful
            # result...
            from jnius import autoclass  # noqa: PLC0415

            context = autoclass("android.content.Context")
            result = context.getFilesDir().getParentFile().getAbsolutePath()
        except Exception:  # noqa: BLE001
            result = None
    if result is None:
        # and if that fails, too, find an android folder looking at path on the sys.path
        # warning: only works for apps installed under /data, not adopted storage etc.
        pattern = re.compile(r"/data/(data|user/\d+)/(.+)/files")
        for path in sys.path:
            if pattern.match(path):
                result = path.split("/files")[0]
                break
        else:
            result = None
    if result is None:
        # one last try: find an android folder looking at path on the sys.path taking adopted storage paths into
        # account
        pattern = re.compile(r"/mnt/expand/[a-fA-F0-9-]{36}/(data|user/\d+)/(.+)/files")
        for path in sys.path:
            if pattern.match(path):
                result = path.split("/files")[0]
                break
        else:
            result = None
    return result


@lru_cache(maxsize=1)
def _android_documents_folder() -> str:
    """:return: documents folder for the Android OS"""
    # Get directories with pyjnius
    try:
        from jnius import autoclass  # noqa: PLC0415

        context = autoclass("android.content.Context")
        environment = autoclass("android.os.Environment")
        documents_dir: str = context.getExternalFilesDir(environment.DIRECTORY_DOCUMENTS).getAbsolutePath()
    except Exception:  # noqa: BLE001
        documents_dir = "/storage/emulated/0/Documents"

    return documents_dir


@lru_cache(maxsize=1)
def _android_downloads_folder() -> str:
    """:return: downloads folder for the Android OS"""
    # Get directories with pyjnius
    try:
        from jnius import autoclass  # noqa: PLC0415

        context = autoclass("android.content.Context")
        environment = autoclass("android.os.Environment")
        downloads_dir: str = context.getExternalFilesDir(environment.DIRECTORY_DOWNLOADS).getAbsolutePath()
    except Exception:  # noqa: BLE001
        downloads_dir = "/storage/emulated/0/Downloads"

    return downloads_dir


@lru_cache(maxsize=1)
def _android_pictures_folder() -> str:
    """:return: pictures folder for the Android OS"""
    # Get directories with pyjnius
    try:
        from jnius import autoclass  # noqa: PLC0415

        context = autoclass("android.content.Context")
        environment = autoclass("android.os.Environment")
        pictures_dir: str = context.getExternalFilesDir(environment.DIRECTORY_PICTURES).getAbsolutePath()
    except Exception:  # noqa: BLE001
        pictures_dir = "/storage/emulated/0/Pictures"

    return pictures_dir


@lru_cache(maxsize=1)
def _android_videos_folder() -> str:
    """:return: videos folder for the Android OS"""
    # Get directories with pyjnius
    try:
        from jnius import autoclass  # noqa: PLC0415

        context = autoclass("android.content.Context")
        environment = autoclass("android.os.Environment")
        videos_dir: str = context.getExternalFilesDir(environment.DIRECTORY_DCIM).getAbsolutePath()
    except Exception:  # noqa: BLE001
        videos_dir = "/storage/emulated/0/DCIM/Camera"

    return videos_dir


@lru_cache(maxsize=1)
def _android_music_folder() -> str:
    """:return: music folder for the Android OS"""
    # Get directories with pyjnius
    try:
        from jnius import autoclass  # noqa: PLC0415

        context = autoclass("android.content.Context")
        environment = autoclass("android.os.Environment")
        music_dir: str = context.getExternalFilesDir(environment.DIRECTORY_MUSIC).getAbsolutePath()
    except Exception:  # noqa: BLE001
        music_dir = "/storage/emulated/0/Music"

    return music_dir


__all__ = [
    "Android",
]


================================================
FILE: src/pip/_vendor/platformdirs/api.py
================================================
"""Base API."""

from __future__ import annotations

import os
from abc import ABC, abstractmethod
from pathlib import Path
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from collections.abc import Iterator
    from typing import Literal


class PlatformDirsABC(ABC):  # noqa: PLR0904
    """Abstract base class for platform directories."""

    def __init__(  # noqa: PLR0913, PLR0917
        self,
        appname: str | None = None,
        appauthor: str | Literal[False] | None = None,
        version: str | None = None,
        roaming: bool = False,  # noqa: FBT001, FBT002
        multipath: bool = False,  # noqa: FBT001, FBT002
        opinion: bool = True,  # noqa: FBT001, FBT002
        ensure_exists: bool = False,  # noqa: FBT001, FBT002
    ) -> None:
        """
        Create a new platform directory.

        :param appname: See `appname`.
        :param appauthor: See `appauthor`.
        :param version: See `version`.
        :param roaming: See `roaming`.
        :param multipath: See `multipath`.
        :param opinion: See `opinion`.
        :param ensure_exists: See `ensure_exists`.

        """
        self.appname = appname  #: The name of application.
        self.appauthor = appauthor
        """
        The name of the app author or distributing body for this application.

        Typically, it is the owning company name. Defaults to `appname`. You may pass ``False`` to disable it.

        """
        self.version = version
        """
        An optional version path element to append to the path.

        You might want to use this if you want multiple versions of your app to be able to run independently. If used,
        this would typically be ``.``.

        """
        self.roaming = roaming
        """
        Whether to use the roaming appdata directory on Windows.

        That means that for users on a Windows network setup for roaming profiles, this user data will be synced on
        login (see
        `here `_).

        """
        self.multipath = multipath
        """
        An optional parameter which indicates that the entire list of data dirs should be returned.

        By default, the first item would only be returned.

        """
        self.opinion = opinion  #: A flag to indicating to use opinionated values.
        self.ensure_exists = ensure_exists
        """
        Optionally create the directory (and any missing parents) upon access if it does not exist.

        By default, no directories are created.

        """

    def _append_app_name_and_version(self, *base: str) -> str:
        params = list(base[1:])
        if self.appname:
            params.append(self.appname)
            if self.version:
                params.append(self.version)
        path = os.path.join(base[0], *params)  # noqa: PTH118
        self._optionally_create_directory(path)
        return path

    def _optionally_create_directory(self, path: str) -> None:
        if self.ensure_exists:
            Path(path).mkdir(parents=True, exist_ok=True)

    def _first_item_as_path_if_multipath(self, directory: str) -> Path:
        if self.multipath:
            # If multipath is True, the first path is returned.
            directory = directory.partition(os.pathsep)[0]
        return Path(directory)

    @property
    @abstractmethod
    def user_data_dir(self) -> str:
        """:return: data directory tied to the user"""

    @property
    @abstractmethod
    def site_data_dir(self) -> str:
        """:return: data directory shared by users"""

    @property
    @abstractmethod
    def user_config_dir(self) -> str:
        """:return: config directory tied to the user"""

    @property
    @abstractmethod
    def site_config_dir(self) -> str:
        """:return: config directory shared by the users"""

    @property
    @abstractmethod
    def user_cache_dir(self) -> str:
        """:return: cache directory tied to the user"""

    @property
    @abstractmethod
    def site_cache_dir(self) -> str:
        """:return: cache directory shared by users"""

    @property
    @abstractmethod
    def user_state_dir(self) -> str:
        """:return: state directory tied to the user"""

    @property
    @abstractmethod
    def user_log_dir(self) -> str:
        """:return: log directory tied to the user"""

    @property
    @abstractmethod
    def user_documents_dir(self) -> str:
        """:return: documents directory tied to the user"""

    @property
    @abstractmethod
    def user_downloads_dir(self) -> str:
        """:return: downloads directory tied to the user"""

    @property
    @abstractmethod
    def user_pictures_dir(self) -> str:
        """:return: pictures directory tied to the user"""

    @property
    @abstractmethod
    def user_videos_dir(self) -> str:
        """:return: videos directory tied to the user"""

    @property
    @abstractmethod
    def user_music_dir(self) -> str:
        """:return: music directory tied to the user"""

    @property
    @abstractmethod
    def user_desktop_dir(self) -> str:
        """:return: desktop directory tied to the user"""

    @property
    @abstractmethod
    def user_runtime_dir(self) -> str:
        """:return: runtime directory tied to the user"""

    @property
    @abstractmethod
    def site_runtime_dir(self) -> str:
        """:return: runtime directory shared by users"""

    @property
    def user_data_path(self) -> Path:
        """:return: data path tied to the user"""
        return Path(self.user_data_dir)

    @property
    def site_data_path(self) -> Path:
        """:return: data path shared by users"""
        return Path(self.site_data_dir)

    @property
    def user_config_path(self) -> Path:
        """:return: config path tied to the user"""
        return Path(self.user_config_dir)

    @property
    def site_config_path(self) -> Path:
        """:return: config path shared by the users"""
        return Path(self.site_config_dir)

    @property
    def user_cache_path(self) -> Path:
        """:return: cache path tied to the user"""
        return Path(self.user_cache_dir)

    @property
    def site_cache_path(self) -> Path:
        """:return: cache path shared by users"""
        return Path(self.site_cache_dir)

    @property
    def user_state_path(self) -> Path:
        """:return: state path tied to the user"""
        return Path(self.user_state_dir)

    @property
    def user_log_path(self) -> Path:
        """:return: log path tied to the user"""
        return Path(self.user_log_dir)

    @property
    def user_documents_path(self) -> Path:
        """:return: documents a path tied to the user"""
        return Path(self.user_documents_dir)

    @property
    def user_downloads_path(self) -> Path:
        """:return: downloads path tied to the user"""
        return Path(self.user_downloads_dir)

    @property
    def user_pictures_path(self) -> Path:
        """:return: pictures path tied to the user"""
        return Path(self.user_pictures_dir)

    @property
    def user_videos_path(self) -> Path:
        """:return: videos path tied to the user"""
        return Path(self.user_videos_dir)

    @property
    def user_music_path(self) -> Path:
        """:return: music path tied to the user"""
        return Path(self.user_music_dir)

    @property
    def user_desktop_path(self) -> Path:
        """:return: desktop path tied to the user"""
        return Path(self.user_desktop_dir)

    @property
    def user_runtime_path(self) -> Path:
        """:return: runtime path tied to the user"""
        return Path(self.user_runtime_dir)

    @property
    def site_runtime_path(self) -> Path:
        """:return: runtime path shared by users"""
        return Path(self.site_runtime_dir)

    def iter_config_dirs(self) -> Iterator[str]:
        """:yield: all user and site configuration directories."""
        yield self.user_config_dir
        yield self.site_config_dir

    def iter_data_dirs(self) -> Iterator[str]:
        """:yield: all user and site data directories."""
        yield self.user_data_dir
        yield self.site_data_dir

    def iter_cache_dirs(self) -> Iterator[str]:
        """:yield: all user and site cache directories."""
        yield self.user_cache_dir
        yield self.site_cache_dir

    def iter_runtime_dirs(self) -> Iterator[str]:
        """:yield: all user and site runtime directories."""
        yield self.user_runtime_dir
        yield self.site_runtime_dir

    def iter_config_paths(self) -> Iterator[Path]:
        """:yield: all user and site configuration paths."""
        for path in self.iter_config_dirs():
            yield Path(path)

    def iter_data_paths(self) -> Iterator[Path]:
        """:yield: all user and site data paths."""
        for path in self.iter_data_dirs():
            yield Path(path)

    def iter_cache_paths(self) -> Iterator[Path]:
        """:yield: all user and site cache paths."""
        for path in self.iter_cache_dirs():
            yield Path(path)

    def iter_runtime_paths(self) -> Iterator[Path]:
        """:yield: all user and site runtime paths."""
        for path in self.iter_runtime_dirs():
            yield Path(path)


================================================
FILE: src/pip/_vendor/platformdirs/macos.py
================================================
"""macOS."""

from __future__ import annotations

import os.path
import sys
from typing import TYPE_CHECKING

from .api import PlatformDirsABC

if TYPE_CHECKING:
    from pathlib import Path


class MacOS(PlatformDirsABC):
    """
    Platform directories for the macOS operating system.

    Follows the guidance from
    `Apple documentation `_.
    Makes use of the `appname `,
    `version `,
    `ensure_exists `.

    """

    @property
    def user_data_dir(self) -> str:
        """:return: data directory tied to the user, e.g. ``~/Library/Application Support/$appname/$version``"""
        return self._append_app_name_and_version(os.path.expanduser("~/Library/Application Support"))  # noqa: PTH111

    @property
    def site_data_dir(self) -> str:
        """
        :return: data directory shared by users, e.g. ``/Library/Application Support/$appname/$version``.
          If we're using a Python binary managed by `Homebrew `_, the directory
          will be under the Homebrew prefix, e.g. ``$homebrew_prefix/share/$appname/$version``.
          If `multipath ` is enabled, and we're in Homebrew,
          the response is a multi-path string separated by ":", e.g.
          ``$homebrew_prefix/share/$appname/$version:/Library/Application Support/$appname/$version``
        """
        is_homebrew = "/opt/python" in sys.prefix
        homebrew_prefix = sys.prefix.split("/opt/python")[0] if is_homebrew else ""
        path_list = [self._append_app_name_and_version(f"{homebrew_prefix}/share")] if is_homebrew else []
        path_list.append(self._append_app_name_and_version("/Library/Application Support"))
        if self.multipath:
            return os.pathsep.join(path_list)
        return path_list[0]

    @property
    def site_data_path(self) -> Path:
        """:return: data path shared by users. Only return the first item, even if ``multipath`` is set to ``True``"""
        return self._first_item_as_path_if_multipath(self.site_data_dir)

    @property
    def user_config_dir(self) -> str:
        """:return: config directory tied to the user, same as `user_data_dir`"""
        return self.user_data_dir

    @property
    def site_config_dir(self) -> str:
        """:return: config directory shared by the users, same as `site_data_dir`"""
        return self.site_data_dir

    @property
    def user_cache_dir(self) -> str:
        """:return: cache directory tied to the user, e.g. ``~/Library/Caches/$appname/$version``"""
        return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches"))  # noqa: PTH111

    @property
    def site_cache_dir(self) -> str:
        """
        :return: cache directory shared by users, e.g. ``/Library/Caches/$appname/$version``.
          If we're using a Python binary managed by `Homebrew `_, the directory
          will be under the Homebrew prefix, e.g. ``$homebrew_prefix/var/cache/$appname/$version``.
          If `multipath ` is enabled, and we're in Homebrew,
          the response is a multi-path string separated by ":", e.g.
          ``$homebrew_prefix/var/cache/$appname/$version:/Library/Caches/$appname/$version``
        """
        is_homebrew = "/opt/python" in sys.prefix
        homebrew_prefix = sys.prefix.split("/opt/python")[0] if is_homebrew else ""
        path_list = [self._append_app_name_and_version(f"{homebrew_prefix}/var/cache")] if is_homebrew else []
        path_list.append(self._append_app_name_and_version("/Library/Caches"))
        if self.multipath:
            return os.pathsep.join(path_list)
        return path_list[0]

    @property
    def site_cache_path(self) -> Path:
        """:return: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``"""
        return self._first_item_as_path_if_multipath(self.site_cache_dir)

    @property
    def user_state_dir(self) -> str:
        """:return: state directory tied to the user, same as `user_data_dir`"""
        return self.user_data_dir

    @property
    def user_log_dir(self) -> str:
        """:return: log directory tied to the user, e.g. ``~/Library/Logs/$appname/$version``"""
        return self._append_app_name_and_version(os.path.expanduser("~/Library/Logs"))  # noqa: PTH111

    @property
    def user_documents_dir(self) -> str:
        """:return: documents directory tied to the user, e.g. ``~/Documents``"""
        return os.path.expanduser("~/Documents")  # noqa: PTH111

    @property
    def user_downloads_dir(self) -> str:
        """:return: downloads directory tied to the user, e.g. ``~/Downloads``"""
        return os.path.expanduser("~/Downloads")  # noqa: PTH111

    @property
    def user_pictures_dir(self) -> str:
        """:return: pictures directory tied to the user, e.g. ``~/Pictures``"""
        return os.path.expanduser("~/Pictures")  # noqa: PTH111

    @property
    def user_videos_dir(self) -> str:
        """:return: videos directory tied to the user, e.g. ``~/Movies``"""
        return os.path.expanduser("~/Movies")  # noqa: PTH111

    @property
    def user_music_dir(self) -> str:
        """:return: music directory tied to the user, e.g. ``~/Music``"""
        return os.path.expanduser("~/Music")  # noqa: PTH111

    @property
    def user_desktop_dir(self) -> str:
        """:return: desktop directory tied to the user, e.g. ``~/Desktop``"""
        return os.path.expanduser("~/Desktop")  # noqa: PTH111

    @property
    def user_runtime_dir(self) -> str:
        """:return: runtime directory tied to the user, e.g. ``~/Library/Caches/TemporaryItems/$appname/$version``"""
        return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches/TemporaryItems"))  # noqa: PTH111

    @property
    def site_runtime_dir(self) -> str:
        """:return: runtime directory shared by users, same as `user_runtime_dir`"""
        return self.user_runtime_dir


__all__ = [
    "MacOS",
]


================================================
FILE: src/pip/_vendor/platformdirs/py.typed
================================================


================================================
FILE: src/pip/_vendor/platformdirs/unix.py
================================================
"""Unix."""

from __future__ import annotations

import os
import sys
from configparser import ConfigParser
from pathlib import Path
from typing import TYPE_CHECKING, NoReturn

from .api import PlatformDirsABC

if TYPE_CHECKING:
    from collections.abc import Iterator

if sys.platform == "win32":

    def getuid() -> NoReturn:
        msg = "should only be used on Unix"
        raise RuntimeError(msg)

else:
    from os import getuid


class Unix(PlatformDirsABC):  # noqa: PLR0904
    """
    On Unix/Linux, we follow the `XDG Basedir Spec `_.

    The spec allows overriding directories with environment variables. The examples shown are the default values,
    alongside the name of the environment variable that overrides them. Makes use of the `appname
    `, `version `, `multipath
    `, `opinion `, `ensure_exists
    `.

    """

    @property
    def user_data_dir(self) -> str:
        """
        :return: data directory tied to the user, e.g. ``~/.local/share/$appname/$version`` or
         ``$XDG_DATA_HOME/$appname/$version``
        """
        path = os.environ.get("XDG_DATA_HOME", "")
        if not path.strip():
            path = os.path.expanduser("~/.local/share")  # noqa: PTH111
        return self._append_app_name_and_version(path)

    @property
    def _site_data_dirs(self) -> list[str]:
        path = os.environ.get("XDG_DATA_DIRS", "")
        if not path.strip():
            path = f"/usr/local/share{os.pathsep}/usr/share"
        return [self._append_app_name_and_version(p) for p in path.split(os.pathsep)]

    @property
    def site_data_dir(self) -> str:
        """
        :return: data directories shared by users (if `multipath ` is
         enabled and ``XDG_DATA_DIRS`` is set and a multi path the response is also a multi path separated by the
         OS path separator), e.g. ``/usr/local/share/$appname/$version`` or ``/usr/share/$appname/$version``
        """
        # XDG default for $XDG_DATA_DIRS; only first, if multipath is False
        dirs = self._site_data_dirs
        if not self.multipath:
            return dirs[0]
        return os.pathsep.join(dirs)

    @property
    def user_config_dir(self) -> str:
        """
        :return: config directory tied to the user, e.g. ``~/.config/$appname/$version`` or
         ``$XDG_CONFIG_HOME/$appname/$version``
        """
        path = os.environ.get("XDG_CONFIG_HOME", "")
        if not path.strip():
            path = os.path.expanduser("~/.config")  # noqa: PTH111
        return self._append_app_name_and_version(path)

    @property
    def _site_config_dirs(self) -> list[str]:
        path = os.environ.get("XDG_CONFIG_DIRS", "")
        if not path.strip():
            path = "/etc/xdg"
        return [self._append_app_name_and_version(p) for p in path.split(os.pathsep)]

    @property
    def site_config_dir(self) -> str:
        """
        :return: config directories shared by users (if `multipath `
         is enabled and ``XDG_CONFIG_DIRS`` is set and a multi path the response is also a multi path separated by
         the OS path separator), e.g. ``/etc/xdg/$appname/$version``
        """
        # XDG default for $XDG_CONFIG_DIRS only first, if multipath is False
        dirs = self._site_config_dirs
        if not self.multipath:
            return dirs[0]
        return os.pathsep.join(dirs)

    @property
    def user_cache_dir(self) -> str:
        """
        :return: cache directory tied to the user, e.g. ``~/.cache/$appname/$version`` or
         ``~/$XDG_CACHE_HOME/$appname/$version``
        """
        path = os.environ.get("XDG_CACHE_HOME", "")
        if not path.strip():
            path = os.path.expanduser("~/.cache")  # noqa: PTH111
        return self._append_app_name_and_version(path)

    @property
    def site_cache_dir(self) -> str:
        """:return: cache directory shared by users, e.g. ``/var/cache/$appname/$version``"""
        return self._append_app_name_and_version("/var/cache")

    @property
    def user_state_dir(self) -> str:
        """
        :return: state directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or
         ``$XDG_STATE_HOME/$appname/$version``
        """
        path = os.environ.get("XDG_STATE_HOME", "")
        if not path.strip():
            path = os.path.expanduser("~/.local/state")  # noqa: PTH111
        return self._append_app_name_and_version(path)

    @property
    def user_log_dir(self) -> str:
        """:return: log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in it"""
        path = self.user_state_dir
        if self.opinion:
            path = os.path.join(path, "log")  # noqa: PTH118
            self._optionally_create_directory(path)
        return path

    @property
    def user_documents_dir(self) -> str:
        """:return: documents directory tied to the user, e.g. ``~/Documents``"""
        return _get_user_media_dir("XDG_DOCUMENTS_DIR", "~/Documents")

    @property
    def user_downloads_dir(self) -> str:
        """:return: downloads directory tied to the user, e.g. ``~/Downloads``"""
        return _get_user_media_dir("XDG_DOWNLOAD_DIR", "~/Downloads")

    @property
    def user_pictures_dir(self) -> str:
        """:return: pictures directory tied to the user, e.g. ``~/Pictures``"""
        return _get_user_media_dir("XDG_PICTURES_DIR", "~/Pictures")

    @property
    def user_videos_dir(self) -> str:
        """:return: videos directory tied to the user, e.g. ``~/Videos``"""
        return _get_user_media_dir("XDG_VIDEOS_DIR", "~/Videos")

    @property
    def user_music_dir(self) -> str:
        """:return: music directory tied to the user, e.g. ``~/Music``"""
        return _get_user_media_dir("XDG_MUSIC_DIR", "~/Music")

    @property
    def user_desktop_dir(self) -> str:
        """:return: desktop directory tied to the user, e.g. ``~/Desktop``"""
        return _get_user_media_dir("XDG_DESKTOP_DIR", "~/Desktop")

    @property
    def user_runtime_dir(self) -> str:
        """
        :return: runtime directory tied to the user, e.g. ``/run/user/$(id -u)/$appname/$version`` or
         ``$XDG_RUNTIME_DIR/$appname/$version``.

         For FreeBSD/OpenBSD/NetBSD, it would return ``/var/run/user/$(id -u)/$appname/$version`` if
         exists, otherwise ``/tmp/runtime-$(id -u)/$appname/$version``, if``$XDG_RUNTIME_DIR``
         is not set.
        """
        path = os.environ.get("XDG_RUNTIME_DIR", "")
        if not path.strip():
            if sys.platform.startswith(("freebsd", "openbsd", "netbsd")):
                path = f"/var/run/user/{getuid()}"
                if not Path(path).exists():
                    path = f"/tmp/runtime-{getuid()}"  # noqa: S108
            else:
                path = f"/run/user/{getuid()}"
        return self._append_app_name_and_version(path)

    @property
    def site_runtime_dir(self) -> str:
        """
        :return: runtime directory shared by users, e.g. ``/run/$appname/$version`` or \
        ``$XDG_RUNTIME_DIR/$appname/$version``.

        Note that this behaves almost exactly like `user_runtime_dir` if ``$XDG_RUNTIME_DIR`` is set, but will
        fall back to paths associated to the root user instead of a regular logged-in user if it's not set.

        If you wish to ensure that a logged-in root user path is returned e.g. ``/run/user/0``, use `user_runtime_dir`
        instead.

        For FreeBSD/OpenBSD/NetBSD, it would return ``/var/run/$appname/$version`` if ``$XDG_RUNTIME_DIR`` is not set.
        """
        path = os.environ.get("XDG_RUNTIME_DIR", "")
        if not path.strip():
            if sys.platform.startswith(("freebsd", "openbsd", "netbsd")):
                path = "/var/run"
            else:
                path = "/run"
        return self._append_app_name_and_version(path)

    @property
    def site_data_path(self) -> Path:
        """:return: data path shared by users. Only return the first item, even if ``multipath`` is set to ``True``"""
        return self._first_item_as_path_if_multipath(self.site_data_dir)

    @property
    def site_config_path(self) -> Path:
        """:return: config path shared by the users, returns the first item, even if ``multipath`` is set to ``True``"""
        return self._first_item_as_path_if_multipath(self.site_config_dir)

    @property
    def site_cache_path(self) -> Path:
        """:return: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``"""
        return self._first_item_as_path_if_multipath(self.site_cache_dir)

    def iter_config_dirs(self) -> Iterator[str]:
        """:yield: all user and site configuration directories."""
        yield self.user_config_dir
        yield from self._site_config_dirs

    def iter_data_dirs(self) -> Iterator[str]:
        """:yield: all user and site data directories."""
        yield self.user_data_dir
        yield from self._site_data_dirs


def _get_user_media_dir(env_var: str, fallback_tilde_path: str) -> str:
    media_dir = _get_user_dirs_folder(env_var)
    if media_dir is None:
        media_dir = os.environ.get(env_var, "").strip()
        if not media_dir:
            media_dir = os.path.expanduser(fallback_tilde_path)  # noqa: PTH111

    return media_dir


def _get_user_dirs_folder(key: str) -> str | None:
    """
    Return directory from user-dirs.dirs config file.

    See https://freedesktop.org/wiki/Software/xdg-user-dirs/.

    """
    user_dirs_config_path = Path(Unix().user_config_dir) / "user-dirs.dirs"
    if user_dirs_config_path.exists():
        parser = ConfigParser()

        with user_dirs_config_path.open() as stream:
            # Add fake section header, so ConfigParser doesn't complain
            parser.read_string(f"[top]\n{stream.read()}")

        if key not in parser["top"]:
            return None

        path = parser["top"][key].strip('"')
        # Handle relative home paths
        return path.replace("$HOME", os.path.expanduser("~"))  # noqa: PTH111

    return None


__all__ = [
    "Unix",
]


================================================
FILE: src/pip/_vendor/platformdirs/version.py
================================================
# file generated by setuptools-scm
# don't change, don't track in version control

__all__ = [
    "__version__",
    "__version_tuple__",
    "version",
    "version_tuple",
    "__commit_id__",
    "commit_id",
]

TYPE_CHECKING = False
if TYPE_CHECKING:
    from typing import Tuple
    from typing import Union

    VERSION_TUPLE = Tuple[Union[int, str], ...]
    COMMIT_ID = Union[str, None]
else:
    VERSION_TUPLE = object
    COMMIT_ID = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE
commit_id: COMMIT_ID
__commit_id__: COMMIT_ID

__version__ = version = '4.5.1'
__version_tuple__ = version_tuple = (4, 5, 1)

__commit_id__ = commit_id = None


================================================
FILE: src/pip/_vendor/platformdirs/windows.py
================================================
"""Windows."""

from __future__ import annotations

import os
import sys
from functools import lru_cache
from typing import TYPE_CHECKING

from .api import PlatformDirsABC

if TYPE_CHECKING:
    from collections.abc import Callable


class Windows(PlatformDirsABC):
    """
    `MSDN on where to store app data files `_.

    Makes use of the `appname `, `appauthor
    `, `version `, `roaming
    `, `opinion `, `ensure_exists
    `.

    """

    @property
    def user_data_dir(self) -> str:
        """
        :return: data directory tied to the user, e.g.
         ``%USERPROFILE%\\AppData\\Local\\$appauthor\\$appname`` (not roaming) or
         ``%USERPROFILE%\\AppData\\Roaming\\$appauthor\\$appname`` (roaming)
        """
        const = "CSIDL_APPDATA" if self.roaming else "CSIDL_LOCAL_APPDATA"
        path = os.path.normpath(get_win_folder(const))
        return self._append_parts(path)

    def _append_parts(self, path: str, *, opinion_value: str | None = None) -> str:
        params = []
        if self.appname:
            if self.appauthor is not False:
                author = self.appauthor or self.appname
                params.append(author)
            params.append(self.appname)
            if opinion_value is not None and self.opinion:
                params.append(opinion_value)
            if self.version:
                params.append(self.version)
        path = os.path.join(path, *params)  # noqa: PTH118
        self._optionally_create_directory(path)
        return path

    @property
    def site_data_dir(self) -> str:
        """:return: data directory shared by users, e.g. ``C:\\ProgramData\\$appauthor\\$appname``"""
        path = os.path.normpath(get_win_folder("CSIDL_COMMON_APPDATA"))
        return self._append_parts(path)

    @property
    def user_config_dir(self) -> str:
        """:return: config directory tied to the user, same as `user_data_dir`"""
        return self.user_data_dir

    @property
    def site_config_dir(self) -> str:
        """:return: config directory shared by the users, same as `site_data_dir`"""
        return self.site_data_dir

    @property
    def user_cache_dir(self) -> str:
        """
        :return: cache directory tied to the user (if opinionated with ``Cache`` folder within ``$appname``) e.g.
         ``%USERPROFILE%\\AppData\\Local\\$appauthor\\$appname\\Cache\\$version``
        """
        path = os.path.normpath(get_win_folder("CSIDL_LOCAL_APPDATA"))
        return self._append_parts(path, opinion_value="Cache")

    @property
    def site_cache_dir(self) -> str:
        """:return: cache directory shared by users, e.g. ``C:\\ProgramData\\$appauthor\\$appname\\Cache\\$version``"""
        path = os.path.normpath(get_win_folder("CSIDL_COMMON_APPDATA"))
        return self._append_parts(path, opinion_value="Cache")

    @property
    def user_state_dir(self) -> str:
        """:return: state directory tied to the user, same as `user_data_dir`"""
        return self.user_data_dir

    @property
    def user_log_dir(self) -> str:
        """:return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in it"""
        path = self.user_data_dir
        if self.opinion:
            path = os.path.join(path, "Logs")  # noqa: PTH118
            self._optionally_create_directory(path)
        return path

    @property
    def user_documents_dir(self) -> str:
        """:return: documents directory tied to the user e.g. ``%USERPROFILE%\\Documents``"""
        return os.path.normpath(get_win_folder("CSIDL_PERSONAL"))

    @property
    def user_downloads_dir(self) -> str:
        """:return: downloads directory tied to the user e.g. ``%USERPROFILE%\\Downloads``"""
        return os.path.normpath(get_win_folder("CSIDL_DOWNLOADS"))

    @property
    def user_pictures_dir(self) -> str:
        """:return: pictures directory tied to the user e.g. ``%USERPROFILE%\\Pictures``"""
        return os.path.normpath(get_win_folder("CSIDL_MYPICTURES"))

    @property
    def user_videos_dir(self) -> str:
        """:return: videos directory tied to the user e.g. ``%USERPROFILE%\\Videos``"""
        return os.path.normpath(get_win_folder("CSIDL_MYVIDEO"))

    @property
    def user_music_dir(self) -> str:
        """:return: music directory tied to the user e.g. ``%USERPROFILE%\\Music``"""
        return os.path.normpath(get_win_folder("CSIDL_MYMUSIC"))

    @property
    def user_desktop_dir(self) -> str:
        """:return: desktop directory tied to the user, e.g. ``%USERPROFILE%\\Desktop``"""
        return os.path.normpath(get_win_folder("CSIDL_DESKTOPDIRECTORY"))

    @property
    def user_runtime_dir(self) -> str:
        """
        :return: runtime directory tied to the user, e.g.
         ``%USERPROFILE%\\AppData\\Local\\Temp\\$appauthor\\$appname``
        """
        path = os.path.normpath(os.path.join(get_win_folder("CSIDL_LOCAL_APPDATA"), "Temp"))  # noqa: PTH118
        return self._append_parts(path)

    @property
    def site_runtime_dir(self) -> str:
        """:return: runtime directory shared by users, same as `user_runtime_dir`"""
        return self.user_runtime_dir


def get_win_folder_from_env_vars(csidl_name: str) -> str:
    """Get folder from environment variables."""
    result = get_win_folder_if_csidl_name_not_env_var(csidl_name)
    if result is not None:
        return result

    env_var_name = {
        "CSIDL_APPDATA": "APPDATA",
        "CSIDL_COMMON_APPDATA": "ALLUSERSPROFILE",
        "CSIDL_LOCAL_APPDATA": "LOCALAPPDATA",
    }.get(csidl_name)
    if env_var_name is None:
        msg = f"Unknown CSIDL name: {csidl_name}"
        raise ValueError(msg)
    result = os.environ.get(env_var_name)
    if result is None:
        msg = f"Unset environment variable: {env_var_name}"
        raise ValueError(msg)
    return result


def get_win_folder_if_csidl_name_not_env_var(csidl_name: str) -> str | None:
    """Get a folder for a CSIDL name that does not exist as an environment variable."""
    if csidl_name == "CSIDL_PERSONAL":
        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Documents")  # noqa: PTH118

    if csidl_name == "CSIDL_DOWNLOADS":
        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Downloads")  # noqa: PTH118

    if csidl_name == "CSIDL_MYPICTURES":
        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Pictures")  # noqa: PTH118

    if csidl_name == "CSIDL_MYVIDEO":
        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Videos")  # noqa: PTH118

    if csidl_name == "CSIDL_MYMUSIC":
        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Music")  # noqa: PTH118
    return None


def get_win_folder_from_registry(csidl_name: str) -> str:
    """
    Get folder from the registry.

    This is a fallback technique at best. I'm not sure if using the registry for these guarantees us the correct answer
    for all CSIDL_* names.

    """
    machine_names = {
        "CSIDL_COMMON_APPDATA",
    }
    shell_folder_name = {
        "CSIDL_APPDATA": "AppData",
        "CSIDL_COMMON_APPDATA": "Common AppData",
        "CSIDL_LOCAL_APPDATA": "Local AppData",
        "CSIDL_PERSONAL": "Personal",
        "CSIDL_DOWNLOADS": "{374DE290-123F-4565-9164-39C4925E467B}",
        "CSIDL_MYPICTURES": "My Pictures",
        "CSIDL_MYVIDEO": "My Video",
        "CSIDL_MYMUSIC": "My Music",
    }.get(csidl_name)
    if shell_folder_name is None:
        msg = f"Unknown CSIDL name: {csidl_name}"
        raise ValueError(msg)
    if sys.platform != "win32":  # only needed for mypy type checker to know that this code runs only on Windows
        raise NotImplementedError
    import winreg  # noqa: PLC0415

    # Use HKEY_LOCAL_MACHINE for system-wide folders, HKEY_CURRENT_USER for user-specific folders
    hkey = winreg.HKEY_LOCAL_MACHINE if csidl_name in machine_names else winreg.HKEY_CURRENT_USER

    key = winreg.OpenKey(hkey, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
    directory, _ = winreg.QueryValueEx(key, shell_folder_name)
    return str(directory)


def get_win_folder_via_ctypes(csidl_name: str) -> str:
    """Get folder with ctypes."""
    # There is no 'CSIDL_DOWNLOADS'.
    # Use 'CSIDL_PROFILE' (40) and append the default folder 'Downloads' instead.
    # https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid

    import ctypes  # noqa: PLC0415

    csidl_const = {
        "CSIDL_APPDATA": 26,
        "CSIDL_COMMON_APPDATA": 35,
        "CSIDL_LOCAL_APPDATA": 28,
        "CSIDL_PERSONAL": 5,
        "CSIDL_MYPICTURES": 39,
        "CSIDL_MYVIDEO": 14,
        "CSIDL_MYMUSIC": 13,
        "CSIDL_DOWNLOADS": 40,
        "CSIDL_DESKTOPDIRECTORY": 16,
    }.get(csidl_name)
    if csidl_const is None:
        msg = f"Unknown CSIDL name: {csidl_name}"
        raise ValueError(msg)

    buf = ctypes.create_unicode_buffer(1024)
    windll = getattr(ctypes, "windll")  # noqa: B009 # using getattr to avoid false positive with mypy type checker
    windll.shell32.SHGetFolderPathW(None, csidl_const, None, 0, buf)

    # Downgrade to short path name if it has high-bit chars.
    if any(ord(c) > 255 for c in buf):  # noqa: PLR2004
        buf2 = ctypes.create_unicode_buffer(1024)
        if windll.kernel32.GetShortPathNameW(buf.value, buf2, 1024):
            buf = buf2

    if csidl_name == "CSIDL_DOWNLOADS":
        return os.path.join(buf.value, "Downloads")  # noqa: PTH118

    return buf.value


def _pick_get_win_folder() -> Callable[[str], str]:
    try:
        import ctypes  # noqa: PLC0415
    except ImportError:
        pass
    else:
        if hasattr(ctypes, "windll"):
            return get_win_folder_via_ctypes
    try:
        import winreg  # noqa: PLC0415, F401
    except ImportError:
        return get_win_folder_from_env_vars
    else:
        return get_win_folder_from_registry


get_win_folder = lru_cache(maxsize=None)(_pick_get_win_folder())

__all__ = [
    "Windows",
]


================================================
FILE: src/pip/_vendor/pygments/LICENSE
================================================
Copyright (c) 2006-2022 by the respective authors (see AUTHORS file).
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


================================================
FILE: src/pip/_vendor/pygments/__init__.py
================================================
"""
    Pygments
    ~~~~~~~~

    Pygments is a syntax highlighting package written in Python.

    It is a generic syntax highlighter for general use in all kinds of software
    such as forum systems, wikis or other applications that need to prettify
    source code. Highlights are:

    * a wide range of common languages and markup formats is supported
    * special attention is paid to details, increasing quality by a fair amount
    * support for new languages and formats are added easily
    * a number of output formats, presently HTML, LaTeX, RTF, SVG, all image
      formats that PIL supports, and ANSI sequences
    * it is usable as a command-line tool and as a library
    * ... and it highlights even Brainfuck!

    The `Pygments master branch`_ is installable with ``easy_install Pygments==dev``.

    .. _Pygments master branch:
       https://github.com/pygments/pygments/archive/master.zip#egg=Pygments-dev

    :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""
from io import StringIO, BytesIO

__version__ = '2.19.2'
__docformat__ = 'restructuredtext'

__all__ = ['lex', 'format', 'highlight']


def lex(code, lexer):
    """
    Lex `code` with the `lexer` (must be a `Lexer` instance)
    and return an iterable of tokens. Currently, this only calls
    `lexer.get_tokens()`.
    """
    try:
        return lexer.get_tokens(code)
    except TypeError:
        # Heuristic to catch a common mistake.
        from pip._vendor.pygments.lexer import RegexLexer
        if isinstance(lexer, type) and issubclass(lexer, RegexLexer):
            raise TypeError('lex() argument must be a lexer instance, '
                            'not a class')
        raise


def format(tokens, formatter, outfile=None):  # pylint: disable=redefined-builtin
    """
    Format ``tokens`` (an iterable of tokens) with the formatter ``formatter``
    (a `Formatter` instance).

    If ``outfile`` is given and a valid file object (an object with a
    ``write`` method), the result will be written to it, otherwise it
    is returned as a string.
    """
    try:
        if not outfile:
            realoutfile = getattr(formatter, 'encoding', None) and BytesIO() or StringIO()
            formatter.format(tokens, realoutfile)
            return realoutfile.getvalue()
        else:
            formatter.format(tokens, outfile)
    except TypeError:
        # Heuristic to catch a common mistake.
        from pip._vendor.pygments.formatter import Formatter
        if isinstance(formatter, type) and issubclass(formatter, Formatter):
            raise TypeError('format() argument must be a formatter instance, '
                            'not a class')
        raise


def highlight(code, lexer, formatter, outfile=None):
    """
    This is the most high-level highlighting function. It combines `lex` and
    `format` in one function.
    """
    return format(lex(code, lexer), formatter, outfile)


================================================
FILE: src/pip/_vendor/pygments/__main__.py
================================================
"""
    pygments.__main__
    ~~~~~~~~~~~~~~~~~

    Main entry point for ``python -m pygments``.

    :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

import sys
from pip._vendor.pygments.cmdline import main

try:
    sys.exit(main(sys.argv))
except KeyboardInterrupt:
    sys.exit(1)


================================================
FILE: src/pip/_vendor/pygments/console.py
================================================
"""
    pygments.console
    ~~~~~~~~~~~~~~~~

    Format colored console output.

    :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

esc = "\x1b["

codes = {}
codes[""] = ""
codes["reset"] = esc + "39;49;00m"

codes["bold"] = esc + "01m"
codes["faint"] = esc + "02m"
codes["standout"] = esc + "03m"
codes["underline"] = esc + "04m"
codes["blink"] = esc + "05m"
codes["overline"] = esc + "06m"

dark_colors = ["black", "red", "green", "yellow", "blue",
               "magenta", "cyan", "gray"]
light_colors = ["brightblack", "brightred", "brightgreen", "brightyellow", "brightblue",
                "brightmagenta", "brightcyan", "white"]

x = 30
for dark, light in zip(dark_colors, light_colors):
    codes[dark] = esc + "%im" % x
    codes[light] = esc + "%im" % (60 + x)
    x += 1

del dark, light, x

codes["white"] = codes["bold"]


def reset_color():
    return codes["reset"]


def colorize(color_key, text):
    return codes[color_key] + text + codes["reset"]


def ansiformat(attr, text):
    """
    Format ``text`` with a color and/or some attributes::

        color       normal color
        *color*     bold color
        _color_     underlined color
        +color+     blinking color
    """
    result = []
    if attr[:1] == attr[-1:] == '+':
        result.append(codes['blink'])
        attr = attr[1:-1]
    if attr[:1] == attr[-1:] == '*':
        result.append(codes['bold'])
        attr = attr[1:-1]
    if attr[:1] == attr[-1:] == '_':
        result.append(codes['underline'])
        attr = attr[1:-1]
    result.append(codes[attr])
    result.append(text)
    result.append(codes['reset'])
    return ''.join(result)


================================================
FILE: src/pip/_vendor/pygments/filter.py
================================================
"""
    pygments.filter
    ~~~~~~~~~~~~~~~

    Module that implements the default filter.

    :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""


def apply_filters(stream, filters, lexer=None):
    """
    Use this method to apply an iterable of filters to
    a stream. If lexer is given it's forwarded to the
    filter, otherwise the filter receives `None`.
    """
    def _apply(filter_, stream):
        yield from filter_.filter(lexer, stream)
    for filter_ in filters:
        stream = _apply(filter_, stream)
    return stream


def simplefilter(f):
    """
    Decorator that converts a function into a filter::

        @simplefilter
        def lowercase(self, lexer, stream, options):
            for ttype, value in stream:
                yield ttype, value.lower()
    """
    return type(f.__name__, (FunctionFilter,), {
        '__module__': getattr(f, '__module__'),
        '__doc__': f.__doc__,
        'function': f,
    })


class Filter:
    """
    Default filter. Subclass this class or use the `simplefilter`
    decorator to create own filters.
    """

    def __init__(self, **options):
        self.options = options

    def filter(self, lexer, stream):
        raise NotImplementedError()


class FunctionFilter(Filter):
    """
    Abstract class used by `simplefilter` to create simple
    function filters on the fly. The `simplefilter` decorator
    automatically creates subclasses of this class for
    functions passed to it.
    """
    function = None

    def __init__(self, **options):
        if not hasattr(self, 'function'):
            raise TypeError(f'{self.__class__.__name__!r} used without bound function')
        Filter.__init__(self, **options)

    def filter(self, lexer, stream):
        # pylint: disable=not-callable
        yield from self.function(lexer, stream, self.options)


================================================
FILE: src/pip/_vendor/pygments/filters/__init__.py
================================================
"""
    pygments.filters
    ~~~~~~~~~~~~~~~~

    Module containing filter lookup functions and default
    filters.

    :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

import re

from pip._vendor.pygments.token import String, Comment, Keyword, Name, Error, Whitespace, \
    string_to_tokentype
from pip._vendor.pygments.filter import Filter
from pip._vendor.pygments.util import get_list_opt, get_int_opt, get_bool_opt, \
    get_choice_opt, ClassNotFound, OptionError
from pip._vendor.pygments.plugin import find_plugin_filters


def find_filter_class(filtername):
    """Lookup a filter by name. Return None if not found."""
    if filtername in FILTERS:
        return FILTERS[filtername]
    for name, cls in find_plugin_filters():
        if name == filtername:
            return cls
    return None


def get_filter_by_name(filtername, **options):
    """Return an instantiated filter.

    Options are passed to the filter initializer if wanted.
    Raise a ClassNotFound if not found.
    """
    cls = find_filter_class(filtername)
    if cls:
        return cls(**options)
    else:
        raise ClassNotFound(f'filter {filtername!r} not found')


def get_all_filters():
    """Return a generator of all filter names."""
    yield from FILTERS
    for name, _ in find_plugin_filters():
        yield name


def _replace_special(ttype, value, regex, specialttype,
                     replacefunc=lambda x: x):
    last = 0
    for match in regex.finditer(value):
        start, end = match.start(), match.end()
        if start != last:
            yield ttype, value[last:start]
        yield specialttype, replacefunc(value[start:end])
        last = end
    if last != len(value):
        yield ttype, value[last:]


class CodeTagFilter(Filter):
    """Highlight special code tags in comments and docstrings.

    Options accepted:

    `codetags` : list of strings
       A list of strings that are flagged as code tags.  The default is to
       highlight ``XXX``, ``TODO``, ``FIXME``, ``BUG`` and ``NOTE``.

    .. versionchanged:: 2.13
       Now recognizes ``FIXME`` by default.
    """

    def __init__(self, **options):
        Filter.__init__(self, **options)
        tags = get_list_opt(options, 'codetags',
                            ['XXX', 'TODO', 'FIXME', 'BUG', 'NOTE'])
        self.tag_re = re.compile(r'\b({})\b'.format('|'.join([
            re.escape(tag) for tag in tags if tag
        ])))

    def filter(self, lexer, stream):
        regex = self.tag_re
        for ttype, value in stream:
            if ttype in String.Doc or \
               ttype in Comment and \
               ttype not in Comment.Preproc:
                yield from _replace_special(ttype, value, regex, Comment.Special)
            else:
                yield ttype, value


class SymbolFilter(Filter):
    """Convert mathematical symbols such as \\ in Isabelle
    or \\longrightarrow in LaTeX into Unicode characters.

    This is mostly useful for HTML or console output when you want to
    approximate the source rendering you'd see in an IDE.

    Options accepted:

    `lang` : string
       The symbol language. Must be one of ``'isabelle'`` or
       ``'latex'``.  The default is ``'isabelle'``.
    """

    latex_symbols = {
        '\\alpha'                : '\U000003b1',
        '\\beta'                 : '\U000003b2',
        '\\gamma'                : '\U000003b3',
        '\\delta'                : '\U000003b4',
        '\\varepsilon'           : '\U000003b5',
        '\\zeta'                 : '\U000003b6',
        '\\eta'                  : '\U000003b7',
        '\\vartheta'             : '\U000003b8',
        '\\iota'                 : '\U000003b9',
        '\\kappa'                : '\U000003ba',
        '\\lambda'               : '\U000003bb',
        '\\mu'                   : '\U000003bc',
        '\\nu'                   : '\U000003bd',
        '\\xi'                   : '\U000003be',
        '\\pi'                   : '\U000003c0',
        '\\varrho'               : '\U000003c1',
        '\\sigma'                : '\U000003c3',
        '\\tau'                  : '\U000003c4',
        '\\upsilon'              : '\U000003c5',
        '\\varphi'               : '\U000003c6',
        '\\chi'                  : '\U000003c7',
        '\\psi'                  : '\U000003c8',
        '\\omega'                : '\U000003c9',
        '\\Gamma'                : '\U00000393',
        '\\Delta'                : '\U00000394',
        '\\Theta'                : '\U00000398',
        '\\Lambda'               : '\U0000039b',
        '\\Xi'                   : '\U0000039e',
        '\\Pi'                   : '\U000003a0',
        '\\Sigma'                : '\U000003a3',
        '\\Upsilon'              : '\U000003a5',
        '\\Phi'                  : '\U000003a6',
        '\\Psi'                  : '\U000003a8',
        '\\Omega'                : '\U000003a9',
        '\\leftarrow'            : '\U00002190',
        '\\longleftarrow'        : '\U000027f5',
        '\\rightarrow'           : '\U00002192',
        '\\longrightarrow'       : '\U000027f6',
        '\\Leftarrow'            : '\U000021d0',
        '\\Longleftarrow'        : '\U000027f8',
        '\\Rightarrow'           : '\U000021d2',
        '\\Longrightarrow'       : '\U000027f9',
        '\\leftrightarrow'       : '\U00002194',
        '\\longleftrightarrow'   : '\U000027f7',
        '\\Leftrightarrow'       : '\U000021d4',
        '\\Longleftrightarrow'   : '\U000027fa',
        '\\mapsto'               : '\U000021a6',
        '\\longmapsto'           : '\U000027fc',
        '\\relbar'               : '\U00002500',
        '\\Relbar'               : '\U00002550',
        '\\hookleftarrow'        : '\U000021a9',
        '\\hookrightarrow'       : '\U000021aa',
        '\\leftharpoondown'      : '\U000021bd',
        '\\rightharpoondown'     : '\U000021c1',
        '\\leftharpoonup'        : '\U000021bc',
        '\\rightharpoonup'       : '\U000021c0',
        '\\rightleftharpoons'    : '\U000021cc',
        '\\leadsto'              : '\U0000219d',
        '\\downharpoonleft'      : '\U000021c3',
        '\\downharpoonright'     : '\U000021c2',
        '\\upharpoonleft'        : '\U000021bf',
        '\\upharpoonright'       : '\U000021be',
        '\\restriction'          : '\U000021be',
        '\\uparrow'              : '\U00002191',
        '\\Uparrow'              : '\U000021d1',
        '\\downarrow'            : '\U00002193',
        '\\Downarrow'            : '\U000021d3',
        '\\updownarrow'          : '\U00002195',
        '\\Updownarrow'          : '\U000021d5',
        '\\langle'               : '\U000027e8',
        '\\rangle'               : '\U000027e9',
        '\\lceil'                : '\U00002308',
        '\\rceil'                : '\U00002309',
        '\\lfloor'               : '\U0000230a',
        '\\rfloor'               : '\U0000230b',
        '\\flqq'                 : '\U000000ab',
        '\\frqq'                 : '\U000000bb',
        '\\bot'                  : '\U000022a5',
        '\\top'                  : '\U000022a4',
        '\\wedge'                : '\U00002227',
        '\\bigwedge'             : '\U000022c0',
        '\\vee'                  : '\U00002228',
        '\\bigvee'               : '\U000022c1',
        '\\forall'               : '\U00002200',
        '\\exists'               : '\U00002203',
        '\\nexists'              : '\U00002204',
        '\\neg'                  : '\U000000ac',
        '\\Box'                  : '\U000025a1',
        '\\Diamond'              : '\U000025c7',
        '\\vdash'                : '\U000022a2',
        '\\models'               : '\U000022a8',
        '\\dashv'                : '\U000022a3',
        '\\surd'                 : '\U0000221a',
        '\\le'                   : '\U00002264',
        '\\ge'                   : '\U00002265',
        '\\ll'                   : '\U0000226a',
        '\\gg'                   : '\U0000226b',
        '\\lesssim'              : '\U00002272',
        '\\gtrsim'               : '\U00002273',
        '\\lessapprox'           : '\U00002a85',
        '\\gtrapprox'            : '\U00002a86',
        '\\in'                   : '\U00002208',
        '\\notin'                : '\U00002209',
        '\\subset'               : '\U00002282',
        '\\supset'               : '\U00002283',
        '\\subseteq'             : '\U00002286',
        '\\supseteq'             : '\U00002287',
        '\\sqsubset'             : '\U0000228f',
        '\\sqsupset'             : '\U00002290',
        '\\sqsubseteq'           : '\U00002291',
        '\\sqsupseteq'           : '\U00002292',
        '\\cap'                  : '\U00002229',
        '\\bigcap'               : '\U000022c2',
        '\\cup'                  : '\U0000222a',
        '\\bigcup'               : '\U000022c3',
        '\\sqcup'                : '\U00002294',
        '\\bigsqcup'             : '\U00002a06',
        '\\sqcap'                : '\U00002293',
        '\\Bigsqcap'             : '\U00002a05',
        '\\setminus'             : '\U00002216',
        '\\propto'               : '\U0000221d',
        '\\uplus'                : '\U0000228e',
        '\\bigplus'              : '\U00002a04',
        '\\sim'                  : '\U0000223c',
        '\\doteq'                : '\U00002250',
        '\\simeq'                : '\U00002243',
        '\\approx'               : '\U00002248',
        '\\asymp'                : '\U0000224d',
        '\\cong'                 : '\U00002245',
        '\\equiv'                : '\U00002261',
        '\\Join'                 : '\U000022c8',
        '\\bowtie'               : '\U00002a1d',
        '\\prec'                 : '\U0000227a',
        '\\succ'                 : '\U0000227b',
        '\\preceq'               : '\U0000227c',
        '\\succeq'               : '\U0000227d',
        '\\parallel'             : '\U00002225',
        '\\mid'                  : '\U000000a6',
        '\\pm'                   : '\U000000b1',
        '\\mp'                   : '\U00002213',
        '\\times'                : '\U000000d7',
        '\\div'                  : '\U000000f7',
        '\\cdot'                 : '\U000022c5',
        '\\star'                 : '\U000022c6',
        '\\circ'                 : '\U00002218',
        '\\dagger'               : '\U00002020',
        '\\ddagger'              : '\U00002021',
        '\\lhd'                  : '\U000022b2',
        '\\rhd'                  : '\U000022b3',
        '\\unlhd'                : '\U000022b4',
        '\\unrhd'                : '\U000022b5',
        '\\triangleleft'         : '\U000025c3',
        '\\triangleright'        : '\U000025b9',
        '\\triangle'             : '\U000025b3',
        '\\triangleq'            : '\U0000225c',
        '\\oplus'                : '\U00002295',
        '\\bigoplus'             : '\U00002a01',
        '\\otimes'               : '\U00002297',
        '\\bigotimes'            : '\U00002a02',
        '\\odot'                 : '\U00002299',
        '\\bigodot'              : '\U00002a00',
        '\\ominus'               : '\U00002296',
        '\\oslash'               : '\U00002298',
        '\\dots'                 : '\U00002026',
        '\\cdots'                : '\U000022ef',
        '\\sum'                  : '\U00002211',
        '\\prod'                 : '\U0000220f',
        '\\coprod'               : '\U00002210',
        '\\infty'                : '\U0000221e',
        '\\int'                  : '\U0000222b',
        '\\oint'                 : '\U0000222e',
        '\\clubsuit'             : '\U00002663',
        '\\diamondsuit'          : '\U00002662',
        '\\heartsuit'            : '\U00002661',
        '\\spadesuit'            : '\U00002660',
        '\\aleph'                : '\U00002135',
        '\\emptyset'             : '\U00002205',
        '\\nabla'                : '\U00002207',
        '\\partial'              : '\U00002202',
        '\\flat'                 : '\U0000266d',
        '\\natural'              : '\U0000266e',
        '\\sharp'                : '\U0000266f',
        '\\angle'                : '\U00002220',
        '\\copyright'            : '\U000000a9',
        '\\textregistered'       : '\U000000ae',
        '\\textonequarter'       : '\U000000bc',
        '\\textonehalf'          : '\U000000bd',
        '\\textthreequarters'    : '\U000000be',
        '\\textordfeminine'      : '\U000000aa',
        '\\textordmasculine'     : '\U000000ba',
        '\\euro'                 : '\U000020ac',
        '\\pounds'               : '\U000000a3',
        '\\yen'                  : '\U000000a5',
        '\\textcent'             : '\U000000a2',
        '\\textcurrency'         : '\U000000a4',
        '\\textdegree'           : '\U000000b0',
    }

    isabelle_symbols = {
        '\\'                 : '\U0001d7ec',
        '\\'                  : '\U0001d7ed',
        '\\'                  : '\U0001d7ee',
        '\\'                : '\U0001d7ef',
        '\\'                 : '\U0001d7f0',
        '\\'                 : '\U0001d7f1',
        '\\'                  : '\U0001d7f2',
        '\\'                : '\U0001d7f3',
        '\\'                : '\U0001d7f4',
        '\\'                 : '\U0001d7f5',
        '\\'                    : '\U0001d49c',
        '\\'                    : '\U0000212c',
        '\\'                    : '\U0001d49e',
        '\\'                    : '\U0001d49f',
        '\\'                    : '\U00002130',
        '\\'                    : '\U00002131',
        '\\'                    : '\U0001d4a2',
        '\\'                    : '\U0000210b',
        '\\'                    : '\U00002110',
        '\\'                    : '\U0001d4a5',
        '\\'                    : '\U0001d4a6',
        '\\'                    : '\U00002112',
        '\\'                    : '\U00002133',
        '\\'                    : '\U0001d4a9',
        '\\'                    : '\U0001d4aa',
        '\\

' : '\U0001d5c9', '\\' : '\U0001d5ca', '\\' : '\U0001d5cb', '\\' : '\U0001d5cc', '\\' : '\U0001d5cd', '\\' : '\U0001d5ce', '\\' : '\U0001d5cf', '\\' : '\U0001d5d0', '\\' : '\U0001d5d1', '\\' : '\U0001d5d2', '\\' : '\U0001d5d3', '\\' : '\U0001d504', '\\' : '\U0001d505', '\\' : '\U0000212d', '\\

' : '\U0001d507', '\\' : '\U0001d508', '\\' : '\U0001d509', '\\' : '\U0001d50a', '\\' : '\U0000210c', '\\' : '\U00002111', '\\' : '\U0001d50d', '\\' : '\U0001d50e', '\\' : '\U0001d50f', '\\' : '\U0001d510', '\\' : '\U0001d511', '\\' : '\U0001d512', '\\' : '\U0001d513', '\\' : '\U0001d514', '\\' : '\U0000211c', '\\' : '\U0001d516', '\\' : '\U0001d517', '\\' : '\U0001d518', '\\' : '\U0001d519', '\\' : '\U0001d51a', '\\' : '\U0001d51b', '\\' : '\U0001d51c', '\\' : '\U00002128', '\\' : '\U0001d51e', '\\' : '\U0001d51f', '\\' : '\U0001d520', '\\
' : '\U0001d521', '\\' : '\U0001d522', '\\' : '\U0001d523', '\\' : '\U0001d524', '\\' : '\U0001d525', '\\' : '\U0001d526', '\\' : '\U0001d527', '\\' : '\U0001d528', '\\' : '\U0001d529', '\\' : '\U0001d52a', '\\' : '\U0001d52b', '\\' : '\U0001d52c', '\\' : '\U0001d52d', '\\' : '\U0001d52e', '\\' : '\U0001d52f', '\\' : '\U0001d530', '\\' : '\U0001d531', '\\' : '\U0001d532', '\\' : '\U0001d533', '\\' : '\U0001d534', '\\' : '\U0001d535', '\\' : '\U0001d536', '\\' : '\U0001d537', '\\' : '\U000003b1', '\\' : '\U000003b2', '\\' : '\U000003b3', '\\' : '\U000003b4', '\\' : '\U000003b5', '\\' : '\U000003b6', '\\' : '\U000003b7', '\\' : '\U000003b8', '\\' : '\U000003b9', '\\' : '\U000003ba', '\\' : '\U000003bb', '\\' : '\U000003bc', '\\' : '\U000003bd', '\\' : '\U000003be', '\\' : '\U000003c0', '\\' : '\U000003c1', '\\' : '\U000003c3', '\\' : '\U000003c4', '\\' : '\U000003c5', '\\' : '\U000003c6', '\\' : '\U000003c7', '\\' : '\U000003c8', '\\' : '\U000003c9', '\\' : '\U00000393', '\\' : '\U00000394', '\\' : '\U00000398', '\\' : '\U0000039b', '\\' : '\U0000039e', '\\' : '\U000003a0', '\\' : '\U000003a3', '\\' : '\U000003a5', '\\' : '\U000003a6', '\\' : '\U000003a8', '\\' : '\U000003a9', '\\' : '\U0001d539', '\\' : '\U00002102', '\\' : '\U00002115', '\\' : '\U0000211a', '\\' : '\U0000211d', '\\' : '\U00002124', '\\' : '\U00002190', '\\' : '\U000027f5', '\\' : '\U00002192', '\\' : '\U000027f6', '\\' : '\U000021d0', '\\' : '\U000027f8', '\\' : '\U000021d2', '\\' : '\U000027f9', '\\' : '\U00002194', '\\' : '\U000027f7', '\\' : '\U000021d4', '\\' : '\U000027fa', '\\' : '\U000021a6', '\\' : '\U000027fc', '\\' : '\U00002500', '\\' : '\U00002550', '\\' : '\U000021a9', '\\' : '\U000021aa', '\\' : '\U000021bd', '\\' : '\U000021c1', '\\' : '\U000021bc', '\\' : '\U000021c0', '\\' : '\U000021cc', '\\' : '\U0000219d', '\\' : '\U000021c3', '\\' : '\U000021c2', '\\' : '\U000021bf', '\\' : '\U000021be', '\\' : '\U000021be', '\\' : '\U00002237', '\\' : '\U00002191', '\\' : '\U000021d1', '\\' : '\U00002193', '\\' : '\U000021d3', '\\' : '\U00002195', '\\' : '\U000021d5', '\\' : '\U000027e8', '\\' : '\U000027e9', '\\' : '\U00002308', '\\' : '\U00002309', '\\' : '\U0000230a', '\\' : '\U0000230b', '\\' : '\U00002987', '\\' : '\U00002988', '\\' : '\U000027e6', '\\' : '\U000027e7', '\\' : '\U00002983', '\\' : '\U00002984', '\\' : '\U000000ab', '\\' : '\U000000bb', '\\' : '\U000022a5', '\\' : '\U000022a4', '\\' : '\U00002227', '\\' : '\U000022c0', '\\' : '\U00002228', '\\' : '\U000022c1', '\\' : '\U00002200', '\\' : '\U00002203', '\\' : '\U00002204', '\\' : '\U000000ac', '\\' : '\U000025a1', '\\' : '\U000025c7', '\\' : '\U000022a2', '\\' : '\U000022a8', '\\' : '\U000022a9', '\\' : '\U000022ab', '\\' : '\U000022a3', '\\' : '\U0000221a', '\\' : '\U00002264', '\\' : '\U00002265', '\\' : '\U0000226a', '\\' : '\U0000226b', '\\' : '\U00002272', '\\' : '\U00002273', '\\' : '\U00002a85', '\\' : '\U00002a86', '\\' : '\U00002208', '\\' : '\U00002209', '\\' : '\U00002282', '\\' : '\U00002283', '\\' : '\U00002286', '\\' : '\U00002287', '\\' : '\U0000228f', '\\' : '\U00002290', '\\' : '\U00002291', '\\' : '\U00002292', '\\' : '\U00002229', '\\' : '\U000022c2', '\\' : '\U0000222a', '\\' : '\U000022c3', '\\' : '\U00002294', '\\' : '\U00002a06', '\\' : '\U00002293', '\\' : '\U00002a05', '\\' : '\U00002216', '\\' : '\U0000221d', '\\' : '\U0000228e', '\\' : '\U00002a04', '\\' : '\U00002260', '\\' : '\U0000223c', '\\' : '\U00002250', '\\' : '\U00002243', '\\' : '\U00002248', '\\' : '\U0000224d', '\\' : '\U00002245', '\\' : '\U00002323', '\\' : '\U00002261', '\\' : '\U00002322', '\\' : '\U000022c8', '\\' : '\U00002a1d', '\\' : '\U0000227a', '\\' : '\U0000227b', '\\' : '\U0000227c', '\\' : '\U0000227d', '\\' : '\U00002225', '\\' : '\U000000a6', '\\' : '\U000000b1', '\\' : '\U00002213', '\\' : '\U000000d7', '\\
' : '\U000000f7', '\\' : '\U000022c5', '\\' : '\U000022c6', '\\' : '\U00002219', '\\' : '\U00002218', '\\' : '\U00002020', '\\' : '\U00002021', '\\' : '\U000022b2', '\\' : '\U000022b3', '\\' : '\U000022b4', '\\' : '\U000022b5', '\\' : '\U000025c3', '\\' : '\U000025b9', '\\' : '\U000025b3', '\\' : '\U0000225c', '\\' : '\U00002295', '\\' : '\U00002a01', '\\' : '\U00002297', '\\' : '\U00002a02', '\\' : '\U00002299', '\\' : '\U00002a00', '\\' : '\U00002296', '\\' : '\U00002298', '\\' : '\U00002026', '\\' : '\U000022ef', '\\' : '\U00002211', '\\' : '\U0000220f', '\\' : '\U00002210', '\\' : '\U0000221e', '\\' : '\U0000222b', '\\' : '\U0000222e', '\\' : '\U00002663', '\\' : '\U00002662', '\\' : '\U00002661', '\\' : '\U00002660', '\\' : '\U00002135', '\\' : '\U00002205', '\\' : '\U00002207', '\\' : '\U00002202', '\\' : '\U0000266d', '\\' : '\U0000266e', '\\' : '\U0000266f', '\\' : '\U00002220', '\\' : '\U000000a9', '\\' : '\U000000ae', '\\' : '\U000000ad', '\\' : '\U000000af', '\\' : '\U000000bc', '\\' : '\U000000bd', '\\' : '\U000000be', '\\' : '\U000000aa', '\\' : '\U000000ba', '\\
' : '\U000000a7', '\\' : '\U000000b6', '\\' : '\U000000a1', '\\' : '\U000000bf', '\\' : '\U000020ac', '\\' : '\U000000a3', '\\' : '\U000000a5', '\\' : '\U000000a2', '\\' : '\U000000a4', '\\' : '\U000000b0', '\\' : '\U00002a3f', '\\' : '\U00002127', '\\' : '\U000025ca', '\\' : '\U00002118', '\\' : '\U00002240', '\\' : '\U000022c4', '\\' : '\U000000b4', '\\' : '\U00000131', '\\' : '\U000000a8', '\\' : '\U000000b8', '\\' : '\U000002dd', '\\' : '\U000003f5', '\\' : '\U000023ce', '\\' : '\U00002039', '\\' : '\U0000203a', '\\' : '\U00002302', '\\<^sub>' : '\U000021e9', '\\<^sup>' : '\U000021e7', '\\<^bold>' : '\U00002759', '\\<^bsub>' : '\U000021d8', '\\<^esub>' : '\U000021d9', '\\<^bsup>' : '\U000021d7', '\\<^esup>' : '\U000021d6', } lang_map = {'isabelle' : isabelle_symbols, 'latex' : latex_symbols} def __init__(self, **options): Filter.__init__(self, **options) lang = get_choice_opt(options, 'lang', ['isabelle', 'latex'], 'isabelle') self.symbols = self.lang_map[lang] def filter(self, lexer, stream): for ttype, value in stream: if value in self.symbols: yield ttype, self.symbols[value] else: yield ttype, value class KeywordCaseFilter(Filter): """Convert keywords to lowercase or uppercase or capitalize them, which means first letter uppercase, rest lowercase. This can be useful e.g. if you highlight Pascal code and want to adapt the code to your styleguide. Options accepted: `case` : string The casing to convert keywords to. Must be one of ``'lower'``, ``'upper'`` or ``'capitalize'``. The default is ``'lower'``. """ def __init__(self, **options): Filter.__init__(self, **options) case = get_choice_opt(options, 'case', ['lower', 'upper', 'capitalize'], 'lower') self.convert = getattr(str, case) def filter(self, lexer, stream): for ttype, value in stream: if ttype in Keyword: yield ttype, self.convert(value) else: yield ttype, value class NameHighlightFilter(Filter): """Highlight a normal Name (and Name.*) token with a different token type. Example:: filter = NameHighlightFilter( names=['foo', 'bar', 'baz'], tokentype=Name.Function, ) This would highlight the names "foo", "bar" and "baz" as functions. `Name.Function` is the default token type. Options accepted: `names` : list of strings A list of names that should be given the different token type. There is no default. `tokentype` : TokenType or string A token type or a string containing a token type name that is used for highlighting the strings in `names`. The default is `Name.Function`. """ def __init__(self, **options): Filter.__init__(self, **options) self.names = set(get_list_opt(options, 'names', [])) tokentype = options.get('tokentype') if tokentype: self.tokentype = string_to_tokentype(tokentype) else: self.tokentype = Name.Function def filter(self, lexer, stream): for ttype, value in stream: if ttype in Name and value in self.names: yield self.tokentype, value else: yield ttype, value class ErrorToken(Exception): pass class RaiseOnErrorTokenFilter(Filter): """Raise an exception when the lexer generates an error token. Options accepted: `excclass` : Exception class The exception class to raise. The default is `pygments.filters.ErrorToken`. .. versionadded:: 0.8 """ def __init__(self, **options): Filter.__init__(self, **options) self.exception = options.get('excclass', ErrorToken) try: # issubclass() will raise TypeError if first argument is not a class if not issubclass(self.exception, Exception): raise TypeError except TypeError: raise OptionError('excclass option is not an exception class') def filter(self, lexer, stream): for ttype, value in stream: if ttype is Error: raise self.exception(value) yield ttype, value class VisibleWhitespaceFilter(Filter): """Convert tabs, newlines and/or spaces to visible characters. Options accepted: `spaces` : string or bool If this is a one-character string, spaces will be replaces by this string. If it is another true value, spaces will be replaced by ``·`` (unicode MIDDLE DOT). If it is a false value, spaces will not be replaced. The default is ``False``. `tabs` : string or bool The same as for `spaces`, but the default replacement character is ``»`` (unicode RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK). The default value is ``False``. Note: this will not work if the `tabsize` option for the lexer is nonzero, as tabs will already have been expanded then. `tabsize` : int If tabs are to be replaced by this filter (see the `tabs` option), this is the total number of characters that a tab should be expanded to. The default is ``8``. `newlines` : string or bool The same as for `spaces`, but the default replacement character is ``¶`` (unicode PILCROW SIGN). The default value is ``False``. `wstokentype` : bool If true, give whitespace the special `Whitespace` token type. This allows styling the visible whitespace differently (e.g. greyed out), but it can disrupt background colors. The default is ``True``. .. versionadded:: 0.8 """ def __init__(self, **options): Filter.__init__(self, **options) for name, default in [('spaces', '·'), ('tabs', '»'), ('newlines', '¶')]: opt = options.get(name, False) if isinstance(opt, str) and len(opt) == 1: setattr(self, name, opt) else: setattr(self, name, (opt and default or '')) tabsize = get_int_opt(options, 'tabsize', 8) if self.tabs: self.tabs += ' ' * (tabsize - 1) if self.newlines: self.newlines += '\n' self.wstt = get_bool_opt(options, 'wstokentype', True) def filter(self, lexer, stream): if self.wstt: spaces = self.spaces or ' ' tabs = self.tabs or '\t' newlines = self.newlines or '\n' regex = re.compile(r'\s') def replacefunc(wschar): if wschar == ' ': return spaces elif wschar == '\t': return tabs elif wschar == '\n': return newlines return wschar for ttype, value in stream: yield from _replace_special(ttype, value, regex, Whitespace, replacefunc) else: spaces, tabs, newlines = self.spaces, self.tabs, self.newlines # simpler processing for ttype, value in stream: if spaces: value = value.replace(' ', spaces) if tabs: value = value.replace('\t', tabs) if newlines: value = value.replace('\n', newlines) yield ttype, value class GobbleFilter(Filter): """Gobbles source code lines (eats initial characters). This filter drops the first ``n`` characters off every line of code. This may be useful when the source code fed to the lexer is indented by a fixed amount of space that isn't desired in the output. Options accepted: `n` : int The number of characters to gobble. .. versionadded:: 1.2 """ def __init__(self, **options): Filter.__init__(self, **options) self.n = get_int_opt(options, 'n', 0) def gobble(self, value, left): if left < len(value): return value[left:], 0 else: return '', left - len(value) def filter(self, lexer, stream): n = self.n left = n # How many characters left to gobble. for ttype, value in stream: # Remove ``left`` tokens from first line, ``n`` from all others. parts = value.split('\n') (parts[0], left) = self.gobble(parts[0], left) for i in range(1, len(parts)): (parts[i], left) = self.gobble(parts[i], n) value = '\n'.join(parts) if value != '': yield ttype, value class TokenMergeFilter(Filter): """Merges consecutive tokens with the same token type in the output stream of a lexer. .. versionadded:: 1.2 """ def __init__(self, **options): Filter.__init__(self, **options) def filter(self, lexer, stream): current_type = None current_value = None for ttype, value in stream: if ttype is current_type: current_value += value else: if current_type is not None: yield current_type, current_value current_type = ttype current_value = value if current_type is not None: yield current_type, current_value FILTERS = { 'codetagify': CodeTagFilter, 'keywordcase': KeywordCaseFilter, 'highlight': NameHighlightFilter, 'raiseonerror': RaiseOnErrorTokenFilter, 'whitespace': VisibleWhitespaceFilter, 'gobble': GobbleFilter, 'tokenmerge': TokenMergeFilter, 'symbols': SymbolFilter, } ================================================ FILE: src/pip/_vendor/pygments/formatter.py ================================================ """ pygments.formatter ~~~~~~~~~~~~~~~~~~ Base formatter class. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import codecs from pip._vendor.pygments.util import get_bool_opt from pip._vendor.pygments.styles import get_style_by_name __all__ = ['Formatter'] def _lookup_style(style): if isinstance(style, str): return get_style_by_name(style) return style class Formatter: """ Converts a token stream to text. Formatters should have attributes to help selecting them. These are similar to the corresponding :class:`~pygments.lexer.Lexer` attributes. .. autoattribute:: name :no-value: .. autoattribute:: aliases :no-value: .. autoattribute:: filenames :no-value: You can pass options as keyword arguments to the constructor. All formatters accept these basic options: ``style`` The style to use, can be a string or a Style subclass (default: "default"). Not used by e.g. the TerminalFormatter. ``full`` Tells the formatter to output a "full" document, i.e. a complete self-contained document. This doesn't have any effect for some formatters (default: false). ``title`` If ``full`` is true, the title that should be used to caption the document (default: ''). ``encoding`` If given, must be an encoding name. This will be used to convert the Unicode token strings to byte strings in the output. If it is "" or None, Unicode strings will be written to the output file, which most file-like objects do not support (default: None). ``outencoding`` Overrides ``encoding`` if given. """ #: Full name for the formatter, in human-readable form. name = None #: A list of short, unique identifiers that can be used to lookup #: the formatter from a list, e.g. using :func:`.get_formatter_by_name()`. aliases = [] #: A list of fnmatch patterns that match filenames for which this #: formatter can produce output. The patterns in this list should be unique #: among all formatters. filenames = [] #: If True, this formatter outputs Unicode strings when no encoding #: option is given. unicodeoutput = True def __init__(self, **options): """ As with lexers, this constructor takes arbitrary optional arguments, and if you override it, you should first process your own options, then call the base class implementation. """ self.style = _lookup_style(options.get('style', 'default')) self.full = get_bool_opt(options, 'full', False) self.title = options.get('title', '') self.encoding = options.get('encoding', None) or None if self.encoding in ('guess', 'chardet'): # can happen for e.g. pygmentize -O encoding=guess self.encoding = 'utf-8' self.encoding = options.get('outencoding') or self.encoding self.options = options def get_style_defs(self, arg=''): """ This method must return statements or declarations suitable to define the current style for subsequent highlighted text (e.g. CSS classes in the `HTMLFormatter`). The optional argument `arg` can be used to modify the generation and is formatter dependent (it is standardized because it can be given on the command line). This method is called by the ``-S`` :doc:`command-line option `, the `arg` is then given by the ``-a`` option. """ return '' def format(self, tokensource, outfile): """ This method must format the tokens from the `tokensource` iterable and write the formatted version to the file object `outfile`. Formatter options can control how exactly the tokens are converted. """ if self.encoding: # wrap the outfile in a StreamWriter outfile = codecs.lookup(self.encoding)[3](outfile) return self.format_unencoded(tokensource, outfile) # Allow writing Formatter[str] or Formatter[bytes]. That's equivalent to # Formatter. This helps when using third-party type stubs from typeshed. def __class_getitem__(cls, name): return cls ================================================ FILE: src/pip/_vendor/pygments/formatters/__init__.py ================================================ """ pygments.formatters ~~~~~~~~~~~~~~~~~~~ Pygments formatters. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re import sys import types import fnmatch from os.path import basename from pip._vendor.pygments.formatters._mapping import FORMATTERS from pip._vendor.pygments.plugin import find_plugin_formatters from pip._vendor.pygments.util import ClassNotFound __all__ = ['get_formatter_by_name', 'get_formatter_for_filename', 'get_all_formatters', 'load_formatter_from_file'] + list(FORMATTERS) _formatter_cache = {} # classes by name _pattern_cache = {} def _fn_matches(fn, glob): """Return whether the supplied file name fn matches pattern filename.""" if glob not in _pattern_cache: pattern = _pattern_cache[glob] = re.compile(fnmatch.translate(glob)) return pattern.match(fn) return _pattern_cache[glob].match(fn) def _load_formatters(module_name): """Load a formatter (and all others in the module too).""" mod = __import__(module_name, None, None, ['__all__']) for formatter_name in mod.__all__: cls = getattr(mod, formatter_name) _formatter_cache[cls.name] = cls def get_all_formatters(): """Return a generator for all formatter classes.""" # NB: this returns formatter classes, not info like get_all_lexers(). for info in FORMATTERS.values(): if info[1] not in _formatter_cache: _load_formatters(info[0]) yield _formatter_cache[info[1]] for _, formatter in find_plugin_formatters(): yield formatter def find_formatter_class(alias): """Lookup a formatter by alias. Returns None if not found. """ for module_name, name, aliases, _, _ in FORMATTERS.values(): if alias in aliases: if name not in _formatter_cache: _load_formatters(module_name) return _formatter_cache[name] for _, cls in find_plugin_formatters(): if alias in cls.aliases: return cls def get_formatter_by_name(_alias, **options): """ Return an instance of a :class:`.Formatter` subclass that has `alias` in its aliases list. The formatter is given the `options` at its instantiation. Will raise :exc:`pygments.util.ClassNotFound` if no formatter with that alias is found. """ cls = find_formatter_class(_alias) if cls is None: raise ClassNotFound(f"no formatter found for name {_alias!r}") return cls(**options) def load_formatter_from_file(filename, formattername="CustomFormatter", **options): """ Return a `Formatter` subclass instance loaded from the provided file, relative to the current directory. The file is expected to contain a Formatter class named ``formattername`` (by default, CustomFormatter). Users should be very careful with the input, because this method is equivalent to running ``eval()`` on the input file. The formatter is given the `options` at its instantiation. :exc:`pygments.util.ClassNotFound` is raised if there are any errors loading the formatter. .. versionadded:: 2.2 """ try: # This empty dict will contain the namespace for the exec'd file custom_namespace = {} with open(filename, 'rb') as f: exec(f.read(), custom_namespace) # Retrieve the class `formattername` from that namespace if formattername not in custom_namespace: raise ClassNotFound(f'no valid {formattername} class found in {filename}') formatter_class = custom_namespace[formattername] # And finally instantiate it with the options return formatter_class(**options) except OSError as err: raise ClassNotFound(f'cannot read {filename}: {err}') except ClassNotFound: raise except Exception as err: raise ClassNotFound(f'error when loading custom formatter: {err}') def get_formatter_for_filename(fn, **options): """ Return a :class:`.Formatter` subclass instance that has a filename pattern matching `fn`. The formatter is given the `options` at its instantiation. Will raise :exc:`pygments.util.ClassNotFound` if no formatter for that filename is found. """ fn = basename(fn) for modname, name, _, filenames, _ in FORMATTERS.values(): for filename in filenames: if _fn_matches(fn, filename): if name not in _formatter_cache: _load_formatters(modname) return _formatter_cache[name](**options) for _name, cls in find_plugin_formatters(): for filename in cls.filenames: if _fn_matches(fn, filename): return cls(**options) raise ClassNotFound(f"no formatter found for file name {fn!r}") class _automodule(types.ModuleType): """Automatically import formatters.""" def __getattr__(self, name): info = FORMATTERS.get(name) if info: _load_formatters(info[0]) cls = _formatter_cache[info[1]] setattr(self, name, cls) return cls raise AttributeError(name) oldmod = sys.modules[__name__] newmod = _automodule(__name__) newmod.__dict__.update(oldmod.__dict__) sys.modules[__name__] = newmod del newmod.newmod, newmod.oldmod, newmod.sys, newmod.types ================================================ FILE: src/pip/_vendor/pygments/formatters/_mapping.py ================================================ # Automatically generated by scripts/gen_mapfiles.py. # DO NOT EDIT BY HAND; run `tox -e mapfiles` instead. FORMATTERS = { 'BBCodeFormatter': ('pygments.formatters.bbcode', 'BBCode', ('bbcode', 'bb'), (), 'Format tokens with BBcodes. These formatting codes are used by many bulletin boards, so you can highlight your sourcecode with pygments before posting it there.'), 'BmpImageFormatter': ('pygments.formatters.img', 'img_bmp', ('bmp', 'bitmap'), ('*.bmp',), 'Create a bitmap image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'), 'GifImageFormatter': ('pygments.formatters.img', 'img_gif', ('gif',), ('*.gif',), 'Create a GIF image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'), 'GroffFormatter': ('pygments.formatters.groff', 'groff', ('groff', 'troff', 'roff'), (), 'Format tokens with groff escapes to change their color and font style.'), 'HtmlFormatter': ('pygments.formatters.html', 'HTML', ('html',), ('*.html', '*.htm'), "Format tokens as HTML 4 ```` tags. By default, the content is enclosed in a ``
`` tag, itself wrapped in a ``
`` tag (but see the `nowrap` option). The ``
``'s CSS class can be set by the `cssclass` option."), 'IRCFormatter': ('pygments.formatters.irc', 'IRC', ('irc', 'IRC'), (), 'Format tokens with IRC color sequences'), 'ImageFormatter': ('pygments.formatters.img', 'img', ('img', 'IMG', 'png'), ('*.png',), 'Create a PNG image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'), 'JpgImageFormatter': ('pygments.formatters.img', 'img_jpg', ('jpg', 'jpeg'), ('*.jpg',), 'Create a JPEG image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'), 'LatexFormatter': ('pygments.formatters.latex', 'LaTeX', ('latex', 'tex'), ('*.tex',), 'Format tokens as LaTeX code. This needs the `fancyvrb` and `color` standard packages.'), 'NullFormatter': ('pygments.formatters.other', 'Text only', ('text', 'null'), ('*.txt',), 'Output the text unchanged without any formatting.'), 'PangoMarkupFormatter': ('pygments.formatters.pangomarkup', 'Pango Markup', ('pango', 'pangomarkup'), (), 'Format tokens as Pango Markup code. It can then be rendered to an SVG.'), 'RawTokenFormatter': ('pygments.formatters.other', 'Raw tokens', ('raw', 'tokens'), ('*.raw',), 'Format tokens as a raw representation for storing token streams.'), 'RtfFormatter': ('pygments.formatters.rtf', 'RTF', ('rtf',), ('*.rtf',), 'Format tokens as RTF markup. This formatter automatically outputs full RTF documents with color information and other useful stuff. Perfect for Copy and Paste into Microsoft(R) Word(R) documents.'), 'SvgFormatter': ('pygments.formatters.svg', 'SVG', ('svg',), ('*.svg',), 'Format tokens as an SVG graphics file. This formatter is still experimental. Each line of code is a ```` element with explicit ``x`` and ``y`` coordinates containing ```` elements with the individual token styles.'), 'Terminal256Formatter': ('pygments.formatters.terminal256', 'Terminal256', ('terminal256', 'console256', '256'), (), 'Format tokens with ANSI color sequences, for output in a 256-color terminal or console. Like in `TerminalFormatter` color sequences are terminated at newlines, so that paging the output works correctly.'), 'TerminalFormatter': ('pygments.formatters.terminal', 'Terminal', ('terminal', 'console'), (), 'Format tokens with ANSI color sequences, for output in a text console. Color sequences are terminated at newlines, so that paging the output works correctly.'), 'TerminalTrueColorFormatter': ('pygments.formatters.terminal256', 'TerminalTrueColor', ('terminal16m', 'console16m', '16m'), (), 'Format tokens with ANSI color sequences, for output in a true-color terminal or console. Like in `TerminalFormatter` color sequences are terminated at newlines, so that paging the output works correctly.'), 'TestcaseFormatter': ('pygments.formatters.other', 'Testcase', ('testcase',), (), 'Format tokens as appropriate for a new testcase.'), } ================================================ FILE: src/pip/_vendor/pygments/lexer.py ================================================ """ pygments.lexer ~~~~~~~~~~~~~~ Base lexer classes. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re import sys import time from pip._vendor.pygments.filter import apply_filters, Filter from pip._vendor.pygments.filters import get_filter_by_name from pip._vendor.pygments.token import Error, Text, Other, Whitespace, _TokenType from pip._vendor.pygments.util import get_bool_opt, get_int_opt, get_list_opt, \ make_analysator, Future, guess_decode from pip._vendor.pygments.regexopt import regex_opt __all__ = ['Lexer', 'RegexLexer', 'ExtendedRegexLexer', 'DelegatingLexer', 'LexerContext', 'include', 'inherit', 'bygroups', 'using', 'this', 'default', 'words', 'line_re'] line_re = re.compile('.*?\n') _encoding_map = [(b'\xef\xbb\xbf', 'utf-8'), (b'\xff\xfe\0\0', 'utf-32'), (b'\0\0\xfe\xff', 'utf-32be'), (b'\xff\xfe', 'utf-16'), (b'\xfe\xff', 'utf-16be')] _default_analyse = staticmethod(lambda x: 0.0) class LexerMeta(type): """ This metaclass automagically converts ``analyse_text`` methods into static methods which always return float values. """ def __new__(mcs, name, bases, d): if 'analyse_text' in d: d['analyse_text'] = make_analysator(d['analyse_text']) return type.__new__(mcs, name, bases, d) class Lexer(metaclass=LexerMeta): """ Lexer for a specific language. See also :doc:`lexerdevelopment`, a high-level guide to writing lexers. Lexer classes have attributes used for choosing the most appropriate lexer based on various criteria. .. autoattribute:: name :no-value: .. autoattribute:: aliases :no-value: .. autoattribute:: filenames :no-value: .. autoattribute:: alias_filenames .. autoattribute:: mimetypes :no-value: .. autoattribute:: priority Lexers included in Pygments should have two additional attributes: .. autoattribute:: url :no-value: .. autoattribute:: version_added :no-value: Lexers included in Pygments may have additional attributes: .. autoattribute:: _example :no-value: You can pass options to the constructor. The basic options recognized by all lexers and processed by the base `Lexer` class are: ``stripnl`` Strip leading and trailing newlines from the input (default: True). ``stripall`` Strip all leading and trailing whitespace from the input (default: False). ``ensurenl`` Make sure that the input ends with a newline (default: True). This is required for some lexers that consume input linewise. .. versionadded:: 1.3 ``tabsize`` If given and greater than 0, expand tabs in the input (default: 0). ``encoding`` If given, must be an encoding name. This encoding will be used to convert the input string to Unicode, if it is not already a Unicode string (default: ``'guess'``, which uses a simple UTF-8 / Locale / Latin1 detection. Can also be ``'chardet'`` to use the chardet library, if it is installed. ``inencoding`` Overrides the ``encoding`` if given. """ #: Full name of the lexer, in human-readable form name = None #: A list of short, unique identifiers that can be used to look #: up the lexer from a list, e.g., using `get_lexer_by_name()`. aliases = [] #: A list of `fnmatch` patterns that match filenames which contain #: content for this lexer. The patterns in this list should be unique among #: all lexers. filenames = [] #: A list of `fnmatch` patterns that match filenames which may or may not #: contain content for this lexer. This list is used by the #: :func:`.guess_lexer_for_filename()` function, to determine which lexers #: are then included in guessing the correct one. That means that #: e.g. every lexer for HTML and a template language should include #: ``\*.html`` in this list. alias_filenames = [] #: A list of MIME types for content that can be lexed with this lexer. mimetypes = [] #: Priority, should multiple lexers match and no content is provided priority = 0 #: URL of the language specification/definition. Used in the Pygments #: documentation. Set to an empty string to disable. url = None #: Version of Pygments in which the lexer was added. version_added = None #: Example file name. Relative to the ``tests/examplefiles`` directory. #: This is used by the documentation generator to show an example. _example = None def __init__(self, **options): """ This constructor takes arbitrary options as keyword arguments. Every subclass must first process its own options and then call the `Lexer` constructor, since it processes the basic options like `stripnl`. An example looks like this: .. sourcecode:: python def __init__(self, **options): self.compress = options.get('compress', '') Lexer.__init__(self, **options) As these options must all be specifiable as strings (due to the command line usage), there are various utility functions available to help with that, see `Utilities`_. """ self.options = options self.stripnl = get_bool_opt(options, 'stripnl', True) self.stripall = get_bool_opt(options, 'stripall', False) self.ensurenl = get_bool_opt(options, 'ensurenl', True) self.tabsize = get_int_opt(options, 'tabsize', 0) self.encoding = options.get('encoding', 'guess') self.encoding = options.get('inencoding') or self.encoding self.filters = [] for filter_ in get_list_opt(options, 'filters', ()): self.add_filter(filter_) def __repr__(self): if self.options: return f'' else: return f'' def add_filter(self, filter_, **options): """ Add a new stream filter to this lexer. """ if not isinstance(filter_, Filter): filter_ = get_filter_by_name(filter_, **options) self.filters.append(filter_) def analyse_text(text): """ A static method which is called for lexer guessing. It should analyse the text and return a float in the range from ``0.0`` to ``1.0``. If it returns ``0.0``, the lexer will not be selected as the most probable one, if it returns ``1.0``, it will be selected immediately. This is used by `guess_lexer`. The `LexerMeta` metaclass automatically wraps this function so that it works like a static method (no ``self`` or ``cls`` parameter) and the return value is automatically converted to `float`. If the return value is an object that is boolean `False` it's the same as if the return values was ``0.0``. """ def _preprocess_lexer_input(self, text): """Apply preprocessing such as decoding the input, removing BOM and normalizing newlines.""" if not isinstance(text, str): if self.encoding == 'guess': text, _ = guess_decode(text) elif self.encoding == 'chardet': try: # pip vendoring note: this code is not reachable by pip, # removed import of chardet to make it clear. raise ImportError('chardet is not vendored by pip') except ImportError as e: raise ImportError('To enable chardet encoding guessing, ' 'please install the chardet library ' 'from http://chardet.feedparser.org/') from e # check for BOM first decoded = None for bom, encoding in _encoding_map: if text.startswith(bom): decoded = text[len(bom):].decode(encoding, 'replace') break # no BOM found, so use chardet if decoded is None: enc = chardet.detect(text[:1024]) # Guess using first 1KB decoded = text.decode(enc.get('encoding') or 'utf-8', 'replace') text = decoded else: text = text.decode(self.encoding) if text.startswith('\ufeff'): text = text[len('\ufeff'):] else: if text.startswith('\ufeff'): text = text[len('\ufeff'):] # text now *is* a unicode string text = text.replace('\r\n', '\n') text = text.replace('\r', '\n') if self.stripall: text = text.strip() elif self.stripnl: text = text.strip('\n') if self.tabsize > 0: text = text.expandtabs(self.tabsize) if self.ensurenl and not text.endswith('\n'): text += '\n' return text def get_tokens(self, text, unfiltered=False): """ This method is the basic interface of a lexer. It is called by the `highlight()` function. It must process the text and return an iterable of ``(tokentype, value)`` pairs from `text`. Normally, you don't need to override this method. The default implementation processes the options recognized by all lexers (`stripnl`, `stripall` and so on), and then yields all tokens from `get_tokens_unprocessed()`, with the ``index`` dropped. If `unfiltered` is set to `True`, the filtering mechanism is bypassed even if filters are defined. """ text = self._preprocess_lexer_input(text) def streamer(): for _, t, v in self.get_tokens_unprocessed(text): yield t, v stream = streamer() if not unfiltered: stream = apply_filters(stream, self.filters, self) return stream def get_tokens_unprocessed(self, text): """ This method should process the text and return an iterable of ``(index, tokentype, value)`` tuples where ``index`` is the starting position of the token within the input text. It must be overridden by subclasses. It is recommended to implement it as a generator to maximize effectiveness. """ raise NotImplementedError class DelegatingLexer(Lexer): """ This lexer takes two lexer as arguments. A root lexer and a language lexer. First everything is scanned using the language lexer, afterwards all ``Other`` tokens are lexed using the root lexer. The lexers from the ``template`` lexer package use this base lexer. """ def __init__(self, _root_lexer, _language_lexer, _needle=Other, **options): self.root_lexer = _root_lexer(**options) self.language_lexer = _language_lexer(**options) self.needle = _needle Lexer.__init__(self, **options) def get_tokens_unprocessed(self, text): buffered = '' insertions = [] lng_buffer = [] for i, t, v in self.language_lexer.get_tokens_unprocessed(text): if t is self.needle: if lng_buffer: insertions.append((len(buffered), lng_buffer)) lng_buffer = [] buffered += v else: lng_buffer.append((i, t, v)) if lng_buffer: insertions.append((len(buffered), lng_buffer)) return do_insertions(insertions, self.root_lexer.get_tokens_unprocessed(buffered)) # ------------------------------------------------------------------------------ # RegexLexer and ExtendedRegexLexer # class include(str): # pylint: disable=invalid-name """ Indicates that a state should include rules from another state. """ pass class _inherit: """ Indicates the a state should inherit from its superclass. """ def __repr__(self): return 'inherit' inherit = _inherit() # pylint: disable=invalid-name class combined(tuple): # pylint: disable=invalid-name """ Indicates a state combined from multiple states. """ def __new__(cls, *args): return tuple.__new__(cls, args) def __init__(self, *args): # tuple.__init__ doesn't do anything pass class _PseudoMatch: """ A pseudo match object constructed from a string. """ def __init__(self, start, text): self._text = text self._start = start def start(self, arg=None): return self._start def end(self, arg=None): return self._start + len(self._text) def group(self, arg=None): if arg: raise IndexError('No such group') return self._text def groups(self): return (self._text,) def groupdict(self): return {} def bygroups(*args): """ Callback that yields multiple actions for each group in the match. """ def callback(lexer, match, ctx=None): for i, action in enumerate(args): if action is None: continue elif type(action) is _TokenType: data = match.group(i + 1) if data: yield match.start(i + 1), action, data else: data = match.group(i + 1) if data is not None: if ctx: ctx.pos = match.start(i + 1) for item in action(lexer, _PseudoMatch(match.start(i + 1), data), ctx): if item: yield item if ctx: ctx.pos = match.end() return callback class _This: """ Special singleton used for indicating the caller class. Used by ``using``. """ this = _This() def using(_other, **kwargs): """ Callback that processes the match with a different lexer. The keyword arguments are forwarded to the lexer, except `state` which is handled separately. `state` specifies the state that the new lexer will start in, and can be an enumerable such as ('root', 'inline', 'string') or a simple string which is assumed to be on top of the root state. Note: For that to work, `_other` must not be an `ExtendedRegexLexer`. """ gt_kwargs = {} if 'state' in kwargs: s = kwargs.pop('state') if isinstance(s, (list, tuple)): gt_kwargs['stack'] = s else: gt_kwargs['stack'] = ('root', s) if _other is this: def callback(lexer, match, ctx=None): # if keyword arguments are given the callback # function has to create a new lexer instance if kwargs: # XXX: cache that somehow kwargs.update(lexer.options) lx = lexer.__class__(**kwargs) else: lx = lexer s = match.start() for i, t, v in lx.get_tokens_unprocessed(match.group(), **gt_kwargs): yield i + s, t, v if ctx: ctx.pos = match.end() else: def callback(lexer, match, ctx=None): # XXX: cache that somehow kwargs.update(lexer.options) lx = _other(**kwargs) s = match.start() for i, t, v in lx.get_tokens_unprocessed(match.group(), **gt_kwargs): yield i + s, t, v if ctx: ctx.pos = match.end() return callback class default: """ Indicates a state or state action (e.g. #pop) to apply. For example default('#pop') is equivalent to ('', Token, '#pop') Note that state tuples may be used as well. .. versionadded:: 2.0 """ def __init__(self, state): self.state = state class words(Future): """ Indicates a list of literal words that is transformed into an optimized regex that matches any of the words. .. versionadded:: 2.0 """ def __init__(self, words, prefix='', suffix=''): self.words = words self.prefix = prefix self.suffix = suffix def get(self): return regex_opt(self.words, prefix=self.prefix, suffix=self.suffix) class RegexLexerMeta(LexerMeta): """ Metaclass for RegexLexer, creates the self._tokens attribute from self.tokens on the first instantiation. """ def _process_regex(cls, regex, rflags, state): """Preprocess the regular expression component of a token definition.""" if isinstance(regex, Future): regex = regex.get() return re.compile(regex, rflags).match def _process_token(cls, token): """Preprocess the token component of a token definition.""" assert type(token) is _TokenType or callable(token), \ f'token type must be simple type or callable, not {token!r}' return token def _process_new_state(cls, new_state, unprocessed, processed): """Preprocess the state transition action of a token definition.""" if isinstance(new_state, str): # an existing state if new_state == '#pop': return -1 elif new_state in unprocessed: return (new_state,) elif new_state == '#push': return new_state elif new_state[:5] == '#pop:': return -int(new_state[5:]) else: assert False, f'unknown new state {new_state!r}' elif isinstance(new_state, combined): # combine a new state from existing ones tmp_state = '_tmp_%d' % cls._tmpname cls._tmpname += 1 itokens = [] for istate in new_state: assert istate != new_state, f'circular state ref {istate!r}' itokens.extend(cls._process_state(unprocessed, processed, istate)) processed[tmp_state] = itokens return (tmp_state,) elif isinstance(new_state, tuple): # push more than one state for istate in new_state: assert (istate in unprocessed or istate in ('#pop', '#push')), \ 'unknown new state ' + istate return new_state else: assert False, f'unknown new state def {new_state!r}' def _process_state(cls, unprocessed, processed, state): """Preprocess a single state definition.""" assert isinstance(state, str), f"wrong state name {state!r}" assert state[0] != '#', f"invalid state name {state!r}" if state in processed: return processed[state] tokens = processed[state] = [] rflags = cls.flags for tdef in unprocessed[state]: if isinstance(tdef, include): # it's a state reference assert tdef != state, f"circular state reference {state!r}" tokens.extend(cls._process_state(unprocessed, processed, str(tdef))) continue if isinstance(tdef, _inherit): # should be processed already, but may not in the case of: # 1. the state has no counterpart in any parent # 2. the state includes more than one 'inherit' continue if isinstance(tdef, default): new_state = cls._process_new_state(tdef.state, unprocessed, processed) tokens.append((re.compile('').match, None, new_state)) continue assert type(tdef) is tuple, f"wrong rule def {tdef!r}" try: rex = cls._process_regex(tdef[0], rflags, state) except Exception as err: raise ValueError(f"uncompilable regex {tdef[0]!r} in state {state!r} of {cls!r}: {err}") from err token = cls._process_token(tdef[1]) if len(tdef) == 2: new_state = None else: new_state = cls._process_new_state(tdef[2], unprocessed, processed) tokens.append((rex, token, new_state)) return tokens def process_tokendef(cls, name, tokendefs=None): """Preprocess a dictionary of token definitions.""" processed = cls._all_tokens[name] = {} tokendefs = tokendefs or cls.tokens[name] for state in list(tokendefs): cls._process_state(tokendefs, processed, state) return processed def get_tokendefs(cls): """ Merge tokens from superclasses in MRO order, returning a single tokendef dictionary. Any state that is not defined by a subclass will be inherited automatically. States that *are* defined by subclasses will, by default, override that state in the superclass. If a subclass wishes to inherit definitions from a superclass, it can use the special value "inherit", which will cause the superclass' state definition to be included at that point in the state. """ tokens = {} inheritable = {} for c in cls.__mro__: toks = c.__dict__.get('tokens', {}) for state, items in toks.items(): curitems = tokens.get(state) if curitems is None: # N.b. because this is assigned by reference, sufficiently # deep hierarchies are processed incrementally (e.g. for # A(B), B(C), C(RegexLexer), B will be premodified so X(B) # will not see any inherits in B). tokens[state] = items try: inherit_ndx = items.index(inherit) except ValueError: continue inheritable[state] = inherit_ndx continue inherit_ndx = inheritable.pop(state, None) if inherit_ndx is None: continue # Replace the "inherit" value with the items curitems[inherit_ndx:inherit_ndx+1] = items try: # N.b. this is the index in items (that is, the superclass # copy), so offset required when storing below. new_inh_ndx = items.index(inherit) except ValueError: pass else: inheritable[state] = inherit_ndx + new_inh_ndx return tokens def __call__(cls, *args, **kwds): """Instantiate cls after preprocessing its token definitions.""" if '_tokens' not in cls.__dict__: cls._all_tokens = {} cls._tmpname = 0 if hasattr(cls, 'token_variants') and cls.token_variants: # don't process yet pass else: cls._tokens = cls.process_tokendef('', cls.get_tokendefs()) return type.__call__(cls, *args, **kwds) class RegexLexer(Lexer, metaclass=RegexLexerMeta): """ Base for simple stateful regular expression-based lexers. Simplifies the lexing process so that you need only provide a list of states and regular expressions. """ #: Flags for compiling the regular expressions. #: Defaults to MULTILINE. flags = re.MULTILINE #: At all time there is a stack of states. Initially, the stack contains #: a single state 'root'. The top of the stack is called "the current state". #: #: Dict of ``{'state': [(regex, tokentype, new_state), ...], ...}`` #: #: ``new_state`` can be omitted to signify no state transition. #: If ``new_state`` is a string, it is pushed on the stack. This ensure #: the new current state is ``new_state``. #: If ``new_state`` is a tuple of strings, all of those strings are pushed #: on the stack and the current state will be the last element of the list. #: ``new_state`` can also be ``combined('state1', 'state2', ...)`` #: to signify a new, anonymous state combined from the rules of two #: or more existing ones. #: Furthermore, it can be '#pop' to signify going back one step in #: the state stack, or '#push' to push the current state on the stack #: again. Note that if you push while in a combined state, the combined #: state itself is pushed, and not only the state in which the rule is #: defined. #: #: The tuple can also be replaced with ``include('state')``, in which #: case the rules from the state named by the string are included in the #: current one. tokens = {} def get_tokens_unprocessed(self, text, stack=('root',)): """ Split ``text`` into (tokentype, text) pairs. ``stack`` is the initial stack (default: ``['root']``) """ pos = 0 tokendefs = self._tokens statestack = list(stack) statetokens = tokendefs[statestack[-1]] while 1: for rexmatch, action, new_state in statetokens: m = rexmatch(text, pos) if m: if action is not None: if type(action) is _TokenType: yield pos, action, m.group() else: yield from action(self, m) pos = m.end() if new_state is not None: # state transition if isinstance(new_state, tuple): for state in new_state: if state == '#pop': if len(statestack) > 1: statestack.pop() elif state == '#push': statestack.append(statestack[-1]) else: statestack.append(state) elif isinstance(new_state, int): # pop, but keep at least one state on the stack # (random code leading to unexpected pops should # not allow exceptions) if abs(new_state) >= len(statestack): del statestack[1:] else: del statestack[new_state:] elif new_state == '#push': statestack.append(statestack[-1]) else: assert False, f"wrong state def: {new_state!r}" statetokens = tokendefs[statestack[-1]] break else: # We are here only if all state tokens have been considered # and there was not a match on any of them. try: if text[pos] == '\n': # at EOL, reset state to "root" statestack = ['root'] statetokens = tokendefs['root'] yield pos, Whitespace, '\n' pos += 1 continue yield pos, Error, text[pos] pos += 1 except IndexError: break class LexerContext: """ A helper object that holds lexer position data. """ def __init__(self, text, pos, stack=None, end=None): self.text = text self.pos = pos self.end = end or len(text) # end=0 not supported ;-) self.stack = stack or ['root'] def __repr__(self): return f'LexerContext({self.text!r}, {self.pos!r}, {self.stack!r})' class ExtendedRegexLexer(RegexLexer): """ A RegexLexer that uses a context object to store its state. """ def get_tokens_unprocessed(self, text=None, context=None): """ Split ``text`` into (tokentype, text) pairs. If ``context`` is given, use this lexer context instead. """ tokendefs = self._tokens if not context: ctx = LexerContext(text, 0) statetokens = tokendefs['root'] else: ctx = context statetokens = tokendefs[ctx.stack[-1]] text = ctx.text while 1: for rexmatch, action, new_state in statetokens: m = rexmatch(text, ctx.pos, ctx.end) if m: if action is not None: if type(action) is _TokenType: yield ctx.pos, action, m.group() ctx.pos = m.end() else: yield from action(self, m, ctx) if not new_state: # altered the state stack? statetokens = tokendefs[ctx.stack[-1]] # CAUTION: callback must set ctx.pos! if new_state is not None: # state transition if isinstance(new_state, tuple): for state in new_state: if state == '#pop': if len(ctx.stack) > 1: ctx.stack.pop() elif state == '#push': ctx.stack.append(ctx.stack[-1]) else: ctx.stack.append(state) elif isinstance(new_state, int): # see RegexLexer for why this check is made if abs(new_state) >= len(ctx.stack): del ctx.stack[1:] else: del ctx.stack[new_state:] elif new_state == '#push': ctx.stack.append(ctx.stack[-1]) else: assert False, f"wrong state def: {new_state!r}" statetokens = tokendefs[ctx.stack[-1]] break else: try: if ctx.pos >= ctx.end: break if text[ctx.pos] == '\n': # at EOL, reset state to "root" ctx.stack = ['root'] statetokens = tokendefs['root'] yield ctx.pos, Text, '\n' ctx.pos += 1 continue yield ctx.pos, Error, text[ctx.pos] ctx.pos += 1 except IndexError: break def do_insertions(insertions, tokens): """ Helper for lexers which must combine the results of several sublexers. ``insertions`` is a list of ``(index, itokens)`` pairs. Each ``itokens`` iterable should be inserted at position ``index`` into the token stream given by the ``tokens`` argument. The result is a combined token stream. TODO: clean up the code here. """ insertions = iter(insertions) try: index, itokens = next(insertions) except StopIteration: # no insertions yield from tokens return realpos = None insleft = True # iterate over the token stream where we want to insert # the tokens from the insertion list. for i, t, v in tokens: # first iteration. store the position of first item if realpos is None: realpos = i oldi = 0 while insleft and i + len(v) >= index: tmpval = v[oldi:index - i] if tmpval: yield realpos, t, tmpval realpos += len(tmpval) for it_index, it_token, it_value in itokens: yield realpos, it_token, it_value realpos += len(it_value) oldi = index - i try: index, itokens = next(insertions) except StopIteration: insleft = False break # not strictly necessary if oldi < len(v): yield realpos, t, v[oldi:] realpos += len(v) - oldi # leftover tokens while insleft: # no normal tokens, set realpos to zero realpos = realpos or 0 for p, t, v in itokens: yield realpos, t, v realpos += len(v) try: index, itokens = next(insertions) except StopIteration: insleft = False break # not strictly necessary class ProfilingRegexLexerMeta(RegexLexerMeta): """Metaclass for ProfilingRegexLexer, collects regex timing info.""" def _process_regex(cls, regex, rflags, state): if isinstance(regex, words): rex = regex_opt(regex.words, prefix=regex.prefix, suffix=regex.suffix) else: rex = regex compiled = re.compile(rex, rflags) def match_func(text, pos, endpos=sys.maxsize): info = cls._prof_data[-1].setdefault((state, rex), [0, 0.0]) t0 = time.time() res = compiled.match(text, pos, endpos) t1 = time.time() info[0] += 1 info[1] += t1 - t0 return res return match_func class ProfilingRegexLexer(RegexLexer, metaclass=ProfilingRegexLexerMeta): """Drop-in replacement for RegexLexer that does profiling of its regexes.""" _prof_data = [] _prof_sort_index = 4 # defaults to time per call def get_tokens_unprocessed(self, text, stack=('root',)): # this needs to be a stack, since using(this) will produce nested calls self.__class__._prof_data.append({}) yield from RegexLexer.get_tokens_unprocessed(self, text, stack) rawdata = self.__class__._prof_data.pop() data = sorted(((s, repr(r).strip('u\'').replace('\\\\', '\\')[:65], n, 1000 * t, 1000 * t / n) for ((s, r), (n, t)) in rawdata.items()), key=lambda x: x[self._prof_sort_index], reverse=True) sum_total = sum(x[3] for x in data) print() print('Profiling result for %s lexing %d chars in %.3f ms' % (self.__class__.__name__, len(text), sum_total)) print('=' * 110) print('%-20s %-64s ncalls tottime percall' % ('state', 'regex')) print('-' * 110) for d in data: print('%-20s %-65s %5d %8.4f %8.4f' % d) print('=' * 110) ================================================ FILE: src/pip/_vendor/pygments/lexers/__init__.py ================================================ """ pygments.lexers ~~~~~~~~~~~~~~~ Pygments lexers. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re import sys import types import fnmatch from os.path import basename from pip._vendor.pygments.lexers._mapping import LEXERS from pip._vendor.pygments.modeline import get_filetype_from_buffer from pip._vendor.pygments.plugin import find_plugin_lexers from pip._vendor.pygments.util import ClassNotFound, guess_decode COMPAT = { 'Python3Lexer': 'PythonLexer', 'Python3TracebackLexer': 'PythonTracebackLexer', 'LeanLexer': 'Lean3Lexer', } __all__ = ['get_lexer_by_name', 'get_lexer_for_filename', 'find_lexer_class', 'guess_lexer', 'load_lexer_from_file'] + list(LEXERS) + list(COMPAT) _lexer_cache = {} _pattern_cache = {} def _fn_matches(fn, glob): """Return whether the supplied file name fn matches pattern filename.""" if glob not in _pattern_cache: pattern = _pattern_cache[glob] = re.compile(fnmatch.translate(glob)) return pattern.match(fn) return _pattern_cache[glob].match(fn) def _load_lexers(module_name): """Load a lexer (and all others in the module too).""" mod = __import__(module_name, None, None, ['__all__']) for lexer_name in mod.__all__: cls = getattr(mod, lexer_name) _lexer_cache[cls.name] = cls def get_all_lexers(plugins=True): """Return a generator of tuples in the form ``(name, aliases, filenames, mimetypes)`` of all know lexers. If *plugins* is true (the default), plugin lexers supplied by entrypoints are also returned. Otherwise, only builtin ones are considered. """ for item in LEXERS.values(): yield item[1:] if plugins: for lexer in find_plugin_lexers(): yield lexer.name, lexer.aliases, lexer.filenames, lexer.mimetypes def find_lexer_class(name): """ Return the `Lexer` subclass that with the *name* attribute as given by the *name* argument. """ if name in _lexer_cache: return _lexer_cache[name] # lookup builtin lexers for module_name, lname, aliases, _, _ in LEXERS.values(): if name == lname: _load_lexers(module_name) return _lexer_cache[name] # continue with lexers from setuptools entrypoints for cls in find_plugin_lexers(): if cls.name == name: return cls def find_lexer_class_by_name(_alias): """ Return the `Lexer` subclass that has `alias` in its aliases list, without instantiating it. Like `get_lexer_by_name`, but does not instantiate the class. Will raise :exc:`pygments.util.ClassNotFound` if no lexer with that alias is found. .. versionadded:: 2.2 """ if not _alias: raise ClassNotFound(f'no lexer for alias {_alias!r} found') # lookup builtin lexers for module_name, name, aliases, _, _ in LEXERS.values(): if _alias.lower() in aliases: if name not in _lexer_cache: _load_lexers(module_name) return _lexer_cache[name] # continue with lexers from setuptools entrypoints for cls in find_plugin_lexers(): if _alias.lower() in cls.aliases: return cls raise ClassNotFound(f'no lexer for alias {_alias!r} found') def get_lexer_by_name(_alias, **options): """ Return an instance of a `Lexer` subclass that has `alias` in its aliases list. The lexer is given the `options` at its instantiation. Will raise :exc:`pygments.util.ClassNotFound` if no lexer with that alias is found. """ if not _alias: raise ClassNotFound(f'no lexer for alias {_alias!r} found') # lookup builtin lexers for module_name, name, aliases, _, _ in LEXERS.values(): if _alias.lower() in aliases: if name not in _lexer_cache: _load_lexers(module_name) return _lexer_cache[name](**options) # continue with lexers from setuptools entrypoints for cls in find_plugin_lexers(): if _alias.lower() in cls.aliases: return cls(**options) raise ClassNotFound(f'no lexer for alias {_alias!r} found') def load_lexer_from_file(filename, lexername="CustomLexer", **options): """Load a lexer from a file. This method expects a file located relative to the current working directory, which contains a Lexer class. By default, it expects the Lexer to be name CustomLexer; you can specify your own class name as the second argument to this function. Users should be very careful with the input, because this method is equivalent to running eval on the input file. Raises ClassNotFound if there are any problems importing the Lexer. .. versionadded:: 2.2 """ try: # This empty dict will contain the namespace for the exec'd file custom_namespace = {} with open(filename, 'rb') as f: exec(f.read(), custom_namespace) # Retrieve the class `lexername` from that namespace if lexername not in custom_namespace: raise ClassNotFound(f'no valid {lexername} class found in {filename}') lexer_class = custom_namespace[lexername] # And finally instantiate it with the options return lexer_class(**options) except OSError as err: raise ClassNotFound(f'cannot read {filename}: {err}') except ClassNotFound: raise except Exception as err: raise ClassNotFound(f'error when loading custom lexer: {err}') def find_lexer_class_for_filename(_fn, code=None): """Get a lexer for a filename. If multiple lexers match the filename pattern, use ``analyse_text()`` to figure out which one is more appropriate. Returns None if not found. """ matches = [] fn = basename(_fn) for modname, name, _, filenames, _ in LEXERS.values(): for filename in filenames: if _fn_matches(fn, filename): if name not in _lexer_cache: _load_lexers(modname) matches.append((_lexer_cache[name], filename)) for cls in find_plugin_lexers(): for filename in cls.filenames: if _fn_matches(fn, filename): matches.append((cls, filename)) if isinstance(code, bytes): # decode it, since all analyse_text functions expect unicode code = guess_decode(code) def get_rating(info): cls, filename = info # explicit patterns get a bonus bonus = '*' not in filename and 0.5 or 0 # The class _always_ defines analyse_text because it's included in # the Lexer class. The default implementation returns None which # gets turned into 0.0. Run scripts/detect_missing_analyse_text.py # to find lexers which need it overridden. if code: return cls.analyse_text(code) + bonus, cls.__name__ return cls.priority + bonus, cls.__name__ if matches: matches.sort(key=get_rating) # print "Possible lexers, after sort:", matches return matches[-1][0] def get_lexer_for_filename(_fn, code=None, **options): """Get a lexer for a filename. Return a `Lexer` subclass instance that has a filename pattern matching `fn`. The lexer is given the `options` at its instantiation. Raise :exc:`pygments.util.ClassNotFound` if no lexer for that filename is found. If multiple lexers match the filename pattern, use their ``analyse_text()`` methods to figure out which one is more appropriate. """ res = find_lexer_class_for_filename(_fn, code) if not res: raise ClassNotFound(f'no lexer for filename {_fn!r} found') return res(**options) def get_lexer_for_mimetype(_mime, **options): """ Return a `Lexer` subclass instance that has `mime` in its mimetype list. The lexer is given the `options` at its instantiation. Will raise :exc:`pygments.util.ClassNotFound` if not lexer for that mimetype is found. """ for modname, name, _, _, mimetypes in LEXERS.values(): if _mime in mimetypes: if name not in _lexer_cache: _load_lexers(modname) return _lexer_cache[name](**options) for cls in find_plugin_lexers(): if _mime in cls.mimetypes: return cls(**options) raise ClassNotFound(f'no lexer for mimetype {_mime!r} found') def _iter_lexerclasses(plugins=True): """Return an iterator over all lexer classes.""" for key in sorted(LEXERS): module_name, name = LEXERS[key][:2] if name not in _lexer_cache: _load_lexers(module_name) yield _lexer_cache[name] if plugins: yield from find_plugin_lexers() def guess_lexer_for_filename(_fn, _text, **options): """ As :func:`guess_lexer()`, but only lexers which have a pattern in `filenames` or `alias_filenames` that matches `filename` are taken into consideration. :exc:`pygments.util.ClassNotFound` is raised if no lexer thinks it can handle the content. """ fn = basename(_fn) primary = {} matching_lexers = set() for lexer in _iter_lexerclasses(): for filename in lexer.filenames: if _fn_matches(fn, filename): matching_lexers.add(lexer) primary[lexer] = True for filename in lexer.alias_filenames: if _fn_matches(fn, filename): matching_lexers.add(lexer) primary[lexer] = False if not matching_lexers: raise ClassNotFound(f'no lexer for filename {fn!r} found') if len(matching_lexers) == 1: return matching_lexers.pop()(**options) result = [] for lexer in matching_lexers: rv = lexer.analyse_text(_text) if rv == 1.0: return lexer(**options) result.append((rv, lexer)) def type_sort(t): # sort by: # - analyse score # - is primary filename pattern? # - priority # - last resort: class name return (t[0], primary[t[1]], t[1].priority, t[1].__name__) result.sort(key=type_sort) return result[-1][1](**options) def guess_lexer(_text, **options): """ Return a `Lexer` subclass instance that's guessed from the text in `text`. For that, the :meth:`.analyse_text()` method of every known lexer class is called with the text as argument, and the lexer which returned the highest value will be instantiated and returned. :exc:`pygments.util.ClassNotFound` is raised if no lexer thinks it can handle the content. """ if not isinstance(_text, str): inencoding = options.get('inencoding', options.get('encoding')) if inencoding: _text = _text.decode(inencoding or 'utf8') else: _text, _ = guess_decode(_text) # try to get a vim modeline first ft = get_filetype_from_buffer(_text) if ft is not None: try: return get_lexer_by_name(ft, **options) except ClassNotFound: pass best_lexer = [0.0, None] for lexer in _iter_lexerclasses(): rv = lexer.analyse_text(_text) if rv == 1.0: return lexer(**options) if rv > best_lexer[0]: best_lexer[:] = (rv, lexer) if not best_lexer[0] or best_lexer[1] is None: raise ClassNotFound('no lexer matching the text found') return best_lexer[1](**options) class _automodule(types.ModuleType): """Automatically import lexers.""" def __getattr__(self, name): info = LEXERS.get(name) if info: _load_lexers(info[0]) cls = _lexer_cache[info[1]] setattr(self, name, cls) return cls if name in COMPAT: return getattr(self, COMPAT[name]) raise AttributeError(name) oldmod = sys.modules[__name__] newmod = _automodule(__name__) newmod.__dict__.update(oldmod.__dict__) sys.modules[__name__] = newmod del newmod.newmod, newmod.oldmod, newmod.sys, newmod.types ================================================ FILE: src/pip/_vendor/pygments/lexers/_mapping.py ================================================ # Automatically generated by scripts/gen_mapfiles.py. # DO NOT EDIT BY HAND; run `tox -e mapfiles` instead. LEXERS = { 'ABAPLexer': ('pip._vendor.pygments.lexers.business', 'ABAP', ('abap',), ('*.abap', '*.ABAP'), ('text/x-abap',)), 'AMDGPULexer': ('pip._vendor.pygments.lexers.amdgpu', 'AMDGPU', ('amdgpu',), ('*.isa',), ()), 'APLLexer': ('pip._vendor.pygments.lexers.apl', 'APL', ('apl',), ('*.apl', '*.aplf', '*.aplo', '*.apln', '*.aplc', '*.apli', '*.dyalog'), ()), 'AbnfLexer': ('pip._vendor.pygments.lexers.grammar_notation', 'ABNF', ('abnf',), ('*.abnf',), ('text/x-abnf',)), 'ActionScript3Lexer': ('pip._vendor.pygments.lexers.actionscript', 'ActionScript 3', ('actionscript3', 'as3'), ('*.as',), ('application/x-actionscript3', 'text/x-actionscript3', 'text/actionscript3')), 'ActionScriptLexer': ('pip._vendor.pygments.lexers.actionscript', 'ActionScript', ('actionscript', 'as'), ('*.as',), ('application/x-actionscript', 'text/x-actionscript', 'text/actionscript')), 'AdaLexer': ('pip._vendor.pygments.lexers.ada', 'Ada', ('ada', 'ada95', 'ada2005'), ('*.adb', '*.ads', '*.ada'), ('text/x-ada',)), 'AdlLexer': ('pip._vendor.pygments.lexers.archetype', 'ADL', ('adl',), ('*.adl', '*.adls', '*.adlf', '*.adlx'), ()), 'AgdaLexer': ('pip._vendor.pygments.lexers.haskell', 'Agda', ('agda',), ('*.agda',), ('text/x-agda',)), 'AheuiLexer': ('pip._vendor.pygments.lexers.esoteric', 'Aheui', ('aheui',), ('*.aheui',), ()), 'AlloyLexer': ('pip._vendor.pygments.lexers.dsls', 'Alloy', ('alloy',), ('*.als',), ('text/x-alloy',)), 'AmbientTalkLexer': ('pip._vendor.pygments.lexers.ambient', 'AmbientTalk', ('ambienttalk', 'ambienttalk/2', 'at'), ('*.at',), ('text/x-ambienttalk',)), 'AmplLexer': ('pip._vendor.pygments.lexers.ampl', 'Ampl', ('ampl',), ('*.run',), ()), 'Angular2HtmlLexer': ('pip._vendor.pygments.lexers.templates', 'HTML + Angular2', ('html+ng2',), ('*.ng2',), ()), 'Angular2Lexer': ('pip._vendor.pygments.lexers.templates', 'Angular2', ('ng2',), (), ()), 'AntlrActionScriptLexer': ('pip._vendor.pygments.lexers.parsers', 'ANTLR With ActionScript Target', ('antlr-actionscript', 'antlr-as'), ('*.G', '*.g'), ()), 'AntlrCSharpLexer': ('pip._vendor.pygments.lexers.parsers', 'ANTLR With C# Target', ('antlr-csharp', 'antlr-c#'), ('*.G', '*.g'), ()), 'AntlrCppLexer': ('pip._vendor.pygments.lexers.parsers', 'ANTLR With CPP Target', ('antlr-cpp',), ('*.G', '*.g'), ()), 'AntlrJavaLexer': ('pip._vendor.pygments.lexers.parsers', 'ANTLR With Java Target', ('antlr-java',), ('*.G', '*.g'), ()), 'AntlrLexer': ('pip._vendor.pygments.lexers.parsers', 'ANTLR', ('antlr',), (), ()), 'AntlrObjectiveCLexer': ('pip._vendor.pygments.lexers.parsers', 'ANTLR With ObjectiveC Target', ('antlr-objc',), ('*.G', '*.g'), ()), 'AntlrPerlLexer': ('pip._vendor.pygments.lexers.parsers', 'ANTLR With Perl Target', ('antlr-perl',), ('*.G', '*.g'), ()), 'AntlrPythonLexer': ('pip._vendor.pygments.lexers.parsers', 'ANTLR With Python Target', ('antlr-python',), ('*.G', '*.g'), ()), 'AntlrRubyLexer': ('pip._vendor.pygments.lexers.parsers', 'ANTLR With Ruby Target', ('antlr-ruby', 'antlr-rb'), ('*.G', '*.g'), ()), 'ApacheConfLexer': ('pip._vendor.pygments.lexers.configs', 'ApacheConf', ('apacheconf', 'aconf', 'apache'), ('.htaccess', 'apache.conf', 'apache2.conf'), ('text/x-apacheconf',)), 'AppleScriptLexer': ('pip._vendor.pygments.lexers.scripting', 'AppleScript', ('applescript',), ('*.applescript',), ()), 'ArduinoLexer': ('pip._vendor.pygments.lexers.c_like', 'Arduino', ('arduino',), ('*.ino',), ('text/x-arduino',)), 'ArrowLexer': ('pip._vendor.pygments.lexers.arrow', 'Arrow', ('arrow',), ('*.arw',), ()), 'ArturoLexer': ('pip._vendor.pygments.lexers.arturo', 'Arturo', ('arturo', 'art'), ('*.art',), ()), 'AscLexer': ('pip._vendor.pygments.lexers.asc', 'ASCII armored', ('asc', 'pem'), ('*.asc', '*.pem', 'id_dsa', 'id_ecdsa', 'id_ecdsa_sk', 'id_ed25519', 'id_ed25519_sk', 'id_rsa'), ('application/pgp-keys', 'application/pgp-encrypted', 'application/pgp-signature', 'application/pem-certificate-chain')), 'Asn1Lexer': ('pip._vendor.pygments.lexers.asn1', 'ASN.1', ('asn1',), ('*.asn1',), ()), 'AspectJLexer': ('pip._vendor.pygments.lexers.jvm', 'AspectJ', ('aspectj',), ('*.aj',), ('text/x-aspectj',)), 'AsymptoteLexer': ('pip._vendor.pygments.lexers.graphics', 'Asymptote', ('asymptote', 'asy'), ('*.asy',), ('text/x-asymptote',)), 'AugeasLexer': ('pip._vendor.pygments.lexers.configs', 'Augeas', ('augeas',), ('*.aug',), ()), 'AutoItLexer': ('pip._vendor.pygments.lexers.automation', 'AutoIt', ('autoit',), ('*.au3',), ('text/x-autoit',)), 'AutohotkeyLexer': ('pip._vendor.pygments.lexers.automation', 'autohotkey', ('autohotkey', 'ahk'), ('*.ahk', '*.ahkl'), ('text/x-autohotkey',)), 'AwkLexer': ('pip._vendor.pygments.lexers.textedit', 'Awk', ('awk', 'gawk', 'mawk', 'nawk'), ('*.awk',), ('application/x-awk',)), 'BBCBasicLexer': ('pip._vendor.pygments.lexers.basic', 'BBC Basic', ('bbcbasic',), ('*.bbc',), ()), 'BBCodeLexer': ('pip._vendor.pygments.lexers.markup', 'BBCode', ('bbcode',), (), ('text/x-bbcode',)), 'BCLexer': ('pip._vendor.pygments.lexers.algebra', 'BC', ('bc',), ('*.bc',), ()), 'BQNLexer': ('pip._vendor.pygments.lexers.bqn', 'BQN', ('bqn',), ('*.bqn',), ()), 'BSTLexer': ('pip._vendor.pygments.lexers.bibtex', 'BST', ('bst', 'bst-pybtex'), ('*.bst',), ()), 'BareLexer': ('pip._vendor.pygments.lexers.bare', 'BARE', ('bare',), ('*.bare',), ()), 'BaseMakefileLexer': ('pip._vendor.pygments.lexers.make', 'Base Makefile', ('basemake',), (), ()), 'BashLexer': ('pip._vendor.pygments.lexers.shell', 'Bash', ('bash', 'sh', 'ksh', 'zsh', 'shell', 'openrc'), ('*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass', '*.exheres-0', '*.exlib', '*.zsh', '.bashrc', 'bashrc', '.bash_*', 'bash_*', 'zshrc', '.zshrc', '.kshrc', 'kshrc', 'PKGBUILD'), ('application/x-sh', 'application/x-shellscript', 'text/x-shellscript')), 'BashSessionLexer': ('pip._vendor.pygments.lexers.shell', 'Bash Session', ('console', 'shell-session'), ('*.sh-session', '*.shell-session'), ('application/x-shell-session', 'application/x-sh-session')), 'BatchLexer': ('pip._vendor.pygments.lexers.shell', 'Batchfile', ('batch', 'bat', 'dosbatch', 'winbatch'), ('*.bat', '*.cmd'), ('application/x-dos-batch',)), 'BddLexer': ('pip._vendor.pygments.lexers.bdd', 'Bdd', ('bdd',), ('*.feature',), ('text/x-bdd',)), 'BefungeLexer': ('pip._vendor.pygments.lexers.esoteric', 'Befunge', ('befunge',), ('*.befunge',), ('application/x-befunge',)), 'BerryLexer': ('pip._vendor.pygments.lexers.berry', 'Berry', ('berry', 'be'), ('*.be',), ('text/x-berry', 'application/x-berry')), 'BibTeXLexer': ('pip._vendor.pygments.lexers.bibtex', 'BibTeX', ('bibtex', 'bib'), ('*.bib',), ('text/x-bibtex',)), 'BlitzBasicLexer': ('pip._vendor.pygments.lexers.basic', 'BlitzBasic', ('blitzbasic', 'b3d', 'bplus'), ('*.bb', '*.decls'), ('text/x-bb',)), 'BlitzMaxLexer': ('pip._vendor.pygments.lexers.basic', 'BlitzMax', ('blitzmax', 'bmax'), ('*.bmx',), ('text/x-bmx',)), 'BlueprintLexer': ('pip._vendor.pygments.lexers.blueprint', 'Blueprint', ('blueprint',), ('*.blp',), ('text/x-blueprint',)), 'BnfLexer': ('pip._vendor.pygments.lexers.grammar_notation', 'BNF', ('bnf',), ('*.bnf',), ('text/x-bnf',)), 'BoaLexer': ('pip._vendor.pygments.lexers.boa', 'Boa', ('boa',), ('*.boa',), ()), 'BooLexer': ('pip._vendor.pygments.lexers.dotnet', 'Boo', ('boo',), ('*.boo',), ('text/x-boo',)), 'BoogieLexer': ('pip._vendor.pygments.lexers.verification', 'Boogie', ('boogie',), ('*.bpl',), ()), 'BrainfuckLexer': ('pip._vendor.pygments.lexers.esoteric', 'Brainfuck', ('brainfuck', 'bf'), ('*.bf', '*.b'), ('application/x-brainfuck',)), 'BugsLexer': ('pip._vendor.pygments.lexers.modeling', 'BUGS', ('bugs', 'winbugs', 'openbugs'), ('*.bug',), ()), 'CAmkESLexer': ('pip._vendor.pygments.lexers.esoteric', 'CAmkES', ('camkes', 'idl4'), ('*.camkes', '*.idl4'), ()), 'CLexer': ('pip._vendor.pygments.lexers.c_cpp', 'C', ('c',), ('*.c', '*.h', '*.idc', '*.x[bp]m'), ('text/x-chdr', 'text/x-csrc', 'image/x-xbitmap', 'image/x-xpixmap')), 'CMakeLexer': ('pip._vendor.pygments.lexers.make', 'CMake', ('cmake',), ('*.cmake', 'CMakeLists.txt'), ('text/x-cmake',)), 'CObjdumpLexer': ('pip._vendor.pygments.lexers.asm', 'c-objdump', ('c-objdump',), ('*.c-objdump',), ('text/x-c-objdump',)), 'CPSALexer': ('pip._vendor.pygments.lexers.lisp', 'CPSA', ('cpsa',), ('*.cpsa',), ()), 'CSSUL4Lexer': ('pip._vendor.pygments.lexers.ul4', 'CSS+UL4', ('css+ul4',), ('*.cssul4',), ()), 'CSharpAspxLexer': ('pip._vendor.pygments.lexers.dotnet', 'aspx-cs', ('aspx-cs',), ('*.aspx', '*.asax', '*.ascx', '*.ashx', '*.asmx', '*.axd'), ()), 'CSharpLexer': ('pip._vendor.pygments.lexers.dotnet', 'C#', ('csharp', 'c#', 'cs'), ('*.cs',), ('text/x-csharp',)), 'Ca65Lexer': ('pip._vendor.pygments.lexers.asm', 'ca65 assembler', ('ca65',), ('*.s',), ()), 'CadlLexer': ('pip._vendor.pygments.lexers.archetype', 'cADL', ('cadl',), ('*.cadl',), ()), 'CapDLLexer': ('pip._vendor.pygments.lexers.esoteric', 'CapDL', ('capdl',), ('*.cdl',), ()), 'CapnProtoLexer': ('pip._vendor.pygments.lexers.capnproto', "Cap'n Proto", ('capnp',), ('*.capnp',), ()), 'CarbonLexer': ('pip._vendor.pygments.lexers.carbon', 'Carbon', ('carbon',), ('*.carbon',), ('text/x-carbon',)), 'CbmBasicV2Lexer': ('pip._vendor.pygments.lexers.basic', 'CBM BASIC V2', ('cbmbas',), ('*.bas',), ()), 'CddlLexer': ('pip._vendor.pygments.lexers.cddl', 'CDDL', ('cddl',), ('*.cddl',), ('text/x-cddl',)), 'CeylonLexer': ('pip._vendor.pygments.lexers.jvm', 'Ceylon', ('ceylon',), ('*.ceylon',), ('text/x-ceylon',)), 'Cfengine3Lexer': ('pip._vendor.pygments.lexers.configs', 'CFEngine3', ('cfengine3', 'cf3'), ('*.cf',), ()), 'ChaiscriptLexer': ('pip._vendor.pygments.lexers.scripting', 'ChaiScript', ('chaiscript', 'chai'), ('*.chai',), ('text/x-chaiscript', 'application/x-chaiscript')), 'ChapelLexer': ('pip._vendor.pygments.lexers.chapel', 'Chapel', ('chapel', 'chpl'), ('*.chpl',), ()), 'CharmciLexer': ('pip._vendor.pygments.lexers.c_like', 'Charmci', ('charmci',), ('*.ci',), ()), 'CheetahHtmlLexer': ('pip._vendor.pygments.lexers.templates', 'HTML+Cheetah', ('html+cheetah', 'html+spitfire', 'htmlcheetah'), (), ('text/html+cheetah', 'text/html+spitfire')), 'CheetahJavascriptLexer': ('pip._vendor.pygments.lexers.templates', 'JavaScript+Cheetah', ('javascript+cheetah', 'js+cheetah', 'javascript+spitfire', 'js+spitfire'), (), ('application/x-javascript+cheetah', 'text/x-javascript+cheetah', 'text/javascript+cheetah', 'application/x-javascript+spitfire', 'text/x-javascript+spitfire', 'text/javascript+spitfire')), 'CheetahLexer': ('pip._vendor.pygments.lexers.templates', 'Cheetah', ('cheetah', 'spitfire'), ('*.tmpl', '*.spt'), ('application/x-cheetah', 'application/x-spitfire')), 'CheetahXmlLexer': ('pip._vendor.pygments.lexers.templates', 'XML+Cheetah', ('xml+cheetah', 'xml+spitfire'), (), ('application/xml+cheetah', 'application/xml+spitfire')), 'CirruLexer': ('pip._vendor.pygments.lexers.webmisc', 'Cirru', ('cirru',), ('*.cirru',), ('text/x-cirru',)), 'ClayLexer': ('pip._vendor.pygments.lexers.c_like', 'Clay', ('clay',), ('*.clay',), ('text/x-clay',)), 'CleanLexer': ('pip._vendor.pygments.lexers.clean', 'Clean', ('clean',), ('*.icl', '*.dcl'), ()), 'ClojureLexer': ('pip._vendor.pygments.lexers.jvm', 'Clojure', ('clojure', 'clj'), ('*.clj', '*.cljc'), ('text/x-clojure', 'application/x-clojure')), 'ClojureScriptLexer': ('pip._vendor.pygments.lexers.jvm', 'ClojureScript', ('clojurescript', 'cljs'), ('*.cljs',), ('text/x-clojurescript', 'application/x-clojurescript')), 'CobolFreeformatLexer': ('pip._vendor.pygments.lexers.business', 'COBOLFree', ('cobolfree',), ('*.cbl', '*.CBL'), ()), 'CobolLexer': ('pip._vendor.pygments.lexers.business', 'COBOL', ('cobol',), ('*.cob', '*.COB', '*.cpy', '*.CPY'), ('text/x-cobol',)), 'CodeQLLexer': ('pip._vendor.pygments.lexers.codeql', 'CodeQL', ('codeql', 'ql'), ('*.ql', '*.qll'), ()), 'CoffeeScriptLexer': ('pip._vendor.pygments.lexers.javascript', 'CoffeeScript', ('coffeescript', 'coffee-script', 'coffee'), ('*.coffee',), ('text/coffeescript',)), 'ColdfusionCFCLexer': ('pip._vendor.pygments.lexers.templates', 'Coldfusion CFC', ('cfc',), ('*.cfc',), ()), 'ColdfusionHtmlLexer': ('pip._vendor.pygments.lexers.templates', 'Coldfusion HTML', ('cfm',), ('*.cfm', '*.cfml'), ('application/x-coldfusion',)), 'ColdfusionLexer': ('pip._vendor.pygments.lexers.templates', 'cfstatement', ('cfs',), (), ()), 'Comal80Lexer': ('pip._vendor.pygments.lexers.comal', 'COMAL-80', ('comal', 'comal80'), ('*.cml', '*.comal'), ()), 'CommonLispLexer': ('pip._vendor.pygments.lexers.lisp', 'Common Lisp', ('common-lisp', 'cl', 'lisp'), ('*.cl', '*.lisp'), ('text/x-common-lisp',)), 'ComponentPascalLexer': ('pip._vendor.pygments.lexers.oberon', 'Component Pascal', ('componentpascal', 'cp'), ('*.cp', '*.cps'), ('text/x-component-pascal',)), 'CoqLexer': ('pip._vendor.pygments.lexers.theorem', 'Coq', ('coq',), ('*.v',), ('text/x-coq',)), 'CplintLexer': ('pip._vendor.pygments.lexers.cplint', 'cplint', ('cplint',), ('*.ecl', '*.prolog', '*.pro', '*.pl', '*.P', '*.lpad', '*.cpl'), ('text/x-cplint',)), 'CppLexer': ('pip._vendor.pygments.lexers.c_cpp', 'C++', ('cpp', 'c++'), ('*.cpp', '*.hpp', '*.c++', '*.h++', '*.cc', '*.hh', '*.cxx', '*.hxx', '*.C', '*.H', '*.cp', '*.CPP', '*.tpp'), ('text/x-c++hdr', 'text/x-c++src')), 'CppObjdumpLexer': ('pip._vendor.pygments.lexers.asm', 'cpp-objdump', ('cpp-objdump', 'c++-objdumb', 'cxx-objdump'), ('*.cpp-objdump', '*.c++-objdump', '*.cxx-objdump'), ('text/x-cpp-objdump',)), 'CrmshLexer': ('pip._vendor.pygments.lexers.dsls', 'Crmsh', ('crmsh', 'pcmk'), ('*.crmsh', '*.pcmk'), ()), 'CrocLexer': ('pip._vendor.pygments.lexers.d', 'Croc', ('croc',), ('*.croc',), ('text/x-crocsrc',)), 'CryptolLexer': ('pip._vendor.pygments.lexers.haskell', 'Cryptol', ('cryptol', 'cry'), ('*.cry',), ('text/x-cryptol',)), 'CrystalLexer': ('pip._vendor.pygments.lexers.crystal', 'Crystal', ('cr', 'crystal'), ('*.cr',), ('text/x-crystal',)), 'CsoundDocumentLexer': ('pip._vendor.pygments.lexers.csound', 'Csound Document', ('csound-document', 'csound-csd'), ('*.csd',), ()), 'CsoundOrchestraLexer': ('pip._vendor.pygments.lexers.csound', 'Csound Orchestra', ('csound', 'csound-orc'), ('*.orc', '*.udo'), ()), 'CsoundScoreLexer': ('pip._vendor.pygments.lexers.csound', 'Csound Score', ('csound-score', 'csound-sco'), ('*.sco',), ()), 'CssDjangoLexer': ('pip._vendor.pygments.lexers.templates', 'CSS+Django/Jinja', ('css+django', 'css+jinja'), ('*.css.j2', '*.css.jinja2'), ('text/css+django', 'text/css+jinja')), 'CssErbLexer': ('pip._vendor.pygments.lexers.templates', 'CSS+Ruby', ('css+ruby', 'css+erb'), (), ('text/css+ruby',)), 'CssGenshiLexer': ('pip._vendor.pygments.lexers.templates', 'CSS+Genshi Text', ('css+genshitext', 'css+genshi'), (), ('text/css+genshi',)), 'CssLexer': ('pip._vendor.pygments.lexers.css', 'CSS', ('css',), ('*.css',), ('text/css',)), 'CssPhpLexer': ('pip._vendor.pygments.lexers.templates', 'CSS+PHP', ('css+php',), (), ('text/css+php',)), 'CssSmartyLexer': ('pip._vendor.pygments.lexers.templates', 'CSS+Smarty', ('css+smarty',), (), ('text/css+smarty',)), 'CudaLexer': ('pip._vendor.pygments.lexers.c_like', 'CUDA', ('cuda', 'cu'), ('*.cu', '*.cuh'), ('text/x-cuda',)), 'CypherLexer': ('pip._vendor.pygments.lexers.graph', 'Cypher', ('cypher',), ('*.cyp', '*.cypher'), ()), 'CythonLexer': ('pip._vendor.pygments.lexers.python', 'Cython', ('cython', 'pyx', 'pyrex'), ('*.pyx', '*.pxd', '*.pxi'), ('text/x-cython', 'application/x-cython')), 'DLexer': ('pip._vendor.pygments.lexers.d', 'D', ('d',), ('*.d', '*.di'), ('text/x-dsrc',)), 'DObjdumpLexer': ('pip._vendor.pygments.lexers.asm', 'd-objdump', ('d-objdump',), ('*.d-objdump',), ('text/x-d-objdump',)), 'DarcsPatchLexer': ('pip._vendor.pygments.lexers.diff', 'Darcs Patch', ('dpatch',), ('*.dpatch', '*.darcspatch'), ()), 'DartLexer': ('pip._vendor.pygments.lexers.javascript', 'Dart', ('dart',), ('*.dart',), ('text/x-dart',)), 'Dasm16Lexer': ('pip._vendor.pygments.lexers.asm', 'DASM16', ('dasm16',), ('*.dasm16', '*.dasm'), ('text/x-dasm16',)), 'DaxLexer': ('pip._vendor.pygments.lexers.dax', 'Dax', ('dax',), ('*.dax',), ()), 'DebianControlLexer': ('pip._vendor.pygments.lexers.installers', 'Debian Control file', ('debcontrol', 'control'), ('control',), ()), 'DebianSourcesLexer': ('pip._vendor.pygments.lexers.installers', 'Debian Sources file', ('debian.sources',), ('*.sources',), ()), 'DelphiLexer': ('pip._vendor.pygments.lexers.pascal', 'Delphi', ('delphi', 'pas', 'pascal', 'objectpascal'), ('*.pas', '*.dpr'), ('text/x-pascal',)), 'DesktopLexer': ('pip._vendor.pygments.lexers.configs', 'Desktop file', ('desktop',), ('*.desktop',), ('application/x-desktop',)), 'DevicetreeLexer': ('pip._vendor.pygments.lexers.devicetree', 'Devicetree', ('devicetree', 'dts'), ('*.dts', '*.dtsi'), ('text/x-c',)), 'DgLexer': ('pip._vendor.pygments.lexers.python', 'dg', ('dg',), ('*.dg',), ('text/x-dg',)), 'DiffLexer': ('pip._vendor.pygments.lexers.diff', 'Diff', ('diff', 'udiff'), ('*.diff', '*.patch'), ('text/x-diff', 'text/x-patch')), 'DjangoLexer': ('pip._vendor.pygments.lexers.templates', 'Django/Jinja', ('django', 'jinja'), (), ('application/x-django-templating', 'application/x-jinja')), 'DnsZoneLexer': ('pip._vendor.pygments.lexers.dns', 'Zone', ('zone',), ('*.zone',), ('text/dns',)), 'DockerLexer': ('pip._vendor.pygments.lexers.configs', 'Docker', ('docker', 'dockerfile'), ('Dockerfile', '*.docker'), ('text/x-dockerfile-config',)), 'DtdLexer': ('pip._vendor.pygments.lexers.html', 'DTD', ('dtd',), ('*.dtd',), ('application/xml-dtd',)), 'DuelLexer': ('pip._vendor.pygments.lexers.webmisc', 'Duel', ('duel', 'jbst', 'jsonml+bst'), ('*.duel', '*.jbst'), ('text/x-duel', 'text/x-jbst')), 'DylanConsoleLexer': ('pip._vendor.pygments.lexers.dylan', 'Dylan session', ('dylan-console', 'dylan-repl'), ('*.dylan-console',), ('text/x-dylan-console',)), 'DylanLexer': ('pip._vendor.pygments.lexers.dylan', 'Dylan', ('dylan',), ('*.dylan', '*.dyl', '*.intr'), ('text/x-dylan',)), 'DylanLidLexer': ('pip._vendor.pygments.lexers.dylan', 'DylanLID', ('dylan-lid', 'lid'), ('*.lid', '*.hdp'), ('text/x-dylan-lid',)), 'ECLLexer': ('pip._vendor.pygments.lexers.ecl', 'ECL', ('ecl',), ('*.ecl',), ('application/x-ecl',)), 'ECLexer': ('pip._vendor.pygments.lexers.c_like', 'eC', ('ec',), ('*.ec', '*.eh'), ('text/x-echdr', 'text/x-ecsrc')), 'EarlGreyLexer': ('pip._vendor.pygments.lexers.javascript', 'Earl Grey', ('earl-grey', 'earlgrey', 'eg'), ('*.eg',), ('text/x-earl-grey',)), 'EasytrieveLexer': ('pip._vendor.pygments.lexers.scripting', 'Easytrieve', ('easytrieve',), ('*.ezt', '*.mac'), ('text/x-easytrieve',)), 'EbnfLexer': ('pip._vendor.pygments.lexers.parsers', 'EBNF', ('ebnf',), ('*.ebnf',), ('text/x-ebnf',)), 'EiffelLexer': ('pip._vendor.pygments.lexers.eiffel', 'Eiffel', ('eiffel',), ('*.e',), ('text/x-eiffel',)), 'ElixirConsoleLexer': ('pip._vendor.pygments.lexers.erlang', 'Elixir iex session', ('iex',), (), ('text/x-elixir-shellsession',)), 'ElixirLexer': ('pip._vendor.pygments.lexers.erlang', 'Elixir', ('elixir', 'ex', 'exs'), ('*.ex', '*.eex', '*.exs', '*.leex'), ('text/x-elixir',)), 'ElmLexer': ('pip._vendor.pygments.lexers.elm', 'Elm', ('elm',), ('*.elm',), ('text/x-elm',)), 'ElpiLexer': ('pip._vendor.pygments.lexers.elpi', 'Elpi', ('elpi',), ('*.elpi',), ('text/x-elpi',)), 'EmacsLispLexer': ('pip._vendor.pygments.lexers.lisp', 'EmacsLisp', ('emacs-lisp', 'elisp', 'emacs'), ('*.el',), ('text/x-elisp', 'application/x-elisp')), 'EmailLexer': ('pip._vendor.pygments.lexers.email', 'E-mail', ('email', 'eml'), ('*.eml',), ('message/rfc822',)), 'ErbLexer': ('pip._vendor.pygments.lexers.templates', 'ERB', ('erb',), (), ('application/x-ruby-templating',)), 'ErlangLexer': ('pip._vendor.pygments.lexers.erlang', 'Erlang', ('erlang',), ('*.erl', '*.hrl', '*.es', '*.escript'), ('text/x-erlang',)), 'ErlangShellLexer': ('pip._vendor.pygments.lexers.erlang', 'Erlang erl session', ('erl',), ('*.erl-sh',), ('text/x-erl-shellsession',)), 'EvoqueHtmlLexer': ('pip._vendor.pygments.lexers.templates', 'HTML+Evoque', ('html+evoque',), (), ('text/html+evoque',)), 'EvoqueLexer': ('pip._vendor.pygments.lexers.templates', 'Evoque', ('evoque',), ('*.evoque',), ('application/x-evoque',)), 'EvoqueXmlLexer': ('pip._vendor.pygments.lexers.templates', 'XML+Evoque', ('xml+evoque',), (), ('application/xml+evoque',)), 'ExeclineLexer': ('pip._vendor.pygments.lexers.shell', 'execline', ('execline',), ('*.exec',), ()), 'EzhilLexer': ('pip._vendor.pygments.lexers.ezhil', 'Ezhil', ('ezhil',), ('*.n',), ('text/x-ezhil',)), 'FSharpLexer': ('pip._vendor.pygments.lexers.dotnet', 'F#', ('fsharp', 'f#'), ('*.fs', '*.fsi', '*.fsx'), ('text/x-fsharp',)), 'FStarLexer': ('pip._vendor.pygments.lexers.ml', 'FStar', ('fstar',), ('*.fst', '*.fsti'), ('text/x-fstar',)), 'FactorLexer': ('pip._vendor.pygments.lexers.factor', 'Factor', ('factor',), ('*.factor',), ('text/x-factor',)), 'FancyLexer': ('pip._vendor.pygments.lexers.ruby', 'Fancy', ('fancy', 'fy'), ('*.fy', '*.fancypack'), ('text/x-fancysrc',)), 'FantomLexer': ('pip._vendor.pygments.lexers.fantom', 'Fantom', ('fan',), ('*.fan',), ('application/x-fantom',)), 'FelixLexer': ('pip._vendor.pygments.lexers.felix', 'Felix', ('felix', 'flx'), ('*.flx', '*.flxh'), ('text/x-felix',)), 'FennelLexer': ('pip._vendor.pygments.lexers.lisp', 'Fennel', ('fennel', 'fnl'), ('*.fnl',), ()), 'FiftLexer': ('pip._vendor.pygments.lexers.fift', 'Fift', ('fift', 'fif'), ('*.fif',), ()), 'FishShellLexer': ('pip._vendor.pygments.lexers.shell', 'Fish', ('fish', 'fishshell'), ('*.fish', '*.load'), ('application/x-fish',)), 'FlatlineLexer': ('pip._vendor.pygments.lexers.dsls', 'Flatline', ('flatline',), (), ('text/x-flatline',)), 'FloScriptLexer': ('pip._vendor.pygments.lexers.floscript', 'FloScript', ('floscript', 'flo'), ('*.flo',), ()), 'ForthLexer': ('pip._vendor.pygments.lexers.forth', 'Forth', ('forth',), ('*.frt', '*.fs'), ('application/x-forth',)), 'FortranFixedLexer': ('pip._vendor.pygments.lexers.fortran', 'FortranFixed', ('fortranfixed',), ('*.f', '*.F'), ()), 'FortranLexer': ('pip._vendor.pygments.lexers.fortran', 'Fortran', ('fortran', 'f90'), ('*.f03', '*.f90', '*.F03', '*.F90'), ('text/x-fortran',)), 'FoxProLexer': ('pip._vendor.pygments.lexers.foxpro', 'FoxPro', ('foxpro', 'vfp', 'clipper', 'xbase'), ('*.PRG', '*.prg'), ()), 'FreeFemLexer': ('pip._vendor.pygments.lexers.freefem', 'Freefem', ('freefem',), ('*.edp',), ('text/x-freefem',)), 'FuncLexer': ('pip._vendor.pygments.lexers.func', 'FunC', ('func', 'fc'), ('*.fc', '*.func'), ()), 'FutharkLexer': ('pip._vendor.pygments.lexers.futhark', 'Futhark', ('futhark',), ('*.fut',), ('text/x-futhark',)), 'GAPConsoleLexer': ('pip._vendor.pygments.lexers.algebra', 'GAP session', ('gap-console', 'gap-repl'), ('*.tst',), ()), 'GAPLexer': ('pip._vendor.pygments.lexers.algebra', 'GAP', ('gap',), ('*.g', '*.gd', '*.gi', '*.gap'), ()), 'GDScriptLexer': ('pip._vendor.pygments.lexers.gdscript', 'GDScript', ('gdscript', 'gd'), ('*.gd',), ('text/x-gdscript', 'application/x-gdscript')), 'GLShaderLexer': ('pip._vendor.pygments.lexers.graphics', 'GLSL', ('glsl',), ('*.vert', '*.frag', '*.geo'), ('text/x-glslsrc',)), 'GSQLLexer': ('pip._vendor.pygments.lexers.gsql', 'GSQL', ('gsql',), ('*.gsql',), ()), 'GasLexer': ('pip._vendor.pygments.lexers.asm', 'GAS', ('gas', 'asm'), ('*.s', '*.S'), ('text/x-gas',)), 'GcodeLexer': ('pip._vendor.pygments.lexers.gcodelexer', 'g-code', ('gcode',), ('*.gcode',), ()), 'GenshiLexer': ('pip._vendor.pygments.lexers.templates', 'Genshi', ('genshi', 'kid', 'xml+genshi', 'xml+kid'), ('*.kid',), ('application/x-genshi', 'application/x-kid')), 'GenshiTextLexer': ('pip._vendor.pygments.lexers.templates', 'Genshi Text', ('genshitext',), (), ('application/x-genshi-text', 'text/x-genshi')), 'GettextLexer': ('pip._vendor.pygments.lexers.textfmts', 'Gettext Catalog', ('pot', 'po'), ('*.pot', '*.po'), ('application/x-gettext', 'text/x-gettext', 'text/gettext')), 'GherkinLexer': ('pip._vendor.pygments.lexers.testing', 'Gherkin', ('gherkin', 'cucumber'), ('*.feature',), ('text/x-gherkin',)), 'GleamLexer': ('pip._vendor.pygments.lexers.gleam', 'Gleam', ('gleam',), ('*.gleam',), ('text/x-gleam',)), 'GnuplotLexer': ('pip._vendor.pygments.lexers.graphics', 'Gnuplot', ('gnuplot',), ('*.plot', '*.plt'), ('text/x-gnuplot',)), 'GoLexer': ('pip._vendor.pygments.lexers.go', 'Go', ('go', 'golang'), ('*.go',), ('text/x-gosrc',)), 'GoloLexer': ('pip._vendor.pygments.lexers.jvm', 'Golo', ('golo',), ('*.golo',), ()), 'GoodDataCLLexer': ('pip._vendor.pygments.lexers.business', 'GoodData-CL', ('gooddata-cl',), ('*.gdc',), ('text/x-gooddata-cl',)), 'GoogleSqlLexer': ('pip._vendor.pygments.lexers.sql', 'GoogleSQL', ('googlesql', 'zetasql'), ('*.googlesql', '*.googlesql.sql'), ('text/x-google-sql', 'text/x-google-sql-aux')), 'GosuLexer': ('pip._vendor.pygments.lexers.jvm', 'Gosu', ('gosu',), ('*.gs', '*.gsx', '*.gsp', '*.vark'), ('text/x-gosu',)), 'GosuTemplateLexer': ('pip._vendor.pygments.lexers.jvm', 'Gosu Template', ('gst',), ('*.gst',), ('text/x-gosu-template',)), 'GraphQLLexer': ('pip._vendor.pygments.lexers.graphql', 'GraphQL', ('graphql',), ('*.graphql',), ()), 'GraphvizLexer': ('pip._vendor.pygments.lexers.graphviz', 'Graphviz', ('graphviz', 'dot'), ('*.gv', '*.dot'), ('text/x-graphviz', 'text/vnd.graphviz')), 'GroffLexer': ('pip._vendor.pygments.lexers.markup', 'Groff', ('groff', 'nroff', 'man'), ('*.[1-9]', '*.man', '*.1p', '*.3pm'), ('application/x-troff', 'text/troff')), 'GroovyLexer': ('pip._vendor.pygments.lexers.jvm', 'Groovy', ('groovy',), ('*.groovy', '*.gradle'), ('text/x-groovy',)), 'HLSLShaderLexer': ('pip._vendor.pygments.lexers.graphics', 'HLSL', ('hlsl',), ('*.hlsl', '*.hlsli'), ('text/x-hlsl',)), 'HTMLUL4Lexer': ('pip._vendor.pygments.lexers.ul4', 'HTML+UL4', ('html+ul4',), ('*.htmlul4',), ()), 'HamlLexer': ('pip._vendor.pygments.lexers.html', 'Haml', ('haml',), ('*.haml',), ('text/x-haml',)), 'HandlebarsHtmlLexer': ('pip._vendor.pygments.lexers.templates', 'HTML+Handlebars', ('html+handlebars',), ('*.handlebars', '*.hbs'), ('text/html+handlebars', 'text/x-handlebars-template')), 'HandlebarsLexer': ('pip._vendor.pygments.lexers.templates', 'Handlebars', ('handlebars',), (), ()), 'HareLexer': ('pip._vendor.pygments.lexers.hare', 'Hare', ('hare',), ('*.ha',), ('text/x-hare',)), 'HaskellLexer': ('pip._vendor.pygments.lexers.haskell', 'Haskell', ('haskell', 'hs'), ('*.hs',), ('text/x-haskell',)), 'HaxeLexer': ('pip._vendor.pygments.lexers.haxe', 'Haxe', ('haxe', 'hxsl', 'hx'), ('*.hx', '*.hxsl'), ('text/haxe', 'text/x-haxe', 'text/x-hx')), 'HexdumpLexer': ('pip._vendor.pygments.lexers.hexdump', 'Hexdump', ('hexdump',), (), ()), 'HsailLexer': ('pip._vendor.pygments.lexers.asm', 'HSAIL', ('hsail', 'hsa'), ('*.hsail',), ('text/x-hsail',)), 'HspecLexer': ('pip._vendor.pygments.lexers.haskell', 'Hspec', ('hspec',), ('*Spec.hs',), ()), 'HtmlDjangoLexer': ('pip._vendor.pygments.lexers.templates', 'HTML+Django/Jinja', ('html+django', 'html+jinja', 'htmldjango'), ('*.html.j2', '*.htm.j2', '*.xhtml.j2', '*.html.jinja2', '*.htm.jinja2', '*.xhtml.jinja2'), ('text/html+django', 'text/html+jinja')), 'HtmlGenshiLexer': ('pip._vendor.pygments.lexers.templates', 'HTML+Genshi', ('html+genshi', 'html+kid'), (), ('text/html+genshi',)), 'HtmlLexer': ('pip._vendor.pygments.lexers.html', 'HTML', ('html',), ('*.html', '*.htm', '*.xhtml', '*.xslt'), ('text/html', 'application/xhtml+xml')), 'HtmlPhpLexer': ('pip._vendor.pygments.lexers.templates', 'HTML+PHP', ('html+php',), ('*.phtml',), ('application/x-php', 'application/x-httpd-php', 'application/x-httpd-php3', 'application/x-httpd-php4', 'application/x-httpd-php5')), 'HtmlSmartyLexer': ('pip._vendor.pygments.lexers.templates', 'HTML+Smarty', ('html+smarty',), (), ('text/html+smarty',)), 'HttpLexer': ('pip._vendor.pygments.lexers.textfmts', 'HTTP', ('http',), (), ()), 'HxmlLexer': ('pip._vendor.pygments.lexers.haxe', 'Hxml', ('haxeml', 'hxml'), ('*.hxml',), ()), 'HyLexer': ('pip._vendor.pygments.lexers.lisp', 'Hy', ('hylang', 'hy'), ('*.hy',), ('text/x-hy', 'application/x-hy')), 'HybrisLexer': ('pip._vendor.pygments.lexers.scripting', 'Hybris', ('hybris',), ('*.hyb',), ('text/x-hybris', 'application/x-hybris')), 'IDLLexer': ('pip._vendor.pygments.lexers.idl', 'IDL', ('idl',), ('*.pro',), ('text/idl',)), 'IconLexer': ('pip._vendor.pygments.lexers.unicon', 'Icon', ('icon',), ('*.icon', '*.ICON'), ()), 'IdrisLexer': ('pip._vendor.pygments.lexers.haskell', 'Idris', ('idris', 'idr'), ('*.idr',), ('text/x-idris',)), 'IgorLexer': ('pip._vendor.pygments.lexers.igor', 'Igor', ('igor', 'igorpro'), ('*.ipf',), ('text/ipf',)), 'Inform6Lexer': ('pip._vendor.pygments.lexers.int_fiction', 'Inform 6', ('inform6', 'i6'), ('*.inf',), ()), 'Inform6TemplateLexer': ('pip._vendor.pygments.lexers.int_fiction', 'Inform 6 template', ('i6t',), ('*.i6t',), ()), 'Inform7Lexer': ('pip._vendor.pygments.lexers.int_fiction', 'Inform 7', ('inform7', 'i7'), ('*.ni', '*.i7x'), ()), 'IniLexer': ('pip._vendor.pygments.lexers.configs', 'INI', ('ini', 'cfg', 'dosini'), ('*.ini', '*.cfg', '*.inf', '.editorconfig'), ('text/x-ini', 'text/inf')), 'IoLexer': ('pip._vendor.pygments.lexers.iolang', 'Io', ('io',), ('*.io',), ('text/x-iosrc',)), 'IokeLexer': ('pip._vendor.pygments.lexers.jvm', 'Ioke', ('ioke', 'ik'), ('*.ik',), ('text/x-iokesrc',)), 'IrcLogsLexer': ('pip._vendor.pygments.lexers.textfmts', 'IRC logs', ('irc',), ('*.weechatlog',), ('text/x-irclog',)), 'IsabelleLexer': ('pip._vendor.pygments.lexers.theorem', 'Isabelle', ('isabelle',), ('*.thy',), ('text/x-isabelle',)), 'JLexer': ('pip._vendor.pygments.lexers.j', 'J', ('j',), ('*.ijs',), ('text/x-j',)), 'JMESPathLexer': ('pip._vendor.pygments.lexers.jmespath', 'JMESPath', ('jmespath', 'jp'), ('*.jp',), ()), 'JSLTLexer': ('pip._vendor.pygments.lexers.jslt', 'JSLT', ('jslt',), ('*.jslt',), ('text/x-jslt',)), 'JagsLexer': ('pip._vendor.pygments.lexers.modeling', 'JAGS', ('jags',), ('*.jag', '*.bug'), ()), 'JanetLexer': ('pip._vendor.pygments.lexers.lisp', 'Janet', ('janet',), ('*.janet', '*.jdn'), ('text/x-janet', 'application/x-janet')), 'JasminLexer': ('pip._vendor.pygments.lexers.jvm', 'Jasmin', ('jasmin', 'jasminxt'), ('*.j',), ()), 'JavaLexer': ('pip._vendor.pygments.lexers.jvm', 'Java', ('java',), ('*.java',), ('text/x-java',)), 'JavascriptDjangoLexer': ('pip._vendor.pygments.lexers.templates', 'JavaScript+Django/Jinja', ('javascript+django', 'js+django', 'javascript+jinja', 'js+jinja'), ('*.js.j2', '*.js.jinja2'), ('application/x-javascript+django', 'application/x-javascript+jinja', 'text/x-javascript+django', 'text/x-javascript+jinja', 'text/javascript+django', 'text/javascript+jinja')), 'JavascriptErbLexer': ('pip._vendor.pygments.lexers.templates', 'JavaScript+Ruby', ('javascript+ruby', 'js+ruby', 'javascript+erb', 'js+erb'), (), ('application/x-javascript+ruby', 'text/x-javascript+ruby', 'text/javascript+ruby')), 'JavascriptGenshiLexer': ('pip._vendor.pygments.lexers.templates', 'JavaScript+Genshi Text', ('js+genshitext', 'js+genshi', 'javascript+genshitext', 'javascript+genshi'), (), ('application/x-javascript+genshi', 'text/x-javascript+genshi', 'text/javascript+genshi')), 'JavascriptLexer': ('pip._vendor.pygments.lexers.javascript', 'JavaScript', ('javascript', 'js'), ('*.js', '*.jsm', '*.mjs', '*.cjs'), ('application/javascript', 'application/x-javascript', 'text/x-javascript', 'text/javascript')), 'JavascriptPhpLexer': ('pip._vendor.pygments.lexers.templates', 'JavaScript+PHP', ('javascript+php', 'js+php'), (), ('application/x-javascript+php', 'text/x-javascript+php', 'text/javascript+php')), 'JavascriptSmartyLexer': ('pip._vendor.pygments.lexers.templates', 'JavaScript+Smarty', ('javascript+smarty', 'js+smarty'), (), ('application/x-javascript+smarty', 'text/x-javascript+smarty', 'text/javascript+smarty')), 'JavascriptUL4Lexer': ('pip._vendor.pygments.lexers.ul4', 'Javascript+UL4', ('js+ul4',), ('*.jsul4',), ()), 'JclLexer': ('pip._vendor.pygments.lexers.scripting', 'JCL', ('jcl',), ('*.jcl',), ('text/x-jcl',)), 'JsgfLexer': ('pip._vendor.pygments.lexers.grammar_notation', 'JSGF', ('jsgf',), ('*.jsgf',), ('application/jsgf', 'application/x-jsgf', 'text/jsgf')), 'Json5Lexer': ('pip._vendor.pygments.lexers.json5', 'JSON5', ('json5',), ('*.json5',), ()), 'JsonBareObjectLexer': ('pip._vendor.pygments.lexers.data', 'JSONBareObject', (), (), ()), 'JsonLdLexer': ('pip._vendor.pygments.lexers.data', 'JSON-LD', ('jsonld', 'json-ld'), ('*.jsonld',), ('application/ld+json',)), 'JsonLexer': ('pip._vendor.pygments.lexers.data', 'JSON', ('json', 'json-object'), ('*.json', '*.jsonl', '*.ndjson', 'Pipfile.lock'), ('application/json', 'application/json-object', 'application/x-ndjson', 'application/jsonl', 'application/json-seq')), 'JsonnetLexer': ('pip._vendor.pygments.lexers.jsonnet', 'Jsonnet', ('jsonnet',), ('*.jsonnet', '*.libsonnet'), ()), 'JspLexer': ('pip._vendor.pygments.lexers.templates', 'Java Server Page', ('jsp',), ('*.jsp',), ('application/x-jsp',)), 'JsxLexer': ('pip._vendor.pygments.lexers.jsx', 'JSX', ('jsx', 'react'), ('*.jsx', '*.react'), ('text/jsx', 'text/typescript-jsx')), 'JuliaConsoleLexer': ('pip._vendor.pygments.lexers.julia', 'Julia console', ('jlcon', 'julia-repl'), (), ()), 'JuliaLexer': ('pip._vendor.pygments.lexers.julia', 'Julia', ('julia', 'jl'), ('*.jl',), ('text/x-julia', 'application/x-julia')), 'JuttleLexer': ('pip._vendor.pygments.lexers.javascript', 'Juttle', ('juttle',), ('*.juttle',), ('application/juttle', 'application/x-juttle', 'text/x-juttle', 'text/juttle')), 'KLexer': ('pip._vendor.pygments.lexers.q', 'K', ('k',), ('*.k',), ()), 'KalLexer': ('pip._vendor.pygments.lexers.javascript', 'Kal', ('kal',), ('*.kal',), ('text/kal', 'application/kal')), 'KconfigLexer': ('pip._vendor.pygments.lexers.configs', 'Kconfig', ('kconfig', 'menuconfig', 'linux-config', 'kernel-config'), ('Kconfig*', '*Config.in*', 'external.in*', 'standard-modules.in'), ('text/x-kconfig',)), 'KernelLogLexer': ('pip._vendor.pygments.lexers.textfmts', 'Kernel log', ('kmsg', 'dmesg'), ('*.kmsg', '*.dmesg'), ()), 'KokaLexer': ('pip._vendor.pygments.lexers.haskell', 'Koka', ('koka',), ('*.kk', '*.kki'), ('text/x-koka',)), 'KotlinLexer': ('pip._vendor.pygments.lexers.jvm', 'Kotlin', ('kotlin',), ('*.kt', '*.kts'), ('text/x-kotlin',)), 'KuinLexer': ('pip._vendor.pygments.lexers.kuin', 'Kuin', ('kuin',), ('*.kn',), ()), 'KustoLexer': ('pip._vendor.pygments.lexers.kusto', 'Kusto', ('kql', 'kusto'), ('*.kql', '*.kusto', '.csl'), ()), 'LSLLexer': ('pip._vendor.pygments.lexers.scripting', 'LSL', ('lsl',), ('*.lsl',), ('text/x-lsl',)), 'LassoCssLexer': ('pip._vendor.pygments.lexers.templates', 'CSS+Lasso', ('css+lasso',), (), ('text/css+lasso',)), 'LassoHtmlLexer': ('pip._vendor.pygments.lexers.templates', 'HTML+Lasso', ('html+lasso',), (), ('text/html+lasso', 'application/x-httpd-lasso', 'application/x-httpd-lasso[89]')), 'LassoJavascriptLexer': ('pip._vendor.pygments.lexers.templates', 'JavaScript+Lasso', ('javascript+lasso', 'js+lasso'), (), ('application/x-javascript+lasso', 'text/x-javascript+lasso', 'text/javascript+lasso')), 'LassoLexer': ('pip._vendor.pygments.lexers.javascript', 'Lasso', ('lasso', 'lassoscript'), ('*.lasso', '*.lasso[89]'), ('text/x-lasso',)), 'LassoXmlLexer': ('pip._vendor.pygments.lexers.templates', 'XML+Lasso', ('xml+lasso',), (), ('application/xml+lasso',)), 'LdaprcLexer': ('pip._vendor.pygments.lexers.ldap', 'LDAP configuration file', ('ldapconf', 'ldaprc'), ('.ldaprc', 'ldaprc', 'ldap.conf'), ('text/x-ldapconf',)), 'LdifLexer': ('pip._vendor.pygments.lexers.ldap', 'LDIF', ('ldif',), ('*.ldif',), ('text/x-ldif',)), 'Lean3Lexer': ('pip._vendor.pygments.lexers.lean', 'Lean', ('lean', 'lean3'), ('*.lean',), ('text/x-lean', 'text/x-lean3')), 'Lean4Lexer': ('pip._vendor.pygments.lexers.lean', 'Lean4', ('lean4',), ('*.lean',), ('text/x-lean4',)), 'LessCssLexer': ('pip._vendor.pygments.lexers.css', 'LessCss', ('less',), ('*.less',), ('text/x-less-css',)), 'LighttpdConfLexer': ('pip._vendor.pygments.lexers.configs', 'Lighttpd configuration file', ('lighttpd', 'lighty'), ('lighttpd.conf',), ('text/x-lighttpd-conf',)), 'LilyPondLexer': ('pip._vendor.pygments.lexers.lilypond', 'LilyPond', ('lilypond',), ('*.ly',), ()), 'LimboLexer': ('pip._vendor.pygments.lexers.inferno', 'Limbo', ('limbo',), ('*.b',), ('text/limbo',)), 'LiquidLexer': ('pip._vendor.pygments.lexers.templates', 'liquid', ('liquid',), ('*.liquid',), ()), 'LiterateAgdaLexer': ('pip._vendor.pygments.lexers.haskell', 'Literate Agda', ('literate-agda', 'lagda'), ('*.lagda',), ('text/x-literate-agda',)), 'LiterateCryptolLexer': ('pip._vendor.pygments.lexers.haskell', 'Literate Cryptol', ('literate-cryptol', 'lcryptol', 'lcry'), ('*.lcry',), ('text/x-literate-cryptol',)), 'LiterateHaskellLexer': ('pip._vendor.pygments.lexers.haskell', 'Literate Haskell', ('literate-haskell', 'lhaskell', 'lhs'), ('*.lhs',), ('text/x-literate-haskell',)), 'LiterateIdrisLexer': ('pip._vendor.pygments.lexers.haskell', 'Literate Idris', ('literate-idris', 'lidris', 'lidr'), ('*.lidr',), ('text/x-literate-idris',)), 'LiveScriptLexer': ('pip._vendor.pygments.lexers.javascript', 'LiveScript', ('livescript', 'live-script'), ('*.ls',), ('text/livescript',)), 'LlvmLexer': ('pip._vendor.pygments.lexers.asm', 'LLVM', ('llvm',), ('*.ll',), ('text/x-llvm',)), 'LlvmMirBodyLexer': ('pip._vendor.pygments.lexers.asm', 'LLVM-MIR Body', ('llvm-mir-body',), (), ()), 'LlvmMirLexer': ('pip._vendor.pygments.lexers.asm', 'LLVM-MIR', ('llvm-mir',), ('*.mir',), ()), 'LogosLexer': ('pip._vendor.pygments.lexers.objective', 'Logos', ('logos',), ('*.x', '*.xi', '*.xm', '*.xmi'), ('text/x-logos',)), 'LogtalkLexer': ('pip._vendor.pygments.lexers.prolog', 'Logtalk', ('logtalk',), ('*.lgt', '*.logtalk'), ('text/x-logtalk',)), 'LuaLexer': ('pip._vendor.pygments.lexers.scripting', 'Lua', ('lua',), ('*.lua', '*.wlua'), ('text/x-lua', 'application/x-lua')), 'LuauLexer': ('pip._vendor.pygments.lexers.scripting', 'Luau', ('luau',), ('*.luau',), ()), 'MCFunctionLexer': ('pip._vendor.pygments.lexers.minecraft', 'MCFunction', ('mcfunction', 'mcf'), ('*.mcfunction',), ('text/mcfunction',)), 'MCSchemaLexer': ('pip._vendor.pygments.lexers.minecraft', 'MCSchema', ('mcschema',), ('*.mcschema',), ('text/mcschema',)), 'MIMELexer': ('pip._vendor.pygments.lexers.mime', 'MIME', ('mime',), (), ('multipart/mixed', 'multipart/related', 'multipart/alternative')), 'MIPSLexer': ('pip._vendor.pygments.lexers.mips', 'MIPS', ('mips',), ('*.mips', '*.MIPS'), ()), 'MOOCodeLexer': ('pip._vendor.pygments.lexers.scripting', 'MOOCode', ('moocode', 'moo'), ('*.moo',), ('text/x-moocode',)), 'MSDOSSessionLexer': ('pip._vendor.pygments.lexers.shell', 'MSDOS Session', ('doscon',), (), ()), 'Macaulay2Lexer': ('pip._vendor.pygments.lexers.macaulay2', 'Macaulay2', ('macaulay2',), ('*.m2',), ()), 'MakefileLexer': ('pip._vendor.pygments.lexers.make', 'Makefile', ('make', 'makefile', 'mf', 'bsdmake'), ('*.mak', '*.mk', 'Makefile', 'makefile', 'Makefile.*', 'GNUmakefile'), ('text/x-makefile',)), 'MakoCssLexer': ('pip._vendor.pygments.lexers.templates', 'CSS+Mako', ('css+mako',), (), ('text/css+mako',)), 'MakoHtmlLexer': ('pip._vendor.pygments.lexers.templates', 'HTML+Mako', ('html+mako',), (), ('text/html+mako',)), 'MakoJavascriptLexer': ('pip._vendor.pygments.lexers.templates', 'JavaScript+Mako', ('javascript+mako', 'js+mako'), (), ('application/x-javascript+mako', 'text/x-javascript+mako', 'text/javascript+mako')), 'MakoLexer': ('pip._vendor.pygments.lexers.templates', 'Mako', ('mako',), ('*.mao',), ('application/x-mako',)), 'MakoXmlLexer': ('pip._vendor.pygments.lexers.templates', 'XML+Mako', ('xml+mako',), (), ('application/xml+mako',)), 'MapleLexer': ('pip._vendor.pygments.lexers.maple', 'Maple', ('maple',), ('*.mpl', '*.mi', '*.mm'), ('text/x-maple',)), 'MaqlLexer': ('pip._vendor.pygments.lexers.business', 'MAQL', ('maql',), ('*.maql',), ('text/x-gooddata-maql', 'application/x-gooddata-maql')), 'MarkdownLexer': ('pip._vendor.pygments.lexers.markup', 'Markdown', ('markdown', 'md'), ('*.md', '*.markdown'), ('text/x-markdown',)), 'MaskLexer': ('pip._vendor.pygments.lexers.javascript', 'Mask', ('mask',), ('*.mask',), ('text/x-mask',)), 'MasonLexer': ('pip._vendor.pygments.lexers.templates', 'Mason', ('mason',), ('*.m', '*.mhtml', '*.mc', '*.mi', 'autohandler', 'dhandler'), ('application/x-mason',)), 'MathematicaLexer': ('pip._vendor.pygments.lexers.algebra', 'Mathematica', ('mathematica', 'mma', 'nb'), ('*.nb', '*.cdf', '*.nbp', '*.ma'), ('application/mathematica', 'application/vnd.wolfram.mathematica', 'application/vnd.wolfram.mathematica.package', 'application/vnd.wolfram.cdf')), 'MatlabLexer': ('pip._vendor.pygments.lexers.matlab', 'Matlab', ('matlab',), ('*.m',), ('text/matlab',)), 'MatlabSessionLexer': ('pip._vendor.pygments.lexers.matlab', 'Matlab session', ('matlabsession',), (), ()), 'MaximaLexer': ('pip._vendor.pygments.lexers.maxima', 'Maxima', ('maxima', 'macsyma'), ('*.mac', '*.max'), ()), 'MesonLexer': ('pip._vendor.pygments.lexers.meson', 'Meson', ('meson', 'meson.build'), ('meson.build', 'meson_options.txt'), ('text/x-meson',)), 'MiniDLexer': ('pip._vendor.pygments.lexers.d', 'MiniD', ('minid',), (), ('text/x-minidsrc',)), 'MiniScriptLexer': ('pip._vendor.pygments.lexers.scripting', 'MiniScript', ('miniscript', 'ms'), ('*.ms',), ('text/x-minicript', 'application/x-miniscript')), 'ModelicaLexer': ('pip._vendor.pygments.lexers.modeling', 'Modelica', ('modelica',), ('*.mo',), ('text/x-modelica',)), 'Modula2Lexer': ('pip._vendor.pygments.lexers.modula2', 'Modula-2', ('modula2', 'm2'), ('*.def', '*.mod'), ('text/x-modula2',)), 'MoinWikiLexer': ('pip._vendor.pygments.lexers.markup', 'MoinMoin/Trac Wiki markup', ('trac-wiki', 'moin'), (), ('text/x-trac-wiki',)), 'MojoLexer': ('pip._vendor.pygments.lexers.mojo', 'Mojo', ('mojo', '🔥'), ('*.mojo', '*.🔥'), ('text/x-mojo', 'application/x-mojo')), 'MonkeyLexer': ('pip._vendor.pygments.lexers.basic', 'Monkey', ('monkey',), ('*.monkey',), ('text/x-monkey',)), 'MonteLexer': ('pip._vendor.pygments.lexers.monte', 'Monte', ('monte',), ('*.mt',), ()), 'MoonScriptLexer': ('pip._vendor.pygments.lexers.scripting', 'MoonScript', ('moonscript', 'moon'), ('*.moon',), ('text/x-moonscript', 'application/x-moonscript')), 'MoselLexer': ('pip._vendor.pygments.lexers.mosel', 'Mosel', ('mosel',), ('*.mos',), ()), 'MozPreprocCssLexer': ('pip._vendor.pygments.lexers.markup', 'CSS+mozpreproc', ('css+mozpreproc',), ('*.css.in',), ()), 'MozPreprocHashLexer': ('pip._vendor.pygments.lexers.markup', 'mozhashpreproc', ('mozhashpreproc',), (), ()), 'MozPreprocJavascriptLexer': ('pip._vendor.pygments.lexers.markup', 'Javascript+mozpreproc', ('javascript+mozpreproc',), ('*.js.in',), ()), 'MozPreprocPercentLexer': ('pip._vendor.pygments.lexers.markup', 'mozpercentpreproc', ('mozpercentpreproc',), (), ()), 'MozPreprocXulLexer': ('pip._vendor.pygments.lexers.markup', 'XUL+mozpreproc', ('xul+mozpreproc',), ('*.xul.in',), ()), 'MqlLexer': ('pip._vendor.pygments.lexers.c_like', 'MQL', ('mql', 'mq4', 'mq5', 'mql4', 'mql5'), ('*.mq4', '*.mq5', '*.mqh'), ('text/x-mql',)), 'MscgenLexer': ('pip._vendor.pygments.lexers.dsls', 'Mscgen', ('mscgen', 'msc'), ('*.msc',), ()), 'MuPADLexer': ('pip._vendor.pygments.lexers.algebra', 'MuPAD', ('mupad',), ('*.mu',), ()), 'MxmlLexer': ('pip._vendor.pygments.lexers.actionscript', 'MXML', ('mxml',), ('*.mxml',), ()), 'MySqlLexer': ('pip._vendor.pygments.lexers.sql', 'MySQL', ('mysql',), (), ('text/x-mysql',)), 'MyghtyCssLexer': ('pip._vendor.pygments.lexers.templates', 'CSS+Myghty', ('css+myghty',), (), ('text/css+myghty',)), 'MyghtyHtmlLexer': ('pip._vendor.pygments.lexers.templates', 'HTML+Myghty', ('html+myghty',), (), ('text/html+myghty',)), 'MyghtyJavascriptLexer': ('pip._vendor.pygments.lexers.templates', 'JavaScript+Myghty', ('javascript+myghty', 'js+myghty'), (), ('application/x-javascript+myghty', 'text/x-javascript+myghty', 'text/javascript+mygthy')), 'MyghtyLexer': ('pip._vendor.pygments.lexers.templates', 'Myghty', ('myghty',), ('*.myt', 'autodelegate'), ('application/x-myghty',)), 'MyghtyXmlLexer': ('pip._vendor.pygments.lexers.templates', 'XML+Myghty', ('xml+myghty',), (), ('application/xml+myghty',)), 'NCLLexer': ('pip._vendor.pygments.lexers.ncl', 'NCL', ('ncl',), ('*.ncl',), ('text/ncl',)), 'NSISLexer': ('pip._vendor.pygments.lexers.installers', 'NSIS', ('nsis', 'nsi', 'nsh'), ('*.nsi', '*.nsh'), ('text/x-nsis',)), 'NasmLexer': ('pip._vendor.pygments.lexers.asm', 'NASM', ('nasm',), ('*.asm', '*.ASM', '*.nasm'), ('text/x-nasm',)), 'NasmObjdumpLexer': ('pip._vendor.pygments.lexers.asm', 'objdump-nasm', ('objdump-nasm',), ('*.objdump-intel',), ('text/x-nasm-objdump',)), 'NemerleLexer': ('pip._vendor.pygments.lexers.dotnet', 'Nemerle', ('nemerle',), ('*.n',), ('text/x-nemerle',)), 'NesCLexer': ('pip._vendor.pygments.lexers.c_like', 'nesC', ('nesc',), ('*.nc',), ('text/x-nescsrc',)), 'NestedTextLexer': ('pip._vendor.pygments.lexers.configs', 'NestedText', ('nestedtext', 'nt'), ('*.nt',), ()), 'NewLispLexer': ('pip._vendor.pygments.lexers.lisp', 'NewLisp', ('newlisp',), ('*.lsp', '*.nl', '*.kif'), ('text/x-newlisp', 'application/x-newlisp')), 'NewspeakLexer': ('pip._vendor.pygments.lexers.smalltalk', 'Newspeak', ('newspeak',), ('*.ns2',), ('text/x-newspeak',)), 'NginxConfLexer': ('pip._vendor.pygments.lexers.configs', 'Nginx configuration file', ('nginx',), ('nginx.conf',), ('text/x-nginx-conf',)), 'NimrodLexer': ('pip._vendor.pygments.lexers.nimrod', 'Nimrod', ('nimrod', 'nim'), ('*.nim', '*.nimrod'), ('text/x-nim',)), 'NitLexer': ('pip._vendor.pygments.lexers.nit', 'Nit', ('nit',), ('*.nit',), ()), 'NixLexer': ('pip._vendor.pygments.lexers.nix', 'Nix', ('nixos', 'nix'), ('*.nix',), ('text/x-nix',)), 'NodeConsoleLexer': ('pip._vendor.pygments.lexers.javascript', 'Node.js REPL console session', ('nodejsrepl',), (), ('text/x-nodejsrepl',)), 'NotmuchLexer': ('pip._vendor.pygments.lexers.textfmts', 'Notmuch', ('notmuch',), (), ()), 'NuSMVLexer': ('pip._vendor.pygments.lexers.smv', 'NuSMV', ('nusmv',), ('*.smv',), ()), 'NumPyLexer': ('pip._vendor.pygments.lexers.python', 'NumPy', ('numpy',), (), ()), 'NumbaIRLexer': ('pip._vendor.pygments.lexers.numbair', 'Numba_IR', ('numba_ir', 'numbair'), ('*.numba_ir',), ('text/x-numba_ir', 'text/x-numbair')), 'ObjdumpLexer': ('pip._vendor.pygments.lexers.asm', 'objdump', ('objdump',), ('*.objdump',), ('text/x-objdump',)), 'ObjectiveCLexer': ('pip._vendor.pygments.lexers.objective', 'Objective-C', ('objective-c', 'objectivec', 'obj-c', 'objc'), ('*.m', '*.h'), ('text/x-objective-c',)), 'ObjectiveCppLexer': ('pip._vendor.pygments.lexers.objective', 'Objective-C++', ('objective-c++', 'objectivec++', 'obj-c++', 'objc++'), ('*.mm', '*.hh'), ('text/x-objective-c++',)), 'ObjectiveJLexer': ('pip._vendor.pygments.lexers.javascript', 'Objective-J', ('objective-j', 'objectivej', 'obj-j', 'objj'), ('*.j',), ('text/x-objective-j',)), 'OcamlLexer': ('pip._vendor.pygments.lexers.ml', 'OCaml', ('ocaml',), ('*.ml', '*.mli', '*.mll', '*.mly'), ('text/x-ocaml',)), 'OctaveLexer': ('pip._vendor.pygments.lexers.matlab', 'Octave', ('octave',), ('*.m',), ('text/octave',)), 'OdinLexer': ('pip._vendor.pygments.lexers.archetype', 'ODIN', ('odin',), ('*.odin',), ('text/odin',)), 'OmgIdlLexer': ('pip._vendor.pygments.lexers.c_like', 'OMG Interface Definition Language', ('omg-idl',), ('*.idl', '*.pidl'), ()), 'OocLexer': ('pip._vendor.pygments.lexers.ooc', 'Ooc', ('ooc',), ('*.ooc',), ('text/x-ooc',)), 'OpaLexer': ('pip._vendor.pygments.lexers.ml', 'Opa', ('opa',), ('*.opa',), ('text/x-opa',)), 'OpenEdgeLexer': ('pip._vendor.pygments.lexers.business', 'OpenEdge ABL', ('openedge', 'abl', 'progress'), ('*.p', '*.cls'), ('text/x-openedge', 'application/x-openedge')), 'OpenScadLexer': ('pip._vendor.pygments.lexers.openscad', 'OpenSCAD', ('openscad',), ('*.scad',), ('application/x-openscad',)), 'OrgLexer': ('pip._vendor.pygments.lexers.markup', 'Org Mode', ('org', 'orgmode', 'org-mode'), ('*.org',), ('text/org',)), 'OutputLexer': ('pip._vendor.pygments.lexers.special', 'Text output', ('output',), (), ()), 'PacmanConfLexer': ('pip._vendor.pygments.lexers.configs', 'PacmanConf', ('pacmanconf',), ('pacman.conf',), ()), 'PanLexer': ('pip._vendor.pygments.lexers.dsls', 'Pan', ('pan',), ('*.pan',), ()), 'ParaSailLexer': ('pip._vendor.pygments.lexers.parasail', 'ParaSail', ('parasail',), ('*.psi', '*.psl'), ('text/x-parasail',)), 'PawnLexer': ('pip._vendor.pygments.lexers.pawn', 'Pawn', ('pawn',), ('*.p', '*.pwn', '*.inc'), ('text/x-pawn',)), 'PddlLexer': ('pip._vendor.pygments.lexers.pddl', 'PDDL', ('pddl',), ('*.pddl',), ()), 'PegLexer': ('pip._vendor.pygments.lexers.grammar_notation', 'PEG', ('peg',), ('*.peg',), ('text/x-peg',)), 'Perl6Lexer': ('pip._vendor.pygments.lexers.perl', 'Perl6', ('perl6', 'pl6', 'raku'), ('*.pl', '*.pm', '*.nqp', '*.p6', '*.6pl', '*.p6l', '*.pl6', '*.6pm', '*.p6m', '*.pm6', '*.t', '*.raku', '*.rakumod', '*.rakutest', '*.rakudoc'), ('text/x-perl6', 'application/x-perl6')), 'PerlLexer': ('pip._vendor.pygments.lexers.perl', 'Perl', ('perl', 'pl'), ('*.pl', '*.pm', '*.t', '*.perl'), ('text/x-perl', 'application/x-perl')), 'PhixLexer': ('pip._vendor.pygments.lexers.phix', 'Phix', ('phix',), ('*.exw',), ('text/x-phix',)), 'PhpLexer': ('pip._vendor.pygments.lexers.php', 'PHP', ('php', 'php3', 'php4', 'php5'), ('*.php', '*.php[345]', '*.inc'), ('text/x-php',)), 'PigLexer': ('pip._vendor.pygments.lexers.jvm', 'Pig', ('pig',), ('*.pig',), ('text/x-pig',)), 'PikeLexer': ('pip._vendor.pygments.lexers.c_like', 'Pike', ('pike',), ('*.pike', '*.pmod'), ('text/x-pike',)), 'PkgConfigLexer': ('pip._vendor.pygments.lexers.configs', 'PkgConfig', ('pkgconfig',), ('*.pc',), ()), 'PlPgsqlLexer': ('pip._vendor.pygments.lexers.sql', 'PL/pgSQL', ('plpgsql',), (), ('text/x-plpgsql',)), 'PointlessLexer': ('pip._vendor.pygments.lexers.pointless', 'Pointless', ('pointless',), ('*.ptls',), ()), 'PonyLexer': ('pip._vendor.pygments.lexers.pony', 'Pony', ('pony',), ('*.pony',), ()), 'PortugolLexer': ('pip._vendor.pygments.lexers.pascal', 'Portugol', ('portugol',), ('*.alg', '*.portugol'), ()), 'PostScriptLexer': ('pip._vendor.pygments.lexers.graphics', 'PostScript', ('postscript', 'postscr'), ('*.ps', '*.eps'), ('application/postscript',)), 'PostgresConsoleLexer': ('pip._vendor.pygments.lexers.sql', 'PostgreSQL console (psql)', ('psql', 'postgresql-console', 'postgres-console'), (), ('text/x-postgresql-psql',)), 'PostgresExplainLexer': ('pip._vendor.pygments.lexers.sql', 'PostgreSQL EXPLAIN dialect', ('postgres-explain',), ('*.explain',), ('text/x-postgresql-explain',)), 'PostgresLexer': ('pip._vendor.pygments.lexers.sql', 'PostgreSQL SQL dialect', ('postgresql', 'postgres'), (), ('text/x-postgresql',)), 'PovrayLexer': ('pip._vendor.pygments.lexers.graphics', 'POVRay', ('pov',), ('*.pov', '*.inc'), ('text/x-povray',)), 'PowerShellLexer': ('pip._vendor.pygments.lexers.shell', 'PowerShell', ('powershell', 'pwsh', 'posh', 'ps1', 'psm1'), ('*.ps1', '*.psm1'), ('text/x-powershell',)), 'PowerShellSessionLexer': ('pip._vendor.pygments.lexers.shell', 'PowerShell Session', ('pwsh-session', 'ps1con'), (), ()), 'PraatLexer': ('pip._vendor.pygments.lexers.praat', 'Praat', ('praat',), ('*.praat', '*.proc', '*.psc'), ()), 'ProcfileLexer': ('pip._vendor.pygments.lexers.procfile', 'Procfile', ('procfile',), ('Procfile',), ()), 'PrologLexer': ('pip._vendor.pygments.lexers.prolog', 'Prolog', ('prolog',), ('*.ecl', '*.prolog', '*.pro', '*.pl'), ('text/x-prolog',)), 'PromQLLexer': ('pip._vendor.pygments.lexers.promql', 'PromQL', ('promql',), ('*.promql',), ()), 'PromelaLexer': ('pip._vendor.pygments.lexers.c_like', 'Promela', ('promela',), ('*.pml', '*.prom', '*.prm', '*.promela', '*.pr', '*.pm'), ('text/x-promela',)), 'PropertiesLexer': ('pip._vendor.pygments.lexers.configs', 'Properties', ('properties', 'jproperties'), ('*.properties',), ('text/x-java-properties',)), 'ProtoBufLexer': ('pip._vendor.pygments.lexers.dsls', 'Protocol Buffer', ('protobuf', 'proto'), ('*.proto',), ()), 'PrqlLexer': ('pip._vendor.pygments.lexers.prql', 'PRQL', ('prql',), ('*.prql',), ('application/prql', 'application/x-prql')), 'PsyshConsoleLexer': ('pip._vendor.pygments.lexers.php', 'PsySH console session for PHP', ('psysh',), (), ()), 'PtxLexer': ('pip._vendor.pygments.lexers.ptx', 'PTX', ('ptx',), ('*.ptx',), ('text/x-ptx',)), 'PugLexer': ('pip._vendor.pygments.lexers.html', 'Pug', ('pug', 'jade'), ('*.pug', '*.jade'), ('text/x-pug', 'text/x-jade')), 'PuppetLexer': ('pip._vendor.pygments.lexers.dsls', 'Puppet', ('puppet',), ('*.pp',), ()), 'PyPyLogLexer': ('pip._vendor.pygments.lexers.console', 'PyPy Log', ('pypylog', 'pypy'), ('*.pypylog',), ('application/x-pypylog',)), 'Python2Lexer': ('pip._vendor.pygments.lexers.python', 'Python 2.x', ('python2', 'py2'), (), ('text/x-python2', 'application/x-python2')), 'Python2TracebackLexer': ('pip._vendor.pygments.lexers.python', 'Python 2.x Traceback', ('py2tb',), ('*.py2tb',), ('text/x-python2-traceback',)), 'PythonConsoleLexer': ('pip._vendor.pygments.lexers.python', 'Python console session', ('pycon', 'python-console'), (), ('text/x-python-doctest',)), 'PythonLexer': ('pip._vendor.pygments.lexers.python', 'Python', ('python', 'py', 'sage', 'python3', 'py3', 'bazel', 'starlark', 'pyi'), ('*.py', '*.pyw', '*.pyi', '*.jy', '*.sage', '*.sc', 'SConstruct', 'SConscript', '*.bzl', 'BUCK', 'BUILD', 'BUILD.bazel', 'WORKSPACE', '*.tac'), ('text/x-python', 'application/x-python', 'text/x-python3', 'application/x-python3')), 'PythonTracebackLexer': ('pip._vendor.pygments.lexers.python', 'Python Traceback', ('pytb', 'py3tb'), ('*.pytb', '*.py3tb'), ('text/x-python-traceback', 'text/x-python3-traceback')), 'PythonUL4Lexer': ('pip._vendor.pygments.lexers.ul4', 'Python+UL4', ('py+ul4',), ('*.pyul4',), ()), 'QBasicLexer': ('pip._vendor.pygments.lexers.basic', 'QBasic', ('qbasic', 'basic'), ('*.BAS', '*.bas'), ('text/basic',)), 'QLexer': ('pip._vendor.pygments.lexers.q', 'Q', ('q',), ('*.q',), ()), 'QVToLexer': ('pip._vendor.pygments.lexers.qvt', 'QVTO', ('qvto', 'qvt'), ('*.qvto',), ()), 'QlikLexer': ('pip._vendor.pygments.lexers.qlik', 'Qlik', ('qlik', 'qlikview', 'qliksense', 'qlikscript'), ('*.qvs', '*.qvw'), ()), 'QmlLexer': ('pip._vendor.pygments.lexers.webmisc', 'QML', ('qml', 'qbs'), ('*.qml', '*.qbs'), ('application/x-qml', 'application/x-qt.qbs+qml')), 'RConsoleLexer': ('pip._vendor.pygments.lexers.r', 'RConsole', ('rconsole', 'rout'), ('*.Rout',), ()), 'RNCCompactLexer': ('pip._vendor.pygments.lexers.rnc', 'Relax-NG Compact', ('rng-compact', 'rnc'), ('*.rnc',), ()), 'RPMSpecLexer': ('pip._vendor.pygments.lexers.installers', 'RPMSpec', ('spec',), ('*.spec',), ('text/x-rpm-spec',)), 'RacketLexer': ('pip._vendor.pygments.lexers.lisp', 'Racket', ('racket', 'rkt'), ('*.rkt', '*.rktd', '*.rktl'), ('text/x-racket', 'application/x-racket')), 'RagelCLexer': ('pip._vendor.pygments.lexers.parsers', 'Ragel in C Host', ('ragel-c',), ('*.rl',), ()), 'RagelCppLexer': ('pip._vendor.pygments.lexers.parsers', 'Ragel in CPP Host', ('ragel-cpp',), ('*.rl',), ()), 'RagelDLexer': ('pip._vendor.pygments.lexers.parsers', 'Ragel in D Host', ('ragel-d',), ('*.rl',), ()), 'RagelEmbeddedLexer': ('pip._vendor.pygments.lexers.parsers', 'Embedded Ragel', ('ragel-em',), ('*.rl',), ()), 'RagelJavaLexer': ('pip._vendor.pygments.lexers.parsers', 'Ragel in Java Host', ('ragel-java',), ('*.rl',), ()), 'RagelLexer': ('pip._vendor.pygments.lexers.parsers', 'Ragel', ('ragel',), (), ()), 'RagelObjectiveCLexer': ('pip._vendor.pygments.lexers.parsers', 'Ragel in Objective C Host', ('ragel-objc',), ('*.rl',), ()), 'RagelRubyLexer': ('pip._vendor.pygments.lexers.parsers', 'Ragel in Ruby Host', ('ragel-ruby', 'ragel-rb'), ('*.rl',), ()), 'RawTokenLexer': ('pip._vendor.pygments.lexers.special', 'Raw token data', (), (), ('application/x-pygments-tokens',)), 'RdLexer': ('pip._vendor.pygments.lexers.r', 'Rd', ('rd',), ('*.Rd',), ('text/x-r-doc',)), 'ReasonLexer': ('pip._vendor.pygments.lexers.ml', 'ReasonML', ('reasonml', 'reason'), ('*.re', '*.rei'), ('text/x-reasonml',)), 'RebolLexer': ('pip._vendor.pygments.lexers.rebol', 'REBOL', ('rebol',), ('*.r', '*.r3', '*.reb'), ('text/x-rebol',)), 'RedLexer': ('pip._vendor.pygments.lexers.rebol', 'Red', ('red', 'red/system'), ('*.red', '*.reds'), ('text/x-red', 'text/x-red-system')), 'RedcodeLexer': ('pip._vendor.pygments.lexers.esoteric', 'Redcode', ('redcode',), ('*.cw',), ()), 'RegeditLexer': ('pip._vendor.pygments.lexers.configs', 'reg', ('registry',), ('*.reg',), ('text/x-windows-registry',)), 'RegoLexer': ('pip._vendor.pygments.lexers.rego', 'Rego', ('rego',), ('*.rego',), ('text/x-rego',)), 'ResourceLexer': ('pip._vendor.pygments.lexers.resource', 'ResourceBundle', ('resourcebundle', 'resource'), (), ()), 'RexxLexer': ('pip._vendor.pygments.lexers.scripting', 'Rexx', ('rexx', 'arexx'), ('*.rexx', '*.rex', '*.rx', '*.arexx'), ('text/x-rexx',)), 'RhtmlLexer': ('pip._vendor.pygments.lexers.templates', 'RHTML', ('rhtml', 'html+erb', 'html+ruby'), ('*.rhtml',), ('text/html+ruby',)), 'RideLexer': ('pip._vendor.pygments.lexers.ride', 'Ride', ('ride',), ('*.ride',), ('text/x-ride',)), 'RitaLexer': ('pip._vendor.pygments.lexers.rita', 'Rita', ('rita',), ('*.rita',), ('text/rita',)), 'RoboconfGraphLexer': ('pip._vendor.pygments.lexers.roboconf', 'Roboconf Graph', ('roboconf-graph',), ('*.graph',), ()), 'RoboconfInstancesLexer': ('pip._vendor.pygments.lexers.roboconf', 'Roboconf Instances', ('roboconf-instances',), ('*.instances',), ()), 'RobotFrameworkLexer': ('pip._vendor.pygments.lexers.robotframework', 'RobotFramework', ('robotframework',), ('*.robot', '*.resource'), ('text/x-robotframework',)), 'RqlLexer': ('pip._vendor.pygments.lexers.sql', 'RQL', ('rql',), ('*.rql',), ('text/x-rql',)), 'RslLexer': ('pip._vendor.pygments.lexers.dsls', 'RSL', ('rsl',), ('*.rsl',), ('text/rsl',)), 'RstLexer': ('pip._vendor.pygments.lexers.markup', 'reStructuredText', ('restructuredtext', 'rst', 'rest'), ('*.rst', '*.rest'), ('text/x-rst', 'text/prs.fallenstein.rst')), 'RtsLexer': ('pip._vendor.pygments.lexers.trafficscript', 'TrafficScript', ('trafficscript', 'rts'), ('*.rts',), ()), 'RubyConsoleLexer': ('pip._vendor.pygments.lexers.ruby', 'Ruby irb session', ('rbcon', 'irb'), (), ('text/x-ruby-shellsession',)), 'RubyLexer': ('pip._vendor.pygments.lexers.ruby', 'Ruby', ('ruby', 'rb', 'duby'), ('*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec', '*.rbx', '*.duby', 'Gemfile', 'Vagrantfile'), ('text/x-ruby', 'application/x-ruby')), 'RustLexer': ('pip._vendor.pygments.lexers.rust', 'Rust', ('rust', 'rs'), ('*.rs', '*.rs.in'), ('text/rust', 'text/x-rust')), 'SASLexer': ('pip._vendor.pygments.lexers.sas', 'SAS', ('sas',), ('*.SAS', '*.sas'), ('text/x-sas', 'text/sas', 'application/x-sas')), 'SLexer': ('pip._vendor.pygments.lexers.r', 'S', ('splus', 's', 'r'), ('*.S', '*.R', '.Rhistory', '.Rprofile', '.Renviron'), ('text/S-plus', 'text/S', 'text/x-r-source', 'text/x-r', 'text/x-R', 'text/x-r-history', 'text/x-r-profile')), 'SMLLexer': ('pip._vendor.pygments.lexers.ml', 'Standard ML', ('sml',), ('*.sml', '*.sig', '*.fun'), ('text/x-standardml', 'application/x-standardml')), 'SNBTLexer': ('pip._vendor.pygments.lexers.minecraft', 'SNBT', ('snbt',), ('*.snbt',), ('text/snbt',)), 'SarlLexer': ('pip._vendor.pygments.lexers.jvm', 'SARL', ('sarl',), ('*.sarl',), ('text/x-sarl',)), 'SassLexer': ('pip._vendor.pygments.lexers.css', 'Sass', ('sass',), ('*.sass',), ('text/x-sass',)), 'SaviLexer': ('pip._vendor.pygments.lexers.savi', 'Savi', ('savi',), ('*.savi',), ()), 'ScalaLexer': ('pip._vendor.pygments.lexers.jvm', 'Scala', ('scala',), ('*.scala',), ('text/x-scala',)), 'ScamlLexer': ('pip._vendor.pygments.lexers.html', 'Scaml', ('scaml',), ('*.scaml',), ('text/x-scaml',)), 'ScdocLexer': ('pip._vendor.pygments.lexers.scdoc', 'scdoc', ('scdoc', 'scd'), ('*.scd', '*.scdoc'), ()), 'SchemeLexer': ('pip._vendor.pygments.lexers.lisp', 'Scheme', ('scheme', 'scm'), ('*.scm', '*.ss'), ('text/x-scheme', 'application/x-scheme')), 'ScilabLexer': ('pip._vendor.pygments.lexers.matlab', 'Scilab', ('scilab',), ('*.sci', '*.sce', '*.tst'), ('text/scilab',)), 'ScssLexer': ('pip._vendor.pygments.lexers.css', 'SCSS', ('scss',), ('*.scss',), ('text/x-scss',)), 'SedLexer': ('pip._vendor.pygments.lexers.textedit', 'Sed', ('sed', 'gsed', 'ssed'), ('*.sed', '*.[gs]sed'), ('text/x-sed',)), 'ShExCLexer': ('pip._vendor.pygments.lexers.rdf', 'ShExC', ('shexc', 'shex'), ('*.shex',), ('text/shex',)), 'ShenLexer': ('pip._vendor.pygments.lexers.lisp', 'Shen', ('shen',), ('*.shen',), ('text/x-shen', 'application/x-shen')), 'SieveLexer': ('pip._vendor.pygments.lexers.sieve', 'Sieve', ('sieve',), ('*.siv', '*.sieve'), ()), 'SilverLexer': ('pip._vendor.pygments.lexers.verification', 'Silver', ('silver',), ('*.sil', '*.vpr'), ()), 'SingularityLexer': ('pip._vendor.pygments.lexers.configs', 'Singularity', ('singularity',), ('*.def', 'Singularity'), ()), 'SlashLexer': ('pip._vendor.pygments.lexers.slash', 'Slash', ('slash',), ('*.sla',), ()), 'SlimLexer': ('pip._vendor.pygments.lexers.webmisc', 'Slim', ('slim',), ('*.slim',), ('text/x-slim',)), 'SlurmBashLexer': ('pip._vendor.pygments.lexers.shell', 'Slurm', ('slurm', 'sbatch'), ('*.sl',), ()), 'SmaliLexer': ('pip._vendor.pygments.lexers.dalvik', 'Smali', ('smali',), ('*.smali',), ('text/smali',)), 'SmalltalkLexer': ('pip._vendor.pygments.lexers.smalltalk', 'Smalltalk', ('smalltalk', 'squeak', 'st'), ('*.st',), ('text/x-smalltalk',)), 'SmartGameFormatLexer': ('pip._vendor.pygments.lexers.sgf', 'SmartGameFormat', ('sgf',), ('*.sgf',), ()), 'SmartyLexer': ('pip._vendor.pygments.lexers.templates', 'Smarty', ('smarty',), ('*.tpl',), ('application/x-smarty',)), 'SmithyLexer': ('pip._vendor.pygments.lexers.smithy', 'Smithy', ('smithy',), ('*.smithy',), ()), 'SnobolLexer': ('pip._vendor.pygments.lexers.snobol', 'Snobol', ('snobol',), ('*.snobol',), ('text/x-snobol',)), 'SnowballLexer': ('pip._vendor.pygments.lexers.dsls', 'Snowball', ('snowball',), ('*.sbl',), ()), 'SolidityLexer': ('pip._vendor.pygments.lexers.solidity', 'Solidity', ('solidity',), ('*.sol',), ()), 'SoongLexer': ('pip._vendor.pygments.lexers.soong', 'Soong', ('androidbp', 'bp', 'soong'), ('Android.bp',), ()), 'SophiaLexer': ('pip._vendor.pygments.lexers.sophia', 'Sophia', ('sophia',), ('*.aes',), ()), 'SourcePawnLexer': ('pip._vendor.pygments.lexers.pawn', 'SourcePawn', ('sp',), ('*.sp',), ('text/x-sourcepawn',)), 'SourcesListLexer': ('pip._vendor.pygments.lexers.installers', 'Debian Sourcelist', ('debsources', 'sourceslist', 'sources.list'), ('sources.list',), ()), 'SparqlLexer': ('pip._vendor.pygments.lexers.rdf', 'SPARQL', ('sparql',), ('*.rq', '*.sparql'), ('application/sparql-query',)), 'SpiceLexer': ('pip._vendor.pygments.lexers.spice', 'Spice', ('spice', 'spicelang'), ('*.spice',), ('text/x-spice',)), 'SqlJinjaLexer': ('pip._vendor.pygments.lexers.templates', 'SQL+Jinja', ('sql+jinja',), ('*.sql', '*.sql.j2', '*.sql.jinja2'), ()), 'SqlLexer': ('pip._vendor.pygments.lexers.sql', 'SQL', ('sql',), ('*.sql',), ('text/x-sql',)), 'SqliteConsoleLexer': ('pip._vendor.pygments.lexers.sql', 'sqlite3con', ('sqlite3',), ('*.sqlite3-console',), ('text/x-sqlite3-console',)), 'SquidConfLexer': ('pip._vendor.pygments.lexers.configs', 'SquidConf', ('squidconf', 'squid.conf', 'squid'), ('squid.conf',), ('text/x-squidconf',)), 'SrcinfoLexer': ('pip._vendor.pygments.lexers.srcinfo', 'Srcinfo', ('srcinfo',), ('.SRCINFO',), ()), 'SspLexer': ('pip._vendor.pygments.lexers.templates', 'Scalate Server Page', ('ssp',), ('*.ssp',), ('application/x-ssp',)), 'StanLexer': ('pip._vendor.pygments.lexers.modeling', 'Stan', ('stan',), ('*.stan',), ()), 'StataLexer': ('pip._vendor.pygments.lexers.stata', 'Stata', ('stata', 'do'), ('*.do', '*.ado'), ('text/x-stata', 'text/stata', 'application/x-stata')), 'SuperColliderLexer': ('pip._vendor.pygments.lexers.supercollider', 'SuperCollider', ('supercollider', 'sc'), ('*.sc', '*.scd'), ('application/supercollider', 'text/supercollider')), 'SwiftLexer': ('pip._vendor.pygments.lexers.objective', 'Swift', ('swift',), ('*.swift',), ('text/x-swift',)), 'SwigLexer': ('pip._vendor.pygments.lexers.c_like', 'SWIG', ('swig',), ('*.swg', '*.i'), ('text/swig',)), 'SystemVerilogLexer': ('pip._vendor.pygments.lexers.hdl', 'systemverilog', ('systemverilog', 'sv'), ('*.sv', '*.svh'), ('text/x-systemverilog',)), 'SystemdLexer': ('pip._vendor.pygments.lexers.configs', 'Systemd', ('systemd',), ('*.service', '*.socket', '*.device', '*.mount', '*.automount', '*.swap', '*.target', '*.path', '*.timer', '*.slice', '*.scope'), ()), 'TAPLexer': ('pip._vendor.pygments.lexers.testing', 'TAP', ('tap',), ('*.tap',), ()), 'TNTLexer': ('pip._vendor.pygments.lexers.tnt', 'Typographic Number Theory', ('tnt',), ('*.tnt',), ()), 'TOMLLexer': ('pip._vendor.pygments.lexers.configs', 'TOML', ('toml',), ('*.toml', 'Pipfile', 'poetry.lock'), ('application/toml',)), 'TableGenLexer': ('pip._vendor.pygments.lexers.tablegen', 'TableGen', ('tablegen', 'td'), ('*.td',), ()), 'TactLexer': ('pip._vendor.pygments.lexers.tact', 'Tact', ('tact',), ('*.tact',), ()), 'Tads3Lexer': ('pip._vendor.pygments.lexers.int_fiction', 'TADS 3', ('tads3',), ('*.t',), ()), 'TalLexer': ('pip._vendor.pygments.lexers.tal', 'Tal', ('tal', 'uxntal'), ('*.tal',), ('text/x-uxntal',)), 'TasmLexer': ('pip._vendor.pygments.lexers.asm', 'TASM', ('tasm',), ('*.asm', '*.ASM', '*.tasm'), ('text/x-tasm',)), 'TclLexer': ('pip._vendor.pygments.lexers.tcl', 'Tcl', ('tcl',), ('*.tcl', '*.rvt'), ('text/x-tcl', 'text/x-script.tcl', 'application/x-tcl')), 'TcshLexer': ('pip._vendor.pygments.lexers.shell', 'Tcsh', ('tcsh', 'csh'), ('*.tcsh', '*.csh'), ('application/x-csh',)), 'TcshSessionLexer': ('pip._vendor.pygments.lexers.shell', 'Tcsh Session', ('tcshcon',), (), ()), 'TeaTemplateLexer': ('pip._vendor.pygments.lexers.templates', 'Tea', ('tea',), ('*.tea',), ('text/x-tea',)), 'TealLexer': ('pip._vendor.pygments.lexers.teal', 'teal', ('teal',), ('*.teal',), ()), 'TeraTermLexer': ('pip._vendor.pygments.lexers.teraterm', 'Tera Term macro', ('teratermmacro', 'teraterm', 'ttl'), ('*.ttl',), ('text/x-teratermmacro',)), 'TermcapLexer': ('pip._vendor.pygments.lexers.configs', 'Termcap', ('termcap',), ('termcap', 'termcap.src'), ()), 'TerminfoLexer': ('pip._vendor.pygments.lexers.configs', 'Terminfo', ('terminfo',), ('terminfo', 'terminfo.src'), ()), 'TerraformLexer': ('pip._vendor.pygments.lexers.configs', 'Terraform', ('terraform', 'tf', 'hcl'), ('*.tf', '*.hcl'), ('application/x-tf', 'application/x-terraform')), 'TexLexer': ('pip._vendor.pygments.lexers.markup', 'TeX', ('tex', 'latex'), ('*.tex', '*.aux', '*.toc'), ('text/x-tex', 'text/x-latex')), 'TextLexer': ('pip._vendor.pygments.lexers.special', 'Text only', ('text',), ('*.txt',), ('text/plain',)), 'ThingsDBLexer': ('pip._vendor.pygments.lexers.thingsdb', 'ThingsDB', ('ti', 'thingsdb'), ('*.ti',), ()), 'ThriftLexer': ('pip._vendor.pygments.lexers.dsls', 'Thrift', ('thrift',), ('*.thrift',), ('application/x-thrift',)), 'TiddlyWiki5Lexer': ('pip._vendor.pygments.lexers.markup', 'tiddler', ('tid',), ('*.tid',), ('text/vnd.tiddlywiki',)), 'TlbLexer': ('pip._vendor.pygments.lexers.tlb', 'Tl-b', ('tlb',), ('*.tlb',), ()), 'TlsLexer': ('pip._vendor.pygments.lexers.tls', 'TLS Presentation Language', ('tls',), (), ()), 'TodotxtLexer': ('pip._vendor.pygments.lexers.textfmts', 'Todotxt', ('todotxt',), ('todo.txt', '*.todotxt'), ('text/x-todo',)), 'TransactSqlLexer': ('pip._vendor.pygments.lexers.sql', 'Transact-SQL', ('tsql', 't-sql'), ('*.sql',), ('text/x-tsql',)), 'TreetopLexer': ('pip._vendor.pygments.lexers.parsers', 'Treetop', ('treetop',), ('*.treetop', '*.tt'), ()), 'TsxLexer': ('pip._vendor.pygments.lexers.jsx', 'TSX', ('tsx',), ('*.tsx',), ('text/typescript-tsx',)), 'TurtleLexer': ('pip._vendor.pygments.lexers.rdf', 'Turtle', ('turtle',), ('*.ttl',), ('text/turtle', 'application/x-turtle')), 'TwigHtmlLexer': ('pip._vendor.pygments.lexers.templates', 'HTML+Twig', ('html+twig',), ('*.twig',), ('text/html+twig',)), 'TwigLexer': ('pip._vendor.pygments.lexers.templates', 'Twig', ('twig',), (), ('application/x-twig',)), 'TypeScriptLexer': ('pip._vendor.pygments.lexers.javascript', 'TypeScript', ('typescript', 'ts'), ('*.ts',), ('application/x-typescript', 'text/x-typescript')), 'TypoScriptCssDataLexer': ('pip._vendor.pygments.lexers.typoscript', 'TypoScriptCssData', ('typoscriptcssdata',), (), ()), 'TypoScriptHtmlDataLexer': ('pip._vendor.pygments.lexers.typoscript', 'TypoScriptHtmlData', ('typoscripthtmldata',), (), ()), 'TypoScriptLexer': ('pip._vendor.pygments.lexers.typoscript', 'TypoScript', ('typoscript',), ('*.typoscript',), ('text/x-typoscript',)), 'TypstLexer': ('pip._vendor.pygments.lexers.typst', 'Typst', ('typst',), ('*.typ',), ('text/x-typst',)), 'UL4Lexer': ('pip._vendor.pygments.lexers.ul4', 'UL4', ('ul4',), ('*.ul4',), ()), 'UcodeLexer': ('pip._vendor.pygments.lexers.unicon', 'ucode', ('ucode',), ('*.u', '*.u1', '*.u2'), ()), 'UniconLexer': ('pip._vendor.pygments.lexers.unicon', 'Unicon', ('unicon',), ('*.icn',), ('text/unicon',)), 'UnixConfigLexer': ('pip._vendor.pygments.lexers.configs', 'Unix/Linux config files', ('unixconfig', 'linuxconfig'), (), ()), 'UrbiscriptLexer': ('pip._vendor.pygments.lexers.urbi', 'UrbiScript', ('urbiscript',), ('*.u',), ('application/x-urbiscript',)), 'UrlEncodedLexer': ('pip._vendor.pygments.lexers.html', 'urlencoded', ('urlencoded',), (), ('application/x-www-form-urlencoded',)), 'UsdLexer': ('pip._vendor.pygments.lexers.usd', 'USD', ('usd', 'usda'), ('*.usd', '*.usda'), ()), 'VBScriptLexer': ('pip._vendor.pygments.lexers.basic', 'VBScript', ('vbscript',), ('*.vbs', '*.VBS'), ()), 'VCLLexer': ('pip._vendor.pygments.lexers.varnish', 'VCL', ('vcl',), ('*.vcl',), ('text/x-vclsrc',)), 'VCLSnippetLexer': ('pip._vendor.pygments.lexers.varnish', 'VCLSnippets', ('vclsnippets', 'vclsnippet'), (), ('text/x-vclsnippet',)), 'VCTreeStatusLexer': ('pip._vendor.pygments.lexers.console', 'VCTreeStatus', ('vctreestatus',), (), ()), 'VGLLexer': ('pip._vendor.pygments.lexers.dsls', 'VGL', ('vgl',), ('*.rpf',), ()), 'ValaLexer': ('pip._vendor.pygments.lexers.c_like', 'Vala', ('vala', 'vapi'), ('*.vala', '*.vapi'), ('text/x-vala',)), 'VbNetAspxLexer': ('pip._vendor.pygments.lexers.dotnet', 'aspx-vb', ('aspx-vb',), ('*.aspx', '*.asax', '*.ascx', '*.ashx', '*.asmx', '*.axd'), ()), 'VbNetLexer': ('pip._vendor.pygments.lexers.dotnet', 'VB.net', ('vb.net', 'vbnet', 'lobas', 'oobas', 'sobas', 'visual-basic', 'visualbasic'), ('*.vb', '*.bas'), ('text/x-vbnet', 'text/x-vba')), 'VelocityHtmlLexer': ('pip._vendor.pygments.lexers.templates', 'HTML+Velocity', ('html+velocity',), (), ('text/html+velocity',)), 'VelocityLexer': ('pip._vendor.pygments.lexers.templates', 'Velocity', ('velocity',), ('*.vm', '*.fhtml'), ()), 'VelocityXmlLexer': ('pip._vendor.pygments.lexers.templates', 'XML+Velocity', ('xml+velocity',), (), ('application/xml+velocity',)), 'VerifpalLexer': ('pip._vendor.pygments.lexers.verifpal', 'Verifpal', ('verifpal',), ('*.vp',), ('text/x-verifpal',)), 'VerilogLexer': ('pip._vendor.pygments.lexers.hdl', 'verilog', ('verilog', 'v'), ('*.v',), ('text/x-verilog',)), 'VhdlLexer': ('pip._vendor.pygments.lexers.hdl', 'vhdl', ('vhdl',), ('*.vhdl', '*.vhd'), ('text/x-vhdl',)), 'VimLexer': ('pip._vendor.pygments.lexers.textedit', 'VimL', ('vim',), ('*.vim', '.vimrc', '.exrc', '.gvimrc', '_vimrc', '_exrc', '_gvimrc', 'vimrc', 'gvimrc'), ('text/x-vim',)), 'VisualPrologGrammarLexer': ('pip._vendor.pygments.lexers.vip', 'Visual Prolog Grammar', ('visualprologgrammar',), ('*.vipgrm',), ()), 'VisualPrologLexer': ('pip._vendor.pygments.lexers.vip', 'Visual Prolog', ('visualprolog',), ('*.pro', '*.cl', '*.i', '*.pack', '*.ph'), ()), 'VueLexer': ('pip._vendor.pygments.lexers.html', 'Vue', ('vue',), ('*.vue',), ()), 'VyperLexer': ('pip._vendor.pygments.lexers.vyper', 'Vyper', ('vyper',), ('*.vy',), ()), 'WDiffLexer': ('pip._vendor.pygments.lexers.diff', 'WDiff', ('wdiff',), ('*.wdiff',), ()), 'WatLexer': ('pip._vendor.pygments.lexers.webassembly', 'WebAssembly', ('wast', 'wat'), ('*.wat', '*.wast'), ()), 'WebIDLLexer': ('pip._vendor.pygments.lexers.webidl', 'Web IDL', ('webidl',), ('*.webidl',), ()), 'WgslLexer': ('pip._vendor.pygments.lexers.wgsl', 'WebGPU Shading Language', ('wgsl',), ('*.wgsl',), ('text/wgsl',)), 'WhileyLexer': ('pip._vendor.pygments.lexers.whiley', 'Whiley', ('whiley',), ('*.whiley',), ('text/x-whiley',)), 'WikitextLexer': ('pip._vendor.pygments.lexers.markup', 'Wikitext', ('wikitext', 'mediawiki'), (), ('text/x-wiki',)), 'WoWTocLexer': ('pip._vendor.pygments.lexers.wowtoc', 'World of Warcraft TOC', ('wowtoc',), ('*.toc',), ()), 'WrenLexer': ('pip._vendor.pygments.lexers.wren', 'Wren', ('wren',), ('*.wren',), ()), 'X10Lexer': ('pip._vendor.pygments.lexers.x10', 'X10', ('x10', 'xten'), ('*.x10',), ('text/x-x10',)), 'XMLUL4Lexer': ('pip._vendor.pygments.lexers.ul4', 'XML+UL4', ('xml+ul4',), ('*.xmlul4',), ()), 'XQueryLexer': ('pip._vendor.pygments.lexers.webmisc', 'XQuery', ('xquery', 'xqy', 'xq', 'xql', 'xqm'), ('*.xqy', '*.xquery', '*.xq', '*.xql', '*.xqm'), ('text/xquery', 'application/xquery')), 'XmlDjangoLexer': ('pip._vendor.pygments.lexers.templates', 'XML+Django/Jinja', ('xml+django', 'xml+jinja'), ('*.xml.j2', '*.xml.jinja2'), ('application/xml+django', 'application/xml+jinja')), 'XmlErbLexer': ('pip._vendor.pygments.lexers.templates', 'XML+Ruby', ('xml+ruby', 'xml+erb'), (), ('application/xml+ruby',)), 'XmlLexer': ('pip._vendor.pygments.lexers.html', 'XML', ('xml',), ('*.xml', '*.xsl', '*.rss', '*.xslt', '*.xsd', '*.wsdl', '*.wsf'), ('text/xml', 'application/xml', 'image/svg+xml', 'application/rss+xml', 'application/atom+xml')), 'XmlPhpLexer': ('pip._vendor.pygments.lexers.templates', 'XML+PHP', ('xml+php',), (), ('application/xml+php',)), 'XmlSmartyLexer': ('pip._vendor.pygments.lexers.templates', 'XML+Smarty', ('xml+smarty',), (), ('application/xml+smarty',)), 'XorgLexer': ('pip._vendor.pygments.lexers.xorg', 'Xorg', ('xorg.conf',), ('xorg.conf',), ()), 'XppLexer': ('pip._vendor.pygments.lexers.dotnet', 'X++', ('xpp', 'x++'), ('*.xpp',), ()), 'XsltLexer': ('pip._vendor.pygments.lexers.html', 'XSLT', ('xslt',), ('*.xsl', '*.xslt', '*.xpl'), ('application/xsl+xml', 'application/xslt+xml')), 'XtendLexer': ('pip._vendor.pygments.lexers.jvm', 'Xtend', ('xtend',), ('*.xtend',), ('text/x-xtend',)), 'XtlangLexer': ('pip._vendor.pygments.lexers.lisp', 'xtlang', ('extempore',), ('*.xtm',), ()), 'YamlJinjaLexer': ('pip._vendor.pygments.lexers.templates', 'YAML+Jinja', ('yaml+jinja', 'salt', 'sls'), ('*.sls', '*.yaml.j2', '*.yml.j2', '*.yaml.jinja2', '*.yml.jinja2'), ('text/x-yaml+jinja', 'text/x-sls')), 'YamlLexer': ('pip._vendor.pygments.lexers.data', 'YAML', ('yaml',), ('*.yaml', '*.yml'), ('text/x-yaml',)), 'YangLexer': ('pip._vendor.pygments.lexers.yang', 'YANG', ('yang',), ('*.yang',), ('application/yang',)), 'YaraLexer': ('pip._vendor.pygments.lexers.yara', 'YARA', ('yara', 'yar'), ('*.yar',), ('text/x-yara',)), 'ZeekLexer': ('pip._vendor.pygments.lexers.dsls', 'Zeek', ('zeek', 'bro'), ('*.zeek', '*.bro'), ()), 'ZephirLexer': ('pip._vendor.pygments.lexers.php', 'Zephir', ('zephir',), ('*.zep',), ()), 'ZigLexer': ('pip._vendor.pygments.lexers.zig', 'Zig', ('zig',), ('*.zig',), ('text/zig',)), 'apdlexer': ('pip._vendor.pygments.lexers.apdlexer', 'ANSYS parametric design language', ('ansys', 'apdl'), ('*.ans',), ()), } ================================================ FILE: src/pip/_vendor/pygments/lexers/python.py ================================================ """ pygments.lexers.python ~~~~~~~~~~~~~~~~~~~~~~ Lexers for Python and related languages. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import keyword from pip._vendor.pygments.lexer import DelegatingLexer, RegexLexer, include, \ bygroups, using, default, words, combined, this from pip._vendor.pygments.util import get_bool_opt, shebang_matches from pip._vendor.pygments.token import Text, Comment, Operator, Keyword, Name, String, \ Number, Punctuation, Generic, Other, Error, Whitespace from pip._vendor.pygments import unistring as uni __all__ = ['PythonLexer', 'PythonConsoleLexer', 'PythonTracebackLexer', 'Python2Lexer', 'Python2TracebackLexer', 'CythonLexer', 'DgLexer', 'NumPyLexer'] class PythonLexer(RegexLexer): """ For Python source code (version 3.x). .. versionchanged:: 2.5 This is now the default ``PythonLexer``. It is still available as the alias ``Python3Lexer``. """ name = 'Python' url = 'https://www.python.org' aliases = ['python', 'py', 'sage', 'python3', 'py3', 'bazel', 'starlark', 'pyi'] filenames = [ '*.py', '*.pyw', # Type stubs '*.pyi', # Jython '*.jy', # Sage '*.sage', # SCons '*.sc', 'SConstruct', 'SConscript', # Skylark/Starlark (used by Bazel, Buck, and Pants) '*.bzl', 'BUCK', 'BUILD', 'BUILD.bazel', 'WORKSPACE', # Twisted Application infrastructure '*.tac', ] mimetypes = ['text/x-python', 'application/x-python', 'text/x-python3', 'application/x-python3'] version_added = '0.10' uni_name = f"[{uni.xid_start}][{uni.xid_continue}]*" def innerstring_rules(ttype): return [ # the old style '%s' % (...) string formatting (still valid in Py3) (r'%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?' '[hlL]?[E-GXc-giorsaux%]', String.Interpol), # the new style '{}'.format(...) string formatting (r'\{' r'((\w+)((\.\w+)|(\[[^\]]+\]))*)?' # field name r'(\![sra])?' # conversion r'(\:(.?[<>=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?' r'\}', String.Interpol), # backslashes, quotes and formatting signs must be parsed one at a time (r'[^\\\'"%{\n]+', ttype), (r'[\'"\\]', ttype), # unhandled string formatting sign (r'%|(\{{1,2})', ttype) # newlines are an error (use "nl" state) ] def fstring_rules(ttype): return [ # Assuming that a '}' is the closing brace after format specifier. # Sadly, this means that we won't detect syntax error. But it's # more important to parse correct syntax correctly, than to # highlight invalid syntax. (r'\}', String.Interpol), (r'\{', String.Interpol, 'expr-inside-fstring'), # backslashes, quotes and formatting signs must be parsed one at a time (r'[^\\\'"{}\n]+', ttype), (r'[\'"\\]', ttype), # newlines are an error (use "nl" state) ] tokens = { 'root': [ (r'\n', Whitespace), (r'^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")', bygroups(Whitespace, String.Affix, String.Doc)), (r"^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')", bygroups(Whitespace, String.Affix, String.Doc)), (r'\A#!.+$', Comment.Hashbang), (r'#.*$', Comment.Single), (r'\\\n', Text), (r'\\', Text), include('keywords'), include('soft-keywords'), (r'(def)((?:\s|\\\s)+)', bygroups(Keyword, Whitespace), 'funcname'), (r'(class)((?:\s|\\\s)+)', bygroups(Keyword, Whitespace), 'classname'), (r'(from)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Whitespace), 'fromimport'), (r'(import)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Whitespace), 'import'), include('expr'), ], 'expr': [ # raw f-strings ('(?i)(rf|fr)(""")', bygroups(String.Affix, String.Double), combined('rfstringescape', 'tdqf')), ("(?i)(rf|fr)(''')", bygroups(String.Affix, String.Single), combined('rfstringescape', 'tsqf')), ('(?i)(rf|fr)(")', bygroups(String.Affix, String.Double), combined('rfstringescape', 'dqf')), ("(?i)(rf|fr)(')", bygroups(String.Affix, String.Single), combined('rfstringescape', 'sqf')), # non-raw f-strings ('([fF])(""")', bygroups(String.Affix, String.Double), combined('fstringescape', 'tdqf')), ("([fF])(''')", bygroups(String.Affix, String.Single), combined('fstringescape', 'tsqf')), ('([fF])(")', bygroups(String.Affix, String.Double), combined('fstringescape', 'dqf')), ("([fF])(')", bygroups(String.Affix, String.Single), combined('fstringescape', 'sqf')), # raw bytes and strings ('(?i)(rb|br|r)(""")', bygroups(String.Affix, String.Double), 'tdqs'), ("(?i)(rb|br|r)(''')", bygroups(String.Affix, String.Single), 'tsqs'), ('(?i)(rb|br|r)(")', bygroups(String.Affix, String.Double), 'dqs'), ("(?i)(rb|br|r)(')", bygroups(String.Affix, String.Single), 'sqs'), # non-raw strings ('([uU]?)(""")', bygroups(String.Affix, String.Double), combined('stringescape', 'tdqs')), ("([uU]?)(''')", bygroups(String.Affix, String.Single), combined('stringescape', 'tsqs')), ('([uU]?)(")', bygroups(String.Affix, String.Double), combined('stringescape', 'dqs')), ("([uU]?)(')", bygroups(String.Affix, String.Single), combined('stringescape', 'sqs')), # non-raw bytes ('([bB])(""")', bygroups(String.Affix, String.Double), combined('bytesescape', 'tdqs')), ("([bB])(''')", bygroups(String.Affix, String.Single), combined('bytesescape', 'tsqs')), ('([bB])(")', bygroups(String.Affix, String.Double), combined('bytesescape', 'dqs')), ("([bB])(')", bygroups(String.Affix, String.Single), combined('bytesescape', 'sqs')), (r'[^\S\n]+', Text), include('numbers'), (r'!=|==|<<|>>|:=|[-~+/*%=<>&^|.]', Operator), (r'[]{}:(),;[]', Punctuation), (r'(in|is|and|or|not)\b', Operator.Word), include('expr-keywords'), include('builtins'), include('magicfuncs'), include('magicvars'), include('name'), ], 'expr-inside-fstring': [ (r'[{([]', Punctuation, 'expr-inside-fstring-inner'), # without format specifier (r'(=\s*)?' # debug (https://bugs.python.org/issue36817) r'(\![sraf])?' # conversion r'\}', String.Interpol, '#pop'), # with format specifier # we'll catch the remaining '}' in the outer scope (r'(=\s*)?' # debug (https://bugs.python.org/issue36817) r'(\![sraf])?' # conversion r':', String.Interpol, '#pop'), (r'\s+', Whitespace), # allow new lines include('expr'), ], 'expr-inside-fstring-inner': [ (r'[{([]', Punctuation, 'expr-inside-fstring-inner'), (r'[])}]', Punctuation, '#pop'), (r'\s+', Whitespace), # allow new lines include('expr'), ], 'expr-keywords': [ # Based on https://docs.python.org/3/reference/expressions.html (words(( 'async for', 'await', 'else', 'for', 'if', 'lambda', 'yield', 'yield from'), suffix=r'\b'), Keyword), (words(('True', 'False', 'None'), suffix=r'\b'), Keyword.Constant), ], 'keywords': [ (words(( 'assert', 'async', 'await', 'break', 'continue', 'del', 'elif', 'else', 'except', 'finally', 'for', 'global', 'if', 'lambda', 'pass', 'raise', 'nonlocal', 'return', 'try', 'while', 'yield', 'yield from', 'as', 'with'), suffix=r'\b'), Keyword), (words(('True', 'False', 'None'), suffix=r'\b'), Keyword.Constant), ], 'soft-keywords': [ # `match`, `case` and `_` soft keywords (r'(^[ \t]*)' # at beginning of line + possible indentation r'(match|case)\b' # a possible keyword r'(?![ \t]*(?:' # not followed by... r'[:,;=^&|@~)\]}]|(?:' + # characters and keywords that mean this isn't # pattern matching (but None/True/False is ok) r'|'.join(k for k in keyword.kwlist if k[0].islower()) + r')\b))', bygroups(Text, Keyword), 'soft-keywords-inner'), ], 'soft-keywords-inner': [ # optional `_` keyword (r'(\s+)([^\n_]*)(_\b)', bygroups(Whitespace, using(this), Keyword)), default('#pop') ], 'builtins': [ (words(( '__import__', 'abs', 'aiter', 'all', 'any', 'bin', 'bool', 'bytearray', 'breakpoint', 'bytes', 'callable', 'chr', 'classmethod', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip'), prefix=r'(?>|[-~+/*%=<>&^|.]', Operator), include('keywords'), (r'(def)((?:\s|\\\s)+)', bygroups(Keyword, Whitespace), 'funcname'), (r'(class)((?:\s|\\\s)+)', bygroups(Keyword, Whitespace), 'classname'), (r'(from)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Whitespace), 'fromimport'), (r'(import)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Whitespace), 'import'), include('builtins'), include('magicfuncs'), include('magicvars'), include('backtick'), ('([rR]|[uUbB][rR]|[rR][uUbB])(""")', bygroups(String.Affix, String.Double), 'tdqs'), ("([rR]|[uUbB][rR]|[rR][uUbB])(''')", bygroups(String.Affix, String.Single), 'tsqs'), ('([rR]|[uUbB][rR]|[rR][uUbB])(")', bygroups(String.Affix, String.Double), 'dqs'), ("([rR]|[uUbB][rR]|[rR][uUbB])(')", bygroups(String.Affix, String.Single), 'sqs'), ('([uUbB]?)(""")', bygroups(String.Affix, String.Double), combined('stringescape', 'tdqs')), ("([uUbB]?)(''')", bygroups(String.Affix, String.Single), combined('stringescape', 'tsqs')), ('([uUbB]?)(")', bygroups(String.Affix, String.Double), combined('stringescape', 'dqs')), ("([uUbB]?)(')", bygroups(String.Affix, String.Single), combined('stringescape', 'sqs')), include('name'), include('numbers'), ], 'keywords': [ (words(( 'assert', 'break', 'continue', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'global', 'if', 'lambda', 'pass', 'print', 'raise', 'return', 'try', 'while', 'yield', 'yield from', 'as', 'with'), suffix=r'\b'), Keyword), ], 'builtins': [ (words(( '__import__', 'abs', 'all', 'any', 'apply', 'basestring', 'bin', 'bool', 'buffer', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'cmp', 'coerce', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'hex', 'id', 'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter', 'len', 'list', 'locals', 'long', 'map', 'max', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'property', 'range', 'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip'), prefix=r'(?>> )(.*\n)', bygroups(Generic.Prompt, Other.Code), 'continuations'), # This happens, e.g., when tracebacks are embedded in documentation; # trailing whitespaces are often stripped in such contexts. (r'(>>>)(\n)', bygroups(Generic.Prompt, Whitespace)), (r'(\^C)?Traceback \(most recent call last\):\n', Other.Traceback, 'traceback'), # SyntaxError starts with this (r' File "[^"]+", line \d+', Other.Traceback, 'traceback'), (r'.*\n', Generic.Output), ], 'continuations': [ (r'(\.\.\. )(.*\n)', bygroups(Generic.Prompt, Other.Code)), # See above. (r'(\.\.\.)(\n)', bygroups(Generic.Prompt, Whitespace)), default('#pop'), ], 'traceback': [ # As soon as we see a traceback, consume everything until the next # >>> prompt. (r'(?=>>>( |$))', Text, '#pop'), (r'(KeyboardInterrupt)(\n)', bygroups(Name.Class, Whitespace)), (r'.*\n', Other.Traceback), ], } class PythonConsoleLexer(DelegatingLexer): """ For Python console output or doctests, such as: .. sourcecode:: pycon >>> a = 'foo' >>> print(a) foo >>> 1 / 0 Traceback (most recent call last): File "", line 1, in ZeroDivisionError: integer division or modulo by zero Additional options: `python3` Use Python 3 lexer for code. Default is ``True``. .. versionadded:: 1.0 .. versionchanged:: 2.5 Now defaults to ``True``. """ name = 'Python console session' aliases = ['pycon', 'python-console'] mimetypes = ['text/x-python-doctest'] url = 'https://python.org' version_added = '' def __init__(self, **options): python3 = get_bool_opt(options, 'python3', True) if python3: pylexer = PythonLexer tblexer = PythonTracebackLexer else: pylexer = Python2Lexer tblexer = Python2TracebackLexer # We have two auxiliary lexers. Use DelegatingLexer twice with # different tokens. TODO: DelegatingLexer should support this # directly, by accepting a tuplet of auxiliary lexers and a tuple of # distinguishing tokens. Then we wouldn't need this intermediary # class. class _ReplaceInnerCode(DelegatingLexer): def __init__(self, **options): super().__init__(pylexer, _PythonConsoleLexerBase, Other.Code, **options) super().__init__(tblexer, _ReplaceInnerCode, Other.Traceback, **options) class PythonTracebackLexer(RegexLexer): """ For Python 3.x tracebacks, with support for chained exceptions. .. versionchanged:: 2.5 This is now the default ``PythonTracebackLexer``. It is still available as the alias ``Python3TracebackLexer``. """ name = 'Python Traceback' aliases = ['pytb', 'py3tb'] filenames = ['*.pytb', '*.py3tb'] mimetypes = ['text/x-python-traceback', 'text/x-python3-traceback'] url = 'https://python.org' version_added = '1.0' tokens = { 'root': [ (r'\n', Whitespace), (r'^(\^C)?Traceback \(most recent call last\):\n', Generic.Traceback, 'intb'), (r'^During handling of the above exception, another ' r'exception occurred:\n\n', Generic.Traceback), (r'^The above exception was the direct cause of the ' r'following exception:\n\n', Generic.Traceback), (r'^(?= File "[^"]+", line \d+)', Generic.Traceback, 'intb'), (r'^.*\n', Other), ], 'intb': [ (r'^( File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)', bygroups(Text, Name.Builtin, Text, Number, Text, Name, Whitespace)), (r'^( File )("[^"]+")(, line )(\d+)(\n)', bygroups(Text, Name.Builtin, Text, Number, Whitespace)), (r'^( )(.+)(\n)', bygroups(Whitespace, using(PythonLexer), Whitespace), 'markers'), (r'^([ \t]*)(\.\.\.)(\n)', bygroups(Whitespace, Comment, Whitespace)), # for doctests... (r'^([^:]+)(: )(.+)(\n)', bygroups(Generic.Error, Text, Name, Whitespace), '#pop'), (r'^([a-zA-Z_][\w.]*)(:?\n)', bygroups(Generic.Error, Whitespace), '#pop'), default('#pop'), ], 'markers': [ # Either `PEP 657 ` # error locations in Python 3.11+, or single-caret markers # for syntax errors before that. (r'^( {4,})([~^]+)(\n)', bygroups(Whitespace, Punctuation.Marker, Whitespace), '#pop'), default('#pop'), ], } Python3TracebackLexer = PythonTracebackLexer class Python2TracebackLexer(RegexLexer): """ For Python tracebacks. .. versionchanged:: 2.5 This class has been renamed from ``PythonTracebackLexer``. ``PythonTracebackLexer`` now refers to the Python 3 variant. """ name = 'Python 2.x Traceback' aliases = ['py2tb'] filenames = ['*.py2tb'] mimetypes = ['text/x-python2-traceback'] url = 'https://python.org' version_added = '0.7' tokens = { 'root': [ # Cover both (most recent call last) and (innermost last) # The optional ^C allows us to catch keyboard interrupt signals. (r'^(\^C)?(Traceback.*\n)', bygroups(Text, Generic.Traceback), 'intb'), # SyntaxError starts with this. (r'^(?= File "[^"]+", line \d+)', Generic.Traceback, 'intb'), (r'^.*\n', Other), ], 'intb': [ (r'^( File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)', bygroups(Text, Name.Builtin, Text, Number, Text, Name, Whitespace)), (r'^( File )("[^"]+")(, line )(\d+)(\n)', bygroups(Text, Name.Builtin, Text, Number, Whitespace)), (r'^( )(.+)(\n)', bygroups(Text, using(Python2Lexer), Whitespace), 'marker'), (r'^([ \t]*)(\.\.\.)(\n)', bygroups(Text, Comment, Whitespace)), # for doctests... (r'^([^:]+)(: )(.+)(\n)', bygroups(Generic.Error, Text, Name, Whitespace), '#pop'), (r'^([a-zA-Z_]\w*)(:?\n)', bygroups(Generic.Error, Whitespace), '#pop') ], 'marker': [ # For syntax errors. (r'( {4,})(\^)', bygroups(Text, Punctuation.Marker), '#pop'), default('#pop'), ], } class CythonLexer(RegexLexer): """ For Pyrex and Cython source code. """ name = 'Cython' url = 'https://cython.org' aliases = ['cython', 'pyx', 'pyrex'] filenames = ['*.pyx', '*.pxd', '*.pxi'] mimetypes = ['text/x-cython', 'application/x-cython'] version_added = '1.1' tokens = { 'root': [ (r'\n', Whitespace), (r'^(\s*)("""(?:.|\n)*?""")', bygroups(Whitespace, String.Doc)), (r"^(\s*)('''(?:.|\n)*?''')", bygroups(Whitespace, String.Doc)), (r'[^\S\n]+', Text), (r'#.*$', Comment), (r'[]{}:(),;[]', Punctuation), (r'\\\n', Whitespace), (r'\\', Text), (r'(in|is|and|or|not)\b', Operator.Word), (r'(<)([a-zA-Z0-9.?]+)(>)', bygroups(Punctuation, Keyword.Type, Punctuation)), (r'!=|==|<<|>>|[-~+/*%=<>&^|.?]', Operator), (r'(from)(\d+)(<=)(\s+)(<)(\d+)(:)', bygroups(Keyword, Number.Integer, Operator, Whitespace, Operator, Name, Punctuation)), include('keywords'), (r'(def|property)(\s+)', bygroups(Keyword, Whitespace), 'funcname'), (r'(cp?def)(\s+)', bygroups(Keyword, Whitespace), 'cdef'), # (should actually start a block with only cdefs) (r'(cdef)(:)', bygroups(Keyword, Punctuation)), (r'(class|struct)(\s+)', bygroups(Keyword, Whitespace), 'classname'), (r'(from)(\s+)', bygroups(Keyword, Whitespace), 'fromimport'), (r'(c?import)(\s+)', bygroups(Keyword, Whitespace), 'import'), include('builtins'), include('backtick'), ('(?:[rR]|[uU][rR]|[rR][uU])"""', String, 'tdqs'), ("(?:[rR]|[uU][rR]|[rR][uU])'''", String, 'tsqs'), ('(?:[rR]|[uU][rR]|[rR][uU])"', String, 'dqs'), ("(?:[rR]|[uU][rR]|[rR][uU])'", String, 'sqs'), ('[uU]?"""', String, combined('stringescape', 'tdqs')), ("[uU]?'''", String, combined('stringescape', 'tsqs')), ('[uU]?"', String, combined('stringescape', 'dqs')), ("[uU]?'", String, combined('stringescape', 'sqs')), include('name'), include('numbers'), ], 'keywords': [ (words(( 'assert', 'async', 'await', 'break', 'by', 'continue', 'ctypedef', 'del', 'elif', 'else', 'except', 'except?', 'exec', 'finally', 'for', 'fused', 'gil', 'global', 'if', 'include', 'lambda', 'nogil', 'pass', 'print', 'raise', 'return', 'try', 'while', 'yield', 'as', 'with'), suffix=r'\b'), Keyword), (r'(DEF|IF|ELIF|ELSE)\b', Comment.Preproc), ], 'builtins': [ (words(( '__import__', 'abs', 'all', 'any', 'apply', 'basestring', 'bin', 'bint', 'bool', 'buffer', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'cmp', 'coerce', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'hex', 'id', 'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter', 'len', 'list', 'locals', 'long', 'map', 'max', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'property', 'Py_ssize_t', 'range', 'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'unsigned', 'vars', 'xrange', 'zip'), prefix=r'(?]? \d* )? : .* (?: ft | filetype | syn | syntax ) = ( [^:\s]+ ) ''', re.VERBOSE) def get_filetype_from_line(l): # noqa: E741 m = modeline_re.search(l) if m: return m.group(1) def get_filetype_from_buffer(buf, max_lines=5): """ Scan the buffer for modelines and return filetype if one is found. """ lines = buf.splitlines() for line in lines[-1:-max_lines-1:-1]: ret = get_filetype_from_line(line) if ret: return ret for i in range(max_lines, -1, -1): if i < len(lines): ret = get_filetype_from_line(lines[i]) if ret: return ret return None ================================================ FILE: src/pip/_vendor/pygments/plugin.py ================================================ """ pygments.plugin ~~~~~~~~~~~~~~~ Pygments plugin interface. lexer plugins:: [pygments.lexers] yourlexer = yourmodule:YourLexer formatter plugins:: [pygments.formatters] yourformatter = yourformatter:YourFormatter /.ext = yourformatter:YourFormatter As you can see, you can define extensions for the formatter with a leading slash. syntax plugins:: [pygments.styles] yourstyle = yourstyle:YourStyle filter plugin:: [pygments.filter] yourfilter = yourfilter:YourFilter :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from importlib.metadata import entry_points LEXER_ENTRY_POINT = 'pygments.lexers' FORMATTER_ENTRY_POINT = 'pygments.formatters' STYLE_ENTRY_POINT = 'pygments.styles' FILTER_ENTRY_POINT = 'pygments.filters' def iter_entry_points(group_name): groups = entry_points() if hasattr(groups, 'select'): # New interface in Python 3.10 and newer versions of the # importlib_metadata backport. return groups.select(group=group_name) else: # Older interface, deprecated in Python 3.10 and recent # importlib_metadata, but we need it in Python 3.8 and 3.9. return groups.get(group_name, []) def find_plugin_lexers(): for entrypoint in iter_entry_points(LEXER_ENTRY_POINT): yield entrypoint.load() def find_plugin_formatters(): for entrypoint in iter_entry_points(FORMATTER_ENTRY_POINT): yield entrypoint.name, entrypoint.load() def find_plugin_styles(): for entrypoint in iter_entry_points(STYLE_ENTRY_POINT): yield entrypoint.name, entrypoint.load() def find_plugin_filters(): for entrypoint in iter_entry_points(FILTER_ENTRY_POINT): yield entrypoint.name, entrypoint.load() ================================================ FILE: src/pip/_vendor/pygments/regexopt.py ================================================ """ pygments.regexopt ~~~~~~~~~~~~~~~~~ An algorithm that generates optimized regexes for matching long lists of literal strings. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from re import escape from os.path import commonprefix from itertools import groupby from operator import itemgetter CS_ESCAPE = re.compile(r'[\[\^\\\-\]]') FIRST_ELEMENT = itemgetter(0) def make_charset(letters): return '[' + CS_ESCAPE.sub(lambda m: '\\' + m.group(), ''.join(letters)) + ']' def regex_opt_inner(strings, open_paren): """Return a regex that matches any string in the sorted list of strings.""" close_paren = open_paren and ')' or '' # print strings, repr(open_paren) if not strings: # print '-> nothing left' return '' first = strings[0] if len(strings) == 1: # print '-> only 1 string' return open_paren + escape(first) + close_paren if not first: # print '-> first string empty' return open_paren + regex_opt_inner(strings[1:], '(?:') \ + '?' + close_paren if len(first) == 1: # multiple one-char strings? make a charset oneletter = [] rest = [] for s in strings: if len(s) == 1: oneletter.append(s) else: rest.append(s) if len(oneletter) > 1: # do we have more than one oneletter string? if rest: # print '-> 1-character + rest' return open_paren + regex_opt_inner(rest, '') + '|' \ + make_charset(oneletter) + close_paren # print '-> only 1-character' return open_paren + make_charset(oneletter) + close_paren prefix = commonprefix(strings) if prefix: plen = len(prefix) # we have a prefix for all strings # print '-> prefix:', prefix return open_paren + escape(prefix) \ + regex_opt_inner([s[plen:] for s in strings], '(?:') \ + close_paren # is there a suffix? strings_rev = [s[::-1] for s in strings] suffix = commonprefix(strings_rev) if suffix: slen = len(suffix) # print '-> suffix:', suffix[::-1] return open_paren \ + regex_opt_inner(sorted(s[:-slen] for s in strings), '(?:') \ + escape(suffix[::-1]) + close_paren # recurse on common 1-string prefixes # print '-> last resort' return open_paren + \ '|'.join(regex_opt_inner(list(group[1]), '') for group in groupby(strings, lambda s: s[0] == first[0])) \ + close_paren def regex_opt(strings, prefix='', suffix=''): """Return a compiled regex that matches any string in the given list. The strings to match must be literal strings, not regexes. They will be regex-escaped. *prefix* and *suffix* are pre- and appended to the final regex. """ strings = sorted(strings) return prefix + regex_opt_inner(strings, '(') + suffix ================================================ FILE: src/pip/_vendor/pygments/scanner.py ================================================ """ pygments.scanner ~~~~~~~~~~~~~~~~ This library implements a regex based scanner. Some languages like Pascal are easy to parse but have some keywords that depend on the context. Because of this it's impossible to lex that just by using a regular expression lexer like the `RegexLexer`. Have a look at the `DelphiLexer` to get an idea of how to use this scanner. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re class EndOfText(RuntimeError): """ Raise if end of text is reached and the user tried to call a match function. """ class Scanner: """ Simple scanner All method patterns are regular expression strings (not compiled expressions!) """ def __init__(self, text, flags=0): """ :param text: The text which should be scanned :param flags: default regular expression flags """ self.data = text self.data_length = len(text) self.start_pos = 0 self.pos = 0 self.flags = flags self.last = None self.match = None self._re_cache = {} def eos(self): """`True` if the scanner reached the end of text.""" return self.pos >= self.data_length eos = property(eos, eos.__doc__) def check(self, pattern): """ Apply `pattern` on the current position and return the match object. (Doesn't touch pos). Use this for lookahead. """ if self.eos: raise EndOfText() if pattern not in self._re_cache: self._re_cache[pattern] = re.compile(pattern, self.flags) return self._re_cache[pattern].match(self.data, self.pos) def test(self, pattern): """Apply a pattern on the current position and check if it patches. Doesn't touch pos. """ return self.check(pattern) is not None def scan(self, pattern): """ Scan the text for the given pattern and update pos/match and related fields. The return value is a boolean that indicates if the pattern matched. The matched value is stored on the instance as ``match``, the last value is stored as ``last``. ``start_pos`` is the position of the pointer before the pattern was matched, ``pos`` is the end position. """ if self.eos: raise EndOfText() if pattern not in self._re_cache: self._re_cache[pattern] = re.compile(pattern, self.flags) self.last = self.match m = self._re_cache[pattern].match(self.data, self.pos) if m is None: return False self.start_pos = m.start() self.pos = m.end() self.match = m.group() return True def get_char(self): """Scan exactly one char.""" self.scan('.') def __repr__(self): return '<%s %d/%d>' % ( self.__class__.__name__, self.pos, self.data_length ) ================================================ FILE: src/pip/_vendor/pygments/sphinxext.py ================================================ """ pygments.sphinxext ~~~~~~~~~~~~~~~~~~ Sphinx extension to generate automatic documentation of lexers, formatters and filters. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import sys from docutils import nodes from docutils.statemachine import ViewList from docutils.parsers.rst import Directive from sphinx.util.nodes import nested_parse_with_titles MODULEDOC = ''' .. module:: %s %s %s ''' LEXERDOC = ''' .. class:: %s :Short names: %s :Filenames: %s :MIME types: %s %s %s ''' FMTERDOC = ''' .. class:: %s :Short names: %s :Filenames: %s %s ''' FILTERDOC = ''' .. class:: %s :Name: %s %s ''' class PygmentsDoc(Directive): """ A directive to collect all lexers/formatters/filters and generate autoclass directives for them. """ has_content = False required_arguments = 1 optional_arguments = 0 final_argument_whitespace = False option_spec = {} def run(self): self.filenames = set() if self.arguments[0] == 'lexers': out = self.document_lexers() elif self.arguments[0] == 'formatters': out = self.document_formatters() elif self.arguments[0] == 'filters': out = self.document_filters() elif self.arguments[0] == 'lexers_overview': out = self.document_lexers_overview() else: raise Exception('invalid argument for "pygmentsdoc" directive') node = nodes.compound() vl = ViewList(out.split('\n'), source='') nested_parse_with_titles(self.state, vl, node) for fn in self.filenames: self.state.document.settings.record_dependencies.add(fn) return node.children def document_lexers_overview(self): """Generate a tabular overview of all lexers. The columns are the lexer name, the extensions handled by this lexer (or "None"), the aliases and a link to the lexer class.""" from pip._vendor.pygments.lexers._mapping import LEXERS from pip._vendor.pygments.lexers import find_lexer_class out = [] table = [] def format_link(name, url): if url: return f'`{name} <{url}>`_' return name for classname, data in sorted(LEXERS.items(), key=lambda x: x[1][1].lower()): lexer_cls = find_lexer_class(data[1]) extensions = lexer_cls.filenames + lexer_cls.alias_filenames table.append({ 'name': format_link(data[1], lexer_cls.url), 'extensions': ', '.join(extensions).replace('*', '\\*').replace('_', '\\') or 'None', 'aliases': ', '.join(data[2]), 'class': f'{data[0]}.{classname}' }) column_names = ['name', 'extensions', 'aliases', 'class'] column_lengths = [max([len(row[column]) for row in table if row[column]]) for column in column_names] def write_row(*columns): """Format a table row""" out = [] for length, col in zip(column_lengths, columns): if col: out.append(col.ljust(length)) else: out.append(' '*length) return ' '.join(out) def write_seperator(): """Write a table separator row""" sep = ['='*c for c in column_lengths] return write_row(*sep) out.append(write_seperator()) out.append(write_row('Name', 'Extension(s)', 'Short name(s)', 'Lexer class')) out.append(write_seperator()) for row in table: out.append(write_row( row['name'], row['extensions'], row['aliases'], f':class:`~{row["class"]}`')) out.append(write_seperator()) return '\n'.join(out) def document_lexers(self): from pip._vendor.pygments.lexers._mapping import LEXERS from pip._vendor import pygments import inspect import pathlib out = [] modules = {} moduledocstrings = {} for classname, data in sorted(LEXERS.items(), key=lambda x: x[0]): module = data[0] mod = __import__(module, None, None, [classname]) self.filenames.add(mod.__file__) cls = getattr(mod, classname) if not cls.__doc__: print(f"Warning: {classname} does not have a docstring.") docstring = cls.__doc__ if isinstance(docstring, bytes): docstring = docstring.decode('utf8') example_file = getattr(cls, '_example', None) if example_file: p = pathlib.Path(inspect.getabsfile(pygments)).parent.parent /\ 'tests' / 'examplefiles' / example_file content = p.read_text(encoding='utf-8') if not content: raise Exception( f"Empty example file '{example_file}' for lexer " f"{classname}") if data[2]: lexer_name = data[2][0] docstring += '\n\n .. admonition:: Example\n' docstring += f'\n .. code-block:: {lexer_name}\n\n' for line in content.splitlines(): docstring += f' {line}\n' if cls.version_added: version_line = f'.. versionadded:: {cls.version_added}' else: version_line = '' modules.setdefault(module, []).append(( classname, ', '.join(data[2]) or 'None', ', '.join(data[3]).replace('*', '\\*').replace('_', '\\') or 'None', ', '.join(data[4]) or 'None', docstring, version_line)) if module not in moduledocstrings: moddoc = mod.__doc__ if isinstance(moddoc, bytes): moddoc = moddoc.decode('utf8') moduledocstrings[module] = moddoc for module, lexers in sorted(modules.items(), key=lambda x: x[0]): if moduledocstrings[module] is None: raise Exception(f"Missing docstring for {module}") heading = moduledocstrings[module].splitlines()[4].strip().rstrip('.') out.append(MODULEDOC % (module, heading, '-'*len(heading))) for data in lexers: out.append(LEXERDOC % data) return ''.join(out) def document_formatters(self): from pip._vendor.pygments.formatters import FORMATTERS out = [] for classname, data in sorted(FORMATTERS.items(), key=lambda x: x[0]): module = data[0] mod = __import__(module, None, None, [classname]) self.filenames.add(mod.__file__) cls = getattr(mod, classname) docstring = cls.__doc__ if isinstance(docstring, bytes): docstring = docstring.decode('utf8') heading = cls.__name__ out.append(FMTERDOC % (heading, ', '.join(data[2]) or 'None', ', '.join(data[3]).replace('*', '\\*') or 'None', docstring)) return ''.join(out) def document_filters(self): from pip._vendor.pygments.filters import FILTERS out = [] for name, cls in FILTERS.items(): self.filenames.add(sys.modules[cls.__module__].__file__) docstring = cls.__doc__ if isinstance(docstring, bytes): docstring = docstring.decode('utf8') out.append(FILTERDOC % (cls.__name__, name, docstring)) return ''.join(out) def setup(app): app.add_directive('pygmentsdoc', PygmentsDoc) ================================================ FILE: src/pip/_vendor/pygments/style.py ================================================ """ pygments.style ~~~~~~~~~~~~~~ Basic style object. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pip._vendor.pygments.token import Token, STANDARD_TYPES # Default mapping of ansixxx to RGB colors. _ansimap = { # dark 'ansiblack': '000000', 'ansired': '7f0000', 'ansigreen': '007f00', 'ansiyellow': '7f7fe0', 'ansiblue': '00007f', 'ansimagenta': '7f007f', 'ansicyan': '007f7f', 'ansigray': 'e5e5e5', # normal 'ansibrightblack': '555555', 'ansibrightred': 'ff0000', 'ansibrightgreen': '00ff00', 'ansibrightyellow': 'ffff00', 'ansibrightblue': '0000ff', 'ansibrightmagenta': 'ff00ff', 'ansibrightcyan': '00ffff', 'ansiwhite': 'ffffff', } # mapping of deprecated #ansixxx colors to new color names _deprecated_ansicolors = { # dark '#ansiblack': 'ansiblack', '#ansidarkred': 'ansired', '#ansidarkgreen': 'ansigreen', '#ansibrown': 'ansiyellow', '#ansidarkblue': 'ansiblue', '#ansipurple': 'ansimagenta', '#ansiteal': 'ansicyan', '#ansilightgray': 'ansigray', # normal '#ansidarkgray': 'ansibrightblack', '#ansired': 'ansibrightred', '#ansigreen': 'ansibrightgreen', '#ansiyellow': 'ansibrightyellow', '#ansiblue': 'ansibrightblue', '#ansifuchsia': 'ansibrightmagenta', '#ansiturquoise': 'ansibrightcyan', '#ansiwhite': 'ansiwhite', } ansicolors = set(_ansimap) class StyleMeta(type): def __new__(mcs, name, bases, dct): obj = type.__new__(mcs, name, bases, dct) for token in STANDARD_TYPES: if token not in obj.styles: obj.styles[token] = '' def colorformat(text): if text in ansicolors: return text if text[0:1] == '#': col = text[1:] if len(col) == 6: return col elif len(col) == 3: return col[0] * 2 + col[1] * 2 + col[2] * 2 elif text == '': return '' elif text.startswith('var') or text.startswith('calc'): return text assert False, f"wrong color format {text!r}" _styles = obj._styles = {} for ttype in obj.styles: for token in ttype.split(): if token in _styles: continue ndef = _styles.get(token.parent, None) styledefs = obj.styles.get(token, '').split() if not ndef or token is None: ndef = ['', 0, 0, 0, '', '', 0, 0, 0] elif 'noinherit' in styledefs and token is not Token: ndef = _styles[Token][:] else: ndef = ndef[:] _styles[token] = ndef for styledef in obj.styles.get(token, '').split(): if styledef == 'noinherit': pass elif styledef == 'bold': ndef[1] = 1 elif styledef == 'nobold': ndef[1] = 0 elif styledef == 'italic': ndef[2] = 1 elif styledef == 'noitalic': ndef[2] = 0 elif styledef == 'underline': ndef[3] = 1 elif styledef == 'nounderline': ndef[3] = 0 elif styledef[:3] == 'bg:': ndef[4] = colorformat(styledef[3:]) elif styledef[:7] == 'border:': ndef[5] = colorformat(styledef[7:]) elif styledef == 'roman': ndef[6] = 1 elif styledef == 'sans': ndef[7] = 1 elif styledef == 'mono': ndef[8] = 1 else: ndef[0] = colorformat(styledef) return obj def style_for_token(cls, token): t = cls._styles[token] ansicolor = bgansicolor = None color = t[0] if color in _deprecated_ansicolors: color = _deprecated_ansicolors[color] if color in ansicolors: ansicolor = color color = _ansimap[color] bgcolor = t[4] if bgcolor in _deprecated_ansicolors: bgcolor = _deprecated_ansicolors[bgcolor] if bgcolor in ansicolors: bgansicolor = bgcolor bgcolor = _ansimap[bgcolor] return { 'color': color or None, 'bold': bool(t[1]), 'italic': bool(t[2]), 'underline': bool(t[3]), 'bgcolor': bgcolor or None, 'border': t[5] or None, 'roman': bool(t[6]) or None, 'sans': bool(t[7]) or None, 'mono': bool(t[8]) or None, 'ansicolor': ansicolor, 'bgansicolor': bgansicolor, } def list_styles(cls): return list(cls) def styles_token(cls, ttype): return ttype in cls._styles def __iter__(cls): for token in cls._styles: yield token, cls.style_for_token(token) def __len__(cls): return len(cls._styles) class Style(metaclass=StyleMeta): #: overall background color (``None`` means transparent) background_color = '#ffffff' #: highlight background color highlight_color = '#ffffcc' #: line number font color line_number_color = 'inherit' #: line number background color line_number_background_color = 'transparent' #: special line number font color line_number_special_color = '#000000' #: special line number background color line_number_special_background_color = '#ffffc0' #: Style definitions for individual token types. styles = {} #: user-friendly style name (used when selecting the style, so this # should be all-lowercase, no spaces, hyphens) name = 'unnamed' aliases = [] # Attribute for lexers defined within Pygments. If set # to True, the style is not shown in the style gallery # on the website. This is intended for language-specific # styles. web_style_gallery_exclude = False ================================================ FILE: src/pip/_vendor/pygments/styles/__init__.py ================================================ """ pygments.styles ~~~~~~~~~~~~~~~ Contains built-in styles. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pip._vendor.pygments.plugin import find_plugin_styles from pip._vendor.pygments.util import ClassNotFound from pip._vendor.pygments.styles._mapping import STYLES #: A dictionary of built-in styles, mapping style names to #: ``'submodule::classname'`` strings. #: This list is deprecated. Use `pygments.styles.STYLES` instead STYLE_MAP = {v[1]: v[0].split('.')[-1] + '::' + k for k, v in STYLES.items()} #: Internal reverse mapping to make `get_style_by_name` more efficient _STYLE_NAME_TO_MODULE_MAP = {v[1]: (v[0], k) for k, v in STYLES.items()} def get_style_by_name(name): """ Return a style class by its short name. The names of the builtin styles are listed in :data:`pygments.styles.STYLE_MAP`. Will raise :exc:`pygments.util.ClassNotFound` if no style of that name is found. """ if name in _STYLE_NAME_TO_MODULE_MAP: mod, cls = _STYLE_NAME_TO_MODULE_MAP[name] builtin = "yes" else: for found_name, style in find_plugin_styles(): if name == found_name: return style # perhaps it got dropped into our styles package builtin = "" mod = 'pygments.styles.' + name cls = name.title() + "Style" try: mod = __import__(mod, None, None, [cls]) except ImportError: raise ClassNotFound(f"Could not find style module {mod!r}" + (builtin and ", though it should be builtin") + ".") try: return getattr(mod, cls) except AttributeError: raise ClassNotFound(f"Could not find style class {cls!r} in style module.") def get_all_styles(): """Return a generator for all styles by name, both builtin and plugin.""" for v in STYLES.values(): yield v[1] for name, _ in find_plugin_styles(): yield name ================================================ FILE: src/pip/_vendor/pygments/styles/_mapping.py ================================================ # Automatically generated by scripts/gen_mapfiles.py. # DO NOT EDIT BY HAND; run `tox -e mapfiles` instead. STYLES = { 'AbapStyle': ('pygments.styles.abap', 'abap', ()), 'AlgolStyle': ('pygments.styles.algol', 'algol', ()), 'Algol_NuStyle': ('pygments.styles.algol_nu', 'algol_nu', ()), 'ArduinoStyle': ('pygments.styles.arduino', 'arduino', ()), 'AutumnStyle': ('pygments.styles.autumn', 'autumn', ()), 'BlackWhiteStyle': ('pygments.styles.bw', 'bw', ()), 'BorlandStyle': ('pygments.styles.borland', 'borland', ()), 'CoffeeStyle': ('pygments.styles.coffee', 'coffee', ()), 'ColorfulStyle': ('pygments.styles.colorful', 'colorful', ()), 'DefaultStyle': ('pygments.styles.default', 'default', ()), 'DraculaStyle': ('pygments.styles.dracula', 'dracula', ()), 'EmacsStyle': ('pygments.styles.emacs', 'emacs', ()), 'FriendlyGrayscaleStyle': ('pygments.styles.friendly_grayscale', 'friendly_grayscale', ()), 'FriendlyStyle': ('pygments.styles.friendly', 'friendly', ()), 'FruityStyle': ('pygments.styles.fruity', 'fruity', ()), 'GhDarkStyle': ('pygments.styles.gh_dark', 'github-dark', ()), 'GruvboxDarkStyle': ('pygments.styles.gruvbox', 'gruvbox-dark', ()), 'GruvboxLightStyle': ('pygments.styles.gruvbox', 'gruvbox-light', ()), 'IgorStyle': ('pygments.styles.igor', 'igor', ()), 'InkPotStyle': ('pygments.styles.inkpot', 'inkpot', ()), 'LightbulbStyle': ('pygments.styles.lightbulb', 'lightbulb', ()), 'LilyPondStyle': ('pygments.styles.lilypond', 'lilypond', ()), 'LovelaceStyle': ('pygments.styles.lovelace', 'lovelace', ()), 'ManniStyle': ('pygments.styles.manni', 'manni', ()), 'MaterialStyle': ('pygments.styles.material', 'material', ()), 'MonokaiStyle': ('pygments.styles.monokai', 'monokai', ()), 'MurphyStyle': ('pygments.styles.murphy', 'murphy', ()), 'NativeStyle': ('pygments.styles.native', 'native', ()), 'NordDarkerStyle': ('pygments.styles.nord', 'nord-darker', ()), 'NordStyle': ('pygments.styles.nord', 'nord', ()), 'OneDarkStyle': ('pygments.styles.onedark', 'one-dark', ()), 'ParaisoDarkStyle': ('pygments.styles.paraiso_dark', 'paraiso-dark', ()), 'ParaisoLightStyle': ('pygments.styles.paraiso_light', 'paraiso-light', ()), 'PastieStyle': ('pygments.styles.pastie', 'pastie', ()), 'PerldocStyle': ('pygments.styles.perldoc', 'perldoc', ()), 'RainbowDashStyle': ('pygments.styles.rainbow_dash', 'rainbow_dash', ()), 'RrtStyle': ('pygments.styles.rrt', 'rrt', ()), 'SasStyle': ('pygments.styles.sas', 'sas', ()), 'SolarizedDarkStyle': ('pygments.styles.solarized', 'solarized-dark', ()), 'SolarizedLightStyle': ('pygments.styles.solarized', 'solarized-light', ()), 'StarofficeStyle': ('pygments.styles.staroffice', 'staroffice', ()), 'StataDarkStyle': ('pygments.styles.stata_dark', 'stata-dark', ()), 'StataLightStyle': ('pygments.styles.stata_light', 'stata-light', ()), 'TangoStyle': ('pygments.styles.tango', 'tango', ()), 'TracStyle': ('pygments.styles.trac', 'trac', ()), 'VimStyle': ('pygments.styles.vim', 'vim', ()), 'VisualStudioStyle': ('pygments.styles.vs', 'vs', ()), 'XcodeStyle': ('pygments.styles.xcode', 'xcode', ()), 'ZenburnStyle': ('pygments.styles.zenburn', 'zenburn', ()), } ================================================ FILE: src/pip/_vendor/pygments/token.py ================================================ """ pygments.token ~~~~~~~~~~~~~~ Basic token types and the standard tokens. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ class _TokenType(tuple): parent = None def split(self): buf = [] node = self while node is not None: buf.append(node) node = node.parent buf.reverse() return buf def __init__(self, *args): # no need to call super.__init__ self.subtypes = set() def __contains__(self, val): return self is val or ( type(val) is self.__class__ and val[:len(self)] == self ) def __getattr__(self, val): if not val or not val[0].isupper(): return tuple.__getattribute__(self, val) new = _TokenType(self + (val,)) setattr(self, val, new) self.subtypes.add(new) new.parent = self return new def __repr__(self): return 'Token' + (self and '.' or '') + '.'.join(self) def __copy__(self): # These instances are supposed to be singletons return self def __deepcopy__(self, memo): # These instances are supposed to be singletons return self Token = _TokenType() # Special token types Text = Token.Text Whitespace = Text.Whitespace Escape = Token.Escape Error = Token.Error # Text that doesn't belong to this lexer (e.g. HTML in PHP) Other = Token.Other # Common token types for source code Keyword = Token.Keyword Name = Token.Name Literal = Token.Literal String = Literal.String Number = Literal.Number Punctuation = Token.Punctuation Operator = Token.Operator Comment = Token.Comment # Generic types for non-source code Generic = Token.Generic # String and some others are not direct children of Token. # alias them: Token.Token = Token Token.String = String Token.Number = Number def is_token_subtype(ttype, other): """ Return True if ``ttype`` is a subtype of ``other``. exists for backwards compatibility. use ``ttype in other`` now. """ return ttype in other def string_to_tokentype(s): """ Convert a string into a token type:: >>> string_to_token('String.Double') Token.Literal.String.Double >>> string_to_token('Token.Literal.Number') Token.Literal.Number >>> string_to_token('') Token Tokens that are already tokens are returned unchanged: >>> string_to_token(String) Token.Literal.String """ if isinstance(s, _TokenType): return s if not s: return Token node = Token for item in s.split('.'): node = getattr(node, item) return node # Map standard token types to short names, used in CSS class naming. # If you add a new item, please be sure to run this file to perform # a consistency check for duplicate values. STANDARD_TYPES = { Token: '', Text: '', Whitespace: 'w', Escape: 'esc', Error: 'err', Other: 'x', Keyword: 'k', Keyword.Constant: 'kc', Keyword.Declaration: 'kd', Keyword.Namespace: 'kn', Keyword.Pseudo: 'kp', Keyword.Reserved: 'kr', Keyword.Type: 'kt', Name: 'n', Name.Attribute: 'na', Name.Builtin: 'nb', Name.Builtin.Pseudo: 'bp', Name.Class: 'nc', Name.Constant: 'no', Name.Decorator: 'nd', Name.Entity: 'ni', Name.Exception: 'ne', Name.Function: 'nf', Name.Function.Magic: 'fm', Name.Property: 'py', Name.Label: 'nl', Name.Namespace: 'nn', Name.Other: 'nx', Name.Tag: 'nt', Name.Variable: 'nv', Name.Variable.Class: 'vc', Name.Variable.Global: 'vg', Name.Variable.Instance: 'vi', Name.Variable.Magic: 'vm', Literal: 'l', Literal.Date: 'ld', String: 's', String.Affix: 'sa', String.Backtick: 'sb', String.Char: 'sc', String.Delimiter: 'dl', String.Doc: 'sd', String.Double: 's2', String.Escape: 'se', String.Heredoc: 'sh', String.Interpol: 'si', String.Other: 'sx', String.Regex: 'sr', String.Single: 's1', String.Symbol: 'ss', Number: 'm', Number.Bin: 'mb', Number.Float: 'mf', Number.Hex: 'mh', Number.Integer: 'mi', Number.Integer.Long: 'il', Number.Oct: 'mo', Operator: 'o', Operator.Word: 'ow', Punctuation: 'p', Punctuation.Marker: 'pm', Comment: 'c', Comment.Hashbang: 'ch', Comment.Multiline: 'cm', Comment.Preproc: 'cp', Comment.PreprocFile: 'cpf', Comment.Single: 'c1', Comment.Special: 'cs', Generic: 'g', Generic.Deleted: 'gd', Generic.Emph: 'ge', Generic.Error: 'gr', Generic.Heading: 'gh', Generic.Inserted: 'gi', Generic.Output: 'go', Generic.Prompt: 'gp', Generic.Strong: 'gs', Generic.Subheading: 'gu', Generic.EmphStrong: 'ges', Generic.Traceback: 'gt', } ================================================ FILE: src/pip/_vendor/pygments/unistring.py ================================================ """ pygments.unistring ~~~~~~~~~~~~~~~~~~ Strings of all Unicode characters of a certain category. Used for matching in Unicode-aware languages. Run to regenerate. Inspired by chartypes_create.py from the MoinMoin project. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ Cc = '\x00-\x1f\x7f-\x9f' Cf = '\xad\u0600-\u0605\u061c\u06dd\u070f\u08e2\u180e\u200b-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u206f\ufeff\ufff9-\ufffb\U000110bd\U000110cd\U0001bca0-\U0001bca3\U0001d173-\U0001d17a\U000e0001\U000e0020-\U000e007f' Cn = '\u0378-\u0379\u0380-\u0383\u038b\u038d\u03a2\u0530\u0557-\u0558\u058b-\u058c\u0590\u05c8-\u05cf\u05eb-\u05ee\u05f5-\u05ff\u061d\u070e\u074b-\u074c\u07b2-\u07bf\u07fb-\u07fc\u082e-\u082f\u083f\u085c-\u085d\u085f\u086b-\u089f\u08b5\u08be-\u08d2\u0984\u098d-\u098e\u0991-\u0992\u09a9\u09b1\u09b3-\u09b5\u09ba-\u09bb\u09c5-\u09c6\u09c9-\u09ca\u09cf-\u09d6\u09d8-\u09db\u09de\u09e4-\u09e5\u09ff-\u0a00\u0a04\u0a0b-\u0a0e\u0a11-\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a-\u0a3b\u0a3d\u0a43-\u0a46\u0a49-\u0a4a\u0a4e-\u0a50\u0a52-\u0a58\u0a5d\u0a5f-\u0a65\u0a77-\u0a80\u0a84\u0a8e\u0a92\u0aa9\u0ab1\u0ab4\u0aba-\u0abb\u0ac6\u0aca\u0ace-\u0acf\u0ad1-\u0adf\u0ae4-\u0ae5\u0af2-\u0af8\u0b00\u0b04\u0b0d-\u0b0e\u0b11-\u0b12\u0b29\u0b31\u0b34\u0b3a-\u0b3b\u0b45-\u0b46\u0b49-\u0b4a\u0b4e-\u0b55\u0b58-\u0b5b\u0b5e\u0b64-\u0b65\u0b78-\u0b81\u0b84\u0b8b-\u0b8d\u0b91\u0b96-\u0b98\u0b9b\u0b9d\u0ba0-\u0ba2\u0ba5-\u0ba7\u0bab-\u0bad\u0bba-\u0bbd\u0bc3-\u0bc5\u0bc9\u0bce-\u0bcf\u0bd1-\u0bd6\u0bd8-\u0be5\u0bfb-\u0bff\u0c0d\u0c11\u0c29\u0c3a-\u0c3c\u0c45\u0c49\u0c4e-\u0c54\u0c57\u0c5b-\u0c5f\u0c64-\u0c65\u0c70-\u0c77\u0c8d\u0c91\u0ca9\u0cb4\u0cba-\u0cbb\u0cc5\u0cc9\u0cce-\u0cd4\u0cd7-\u0cdd\u0cdf\u0ce4-\u0ce5\u0cf0\u0cf3-\u0cff\u0d04\u0d0d\u0d11\u0d45\u0d49\u0d50-\u0d53\u0d64-\u0d65\u0d80-\u0d81\u0d84\u0d97-\u0d99\u0db2\u0dbc\u0dbe-\u0dbf\u0dc7-\u0dc9\u0dcb-\u0dce\u0dd5\u0dd7\u0de0-\u0de5\u0df0-\u0df1\u0df5-\u0e00\u0e3b-\u0e3e\u0e5c-\u0e80\u0e83\u0e85-\u0e86\u0e89\u0e8b-\u0e8c\u0e8e-\u0e93\u0e98\u0ea0\u0ea4\u0ea6\u0ea8-\u0ea9\u0eac\u0eba\u0ebe-\u0ebf\u0ec5\u0ec7\u0ece-\u0ecf\u0eda-\u0edb\u0ee0-\u0eff\u0f48\u0f6d-\u0f70\u0f98\u0fbd\u0fcd\u0fdb-\u0fff\u10c6\u10c8-\u10cc\u10ce-\u10cf\u1249\u124e-\u124f\u1257\u1259\u125e-\u125f\u1289\u128e-\u128f\u12b1\u12b6-\u12b7\u12bf\u12c1\u12c6-\u12c7\u12d7\u1311\u1316-\u1317\u135b-\u135c\u137d-\u137f\u139a-\u139f\u13f6-\u13f7\u13fe-\u13ff\u169d-\u169f\u16f9-\u16ff\u170d\u1715-\u171f\u1737-\u173f\u1754-\u175f\u176d\u1771\u1774-\u177f\u17de-\u17df\u17ea-\u17ef\u17fa-\u17ff\u180f\u181a-\u181f\u1879-\u187f\u18ab-\u18af\u18f6-\u18ff\u191f\u192c-\u192f\u193c-\u193f\u1941-\u1943\u196e-\u196f\u1975-\u197f\u19ac-\u19af\u19ca-\u19cf\u19db-\u19dd\u1a1c-\u1a1d\u1a5f\u1a7d-\u1a7e\u1a8a-\u1a8f\u1a9a-\u1a9f\u1aae-\u1aaf\u1abf-\u1aff\u1b4c-\u1b4f\u1b7d-\u1b7f\u1bf4-\u1bfb\u1c38-\u1c3a\u1c4a-\u1c4c\u1c89-\u1c8f\u1cbb-\u1cbc\u1cc8-\u1ccf\u1cfa-\u1cff\u1dfa\u1f16-\u1f17\u1f1e-\u1f1f\u1f46-\u1f47\u1f4e-\u1f4f\u1f58\u1f5a\u1f5c\u1f5e\u1f7e-\u1f7f\u1fb5\u1fc5\u1fd4-\u1fd5\u1fdc\u1ff0-\u1ff1\u1ff5\u1fff\u2065\u2072-\u2073\u208f\u209d-\u209f\u20c0-\u20cf\u20f1-\u20ff\u218c-\u218f\u2427-\u243f\u244b-\u245f\u2b74-\u2b75\u2b96-\u2b97\u2bc9\u2bff\u2c2f\u2c5f\u2cf4-\u2cf8\u2d26\u2d28-\u2d2c\u2d2e-\u2d2f\u2d68-\u2d6e\u2d71-\u2d7e\u2d97-\u2d9f\u2da7\u2daf\u2db7\u2dbf\u2dc7\u2dcf\u2dd7\u2ddf\u2e4f-\u2e7f\u2e9a\u2ef4-\u2eff\u2fd6-\u2fef\u2ffc-\u2fff\u3040\u3097-\u3098\u3100-\u3104\u3130\u318f\u31bb-\u31bf\u31e4-\u31ef\u321f\u32ff\u4db6-\u4dbf\u9ff0-\u9fff\ua48d-\ua48f\ua4c7-\ua4cf\ua62c-\ua63f\ua6f8-\ua6ff\ua7ba-\ua7f6\ua82c-\ua82f\ua83a-\ua83f\ua878-\ua87f\ua8c6-\ua8cd\ua8da-\ua8df\ua954-\ua95e\ua97d-\ua97f\ua9ce\ua9da-\ua9dd\ua9ff\uaa37-\uaa3f\uaa4e-\uaa4f\uaa5a-\uaa5b\uaac3-\uaada\uaaf7-\uab00\uab07-\uab08\uab0f-\uab10\uab17-\uab1f\uab27\uab2f\uab66-\uab6f\uabee-\uabef\uabfa-\uabff\ud7a4-\ud7af\ud7c7-\ud7ca\ud7fc-\ud7ff\ufa6e-\ufa6f\ufada-\ufaff\ufb07-\ufb12\ufb18-\ufb1c\ufb37\ufb3d\ufb3f\ufb42\ufb45\ufbc2-\ufbd2\ufd40-\ufd4f\ufd90-\ufd91\ufdc8-\ufdef\ufdfe-\ufdff\ufe1a-\ufe1f\ufe53\ufe67\ufe6c-\ufe6f\ufe75\ufefd-\ufefe\uff00\uffbf-\uffc1\uffc8-\uffc9\uffd0-\uffd1\uffd8-\uffd9\uffdd-\uffdf\uffe7\uffef-\ufff8\ufffe-\uffff\U0001000c\U00010027\U0001003b\U0001003e\U0001004e-\U0001004f\U0001005e-\U0001007f\U000100fb-\U000100ff\U00010103-\U00010106\U00010134-\U00010136\U0001018f\U0001019c-\U0001019f\U000101a1-\U000101cf\U000101fe-\U0001027f\U0001029d-\U0001029f\U000102d1-\U000102df\U000102fc-\U000102ff\U00010324-\U0001032c\U0001034b-\U0001034f\U0001037b-\U0001037f\U0001039e\U000103c4-\U000103c7\U000103d6-\U000103ff\U0001049e-\U0001049f\U000104aa-\U000104af\U000104d4-\U000104d7\U000104fc-\U000104ff\U00010528-\U0001052f\U00010564-\U0001056e\U00010570-\U000105ff\U00010737-\U0001073f\U00010756-\U0001075f\U00010768-\U000107ff\U00010806-\U00010807\U00010809\U00010836\U00010839-\U0001083b\U0001083d-\U0001083e\U00010856\U0001089f-\U000108a6\U000108b0-\U000108df\U000108f3\U000108f6-\U000108fa\U0001091c-\U0001091e\U0001093a-\U0001093e\U00010940-\U0001097f\U000109b8-\U000109bb\U000109d0-\U000109d1\U00010a04\U00010a07-\U00010a0b\U00010a14\U00010a18\U00010a36-\U00010a37\U00010a3b-\U00010a3e\U00010a49-\U00010a4f\U00010a59-\U00010a5f\U00010aa0-\U00010abf\U00010ae7-\U00010aea\U00010af7-\U00010aff\U00010b36-\U00010b38\U00010b56-\U00010b57\U00010b73-\U00010b77\U00010b92-\U00010b98\U00010b9d-\U00010ba8\U00010bb0-\U00010bff\U00010c49-\U00010c7f\U00010cb3-\U00010cbf\U00010cf3-\U00010cf9\U00010d28-\U00010d2f\U00010d3a-\U00010e5f\U00010e7f-\U00010eff\U00010f28-\U00010f2f\U00010f5a-\U00010fff\U0001104e-\U00011051\U00011070-\U0001107e\U000110c2-\U000110cc\U000110ce-\U000110cf\U000110e9-\U000110ef\U000110fa-\U000110ff\U00011135\U00011147-\U0001114f\U00011177-\U0001117f\U000111ce-\U000111cf\U000111e0\U000111f5-\U000111ff\U00011212\U0001123f-\U0001127f\U00011287\U00011289\U0001128e\U0001129e\U000112aa-\U000112af\U000112eb-\U000112ef\U000112fa-\U000112ff\U00011304\U0001130d-\U0001130e\U00011311-\U00011312\U00011329\U00011331\U00011334\U0001133a\U00011345-\U00011346\U00011349-\U0001134a\U0001134e-\U0001134f\U00011351-\U00011356\U00011358-\U0001135c\U00011364-\U00011365\U0001136d-\U0001136f\U00011375-\U000113ff\U0001145a\U0001145c\U0001145f-\U0001147f\U000114c8-\U000114cf\U000114da-\U0001157f\U000115b6-\U000115b7\U000115de-\U000115ff\U00011645-\U0001164f\U0001165a-\U0001165f\U0001166d-\U0001167f\U000116b8-\U000116bf\U000116ca-\U000116ff\U0001171b-\U0001171c\U0001172c-\U0001172f\U00011740-\U000117ff\U0001183c-\U0001189f\U000118f3-\U000118fe\U00011900-\U000119ff\U00011a48-\U00011a4f\U00011a84-\U00011a85\U00011aa3-\U00011abf\U00011af9-\U00011bff\U00011c09\U00011c37\U00011c46-\U00011c4f\U00011c6d-\U00011c6f\U00011c90-\U00011c91\U00011ca8\U00011cb7-\U00011cff\U00011d07\U00011d0a\U00011d37-\U00011d39\U00011d3b\U00011d3e\U00011d48-\U00011d4f\U00011d5a-\U00011d5f\U00011d66\U00011d69\U00011d8f\U00011d92\U00011d99-\U00011d9f\U00011daa-\U00011edf\U00011ef9-\U00011fff\U0001239a-\U000123ff\U0001246f\U00012475-\U0001247f\U00012544-\U00012fff\U0001342f-\U000143ff\U00014647-\U000167ff\U00016a39-\U00016a3f\U00016a5f\U00016a6a-\U00016a6d\U00016a70-\U00016acf\U00016aee-\U00016aef\U00016af6-\U00016aff\U00016b46-\U00016b4f\U00016b5a\U00016b62\U00016b78-\U00016b7c\U00016b90-\U00016e3f\U00016e9b-\U00016eff\U00016f45-\U00016f4f\U00016f7f-\U00016f8e\U00016fa0-\U00016fdf\U00016fe2-\U00016fff\U000187f2-\U000187ff\U00018af3-\U0001afff\U0001b11f-\U0001b16f\U0001b2fc-\U0001bbff\U0001bc6b-\U0001bc6f\U0001bc7d-\U0001bc7f\U0001bc89-\U0001bc8f\U0001bc9a-\U0001bc9b\U0001bca4-\U0001cfff\U0001d0f6-\U0001d0ff\U0001d127-\U0001d128\U0001d1e9-\U0001d1ff\U0001d246-\U0001d2df\U0001d2f4-\U0001d2ff\U0001d357-\U0001d35f\U0001d379-\U0001d3ff\U0001d455\U0001d49d\U0001d4a0-\U0001d4a1\U0001d4a3-\U0001d4a4\U0001d4a7-\U0001d4a8\U0001d4ad\U0001d4ba\U0001d4bc\U0001d4c4\U0001d506\U0001d50b-\U0001d50c\U0001d515\U0001d51d\U0001d53a\U0001d53f\U0001d545\U0001d547-\U0001d549\U0001d551\U0001d6a6-\U0001d6a7\U0001d7cc-\U0001d7cd\U0001da8c-\U0001da9a\U0001daa0\U0001dab0-\U0001dfff\U0001e007\U0001e019-\U0001e01a\U0001e022\U0001e025\U0001e02b-\U0001e7ff\U0001e8c5-\U0001e8c6\U0001e8d7-\U0001e8ff\U0001e94b-\U0001e94f\U0001e95a-\U0001e95d\U0001e960-\U0001ec70\U0001ecb5-\U0001edff\U0001ee04\U0001ee20\U0001ee23\U0001ee25-\U0001ee26\U0001ee28\U0001ee33\U0001ee38\U0001ee3a\U0001ee3c-\U0001ee41\U0001ee43-\U0001ee46\U0001ee48\U0001ee4a\U0001ee4c\U0001ee50\U0001ee53\U0001ee55-\U0001ee56\U0001ee58\U0001ee5a\U0001ee5c\U0001ee5e\U0001ee60\U0001ee63\U0001ee65-\U0001ee66\U0001ee6b\U0001ee73\U0001ee78\U0001ee7d\U0001ee7f\U0001ee8a\U0001ee9c-\U0001eea0\U0001eea4\U0001eeaa\U0001eebc-\U0001eeef\U0001eef2-\U0001efff\U0001f02c-\U0001f02f\U0001f094-\U0001f09f\U0001f0af-\U0001f0b0\U0001f0c0\U0001f0d0\U0001f0f6-\U0001f0ff\U0001f10d-\U0001f10f\U0001f16c-\U0001f16f\U0001f1ad-\U0001f1e5\U0001f203-\U0001f20f\U0001f23c-\U0001f23f\U0001f249-\U0001f24f\U0001f252-\U0001f25f\U0001f266-\U0001f2ff\U0001f6d5-\U0001f6df\U0001f6ed-\U0001f6ef\U0001f6fa-\U0001f6ff\U0001f774-\U0001f77f\U0001f7d9-\U0001f7ff\U0001f80c-\U0001f80f\U0001f848-\U0001f84f\U0001f85a-\U0001f85f\U0001f888-\U0001f88f\U0001f8ae-\U0001f8ff\U0001f90c-\U0001f90f\U0001f93f\U0001f971-\U0001f972\U0001f977-\U0001f979\U0001f97b\U0001f9a3-\U0001f9af\U0001f9ba-\U0001f9bf\U0001f9c3-\U0001f9cf\U0001fa00-\U0001fa5f\U0001fa6e-\U0001ffff\U0002a6d7-\U0002a6ff\U0002b735-\U0002b73f\U0002b81e-\U0002b81f\U0002cea2-\U0002ceaf\U0002ebe1-\U0002f7ff\U0002fa1e-\U000e0000\U000e0002-\U000e001f\U000e0080-\U000e00ff\U000e01f0-\U000effff\U000ffffe-\U000fffff\U0010fffe-\U0010ffff' Co = '\ue000-\uf8ff\U000f0000-\U000ffffd\U00100000-\U0010fffd' Cs = '\ud800-\udbff\\\udc00\udc01-\udfff' Ll = 'a-z\xb5\xdf-\xf6\xf8-\xff\u0101\u0103\u0105\u0107\u0109\u010b\u010d\u010f\u0111\u0113\u0115\u0117\u0119\u011b\u011d\u011f\u0121\u0123\u0125\u0127\u0129\u012b\u012d\u012f\u0131\u0133\u0135\u0137-\u0138\u013a\u013c\u013e\u0140\u0142\u0144\u0146\u0148-\u0149\u014b\u014d\u014f\u0151\u0153\u0155\u0157\u0159\u015b\u015d\u015f\u0161\u0163\u0165\u0167\u0169\u016b\u016d\u016f\u0171\u0173\u0175\u0177\u017a\u017c\u017e-\u0180\u0183\u0185\u0188\u018c-\u018d\u0192\u0195\u0199-\u019b\u019e\u01a1\u01a3\u01a5\u01a8\u01aa-\u01ab\u01ad\u01b0\u01b4\u01b6\u01b9-\u01ba\u01bd-\u01bf\u01c6\u01c9\u01cc\u01ce\u01d0\u01d2\u01d4\u01d6\u01d8\u01da\u01dc-\u01dd\u01df\u01e1\u01e3\u01e5\u01e7\u01e9\u01eb\u01ed\u01ef-\u01f0\u01f3\u01f5\u01f9\u01fb\u01fd\u01ff\u0201\u0203\u0205\u0207\u0209\u020b\u020d\u020f\u0211\u0213\u0215\u0217\u0219\u021b\u021d\u021f\u0221\u0223\u0225\u0227\u0229\u022b\u022d\u022f\u0231\u0233-\u0239\u023c\u023f-\u0240\u0242\u0247\u0249\u024b\u024d\u024f-\u0293\u0295-\u02af\u0371\u0373\u0377\u037b-\u037d\u0390\u03ac-\u03ce\u03d0-\u03d1\u03d5-\u03d7\u03d9\u03db\u03dd\u03df\u03e1\u03e3\u03e5\u03e7\u03e9\u03eb\u03ed\u03ef-\u03f3\u03f5\u03f8\u03fb-\u03fc\u0430-\u045f\u0461\u0463\u0465\u0467\u0469\u046b\u046d\u046f\u0471\u0473\u0475\u0477\u0479\u047b\u047d\u047f\u0481\u048b\u048d\u048f\u0491\u0493\u0495\u0497\u0499\u049b\u049d\u049f\u04a1\u04a3\u04a5\u04a7\u04a9\u04ab\u04ad\u04af\u04b1\u04b3\u04b5\u04b7\u04b9\u04bb\u04bd\u04bf\u04c2\u04c4\u04c6\u04c8\u04ca\u04cc\u04ce-\u04cf\u04d1\u04d3\u04d5\u04d7\u04d9\u04db\u04dd\u04df\u04e1\u04e3\u04e5\u04e7\u04e9\u04eb\u04ed\u04ef\u04f1\u04f3\u04f5\u04f7\u04f9\u04fb\u04fd\u04ff\u0501\u0503\u0505\u0507\u0509\u050b\u050d\u050f\u0511\u0513\u0515\u0517\u0519\u051b\u051d\u051f\u0521\u0523\u0525\u0527\u0529\u052b\u052d\u052f\u0560-\u0588\u10d0-\u10fa\u10fd-\u10ff\u13f8-\u13fd\u1c80-\u1c88\u1d00-\u1d2b\u1d6b-\u1d77\u1d79-\u1d9a\u1e01\u1e03\u1e05\u1e07\u1e09\u1e0b\u1e0d\u1e0f\u1e11\u1e13\u1e15\u1e17\u1e19\u1e1b\u1e1d\u1e1f\u1e21\u1e23\u1e25\u1e27\u1e29\u1e2b\u1e2d\u1e2f\u1e31\u1e33\u1e35\u1e37\u1e39\u1e3b\u1e3d\u1e3f\u1e41\u1e43\u1e45\u1e47\u1e49\u1e4b\u1e4d\u1e4f\u1e51\u1e53\u1e55\u1e57\u1e59\u1e5b\u1e5d\u1e5f\u1e61\u1e63\u1e65\u1e67\u1e69\u1e6b\u1e6d\u1e6f\u1e71\u1e73\u1e75\u1e77\u1e79\u1e7b\u1e7d\u1e7f\u1e81\u1e83\u1e85\u1e87\u1e89\u1e8b\u1e8d\u1e8f\u1e91\u1e93\u1e95-\u1e9d\u1e9f\u1ea1\u1ea3\u1ea5\u1ea7\u1ea9\u1eab\u1ead\u1eaf\u1eb1\u1eb3\u1eb5\u1eb7\u1eb9\u1ebb\u1ebd\u1ebf\u1ec1\u1ec3\u1ec5\u1ec7\u1ec9\u1ecb\u1ecd\u1ecf\u1ed1\u1ed3\u1ed5\u1ed7\u1ed9\u1edb\u1edd\u1edf\u1ee1\u1ee3\u1ee5\u1ee7\u1ee9\u1eeb\u1eed\u1eef\u1ef1\u1ef3\u1ef5\u1ef7\u1ef9\u1efb\u1efd\u1eff-\u1f07\u1f10-\u1f15\u1f20-\u1f27\u1f30-\u1f37\u1f40-\u1f45\u1f50-\u1f57\u1f60-\u1f67\u1f70-\u1f7d\u1f80-\u1f87\u1f90-\u1f97\u1fa0-\u1fa7\u1fb0-\u1fb4\u1fb6-\u1fb7\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fc7\u1fd0-\u1fd3\u1fd6-\u1fd7\u1fe0-\u1fe7\u1ff2-\u1ff4\u1ff6-\u1ff7\u210a\u210e-\u210f\u2113\u212f\u2134\u2139\u213c-\u213d\u2146-\u2149\u214e\u2184\u2c30-\u2c5e\u2c61\u2c65-\u2c66\u2c68\u2c6a\u2c6c\u2c71\u2c73-\u2c74\u2c76-\u2c7b\u2c81\u2c83\u2c85\u2c87\u2c89\u2c8b\u2c8d\u2c8f\u2c91\u2c93\u2c95\u2c97\u2c99\u2c9b\u2c9d\u2c9f\u2ca1\u2ca3\u2ca5\u2ca7\u2ca9\u2cab\u2cad\u2caf\u2cb1\u2cb3\u2cb5\u2cb7\u2cb9\u2cbb\u2cbd\u2cbf\u2cc1\u2cc3\u2cc5\u2cc7\u2cc9\u2ccb\u2ccd\u2ccf\u2cd1\u2cd3\u2cd5\u2cd7\u2cd9\u2cdb\u2cdd\u2cdf\u2ce1\u2ce3-\u2ce4\u2cec\u2cee\u2cf3\u2d00-\u2d25\u2d27\u2d2d\ua641\ua643\ua645\ua647\ua649\ua64b\ua64d\ua64f\ua651\ua653\ua655\ua657\ua659\ua65b\ua65d\ua65f\ua661\ua663\ua665\ua667\ua669\ua66b\ua66d\ua681\ua683\ua685\ua687\ua689\ua68b\ua68d\ua68f\ua691\ua693\ua695\ua697\ua699\ua69b\ua723\ua725\ua727\ua729\ua72b\ua72d\ua72f-\ua731\ua733\ua735\ua737\ua739\ua73b\ua73d\ua73f\ua741\ua743\ua745\ua747\ua749\ua74b\ua74d\ua74f\ua751\ua753\ua755\ua757\ua759\ua75b\ua75d\ua75f\ua761\ua763\ua765\ua767\ua769\ua76b\ua76d\ua76f\ua771-\ua778\ua77a\ua77c\ua77f\ua781\ua783\ua785\ua787\ua78c\ua78e\ua791\ua793-\ua795\ua797\ua799\ua79b\ua79d\ua79f\ua7a1\ua7a3\ua7a5\ua7a7\ua7a9\ua7af\ua7b5\ua7b7\ua7b9\ua7fa\uab30-\uab5a\uab60-\uab65\uab70-\uabbf\ufb00-\ufb06\ufb13-\ufb17\uff41-\uff5a\U00010428-\U0001044f\U000104d8-\U000104fb\U00010cc0-\U00010cf2\U000118c0-\U000118df\U00016e60-\U00016e7f\U0001d41a-\U0001d433\U0001d44e-\U0001d454\U0001d456-\U0001d467\U0001d482-\U0001d49b\U0001d4b6-\U0001d4b9\U0001d4bb\U0001d4bd-\U0001d4c3\U0001d4c5-\U0001d4cf\U0001d4ea-\U0001d503\U0001d51e-\U0001d537\U0001d552-\U0001d56b\U0001d586-\U0001d59f\U0001d5ba-\U0001d5d3\U0001d5ee-\U0001d607\U0001d622-\U0001d63b\U0001d656-\U0001d66f\U0001d68a-\U0001d6a5\U0001d6c2-\U0001d6da\U0001d6dc-\U0001d6e1\U0001d6fc-\U0001d714\U0001d716-\U0001d71b\U0001d736-\U0001d74e\U0001d750-\U0001d755\U0001d770-\U0001d788\U0001d78a-\U0001d78f\U0001d7aa-\U0001d7c2\U0001d7c4-\U0001d7c9\U0001d7cb\U0001e922-\U0001e943' Lm = '\u02b0-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0374\u037a\u0559\u0640\u06e5-\u06e6\u07f4-\u07f5\u07fa\u081a\u0824\u0828\u0971\u0e46\u0ec6\u10fc\u17d7\u1843\u1aa7\u1c78-\u1c7d\u1d2c-\u1d6a\u1d78\u1d9b-\u1dbf\u2071\u207f\u2090-\u209c\u2c7c-\u2c7d\u2d6f\u2e2f\u3005\u3031-\u3035\u303b\u309d-\u309e\u30fc-\u30fe\ua015\ua4f8-\ua4fd\ua60c\ua67f\ua69c-\ua69d\ua717-\ua71f\ua770\ua788\ua7f8-\ua7f9\ua9cf\ua9e6\uaa70\uaadd\uaaf3-\uaaf4\uab5c-\uab5f\uff70\uff9e-\uff9f\U00016b40-\U00016b43\U00016f93-\U00016f9f\U00016fe0-\U00016fe1' Lo = '\xaa\xba\u01bb\u01c0-\u01c3\u0294\u05d0-\u05ea\u05ef-\u05f2\u0620-\u063f\u0641-\u064a\u066e-\u066f\u0671-\u06d3\u06d5\u06ee-\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u0800-\u0815\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0972-\u0980\u0985-\u098c\u098f-\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc-\u09dd\u09df-\u09e1\u09f0-\u09f1\u09fc\u0a05-\u0a0a\u0a0f-\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32-\u0a33\u0a35-\u0a36\u0a38-\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2-\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0-\u0ae1\u0af9\u0b05-\u0b0c\u0b0f-\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32-\u0b33\u0b35-\u0b39\u0b3d\u0b5c-\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99-\u0b9a\u0b9c\u0b9e-\u0b9f\u0ba3-\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60-\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0-\u0ce1\u0cf1-\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32-\u0e33\u0e40-\u0e45\u0e81-\u0e82\u0e84\u0e87-\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa-\u0eab\u0ead-\u0eb0\u0eb2-\u0eb3\u0ebd\u0ec0-\u0ec4\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065-\u1066\u106e-\u1070\u1075-\u1081\u108e\u1100-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16f1-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17dc\u1820-\u1842\u1844-\u1878\u1880-\u1884\u1887-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae-\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c77\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5-\u1cf6\u2135-\u2138\u2d30-\u2d67\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3006\u303c\u3041-\u3096\u309f\u30a1-\u30fa\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua014\ua016-\ua48c\ua4d0-\ua4f7\ua500-\ua60b\ua610-\ua61f\ua62a-\ua62b\ua66e\ua6a0-\ua6e5\ua78f\ua7f7\ua7fb-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd-\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9e0-\ua9e4\ua9e7-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa6f\uaa71-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5-\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadc\uaae0-\uaaea\uaaf2\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff66-\uff6f\uff71-\uff9d\uffa0-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc\U00010000-\U0001000b\U0001000d-\U00010026\U00010028-\U0001003a\U0001003c-\U0001003d\U0001003f-\U0001004d\U00010050-\U0001005d\U00010080-\U000100fa\U00010280-\U0001029c\U000102a0-\U000102d0\U00010300-\U0001031f\U0001032d-\U00010340\U00010342-\U00010349\U00010350-\U00010375\U00010380-\U0001039d\U000103a0-\U000103c3\U000103c8-\U000103cf\U00010450-\U0001049d\U00010500-\U00010527\U00010530-\U00010563\U00010600-\U00010736\U00010740-\U00010755\U00010760-\U00010767\U00010800-\U00010805\U00010808\U0001080a-\U00010835\U00010837-\U00010838\U0001083c\U0001083f-\U00010855\U00010860-\U00010876\U00010880-\U0001089e\U000108e0-\U000108f2\U000108f4-\U000108f5\U00010900-\U00010915\U00010920-\U00010939\U00010980-\U000109b7\U000109be-\U000109bf\U00010a00\U00010a10-\U00010a13\U00010a15-\U00010a17\U00010a19-\U00010a35\U00010a60-\U00010a7c\U00010a80-\U00010a9c\U00010ac0-\U00010ac7\U00010ac9-\U00010ae4\U00010b00-\U00010b35\U00010b40-\U00010b55\U00010b60-\U00010b72\U00010b80-\U00010b91\U00010c00-\U00010c48\U00010d00-\U00010d23\U00010f00-\U00010f1c\U00010f27\U00010f30-\U00010f45\U00011003-\U00011037\U00011083-\U000110af\U000110d0-\U000110e8\U00011103-\U00011126\U00011144\U00011150-\U00011172\U00011176\U00011183-\U000111b2\U000111c1-\U000111c4\U000111da\U000111dc\U00011200-\U00011211\U00011213-\U0001122b\U00011280-\U00011286\U00011288\U0001128a-\U0001128d\U0001128f-\U0001129d\U0001129f-\U000112a8\U000112b0-\U000112de\U00011305-\U0001130c\U0001130f-\U00011310\U00011313-\U00011328\U0001132a-\U00011330\U00011332-\U00011333\U00011335-\U00011339\U0001133d\U00011350\U0001135d-\U00011361\U00011400-\U00011434\U00011447-\U0001144a\U00011480-\U000114af\U000114c4-\U000114c5\U000114c7\U00011580-\U000115ae\U000115d8-\U000115db\U00011600-\U0001162f\U00011644\U00011680-\U000116aa\U00011700-\U0001171a\U00011800-\U0001182b\U000118ff\U00011a00\U00011a0b-\U00011a32\U00011a3a\U00011a50\U00011a5c-\U00011a83\U00011a86-\U00011a89\U00011a9d\U00011ac0-\U00011af8\U00011c00-\U00011c08\U00011c0a-\U00011c2e\U00011c40\U00011c72-\U00011c8f\U00011d00-\U00011d06\U00011d08-\U00011d09\U00011d0b-\U00011d30\U00011d46\U00011d60-\U00011d65\U00011d67-\U00011d68\U00011d6a-\U00011d89\U00011d98\U00011ee0-\U00011ef2\U00012000-\U00012399\U00012480-\U00012543\U00013000-\U0001342e\U00014400-\U00014646\U00016800-\U00016a38\U00016a40-\U00016a5e\U00016ad0-\U00016aed\U00016b00-\U00016b2f\U00016b63-\U00016b77\U00016b7d-\U00016b8f\U00016f00-\U00016f44\U00016f50\U00017000-\U000187f1\U00018800-\U00018af2\U0001b000-\U0001b11e\U0001b170-\U0001b2fb\U0001bc00-\U0001bc6a\U0001bc70-\U0001bc7c\U0001bc80-\U0001bc88\U0001bc90-\U0001bc99\U0001e800-\U0001e8c4\U0001ee00-\U0001ee03\U0001ee05-\U0001ee1f\U0001ee21-\U0001ee22\U0001ee24\U0001ee27\U0001ee29-\U0001ee32\U0001ee34-\U0001ee37\U0001ee39\U0001ee3b\U0001ee42\U0001ee47\U0001ee49\U0001ee4b\U0001ee4d-\U0001ee4f\U0001ee51-\U0001ee52\U0001ee54\U0001ee57\U0001ee59\U0001ee5b\U0001ee5d\U0001ee5f\U0001ee61-\U0001ee62\U0001ee64\U0001ee67-\U0001ee6a\U0001ee6c-\U0001ee72\U0001ee74-\U0001ee77\U0001ee79-\U0001ee7c\U0001ee7e\U0001ee80-\U0001ee89\U0001ee8b-\U0001ee9b\U0001eea1-\U0001eea3\U0001eea5-\U0001eea9\U0001eeab-\U0001eebb\U00020000-\U0002a6d6\U0002a700-\U0002b734\U0002b740-\U0002b81d\U0002b820-\U0002cea1\U0002ceb0-\U0002ebe0\U0002f800-\U0002fa1d' Lt = '\u01c5\u01c8\u01cb\u01f2\u1f88-\u1f8f\u1f98-\u1f9f\u1fa8-\u1faf\u1fbc\u1fcc\u1ffc' Lu = 'A-Z\xc0-\xd6\xd8-\xde\u0100\u0102\u0104\u0106\u0108\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u037f\u0386\u0388-\u038a\u038c\u038e-\u038f\u0391-\u03a1\u03a3-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0524\u0526\u0528\u052a\u052c\u052e\u0531-\u0556\u10a0-\u10c5\u10c7\u10cd\u13a0-\u13f5\u1c90-\u1cba\u1cbd-\u1cbf\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59\u1f5b\u1f5d\u1f5f\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67\u2c69\u2c6b\u2c6d-\u2c70\u2c72\u2c75\u2c7e-\u2c80\u2c82\u2c84\u2c86\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\u2ceb\u2ced\u2cf2\ua640\ua642\ua644\ua646\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a\ua65c\ua65e\ua660\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696\ua698\ua69a\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\ua78d\ua790\ua792\ua796\ua798\ua79a\ua79c\ua79e\ua7a0\ua7a2\ua7a4\ua7a6\ua7a8\ua7aa-\ua7ae\ua7b0-\ua7b4\ua7b6\ua7b8\uff21-\uff3a\U00010400-\U00010427\U000104b0-\U000104d3\U00010c80-\U00010cb2\U000118a0-\U000118bf\U00016e40-\U00016e5f\U0001d400-\U0001d419\U0001d434-\U0001d44d\U0001d468-\U0001d481\U0001d49c\U0001d49e-\U0001d49f\U0001d4a2\U0001d4a5-\U0001d4a6\U0001d4a9-\U0001d4ac\U0001d4ae-\U0001d4b5\U0001d4d0-\U0001d4e9\U0001d504-\U0001d505\U0001d507-\U0001d50a\U0001d50d-\U0001d514\U0001d516-\U0001d51c\U0001d538-\U0001d539\U0001d53b-\U0001d53e\U0001d540-\U0001d544\U0001d546\U0001d54a-\U0001d550\U0001d56c-\U0001d585\U0001d5a0-\U0001d5b9\U0001d5d4-\U0001d5ed\U0001d608-\U0001d621\U0001d63c-\U0001d655\U0001d670-\U0001d689\U0001d6a8-\U0001d6c0\U0001d6e2-\U0001d6fa\U0001d71c-\U0001d734\U0001d756-\U0001d76e\U0001d790-\U0001d7a8\U0001d7ca\U0001e900-\U0001e921' Mc = '\u0903\u093b\u093e-\u0940\u0949-\u094c\u094e-\u094f\u0982-\u0983\u09be-\u09c0\u09c7-\u09c8\u09cb-\u09cc\u09d7\u0a03\u0a3e-\u0a40\u0a83\u0abe-\u0ac0\u0ac9\u0acb-\u0acc\u0b02-\u0b03\u0b3e\u0b40\u0b47-\u0b48\u0b4b-\u0b4c\u0b57\u0bbe-\u0bbf\u0bc1-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcc\u0bd7\u0c01-\u0c03\u0c41-\u0c44\u0c82-\u0c83\u0cbe\u0cc0-\u0cc4\u0cc7-\u0cc8\u0cca-\u0ccb\u0cd5-\u0cd6\u0d02-\u0d03\u0d3e-\u0d40\u0d46-\u0d48\u0d4a-\u0d4c\u0d57\u0d82-\u0d83\u0dcf-\u0dd1\u0dd8-\u0ddf\u0df2-\u0df3\u0f3e-\u0f3f\u0f7f\u102b-\u102c\u1031\u1038\u103b-\u103c\u1056-\u1057\u1062-\u1064\u1067-\u106d\u1083-\u1084\u1087-\u108c\u108f\u109a-\u109c\u17b6\u17be-\u17c5\u17c7-\u17c8\u1923-\u1926\u1929-\u192b\u1930-\u1931\u1933-\u1938\u1a19-\u1a1a\u1a55\u1a57\u1a61\u1a63-\u1a64\u1a6d-\u1a72\u1b04\u1b35\u1b3b\u1b3d-\u1b41\u1b43-\u1b44\u1b82\u1ba1\u1ba6-\u1ba7\u1baa\u1be7\u1bea-\u1bec\u1bee\u1bf2-\u1bf3\u1c24-\u1c2b\u1c34-\u1c35\u1ce1\u1cf2-\u1cf3\u1cf7\u302e-\u302f\ua823-\ua824\ua827\ua880-\ua881\ua8b4-\ua8c3\ua952-\ua953\ua983\ua9b4-\ua9b5\ua9ba-\ua9bb\ua9bd-\ua9c0\uaa2f-\uaa30\uaa33-\uaa34\uaa4d\uaa7b\uaa7d\uaaeb\uaaee-\uaaef\uaaf5\uabe3-\uabe4\uabe6-\uabe7\uabe9-\uabea\uabec\U00011000\U00011002\U00011082\U000110b0-\U000110b2\U000110b7-\U000110b8\U0001112c\U00011145-\U00011146\U00011182\U000111b3-\U000111b5\U000111bf-\U000111c0\U0001122c-\U0001122e\U00011232-\U00011233\U00011235\U000112e0-\U000112e2\U00011302-\U00011303\U0001133e-\U0001133f\U00011341-\U00011344\U00011347-\U00011348\U0001134b-\U0001134d\U00011357\U00011362-\U00011363\U00011435-\U00011437\U00011440-\U00011441\U00011445\U000114b0-\U000114b2\U000114b9\U000114bb-\U000114be\U000114c1\U000115af-\U000115b1\U000115b8-\U000115bb\U000115be\U00011630-\U00011632\U0001163b-\U0001163c\U0001163e\U000116ac\U000116ae-\U000116af\U000116b6\U00011720-\U00011721\U00011726\U0001182c-\U0001182e\U00011838\U00011a39\U00011a57-\U00011a58\U00011a97\U00011c2f\U00011c3e\U00011ca9\U00011cb1\U00011cb4\U00011d8a-\U00011d8e\U00011d93-\U00011d94\U00011d96\U00011ef5-\U00011ef6\U00016f51-\U00016f7e\U0001d165-\U0001d166\U0001d16d-\U0001d172' Me = '\u0488-\u0489\u1abe\u20dd-\u20e0\u20e2-\u20e4\ua670-\ua672' Mn = '\u0300-\u036f\u0483-\u0487\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0902\u093a\u093c\u0941-\u0948\u094d\u0951-\u0957\u0962-\u0963\u0981\u09bc\u09c1-\u09c4\u09cd\u09e2-\u09e3\u09fe\u0a01-\u0a02\u0a3c\u0a41-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a70-\u0a71\u0a75\u0a81-\u0a82\u0abc\u0ac1-\u0ac5\u0ac7-\u0ac8\u0acd\u0ae2-\u0ae3\u0afa-\u0aff\u0b01\u0b3c\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b62-\u0b63\u0b82\u0bc0\u0bcd\u0c00\u0c04\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c62-\u0c63\u0c81\u0cbc\u0cbf\u0cc6\u0ccc-\u0ccd\u0ce2-\u0ce3\u0d00-\u0d01\u0d3b-\u0d3c\u0d41-\u0d44\u0d4d\u0d62-\u0d63\u0dca\u0dd2-\u0dd4\u0dd6\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86-\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039-\u103a\u103d-\u103e\u1058-\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085-\u1086\u108d\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17b4-\u17b5\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u1885-\u1886\u18a9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193b\u1a17-\u1a18\u1a1b\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1ab0-\u1abd\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80-\u1b81\u1ba2-\u1ba5\u1ba8-\u1ba9\u1bab-\u1bad\u1be6\u1be8-\u1be9\u1bed\u1bef-\u1bf1\u1c2c-\u1c33\u1c36-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1cf4\u1cf8-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302d\u3099-\u309a\ua66f\ua674-\ua67d\ua69e-\ua69f\ua6f0-\ua6f1\ua802\ua806\ua80b\ua825-\ua826\ua8c4-\ua8c5\ua8e0-\ua8f1\ua8ff\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\ua9e5\uaa29-\uaa2e\uaa31-\uaa32\uaa35-\uaa36\uaa43\uaa4c\uaa7c\uaab0\uaab2-\uaab4\uaab7-\uaab8\uaabe-\uaabf\uaac1\uaaec-\uaaed\uaaf6\uabe5\uabe8\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\U000101fd\U000102e0\U00010376-\U0001037a\U00010a01-\U00010a03\U00010a05-\U00010a06\U00010a0c-\U00010a0f\U00010a38-\U00010a3a\U00010a3f\U00010ae5-\U00010ae6\U00010d24-\U00010d27\U00010f46-\U00010f50\U00011001\U00011038-\U00011046\U0001107f-\U00011081\U000110b3-\U000110b6\U000110b9-\U000110ba\U00011100-\U00011102\U00011127-\U0001112b\U0001112d-\U00011134\U00011173\U00011180-\U00011181\U000111b6-\U000111be\U000111c9-\U000111cc\U0001122f-\U00011231\U00011234\U00011236-\U00011237\U0001123e\U000112df\U000112e3-\U000112ea\U00011300-\U00011301\U0001133b-\U0001133c\U00011340\U00011366-\U0001136c\U00011370-\U00011374\U00011438-\U0001143f\U00011442-\U00011444\U00011446\U0001145e\U000114b3-\U000114b8\U000114ba\U000114bf-\U000114c0\U000114c2-\U000114c3\U000115b2-\U000115b5\U000115bc-\U000115bd\U000115bf-\U000115c0\U000115dc-\U000115dd\U00011633-\U0001163a\U0001163d\U0001163f-\U00011640\U000116ab\U000116ad\U000116b0-\U000116b5\U000116b7\U0001171d-\U0001171f\U00011722-\U00011725\U00011727-\U0001172b\U0001182f-\U00011837\U00011839-\U0001183a\U00011a01-\U00011a0a\U00011a33-\U00011a38\U00011a3b-\U00011a3e\U00011a47\U00011a51-\U00011a56\U00011a59-\U00011a5b\U00011a8a-\U00011a96\U00011a98-\U00011a99\U00011c30-\U00011c36\U00011c38-\U00011c3d\U00011c3f\U00011c92-\U00011ca7\U00011caa-\U00011cb0\U00011cb2-\U00011cb3\U00011cb5-\U00011cb6\U00011d31-\U00011d36\U00011d3a\U00011d3c-\U00011d3d\U00011d3f-\U00011d45\U00011d47\U00011d90-\U00011d91\U00011d95\U00011d97\U00011ef3-\U00011ef4\U00016af0-\U00016af4\U00016b30-\U00016b36\U00016f8f-\U00016f92\U0001bc9d-\U0001bc9e\U0001d167-\U0001d169\U0001d17b-\U0001d182\U0001d185-\U0001d18b\U0001d1aa-\U0001d1ad\U0001d242-\U0001d244\U0001da00-\U0001da36\U0001da3b-\U0001da6c\U0001da75\U0001da84\U0001da9b-\U0001da9f\U0001daa1-\U0001daaf\U0001e000-\U0001e006\U0001e008-\U0001e018\U0001e01b-\U0001e021\U0001e023-\U0001e024\U0001e026-\U0001e02a\U0001e8d0-\U0001e8d6\U0001e944-\U0001e94a\U000e0100-\U000e01ef' Nd = '0-9\u0660-\u0669\u06f0-\u06f9\u07c0-\u07c9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be6-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0de6-\u0def\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u1040-\u1049\u1090-\u1099\u17e0-\u17e9\u1810-\u1819\u1946-\u194f\u19d0-\u19d9\u1a80-\u1a89\u1a90-\u1a99\u1b50-\u1b59\u1bb0-\u1bb9\u1c40-\u1c49\u1c50-\u1c59\ua620-\ua629\ua8d0-\ua8d9\ua900-\ua909\ua9d0-\ua9d9\ua9f0-\ua9f9\uaa50-\uaa59\uabf0-\uabf9\uff10-\uff19\U000104a0-\U000104a9\U00010d30-\U00010d39\U00011066-\U0001106f\U000110f0-\U000110f9\U00011136-\U0001113f\U000111d0-\U000111d9\U000112f0-\U000112f9\U00011450-\U00011459\U000114d0-\U000114d9\U00011650-\U00011659\U000116c0-\U000116c9\U00011730-\U00011739\U000118e0-\U000118e9\U00011c50-\U00011c59\U00011d50-\U00011d59\U00011da0-\U00011da9\U00016a60-\U00016a69\U00016b50-\U00016b59\U0001d7ce-\U0001d7ff\U0001e950-\U0001e959' Nl = '\u16ee-\u16f0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303a\ua6e6-\ua6ef\U00010140-\U00010174\U00010341\U0001034a\U000103d1-\U000103d5\U00012400-\U0001246e' No = '\xb2-\xb3\xb9\xbc-\xbe\u09f4-\u09f9\u0b72-\u0b77\u0bf0-\u0bf2\u0c78-\u0c7e\u0d58-\u0d5e\u0d70-\u0d78\u0f2a-\u0f33\u1369-\u137c\u17f0-\u17f9\u19da\u2070\u2074-\u2079\u2080-\u2089\u2150-\u215f\u2189\u2460-\u249b\u24ea-\u24ff\u2776-\u2793\u2cfd\u3192-\u3195\u3220-\u3229\u3248-\u324f\u3251-\u325f\u3280-\u3289\u32b1-\u32bf\ua830-\ua835\U00010107-\U00010133\U00010175-\U00010178\U0001018a-\U0001018b\U000102e1-\U000102fb\U00010320-\U00010323\U00010858-\U0001085f\U00010879-\U0001087f\U000108a7-\U000108af\U000108fb-\U000108ff\U00010916-\U0001091b\U000109bc-\U000109bd\U000109c0-\U000109cf\U000109d2-\U000109ff\U00010a40-\U00010a48\U00010a7d-\U00010a7e\U00010a9d-\U00010a9f\U00010aeb-\U00010aef\U00010b58-\U00010b5f\U00010b78-\U00010b7f\U00010ba9-\U00010baf\U00010cfa-\U00010cff\U00010e60-\U00010e7e\U00010f1d-\U00010f26\U00010f51-\U00010f54\U00011052-\U00011065\U000111e1-\U000111f4\U0001173a-\U0001173b\U000118ea-\U000118f2\U00011c5a-\U00011c6c\U00016b5b-\U00016b61\U00016e80-\U00016e96\U0001d2e0-\U0001d2f3\U0001d360-\U0001d378\U0001e8c7-\U0001e8cf\U0001ec71-\U0001ecab\U0001ecad-\U0001ecaf\U0001ecb1-\U0001ecb4\U0001f100-\U0001f10c' Pc = '_\u203f-\u2040\u2054\ufe33-\ufe34\ufe4d-\ufe4f\uff3f' Pd = '\\-\u058a\u05be\u1400\u1806\u2010-\u2015\u2e17\u2e1a\u2e3a-\u2e3b\u2e40\u301c\u3030\u30a0\ufe31-\ufe32\ufe58\ufe63\uff0d' Pe = ')\\]}\u0f3b\u0f3d\u169c\u2046\u207e\u208e\u2309\u230b\u232a\u2769\u276b\u276d\u276f\u2771\u2773\u2775\u27c6\u27e7\u27e9\u27eb\u27ed\u27ef\u2984\u2986\u2988\u298a\u298c\u298e\u2990\u2992\u2994\u2996\u2998\u29d9\u29db\u29fd\u2e23\u2e25\u2e27\u2e29\u3009\u300b\u300d\u300f\u3011\u3015\u3017\u3019\u301b\u301e-\u301f\ufd3e\ufe18\ufe36\ufe38\ufe3a\ufe3c\ufe3e\ufe40\ufe42\ufe44\ufe48\ufe5a\ufe5c\ufe5e\uff09\uff3d\uff5d\uff60\uff63' Pf = '\xbb\u2019\u201d\u203a\u2e03\u2e05\u2e0a\u2e0d\u2e1d\u2e21' Pi = '\xab\u2018\u201b-\u201c\u201f\u2039\u2e02\u2e04\u2e09\u2e0c\u2e1c\u2e20' Po = "!-#%-'*,.-/:-;?-@\\\\\xa1\xa7\xb6-\xb7\xbf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3-\u05f4\u0609-\u060a\u060c-\u060d\u061b\u061e-\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964-\u0965\u0970\u09fd\u0a76\u0af0\u0c84\u0df4\u0e4f\u0e5a-\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9-\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d-\u166e\u16eb-\u16ed\u1735-\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944-\u1945\u1a1e-\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e-\u1c7f\u1cc0-\u1cc7\u1cd3\u2016-\u2017\u2020-\u2027\u2030-\u2038\u203b-\u203e\u2041-\u2043\u2047-\u2051\u2053\u2055-\u205e\u2cf9-\u2cfc\u2cfe-\u2cff\u2d70\u2e00-\u2e01\u2e06-\u2e08\u2e0b\u2e0e-\u2e16\u2e18-\u2e19\u2e1b\u2e1e-\u2e1f\u2e2a-\u2e2e\u2e30-\u2e39\u2e3c-\u2e3f\u2e41\u2e43-\u2e4e\u3001-\u3003\u303d\u30fb\ua4fe-\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce-\ua8cf\ua8f8-\ua8fa\ua8fc\ua92e-\ua92f\ua95f\ua9c1-\ua9cd\ua9de-\ua9df\uaa5c-\uaa5f\uaade-\uaadf\uaaf0-\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45-\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a-\ufe6b\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e-\uff0f\uff1a-\uff1b\uff1f-\uff20\uff3c\uff61\uff64-\uff65\U00010100-\U00010102\U0001039f\U000103d0\U0001056f\U00010857\U0001091f\U0001093f\U00010a50-\U00010a58\U00010a7f\U00010af0-\U00010af6\U00010b39-\U00010b3f\U00010b99-\U00010b9c\U00010f55-\U00010f59\U00011047-\U0001104d\U000110bb-\U000110bc\U000110be-\U000110c1\U00011140-\U00011143\U00011174-\U00011175\U000111c5-\U000111c8\U000111cd\U000111db\U000111dd-\U000111df\U00011238-\U0001123d\U000112a9\U0001144b-\U0001144f\U0001145b\U0001145d\U000114c6\U000115c1-\U000115d7\U00011641-\U00011643\U00011660-\U0001166c\U0001173c-\U0001173e\U0001183b\U00011a3f-\U00011a46\U00011a9a-\U00011a9c\U00011a9e-\U00011aa2\U00011c41-\U00011c45\U00011c70-\U00011c71\U00011ef7-\U00011ef8\U00012470-\U00012474\U00016a6e-\U00016a6f\U00016af5\U00016b37-\U00016b3b\U00016b44\U00016e97-\U00016e9a\U0001bc9f\U0001da87-\U0001da8b\U0001e95e-\U0001e95f" Ps = '(\\[{\u0f3a\u0f3c\u169b\u201a\u201e\u2045\u207d\u208d\u2308\u230a\u2329\u2768\u276a\u276c\u276e\u2770\u2772\u2774\u27c5\u27e6\u27e8\u27ea\u27ec\u27ee\u2983\u2985\u2987\u2989\u298b\u298d\u298f\u2991\u2993\u2995\u2997\u29d8\u29da\u29fc\u2e22\u2e24\u2e26\u2e28\u2e42\u3008\u300a\u300c\u300e\u3010\u3014\u3016\u3018\u301a\u301d\ufd3f\ufe17\ufe35\ufe37\ufe39\ufe3b\ufe3d\ufe3f\ufe41\ufe43\ufe47\ufe59\ufe5b\ufe5d\uff08\uff3b\uff5b\uff5f\uff62' Sc = '$\xa2-\xa5\u058f\u060b\u07fe-\u07ff\u09f2-\u09f3\u09fb\u0af1\u0bf9\u0e3f\u17db\u20a0-\u20bf\ua838\ufdfc\ufe69\uff04\uffe0-\uffe1\uffe5-\uffe6\U0001ecb0' Sk = '\\^`\xa8\xaf\xb4\xb8\u02c2-\u02c5\u02d2-\u02df\u02e5-\u02eb\u02ed\u02ef-\u02ff\u0375\u0384-\u0385\u1fbd\u1fbf-\u1fc1\u1fcd-\u1fcf\u1fdd-\u1fdf\u1fed-\u1fef\u1ffd-\u1ffe\u309b-\u309c\ua700-\ua716\ua720-\ua721\ua789-\ua78a\uab5b\ufbb2-\ufbc1\uff3e\uff40\uffe3\U0001f3fb-\U0001f3ff' Sm = '+<->|~\xac\xb1\xd7\xf7\u03f6\u0606-\u0608\u2044\u2052\u207a-\u207c\u208a-\u208c\u2118\u2140-\u2144\u214b\u2190-\u2194\u219a-\u219b\u21a0\u21a3\u21a6\u21ae\u21ce-\u21cf\u21d2\u21d4\u21f4-\u22ff\u2320-\u2321\u237c\u239b-\u23b3\u23dc-\u23e1\u25b7\u25c1\u25f8-\u25ff\u266f\u27c0-\u27c4\u27c7-\u27e5\u27f0-\u27ff\u2900-\u2982\u2999-\u29d7\u29dc-\u29fb\u29fe-\u2aff\u2b30-\u2b44\u2b47-\u2b4c\ufb29\ufe62\ufe64-\ufe66\uff0b\uff1c-\uff1e\uff5c\uff5e\uffe2\uffe9-\uffec\U0001d6c1\U0001d6db\U0001d6fb\U0001d715\U0001d735\U0001d74f\U0001d76f\U0001d789\U0001d7a9\U0001d7c3\U0001eef0-\U0001eef1' So = '\xa6\xa9\xae\xb0\u0482\u058d-\u058e\u060e-\u060f\u06de\u06e9\u06fd-\u06fe\u07f6\u09fa\u0b70\u0bf3-\u0bf8\u0bfa\u0c7f\u0d4f\u0d79\u0f01-\u0f03\u0f13\u0f15-\u0f17\u0f1a-\u0f1f\u0f34\u0f36\u0f38\u0fbe-\u0fc5\u0fc7-\u0fcc\u0fce-\u0fcf\u0fd5-\u0fd8\u109e-\u109f\u1390-\u1399\u1940\u19de-\u19ff\u1b61-\u1b6a\u1b74-\u1b7c\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2117\u211e-\u2123\u2125\u2127\u2129\u212e\u213a-\u213b\u214a\u214c-\u214d\u214f\u218a-\u218b\u2195-\u2199\u219c-\u219f\u21a1-\u21a2\u21a4-\u21a5\u21a7-\u21ad\u21af-\u21cd\u21d0-\u21d1\u21d3\u21d5-\u21f3\u2300-\u2307\u230c-\u231f\u2322-\u2328\u232b-\u237b\u237d-\u239a\u23b4-\u23db\u23e2-\u2426\u2440-\u244a\u249c-\u24e9\u2500-\u25b6\u25b8-\u25c0\u25c2-\u25f7\u2600-\u266e\u2670-\u2767\u2794-\u27bf\u2800-\u28ff\u2b00-\u2b2f\u2b45-\u2b46\u2b4d-\u2b73\u2b76-\u2b95\u2b98-\u2bc8\u2bca-\u2bfe\u2ce5-\u2cea\u2e80-\u2e99\u2e9b-\u2ef3\u2f00-\u2fd5\u2ff0-\u2ffb\u3004\u3012-\u3013\u3020\u3036-\u3037\u303e-\u303f\u3190-\u3191\u3196-\u319f\u31c0-\u31e3\u3200-\u321e\u322a-\u3247\u3250\u3260-\u327f\u328a-\u32b0\u32c0-\u32fe\u3300-\u33ff\u4dc0-\u4dff\ua490-\ua4c6\ua828-\ua82b\ua836-\ua837\ua839\uaa77-\uaa79\ufdfd\uffe4\uffe8\uffed-\uffee\ufffc-\ufffd\U00010137-\U0001013f\U00010179-\U00010189\U0001018c-\U0001018e\U00010190-\U0001019b\U000101a0\U000101d0-\U000101fc\U00010877-\U00010878\U00010ac8\U0001173f\U00016b3c-\U00016b3f\U00016b45\U0001bc9c\U0001d000-\U0001d0f5\U0001d100-\U0001d126\U0001d129-\U0001d164\U0001d16a-\U0001d16c\U0001d183-\U0001d184\U0001d18c-\U0001d1a9\U0001d1ae-\U0001d1e8\U0001d200-\U0001d241\U0001d245\U0001d300-\U0001d356\U0001d800-\U0001d9ff\U0001da37-\U0001da3a\U0001da6d-\U0001da74\U0001da76-\U0001da83\U0001da85-\U0001da86\U0001ecac\U0001f000-\U0001f02b\U0001f030-\U0001f093\U0001f0a0-\U0001f0ae\U0001f0b1-\U0001f0bf\U0001f0c1-\U0001f0cf\U0001f0d1-\U0001f0f5\U0001f110-\U0001f16b\U0001f170-\U0001f1ac\U0001f1e6-\U0001f202\U0001f210-\U0001f23b\U0001f240-\U0001f248\U0001f250-\U0001f251\U0001f260-\U0001f265\U0001f300-\U0001f3fa\U0001f400-\U0001f6d4\U0001f6e0-\U0001f6ec\U0001f6f0-\U0001f6f9\U0001f700-\U0001f773\U0001f780-\U0001f7d8\U0001f800-\U0001f80b\U0001f810-\U0001f847\U0001f850-\U0001f859\U0001f860-\U0001f887\U0001f890-\U0001f8ad\U0001f900-\U0001f90b\U0001f910-\U0001f93e\U0001f940-\U0001f970\U0001f973-\U0001f976\U0001f97a\U0001f97c-\U0001f9a2\U0001f9b0-\U0001f9b9\U0001f9c0-\U0001f9c2\U0001f9d0-\U0001f9ff\U0001fa60-\U0001fa6d' Zl = '\u2028' Zp = '\u2029' Zs = ' \xa0\u1680\u2000-\u200a\u202f\u205f\u3000' xid_continue = '0-9A-Z_a-z\xaa\xb5\xb7\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376-\u0377\u037b-\u037d\u037f\u0386-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u05d0-\u05ea\u05ef-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u07fd\u0800-\u082d\u0840-\u085b\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u08d3-\u08e1\u08e3-\u0963\u0966-\u096f\u0971-\u0983\u0985-\u098c\u098f-\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7-\u09c8\u09cb-\u09ce\u09d7\u09dc-\u09dd\u09df-\u09e3\u09e6-\u09f1\u09fc\u09fe\u0a01-\u0a03\u0a05-\u0a0a\u0a0f-\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32-\u0a33\u0a35-\u0a36\u0a38-\u0a39\u0a3c\u0a3e-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2-\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0af9-\u0aff\u0b01-\u0b03\u0b05-\u0b0c\u0b0f-\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32-\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47-\u0b48\u0b4b-\u0b4d\u0b56-\u0b57\u0b5c-\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82-\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99-\u0b9a\u0b9c\u0b9e-\u0b9f\u0ba3-\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c00-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c58-\u0c5a\u0c60-\u0c63\u0c66-\u0c6f\u0c80-\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5-\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1-\u0cf2\u0d00-\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d54-\u0d57\u0d5f-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82-\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2-\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81-\u0e82\u0e84\u0e87-\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa-\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18-\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1369-\u1371\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772-\u1773\u1780-\u17d3\u17d7\u17dc-\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1878\u1880-\u18aa\u18b0-\u18f5\u1900-\u191e\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19da\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1ab0-\u1abd\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1cd0-\u1cd2\u1cd4-\u1cf9\u1d00-\u1df9\u1dfb-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u203f-\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099-\u309a\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua7b9\ua7f7-\ua827\ua840-\ua873\ua880-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua8fd-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\ua9e0-\ua9fe\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab65\uab70-\uabea\uabec-\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufbb1\ufbd3-\ufc5d\ufc64-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdf9\ufe00-\ufe0f\ufe20-\ufe2f\ufe33-\ufe34\ufe4d-\ufe4f\ufe71\ufe73\ufe77\ufe79\ufe7b\ufe7d\ufe7f-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc\U00010000-\U0001000b\U0001000d-\U00010026\U00010028-\U0001003a\U0001003c-\U0001003d\U0001003f-\U0001004d\U00010050-\U0001005d\U00010080-\U000100fa\U00010140-\U00010174\U000101fd\U00010280-\U0001029c\U000102a0-\U000102d0\U000102e0\U00010300-\U0001031f\U0001032d-\U0001034a\U00010350-\U0001037a\U00010380-\U0001039d\U000103a0-\U000103c3\U000103c8-\U000103cf\U000103d1-\U000103d5\U00010400-\U0001049d\U000104a0-\U000104a9\U000104b0-\U000104d3\U000104d8-\U000104fb\U00010500-\U00010527\U00010530-\U00010563\U00010600-\U00010736\U00010740-\U00010755\U00010760-\U00010767\U00010800-\U00010805\U00010808\U0001080a-\U00010835\U00010837-\U00010838\U0001083c\U0001083f-\U00010855\U00010860-\U00010876\U00010880-\U0001089e\U000108e0-\U000108f2\U000108f4-\U000108f5\U00010900-\U00010915\U00010920-\U00010939\U00010980-\U000109b7\U000109be-\U000109bf\U00010a00-\U00010a03\U00010a05-\U00010a06\U00010a0c-\U00010a13\U00010a15-\U00010a17\U00010a19-\U00010a35\U00010a38-\U00010a3a\U00010a3f\U00010a60-\U00010a7c\U00010a80-\U00010a9c\U00010ac0-\U00010ac7\U00010ac9-\U00010ae6\U00010b00-\U00010b35\U00010b40-\U00010b55\U00010b60-\U00010b72\U00010b80-\U00010b91\U00010c00-\U00010c48\U00010c80-\U00010cb2\U00010cc0-\U00010cf2\U00010d00-\U00010d27\U00010d30-\U00010d39\U00010f00-\U00010f1c\U00010f27\U00010f30-\U00010f50\U00011000-\U00011046\U00011066-\U0001106f\U0001107f-\U000110ba\U000110d0-\U000110e8\U000110f0-\U000110f9\U00011100-\U00011134\U00011136-\U0001113f\U00011144-\U00011146\U00011150-\U00011173\U00011176\U00011180-\U000111c4\U000111c9-\U000111cc\U000111d0-\U000111da\U000111dc\U00011200-\U00011211\U00011213-\U00011237\U0001123e\U00011280-\U00011286\U00011288\U0001128a-\U0001128d\U0001128f-\U0001129d\U0001129f-\U000112a8\U000112b0-\U000112ea\U000112f0-\U000112f9\U00011300-\U00011303\U00011305-\U0001130c\U0001130f-\U00011310\U00011313-\U00011328\U0001132a-\U00011330\U00011332-\U00011333\U00011335-\U00011339\U0001133b-\U00011344\U00011347-\U00011348\U0001134b-\U0001134d\U00011350\U00011357\U0001135d-\U00011363\U00011366-\U0001136c\U00011370-\U00011374\U00011400-\U0001144a\U00011450-\U00011459\U0001145e\U00011480-\U000114c5\U000114c7\U000114d0-\U000114d9\U00011580-\U000115b5\U000115b8-\U000115c0\U000115d8-\U000115dd\U00011600-\U00011640\U00011644\U00011650-\U00011659\U00011680-\U000116b7\U000116c0-\U000116c9\U00011700-\U0001171a\U0001171d-\U0001172b\U00011730-\U00011739\U00011800-\U0001183a\U000118a0-\U000118e9\U000118ff\U00011a00-\U00011a3e\U00011a47\U00011a50-\U00011a83\U00011a86-\U00011a99\U00011a9d\U00011ac0-\U00011af8\U00011c00-\U00011c08\U00011c0a-\U00011c36\U00011c38-\U00011c40\U00011c50-\U00011c59\U00011c72-\U00011c8f\U00011c92-\U00011ca7\U00011ca9-\U00011cb6\U00011d00-\U00011d06\U00011d08-\U00011d09\U00011d0b-\U00011d36\U00011d3a\U00011d3c-\U00011d3d\U00011d3f-\U00011d47\U00011d50-\U00011d59\U00011d60-\U00011d65\U00011d67-\U00011d68\U00011d6a-\U00011d8e\U00011d90-\U00011d91\U00011d93-\U00011d98\U00011da0-\U00011da9\U00011ee0-\U00011ef6\U00012000-\U00012399\U00012400-\U0001246e\U00012480-\U00012543\U00013000-\U0001342e\U00014400-\U00014646\U00016800-\U00016a38\U00016a40-\U00016a5e\U00016a60-\U00016a69\U00016ad0-\U00016aed\U00016af0-\U00016af4\U00016b00-\U00016b36\U00016b40-\U00016b43\U00016b50-\U00016b59\U00016b63-\U00016b77\U00016b7d-\U00016b8f\U00016e40-\U00016e7f\U00016f00-\U00016f44\U00016f50-\U00016f7e\U00016f8f-\U00016f9f\U00016fe0-\U00016fe1\U00017000-\U000187f1\U00018800-\U00018af2\U0001b000-\U0001b11e\U0001b170-\U0001b2fb\U0001bc00-\U0001bc6a\U0001bc70-\U0001bc7c\U0001bc80-\U0001bc88\U0001bc90-\U0001bc99\U0001bc9d-\U0001bc9e\U0001d165-\U0001d169\U0001d16d-\U0001d172\U0001d17b-\U0001d182\U0001d185-\U0001d18b\U0001d1aa-\U0001d1ad\U0001d242-\U0001d244\U0001d400-\U0001d454\U0001d456-\U0001d49c\U0001d49e-\U0001d49f\U0001d4a2\U0001d4a5-\U0001d4a6\U0001d4a9-\U0001d4ac\U0001d4ae-\U0001d4b9\U0001d4bb\U0001d4bd-\U0001d4c3\U0001d4c5-\U0001d505\U0001d507-\U0001d50a\U0001d50d-\U0001d514\U0001d516-\U0001d51c\U0001d51e-\U0001d539\U0001d53b-\U0001d53e\U0001d540-\U0001d544\U0001d546\U0001d54a-\U0001d550\U0001d552-\U0001d6a5\U0001d6a8-\U0001d6c0\U0001d6c2-\U0001d6da\U0001d6dc-\U0001d6fa\U0001d6fc-\U0001d714\U0001d716-\U0001d734\U0001d736-\U0001d74e\U0001d750-\U0001d76e\U0001d770-\U0001d788\U0001d78a-\U0001d7a8\U0001d7aa-\U0001d7c2\U0001d7c4-\U0001d7cb\U0001d7ce-\U0001d7ff\U0001da00-\U0001da36\U0001da3b-\U0001da6c\U0001da75\U0001da84\U0001da9b-\U0001da9f\U0001daa1-\U0001daaf\U0001e000-\U0001e006\U0001e008-\U0001e018\U0001e01b-\U0001e021\U0001e023-\U0001e024\U0001e026-\U0001e02a\U0001e800-\U0001e8c4\U0001e8d0-\U0001e8d6\U0001e900-\U0001e94a\U0001e950-\U0001e959\U0001ee00-\U0001ee03\U0001ee05-\U0001ee1f\U0001ee21-\U0001ee22\U0001ee24\U0001ee27\U0001ee29-\U0001ee32\U0001ee34-\U0001ee37\U0001ee39\U0001ee3b\U0001ee42\U0001ee47\U0001ee49\U0001ee4b\U0001ee4d-\U0001ee4f\U0001ee51-\U0001ee52\U0001ee54\U0001ee57\U0001ee59\U0001ee5b\U0001ee5d\U0001ee5f\U0001ee61-\U0001ee62\U0001ee64\U0001ee67-\U0001ee6a\U0001ee6c-\U0001ee72\U0001ee74-\U0001ee77\U0001ee79-\U0001ee7c\U0001ee7e\U0001ee80-\U0001ee89\U0001ee8b-\U0001ee9b\U0001eea1-\U0001eea3\U0001eea5-\U0001eea9\U0001eeab-\U0001eebb\U00020000-\U0002a6d6\U0002a700-\U0002b734\U0002b740-\U0002b81d\U0002b820-\U0002cea1\U0002ceb0-\U0002ebe0\U0002f800-\U0002fa1d\U000e0100-\U000e01ef' xid_start = 'A-Z_a-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376-\u0377\u037b-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e-\u066f\u0671-\u06d3\u06d5\u06e5-\u06e6\u06ee-\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4-\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f-\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc-\u09dd\u09df-\u09e1\u09f0-\u09f1\u09fc\u0a05-\u0a0a\u0a0f-\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32-\u0a33\u0a35-\u0a36\u0a38-\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2-\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0-\u0ae1\u0af9\u0b05-\u0b0c\u0b0f-\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32-\u0b33\u0b35-\u0b39\u0b3d\u0b5c-\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99-\u0b9a\u0b9c\u0b9e-\u0b9f\u0ba3-\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60-\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0-\u0ce1\u0cf1-\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e40-\u0e46\u0e81-\u0e82\u0e84\u0e87-\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa-\u0eab\u0ead-\u0eb0\u0eb2\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065-\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae-\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5-\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a-\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7b9\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd-\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5-\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab65\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufbb1\ufbd3-\ufc5d\ufc64-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdf9\ufe71\ufe73\ufe77\ufe79\ufe7b\ufe7d\ufe7f-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uff9d\uffa0-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc\U00010000-\U0001000b\U0001000d-\U00010026\U00010028-\U0001003a\U0001003c-\U0001003d\U0001003f-\U0001004d\U00010050-\U0001005d\U00010080-\U000100fa\U00010140-\U00010174\U00010280-\U0001029c\U000102a0-\U000102d0\U00010300-\U0001031f\U0001032d-\U0001034a\U00010350-\U00010375\U00010380-\U0001039d\U000103a0-\U000103c3\U000103c8-\U000103cf\U000103d1-\U000103d5\U00010400-\U0001049d\U000104b0-\U000104d3\U000104d8-\U000104fb\U00010500-\U00010527\U00010530-\U00010563\U00010600-\U00010736\U00010740-\U00010755\U00010760-\U00010767\U00010800-\U00010805\U00010808\U0001080a-\U00010835\U00010837-\U00010838\U0001083c\U0001083f-\U00010855\U00010860-\U00010876\U00010880-\U0001089e\U000108e0-\U000108f2\U000108f4-\U000108f5\U00010900-\U00010915\U00010920-\U00010939\U00010980-\U000109b7\U000109be-\U000109bf\U00010a00\U00010a10-\U00010a13\U00010a15-\U00010a17\U00010a19-\U00010a35\U00010a60-\U00010a7c\U00010a80-\U00010a9c\U00010ac0-\U00010ac7\U00010ac9-\U00010ae4\U00010b00-\U00010b35\U00010b40-\U00010b55\U00010b60-\U00010b72\U00010b80-\U00010b91\U00010c00-\U00010c48\U00010c80-\U00010cb2\U00010cc0-\U00010cf2\U00010d00-\U00010d23\U00010f00-\U00010f1c\U00010f27\U00010f30-\U00010f45\U00011003-\U00011037\U00011083-\U000110af\U000110d0-\U000110e8\U00011103-\U00011126\U00011144\U00011150-\U00011172\U00011176\U00011183-\U000111b2\U000111c1-\U000111c4\U000111da\U000111dc\U00011200-\U00011211\U00011213-\U0001122b\U00011280-\U00011286\U00011288\U0001128a-\U0001128d\U0001128f-\U0001129d\U0001129f-\U000112a8\U000112b0-\U000112de\U00011305-\U0001130c\U0001130f-\U00011310\U00011313-\U00011328\U0001132a-\U00011330\U00011332-\U00011333\U00011335-\U00011339\U0001133d\U00011350\U0001135d-\U00011361\U00011400-\U00011434\U00011447-\U0001144a\U00011480-\U000114af\U000114c4-\U000114c5\U000114c7\U00011580-\U000115ae\U000115d8-\U000115db\U00011600-\U0001162f\U00011644\U00011680-\U000116aa\U00011700-\U0001171a\U00011800-\U0001182b\U000118a0-\U000118df\U000118ff\U00011a00\U00011a0b-\U00011a32\U00011a3a\U00011a50\U00011a5c-\U00011a83\U00011a86-\U00011a89\U00011a9d\U00011ac0-\U00011af8\U00011c00-\U00011c08\U00011c0a-\U00011c2e\U00011c40\U00011c72-\U00011c8f\U00011d00-\U00011d06\U00011d08-\U00011d09\U00011d0b-\U00011d30\U00011d46\U00011d60-\U00011d65\U00011d67-\U00011d68\U00011d6a-\U00011d89\U00011d98\U00011ee0-\U00011ef2\U00012000-\U00012399\U00012400-\U0001246e\U00012480-\U00012543\U00013000-\U0001342e\U00014400-\U00014646\U00016800-\U00016a38\U00016a40-\U00016a5e\U00016ad0-\U00016aed\U00016b00-\U00016b2f\U00016b40-\U00016b43\U00016b63-\U00016b77\U00016b7d-\U00016b8f\U00016e40-\U00016e7f\U00016f00-\U00016f44\U00016f50\U00016f93-\U00016f9f\U00016fe0-\U00016fe1\U00017000-\U000187f1\U00018800-\U00018af2\U0001b000-\U0001b11e\U0001b170-\U0001b2fb\U0001bc00-\U0001bc6a\U0001bc70-\U0001bc7c\U0001bc80-\U0001bc88\U0001bc90-\U0001bc99\U0001d400-\U0001d454\U0001d456-\U0001d49c\U0001d49e-\U0001d49f\U0001d4a2\U0001d4a5-\U0001d4a6\U0001d4a9-\U0001d4ac\U0001d4ae-\U0001d4b9\U0001d4bb\U0001d4bd-\U0001d4c3\U0001d4c5-\U0001d505\U0001d507-\U0001d50a\U0001d50d-\U0001d514\U0001d516-\U0001d51c\U0001d51e-\U0001d539\U0001d53b-\U0001d53e\U0001d540-\U0001d544\U0001d546\U0001d54a-\U0001d550\U0001d552-\U0001d6a5\U0001d6a8-\U0001d6c0\U0001d6c2-\U0001d6da\U0001d6dc-\U0001d6fa\U0001d6fc-\U0001d714\U0001d716-\U0001d734\U0001d736-\U0001d74e\U0001d750-\U0001d76e\U0001d770-\U0001d788\U0001d78a-\U0001d7a8\U0001d7aa-\U0001d7c2\U0001d7c4-\U0001d7cb\U0001e800-\U0001e8c4\U0001e900-\U0001e943\U0001ee00-\U0001ee03\U0001ee05-\U0001ee1f\U0001ee21-\U0001ee22\U0001ee24\U0001ee27\U0001ee29-\U0001ee32\U0001ee34-\U0001ee37\U0001ee39\U0001ee3b\U0001ee42\U0001ee47\U0001ee49\U0001ee4b\U0001ee4d-\U0001ee4f\U0001ee51-\U0001ee52\U0001ee54\U0001ee57\U0001ee59\U0001ee5b\U0001ee5d\U0001ee5f\U0001ee61-\U0001ee62\U0001ee64\U0001ee67-\U0001ee6a\U0001ee6c-\U0001ee72\U0001ee74-\U0001ee77\U0001ee79-\U0001ee7c\U0001ee7e\U0001ee80-\U0001ee89\U0001ee8b-\U0001ee9b\U0001eea1-\U0001eea3\U0001eea5-\U0001eea9\U0001eeab-\U0001eebb\U00020000-\U0002a6d6\U0002a700-\U0002b734\U0002b740-\U0002b81d\U0002b820-\U0002cea1\U0002ceb0-\U0002ebe0\U0002f800-\U0002fa1d' cats = ['Cc', 'Cf', 'Cn', 'Co', 'Cs', 'Ll', 'Lm', 'Lo', 'Lt', 'Lu', 'Mc', 'Me', 'Mn', 'Nd', 'Nl', 'No', 'Pc', 'Pd', 'Pe', 'Pf', 'Pi', 'Po', 'Ps', 'Sc', 'Sk', 'Sm', 'So', 'Zl', 'Zp', 'Zs'] # Generated from unidata 11.0.0 def combine(*args): return ''.join(globals()[cat] for cat in args) def allexcept(*args): newcats = cats[:] for arg in args: newcats.remove(arg) return ''.join(globals()[cat] for cat in newcats) def _handle_runs(char_list): # pragma: no cover buf = [] for c in char_list: if len(c) == 1: if buf and buf[-1][1] == chr(ord(c)-1): buf[-1] = (buf[-1][0], c) else: buf.append((c, c)) else: buf.append((c, c)) for a, b in buf: if a == b: yield a else: yield f'{a}-{b}' if __name__ == '__main__': # pragma: no cover import unicodedata categories = {'xid_start': [], 'xid_continue': []} with open(__file__, encoding='utf-8') as fp: content = fp.read() header = content[:content.find('Cc =')] footer = content[content.find("def combine("):] for code in range(0x110000): c = chr(code) cat = unicodedata.category(c) if ord(c) == 0xdc00: # Hack to avoid combining this combining with the preceding high # surrogate, 0xdbff, when doing a repr. c = '\\' + c elif ord(c) in (0x2d, 0x5b, 0x5c, 0x5d, 0x5e): # Escape regex metachars. c = '\\' + c categories.setdefault(cat, []).append(c) # XID_START and XID_CONTINUE are special categories used for matching # identifiers in Python 3. if c.isidentifier(): categories['xid_start'].append(c) if ('a' + c).isidentifier(): categories['xid_continue'].append(c) with open(__file__, 'w', encoding='utf-8') as fp: fp.write(header) for cat in sorted(categories): val = ''.join(_handle_runs(categories[cat])) fp.write(f'{cat} = {val!a}\n\n') cats = sorted(categories) cats.remove('xid_start') cats.remove('xid_continue') fp.write(f'cats = {cats!r}\n\n') fp.write(f'# Generated from unidata {unicodedata.unidata_version}\n\n') fp.write(footer) ================================================ FILE: src/pip/_vendor/pygments/util.py ================================================ """ pygments.util ~~~~~~~~~~~~~ Utility functions. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from io import TextIOWrapper split_path_re = re.compile(r'[/\\ ]') doctype_lookup_re = re.compile(r''' ]*> ''', re.DOTALL | re.MULTILINE | re.VERBOSE) tag_re = re.compile(r'<(.+?)(\s.*?)?>.*?', re.IGNORECASE | re.DOTALL | re.MULTILINE) xml_decl_re = re.compile(r'\s*<\?xml[^>]*\?>', re.I) class ClassNotFound(ValueError): """Raised if one of the lookup functions didn't find a matching class.""" class OptionError(Exception): """ This exception will be raised by all option processing functions if the type or value of the argument is not correct. """ def get_choice_opt(options, optname, allowed, default=None, normcase=False): """ If the key `optname` from the dictionary is not in the sequence `allowed`, raise an error, otherwise return it. """ string = options.get(optname, default) if normcase: string = string.lower() if string not in allowed: raise OptionError('Value for option {} must be one of {}'.format(optname, ', '.join(map(str, allowed)))) return string def get_bool_opt(options, optname, default=None): """ Intuitively, this is `options.get(optname, default)`, but restricted to Boolean value. The Booleans can be represented as string, in order to accept Boolean value from the command line arguments. If the key `optname` is present in the dictionary `options` and is not associated with a Boolean, raise an `OptionError`. If it is absent, `default` is returned instead. The valid string values for ``True`` are ``1``, ``yes``, ``true`` and ``on``, the ones for ``False`` are ``0``, ``no``, ``false`` and ``off`` (matched case-insensitively). """ string = options.get(optname, default) if isinstance(string, bool): return string elif isinstance(string, int): return bool(string) elif not isinstance(string, str): raise OptionError(f'Invalid type {string!r} for option {optname}; use ' '1/0, yes/no, true/false, on/off') elif string.lower() in ('1', 'yes', 'true', 'on'): return True elif string.lower() in ('0', 'no', 'false', 'off'): return False else: raise OptionError(f'Invalid value {string!r} for option {optname}; use ' '1/0, yes/no, true/false, on/off') def get_int_opt(options, optname, default=None): """As :func:`get_bool_opt`, but interpret the value as an integer.""" string = options.get(optname, default) try: return int(string) except TypeError: raise OptionError(f'Invalid type {string!r} for option {optname}; you ' 'must give an integer value') except ValueError: raise OptionError(f'Invalid value {string!r} for option {optname}; you ' 'must give an integer value') def get_list_opt(options, optname, default=None): """ If the key `optname` from the dictionary `options` is a string, split it at whitespace and return it. If it is already a list or a tuple, it is returned as a list. """ val = options.get(optname, default) if isinstance(val, str): return val.split() elif isinstance(val, (list, tuple)): return list(val) else: raise OptionError(f'Invalid type {val!r} for option {optname}; you ' 'must give a list value') def docstring_headline(obj): if not obj.__doc__: return '' res = [] for line in obj.__doc__.strip().splitlines(): if line.strip(): res.append(" " + line.strip()) else: break return ''.join(res).lstrip() def make_analysator(f): """Return a static text analyser function that returns float values.""" def text_analyse(text): try: rv = f(text) except Exception: return 0.0 if not rv: return 0.0 try: return min(1.0, max(0.0, float(rv))) except (ValueError, TypeError): return 0.0 text_analyse.__doc__ = f.__doc__ return staticmethod(text_analyse) def shebang_matches(text, regex): r"""Check if the given regular expression matches the last part of the shebang if one exists. >>> from pygments.util import shebang_matches >>> shebang_matches('#!/usr/bin/env python', r'python(2\.\d)?') True >>> shebang_matches('#!/usr/bin/python2.4', r'python(2\.\d)?') True >>> shebang_matches('#!/usr/bin/python-ruby', r'python(2\.\d)?') False >>> shebang_matches('#!/usr/bin/python/ruby', r'python(2\.\d)?') False >>> shebang_matches('#!/usr/bin/startsomethingwith python', ... r'python(2\.\d)?') True It also checks for common windows executable file extensions:: >>> shebang_matches('#!C:\\Python2.4\\Python.exe', r'python(2\.\d)?') True Parameters (``'-f'`` or ``'--foo'`` are ignored so ``'perl'`` does the same as ``'perl -e'``) Note that this method automatically searches the whole string (eg: the regular expression is wrapped in ``'^$'``) """ index = text.find('\n') if index >= 0: first_line = text[:index].lower() else: first_line = text.lower() if first_line.startswith('#!'): try: found = [x for x in split_path_re.split(first_line[2:].strip()) if x and not x.startswith('-')][-1] except IndexError: return False regex = re.compile(rf'^{regex}(\.(exe|cmd|bat|bin))?$', re.IGNORECASE) if regex.search(found) is not None: return True return False def doctype_matches(text, regex): """Check if the doctype matches a regular expression (if present). Note that this method only checks the first part of a DOCTYPE. eg: 'html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"' """ m = doctype_lookup_re.search(text) if m is None: return False doctype = m.group(1) return re.compile(regex, re.I).match(doctype.strip()) is not None def html_doctype_matches(text): """Check if the file looks like it has a html doctype.""" return doctype_matches(text, r'html') _looks_like_xml_cache = {} def looks_like_xml(text): """Check if a doctype exists or if we have some tags.""" if xml_decl_re.match(text): return True key = hash(text) try: return _looks_like_xml_cache[key] except KeyError: m = doctype_lookup_re.search(text) if m is not None: return True rv = tag_re.search(text[:1000]) is not None _looks_like_xml_cache[key] = rv return rv def surrogatepair(c): """Given a unicode character code with length greater than 16 bits, return the two 16 bit surrogate pair. """ # From example D28 of: # http://www.unicode.org/book/ch03.pdf return (0xd7c0 + (c >> 10), (0xdc00 + (c & 0x3ff))) def format_lines(var_name, seq, raw=False, indent_level=0): """Formats a sequence of strings for output.""" lines = [] base_indent = ' ' * indent_level * 4 inner_indent = ' ' * (indent_level + 1) * 4 lines.append(base_indent + var_name + ' = (') if raw: # These should be preformatted reprs of, say, tuples. for i in seq: lines.append(inner_indent + i + ',') else: for i in seq: # Force use of single quotes r = repr(i + '"') lines.append(inner_indent + r[:-2] + r[-1] + ',') lines.append(base_indent + ')') return '\n'.join(lines) def duplicates_removed(it, already_seen=()): """ Returns a list with duplicates removed from the iterable `it`. Order is preserved. """ lst = [] seen = set() for i in it: if i in seen or i in already_seen: continue lst.append(i) seen.add(i) return lst class Future: """Generic class to defer some work. Handled specially in RegexLexerMeta, to support regex string construction at first use. """ def get(self): raise NotImplementedError def guess_decode(text): """Decode *text* with guessed encoding. First try UTF-8; this should fail for non-UTF-8 encodings. Then try the preferred locale encoding. Fall back to latin-1, which always works. """ try: text = text.decode('utf-8') return text, 'utf-8' except UnicodeDecodeError: try: import locale prefencoding = locale.getpreferredencoding() text = text.decode() return text, prefencoding except (UnicodeDecodeError, LookupError): text = text.decode('latin1') return text, 'latin1' def guess_decode_from_terminal(text, term): """Decode *text* coming from terminal *term*. First try the terminal encoding, if given. Then try UTF-8. Then try the preferred locale encoding. Fall back to latin-1, which always works. """ if getattr(term, 'encoding', None): try: text = text.decode(term.encoding) except UnicodeDecodeError: pass else: return text, term.encoding return guess_decode(text) def terminal_encoding(term): """Return our best guess of encoding for the given *term*.""" if getattr(term, 'encoding', None): return term.encoding import locale return locale.getpreferredencoding() class UnclosingTextIOWrapper(TextIOWrapper): # Don't close underlying buffer on destruction. def close(self): self.flush() ================================================ FILE: src/pip/_vendor/pygments.pyi ================================================ from pygments import * ================================================ FILE: src/pip/_vendor/pyproject_hooks/LICENSE ================================================ The MIT License (MIT) Copyright (c) 2017 Thomas Kluyver Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: src/pip/_vendor/pyproject_hooks/__init__.py ================================================ """Wrappers to call pyproject.toml-based build backend hooks. """ from typing import TYPE_CHECKING from ._impl import ( BackendUnavailable, BuildBackendHookCaller, HookMissing, UnsupportedOperation, default_subprocess_runner, quiet_subprocess_runner, ) __version__ = "1.2.0" __all__ = [ "BackendUnavailable", "BackendInvalid", "HookMissing", "UnsupportedOperation", "default_subprocess_runner", "quiet_subprocess_runner", "BuildBackendHookCaller", ] BackendInvalid = BackendUnavailable # Deprecated alias, previously a separate exception if TYPE_CHECKING: from ._impl import SubprocessRunner __all__ += ["SubprocessRunner"] ================================================ FILE: src/pip/_vendor/pyproject_hooks/_impl.py ================================================ import json import os import sys import tempfile from contextlib import contextmanager from os.path import abspath from os.path import join as pjoin from subprocess import STDOUT, check_call, check_output from typing import TYPE_CHECKING, Any, Iterator, Mapping, Optional, Sequence from ._in_process import _in_proc_script_path if TYPE_CHECKING: from typing import Protocol class SubprocessRunner(Protocol): """A protocol for the subprocess runner.""" def __call__( self, cmd: Sequence[str], cwd: Optional[str] = None, extra_environ: Optional[Mapping[str, str]] = None, ) -> None: ... def write_json(obj: Mapping[str, Any], path: str, **kwargs) -> None: with open(path, "w", encoding="utf-8") as f: json.dump(obj, f, **kwargs) def read_json(path: str) -> Mapping[str, Any]: with open(path, encoding="utf-8") as f: return json.load(f) class BackendUnavailable(Exception): """Will be raised if the backend cannot be imported in the hook process.""" def __init__( self, traceback: str, message: Optional[str] = None, backend_name: Optional[str] = None, backend_path: Optional[Sequence[str]] = None, ) -> None: # Preserving arg order for the sake of API backward compatibility. self.backend_name = backend_name self.backend_path = backend_path self.traceback = traceback super().__init__(message or "Error while importing backend") class HookMissing(Exception): """Will be raised on missing hooks (if a fallback can't be used).""" def __init__(self, hook_name: str) -> None: super().__init__(hook_name) self.hook_name = hook_name class UnsupportedOperation(Exception): """May be raised by build_sdist if the backend indicates that it can't.""" def __init__(self, traceback: str) -> None: self.traceback = traceback def default_subprocess_runner( cmd: Sequence[str], cwd: Optional[str] = None, extra_environ: Optional[Mapping[str, str]] = None, ) -> None: """The default method of calling the wrapper subprocess. This uses :func:`subprocess.check_call` under the hood. """ env = os.environ.copy() if extra_environ: env.update(extra_environ) check_call(cmd, cwd=cwd, env=env) def quiet_subprocess_runner( cmd: Sequence[str], cwd: Optional[str] = None, extra_environ: Optional[Mapping[str, str]] = None, ) -> None: """Call the subprocess while suppressing output. This uses :func:`subprocess.check_output` under the hood. """ env = os.environ.copy() if extra_environ: env.update(extra_environ) check_output(cmd, cwd=cwd, env=env, stderr=STDOUT) def norm_and_check(source_tree: str, requested: str) -> str: """Normalise and check a backend path. Ensure that the requested backend path is specified as a relative path, and resolves to a location under the given source tree. Return an absolute version of the requested path. """ if os.path.isabs(requested): raise ValueError("paths must be relative") abs_source = os.path.abspath(source_tree) abs_requested = os.path.normpath(os.path.join(abs_source, requested)) # We have to use commonprefix for Python 2.7 compatibility. So we # normalise case to avoid problems because commonprefix is a character # based comparison :-( norm_source = os.path.normcase(abs_source) norm_requested = os.path.normcase(abs_requested) if os.path.commonprefix([norm_source, norm_requested]) != norm_source: raise ValueError("paths must be inside source tree") return abs_requested class BuildBackendHookCaller: """A wrapper to call the build backend hooks for a source directory.""" def __init__( self, source_dir: str, build_backend: str, backend_path: Optional[Sequence[str]] = None, runner: Optional["SubprocessRunner"] = None, python_executable: Optional[str] = None, ) -> None: """ :param source_dir: The source directory to invoke the build backend for :param build_backend: The build backend spec :param backend_path: Additional path entries for the build backend spec :param runner: The :ref:`subprocess runner ` to use :param python_executable: The Python executable used to invoke the build backend """ if runner is None: runner = default_subprocess_runner self.source_dir = abspath(source_dir) self.build_backend = build_backend if backend_path: backend_path = [norm_and_check(self.source_dir, p) for p in backend_path] self.backend_path = backend_path self._subprocess_runner = runner if not python_executable: python_executable = sys.executable self.python_executable = python_executable @contextmanager def subprocess_runner(self, runner: "SubprocessRunner") -> Iterator[None]: """A context manager for temporarily overriding the default :ref:`subprocess runner `. :param runner: The new subprocess runner to use within the context. .. code-block:: python hook_caller = BuildBackendHookCaller(...) with hook_caller.subprocess_runner(quiet_subprocess_runner): ... """ prev = self._subprocess_runner self._subprocess_runner = runner try: yield finally: self._subprocess_runner = prev def _supported_features(self) -> Sequence[str]: """Return the list of optional features supported by the backend.""" return self._call_hook("_supported_features", {}) def get_requires_for_build_wheel( self, config_settings: Optional[Mapping[str, Any]] = None, ) -> Sequence[str]: """Get additional dependencies required for building a wheel. :param config_settings: The configuration settings for the build backend :returns: A list of :pep:`dependency specifiers <508>`. .. admonition:: Fallback If the build backend does not defined a hook with this name, an empty list will be returned. """ return self._call_hook( "get_requires_for_build_wheel", {"config_settings": config_settings} ) def prepare_metadata_for_build_wheel( self, metadata_directory: str, config_settings: Optional[Mapping[str, Any]] = None, _allow_fallback: bool = True, ) -> str: """Prepare a ``*.dist-info`` folder with metadata for this project. :param metadata_directory: The directory to write the metadata to :param config_settings: The configuration settings for the build backend :param _allow_fallback: Whether to allow the fallback to building a wheel and extracting the metadata from it. Should be passed as a keyword argument only. :returns: Name of the newly created subfolder within ``metadata_directory``, containing the metadata. .. admonition:: Fallback If the build backend does not define a hook with this name and ``_allow_fallback`` is truthy, the backend will be asked to build a wheel via the ``build_wheel`` hook and the dist-info extracted from that will be returned. """ return self._call_hook( "prepare_metadata_for_build_wheel", { "metadata_directory": abspath(metadata_directory), "config_settings": config_settings, "_allow_fallback": _allow_fallback, }, ) def build_wheel( self, wheel_directory: str, config_settings: Optional[Mapping[str, Any]] = None, metadata_directory: Optional[str] = None, ) -> str: """Build a wheel from this project. :param wheel_directory: The directory to write the wheel to :param config_settings: The configuration settings for the build backend :param metadata_directory: The directory to reuse existing metadata from :returns: The name of the newly created wheel within ``wheel_directory``. .. admonition:: Interaction with fallback If the ``build_wheel`` hook was called in the fallback for :meth:`prepare_metadata_for_build_wheel`, the build backend would not be invoked. Instead, the previously built wheel will be copied to ``wheel_directory`` and the name of that file will be returned. """ if metadata_directory is not None: metadata_directory = abspath(metadata_directory) return self._call_hook( "build_wheel", { "wheel_directory": abspath(wheel_directory), "config_settings": config_settings, "metadata_directory": metadata_directory, }, ) def get_requires_for_build_editable( self, config_settings: Optional[Mapping[str, Any]] = None, ) -> Sequence[str]: """Get additional dependencies required for building an editable wheel. :param config_settings: The configuration settings for the build backend :returns: A list of :pep:`dependency specifiers <508>`. .. admonition:: Fallback If the build backend does not defined a hook with this name, an empty list will be returned. """ return self._call_hook( "get_requires_for_build_editable", {"config_settings": config_settings} ) def prepare_metadata_for_build_editable( self, metadata_directory: str, config_settings: Optional[Mapping[str, Any]] = None, _allow_fallback: bool = True, ) -> Optional[str]: """Prepare a ``*.dist-info`` folder with metadata for this project. :param metadata_directory: The directory to write the metadata to :param config_settings: The configuration settings for the build backend :param _allow_fallback: Whether to allow the fallback to building a wheel and extracting the metadata from it. Should be passed as a keyword argument only. :returns: Name of the newly created subfolder within ``metadata_directory``, containing the metadata. .. admonition:: Fallback If the build backend does not define a hook with this name and ``_allow_fallback`` is truthy, the backend will be asked to build a wheel via the ``build_editable`` hook and the dist-info extracted from that will be returned. """ return self._call_hook( "prepare_metadata_for_build_editable", { "metadata_directory": abspath(metadata_directory), "config_settings": config_settings, "_allow_fallback": _allow_fallback, }, ) def build_editable( self, wheel_directory: str, config_settings: Optional[Mapping[str, Any]] = None, metadata_directory: Optional[str] = None, ) -> str: """Build an editable wheel from this project. :param wheel_directory: The directory to write the wheel to :param config_settings: The configuration settings for the build backend :param metadata_directory: The directory to reuse existing metadata from :returns: The name of the newly created wheel within ``wheel_directory``. .. admonition:: Interaction with fallback If the ``build_editable`` hook was called in the fallback for :meth:`prepare_metadata_for_build_editable`, the build backend would not be invoked. Instead, the previously built wheel will be copied to ``wheel_directory`` and the name of that file will be returned. """ if metadata_directory is not None: metadata_directory = abspath(metadata_directory) return self._call_hook( "build_editable", { "wheel_directory": abspath(wheel_directory), "config_settings": config_settings, "metadata_directory": metadata_directory, }, ) def get_requires_for_build_sdist( self, config_settings: Optional[Mapping[str, Any]] = None, ) -> Sequence[str]: """Get additional dependencies required for building an sdist. :returns: A list of :pep:`dependency specifiers <508>`. """ return self._call_hook( "get_requires_for_build_sdist", {"config_settings": config_settings} ) def build_sdist( self, sdist_directory: str, config_settings: Optional[Mapping[str, Any]] = None, ) -> str: """Build an sdist from this project. :returns: The name of the newly created sdist within ``wheel_directory``. """ return self._call_hook( "build_sdist", { "sdist_directory": abspath(sdist_directory), "config_settings": config_settings, }, ) def _call_hook(self, hook_name: str, kwargs: Mapping[str, Any]) -> Any: extra_environ = {"_PYPROJECT_HOOKS_BUILD_BACKEND": self.build_backend} if self.backend_path: backend_path = os.pathsep.join(self.backend_path) extra_environ["_PYPROJECT_HOOKS_BACKEND_PATH"] = backend_path with tempfile.TemporaryDirectory() as td: hook_input = {"kwargs": kwargs} write_json(hook_input, pjoin(td, "input.json"), indent=2) # Run the hook in a subprocess with _in_proc_script_path() as script: python = self.python_executable self._subprocess_runner( [python, abspath(str(script)), hook_name, td], cwd=self.source_dir, extra_environ=extra_environ, ) data = read_json(pjoin(td, "output.json")) if data.get("unsupported"): raise UnsupportedOperation(data.get("traceback", "")) if data.get("no_backend"): raise BackendUnavailable( data.get("traceback", ""), message=data.get("backend_error", ""), backend_name=self.build_backend, backend_path=self.backend_path, ) if data.get("hook_missing"): raise HookMissing(data.get("missing_hook_name") or hook_name) return data["return_val"] ================================================ FILE: src/pip/_vendor/pyproject_hooks/_in_process/__init__.py ================================================ """This is a subpackage because the directory is on sys.path for _in_process.py The subpackage should stay as empty as possible to avoid shadowing modules that the backend might import. """ import importlib.resources as resources try: resources.files except AttributeError: # Python 3.8 compatibility def _in_proc_script_path(): return resources.path(__package__, "_in_process.py") else: def _in_proc_script_path(): return resources.as_file( resources.files(__package__).joinpath("_in_process.py") ) ================================================ FILE: src/pip/_vendor/pyproject_hooks/_in_process/_in_process.py ================================================ """This is invoked in a subprocess to call the build backend hooks. It expects: - Command line args: hook_name, control_dir - Environment variables: _PYPROJECT_HOOKS_BUILD_BACKEND=entry.point:spec _PYPROJECT_HOOKS_BACKEND_PATH=paths (separated with os.pathsep) - control_dir/input.json: - {"kwargs": {...}} Results: - control_dir/output.json - {"return_val": ...} """ import json import os import os.path import re import shutil import sys import traceback from glob import glob from importlib import import_module from importlib.machinery import PathFinder from os.path import join as pjoin # This file is run as a script, and `import wrappers` is not zip-safe, so we # include write_json() and read_json() from wrappers.py. def write_json(obj, path, **kwargs): with open(path, "w", encoding="utf-8") as f: json.dump(obj, f, **kwargs) def read_json(path): with open(path, encoding="utf-8") as f: return json.load(f) class BackendUnavailable(Exception): """Raised if we cannot import the backend""" def __init__(self, message, traceback=None): super().__init__(message) self.message = message self.traceback = traceback class HookMissing(Exception): """Raised if a hook is missing and we are not executing the fallback""" def __init__(self, hook_name=None): super().__init__(hook_name) self.hook_name = hook_name def _build_backend(): """Find and load the build backend""" backend_path = os.environ.get("_PYPROJECT_HOOKS_BACKEND_PATH") ep = os.environ["_PYPROJECT_HOOKS_BUILD_BACKEND"] mod_path, _, obj_path = ep.partition(":") if backend_path: # Ensure in-tree backend directories have the highest priority when importing. extra_pathitems = backend_path.split(os.pathsep) sys.meta_path.insert(0, _BackendPathFinder(extra_pathitems, mod_path)) try: obj = import_module(mod_path) except ImportError: msg = f"Cannot import {mod_path!r}" raise BackendUnavailable(msg, traceback.format_exc()) if obj_path: for path_part in obj_path.split("."): obj = getattr(obj, path_part) return obj class _BackendPathFinder: """Implements the MetaPathFinder interface to locate modules in ``backend-path``. Since the environment provided by the frontend can contain all sorts of MetaPathFinders, the only way to ensure the backend is loaded from the right place is to prepend our own. """ def __init__(self, backend_path, backend_module): self.backend_path = backend_path self.backend_module = backend_module self.backend_parent, _, _ = backend_module.partition(".") def find_spec(self, fullname, _path, _target=None): if "." in fullname: # Rely on importlib to find nested modules based on parent's path return None # Ignore other items in _path or sys.path and use backend_path instead: spec = PathFinder.find_spec(fullname, path=self.backend_path) if spec is None and fullname == self.backend_parent: # According to the spec, the backend MUST be loaded from backend-path. # Therefore, we can halt the import machinery and raise a clean error. msg = f"Cannot find module {self.backend_module!r} in {self.backend_path!r}" raise BackendUnavailable(msg) return spec if sys.version_info >= (3, 8): def find_distributions(self, context=None): # Delayed import: Python 3.7 does not contain importlib.metadata from importlib.metadata import DistributionFinder, MetadataPathFinder context = DistributionFinder.Context(path=self.backend_path) return MetadataPathFinder.find_distributions(context=context) def _supported_features(): """Return the list of options features supported by the backend. Returns a list of strings. The only possible value is 'build_editable'. """ backend = _build_backend() features = [] if hasattr(backend, "build_editable"): features.append("build_editable") return features def get_requires_for_build_wheel(config_settings): """Invoke the optional get_requires_for_build_wheel hook Returns [] if the hook is not defined. """ backend = _build_backend() try: hook = backend.get_requires_for_build_wheel except AttributeError: return [] else: return hook(config_settings) def get_requires_for_build_editable(config_settings): """Invoke the optional get_requires_for_build_editable hook Returns [] if the hook is not defined. """ backend = _build_backend() try: hook = backend.get_requires_for_build_editable except AttributeError: return [] else: return hook(config_settings) def prepare_metadata_for_build_wheel( metadata_directory, config_settings, _allow_fallback ): """Invoke optional prepare_metadata_for_build_wheel Implements a fallback by building a wheel if the hook isn't defined, unless _allow_fallback is False in which case HookMissing is raised. """ backend = _build_backend() try: hook = backend.prepare_metadata_for_build_wheel except AttributeError: if not _allow_fallback: raise HookMissing() else: return hook(metadata_directory, config_settings) # fallback to build_wheel outside the try block to avoid exception chaining # which can be confusing to users and is not relevant whl_basename = backend.build_wheel(metadata_directory, config_settings) return _get_wheel_metadata_from_wheel( whl_basename, metadata_directory, config_settings ) def prepare_metadata_for_build_editable( metadata_directory, config_settings, _allow_fallback ): """Invoke optional prepare_metadata_for_build_editable Implements a fallback by building an editable wheel if the hook isn't defined, unless _allow_fallback is False in which case HookMissing is raised. """ backend = _build_backend() try: hook = backend.prepare_metadata_for_build_editable except AttributeError: if not _allow_fallback: raise HookMissing() try: build_hook = backend.build_editable except AttributeError: raise HookMissing(hook_name="build_editable") else: whl_basename = build_hook(metadata_directory, config_settings) return _get_wheel_metadata_from_wheel( whl_basename, metadata_directory, config_settings ) else: return hook(metadata_directory, config_settings) WHEEL_BUILT_MARKER = "PYPROJECT_HOOKS_ALREADY_BUILT_WHEEL" def _dist_info_files(whl_zip): """Identify the .dist-info folder inside a wheel ZipFile.""" res = [] for path in whl_zip.namelist(): m = re.match(r"[^/\\]+-[^/\\]+\.dist-info/", path) if m: res.append(path) if res: return res raise Exception("No .dist-info folder found in wheel") def _get_wheel_metadata_from_wheel(whl_basename, metadata_directory, config_settings): """Extract the metadata from a wheel. Fallback for when the build backend does not define the 'get_wheel_metadata' hook. """ from zipfile import ZipFile with open(os.path.join(metadata_directory, WHEEL_BUILT_MARKER), "wb"): pass # Touch marker file whl_file = os.path.join(metadata_directory, whl_basename) with ZipFile(whl_file) as zipf: dist_info = _dist_info_files(zipf) zipf.extractall(path=metadata_directory, members=dist_info) return dist_info[0].split("/")[0] def _find_already_built_wheel(metadata_directory): """Check for a wheel already built during the get_wheel_metadata hook.""" if not metadata_directory: return None metadata_parent = os.path.dirname(metadata_directory) if not os.path.isfile(pjoin(metadata_parent, WHEEL_BUILT_MARKER)): return None whl_files = glob(os.path.join(metadata_parent, "*.whl")) if not whl_files: print("Found wheel built marker, but no .whl files") return None if len(whl_files) > 1: print( "Found multiple .whl files; unspecified behaviour. " "Will call build_wheel." ) return None # Exactly one .whl file return whl_files[0] def build_wheel(wheel_directory, config_settings, metadata_directory=None): """Invoke the mandatory build_wheel hook. If a wheel was already built in the prepare_metadata_for_build_wheel fallback, this will copy it rather than rebuilding the wheel. """ prebuilt_whl = _find_already_built_wheel(metadata_directory) if prebuilt_whl: shutil.copy2(prebuilt_whl, wheel_directory) return os.path.basename(prebuilt_whl) return _build_backend().build_wheel( wheel_directory, config_settings, metadata_directory ) def build_editable(wheel_directory, config_settings, metadata_directory=None): """Invoke the optional build_editable hook. If a wheel was already built in the prepare_metadata_for_build_editable fallback, this will copy it rather than rebuilding the wheel. """ backend = _build_backend() try: hook = backend.build_editable except AttributeError: raise HookMissing() else: prebuilt_whl = _find_already_built_wheel(metadata_directory) if prebuilt_whl: shutil.copy2(prebuilt_whl, wheel_directory) return os.path.basename(prebuilt_whl) return hook(wheel_directory, config_settings, metadata_directory) def get_requires_for_build_sdist(config_settings): """Invoke the optional get_requires_for_build_wheel hook Returns [] if the hook is not defined. """ backend = _build_backend() try: hook = backend.get_requires_for_build_sdist except AttributeError: return [] else: return hook(config_settings) class _DummyException(Exception): """Nothing should ever raise this exception""" class GotUnsupportedOperation(Exception): """For internal use when backend raises UnsupportedOperation""" def __init__(self, traceback): self.traceback = traceback def build_sdist(sdist_directory, config_settings): """Invoke the mandatory build_sdist hook.""" backend = _build_backend() try: return backend.build_sdist(sdist_directory, config_settings) except getattr(backend, "UnsupportedOperation", _DummyException): raise GotUnsupportedOperation(traceback.format_exc()) HOOK_NAMES = { "get_requires_for_build_wheel", "prepare_metadata_for_build_wheel", "build_wheel", "get_requires_for_build_editable", "prepare_metadata_for_build_editable", "build_editable", "get_requires_for_build_sdist", "build_sdist", "_supported_features", } def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) # Remove the parent directory from sys.path to avoid polluting the backend # import namespace with this directory. here = os.path.dirname(__file__) if here in sys.path: sys.path.remove(here) hook = globals()[hook_name] hook_input = read_json(pjoin(control_dir, "input.json")) json_out = {"unsupported": False, "return_val": None} try: json_out["return_val"] = hook(**hook_input["kwargs"]) except BackendUnavailable as e: json_out["no_backend"] = True json_out["traceback"] = e.traceback json_out["backend_error"] = e.message except GotUnsupportedOperation as e: json_out["unsupported"] = True json_out["traceback"] = e.traceback except HookMissing as e: json_out["hook_missing"] = True json_out["missing_hook_name"] = e.hook_name or hook_name write_json(json_out, pjoin(control_dir, "output.json"), indent=2) if __name__ == "__main__": main() ================================================ FILE: src/pip/_vendor/pyproject_hooks/py.typed ================================================ ================================================ FILE: src/pip/_vendor/requests/LICENSE ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. ================================================ FILE: src/pip/_vendor/requests/__init__.py ================================================ # __ # /__) _ _ _ _ _/ _ # / ( (- (/ (/ (- _) / _) # / """ Requests HTTP Library ~~~~~~~~~~~~~~~~~~~~~ Requests is an HTTP library, written in Python, for human beings. Basic GET usage: >>> import requests >>> r = requests.get('https://www.python.org') >>> r.status_code 200 >>> b'Python is a programming language' in r.content True ... or POST: >>> payload = dict(key1='value1', key2='value2') >>> r = requests.post('https://httpbin.org/post', data=payload) >>> print(r.text) { ... "form": { "key1": "value1", "key2": "value2" }, ... } The other HTTP methods are supported - see `requests.api`. Full documentation is at . :copyright: (c) 2017 by Kenneth Reitz. :license: Apache 2.0, see LICENSE for more details. """ import warnings from pip._vendor import urllib3 from .exceptions import RequestsDependencyWarning charset_normalizer_version = None chardet_version = None def check_compatibility(urllib3_version, chardet_version, charset_normalizer_version): urllib3_version = urllib3_version.split(".") assert urllib3_version != ["dev"] # Verify urllib3 isn't installed from git. # Sometimes, urllib3 only reports its version as 16.1. if len(urllib3_version) == 2: urllib3_version.append("0") # Check urllib3 for compatibility. major, minor, patch = urllib3_version # noqa: F811 major, minor, patch = int(major), int(minor), int(patch) # urllib3 >= 1.21.1 assert major >= 1 if major == 1: assert minor >= 21 # Check charset_normalizer for compatibility. if chardet_version: major, minor, patch = chardet_version.split(".")[:3] major, minor, patch = int(major), int(minor), int(patch) # chardet_version >= 3.0.2, < 6.0.0 assert (3, 0, 2) <= (major, minor, patch) < (6, 0, 0) elif charset_normalizer_version: major, minor, patch = charset_normalizer_version.split(".")[:3] major, minor, patch = int(major), int(minor), int(patch) # charset_normalizer >= 2.0.0 < 4.0.0 assert (2, 0, 0) <= (major, minor, patch) < (4, 0, 0) else: # pip does not need or use character detection pass def _check_cryptography(cryptography_version): # cryptography < 1.3.4 try: cryptography_version = list(map(int, cryptography_version.split("."))) except ValueError: return if cryptography_version < [1, 3, 4]: warning = "Old version of cryptography ({}) may cause slowdown.".format( cryptography_version ) warnings.warn(warning, RequestsDependencyWarning) # Check imported dependencies for compatibility. try: check_compatibility( urllib3.__version__, chardet_version, charset_normalizer_version ) except (AssertionError, ValueError): warnings.warn( "urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported " "version!".format( urllib3.__version__, chardet_version, charset_normalizer_version ), RequestsDependencyWarning, ) # Attempt to enable urllib3's fallback for SNI support # if the standard library doesn't support SNI or the # 'ssl' library isn't available. try: # Note: This logic prevents upgrading cryptography on Windows, if imported # as part of pip. from pip._internal.utils.compat import WINDOWS if not WINDOWS: raise ImportError("pip internals: don't import cryptography on Windows") try: import ssl except ImportError: ssl = None if not getattr(ssl, "HAS_SNI", False): from pip._vendor.urllib3.contrib import pyopenssl pyopenssl.inject_into_urllib3() # Check cryptography version from cryptography import __version__ as cryptography_version _check_cryptography(cryptography_version) except ImportError: pass # urllib3's DependencyWarnings should be silenced. from pip._vendor.urllib3.exceptions import DependencyWarning warnings.simplefilter("ignore", DependencyWarning) # Set default logging handler to avoid "No handler found" warnings. import logging from logging import NullHandler from . import packages, utils from .__version__ import ( __author__, __author_email__, __build__, __cake__, __copyright__, __description__, __license__, __title__, __url__, __version__, ) from .api import delete, get, head, options, patch, post, put, request from .exceptions import ( ConnectionError, ConnectTimeout, FileModeWarning, HTTPError, JSONDecodeError, ReadTimeout, RequestException, Timeout, TooManyRedirects, URLRequired, ) from .models import PreparedRequest, Request, Response from .sessions import Session, session from .status_codes import codes logging.getLogger(__name__).addHandler(NullHandler()) # FileModeWarnings go off per the default. warnings.simplefilter("default", FileModeWarning, append=True) ================================================ FILE: src/pip/_vendor/requests/__version__.py ================================================ # .-. .-. .-. . . .-. .-. .-. .-. # |( |- |.| | | |- `-. | `-. # ' ' `-' `-`.`-' `-' `-' ' `-' __title__ = "requests" __description__ = "Python HTTP for Humans." __url__ = "https://requests.readthedocs.io" __version__ = "2.32.5" __build__ = 0x023205 __author__ = "Kenneth Reitz" __author_email__ = "me@kennethreitz.org" __license__ = "Apache-2.0" __copyright__ = "Copyright Kenneth Reitz" __cake__ = "\u2728 \U0001f370 \u2728" ================================================ FILE: src/pip/_vendor/requests/_internal_utils.py ================================================ """ requests._internal_utils ~~~~~~~~~~~~~~ Provides utility functions that are consumed internally by Requests which depend on extremely few external helpers (such as compat) """ import re from .compat import builtin_str _VALID_HEADER_NAME_RE_BYTE = re.compile(rb"^[^:\s][^:\r\n]*$") _VALID_HEADER_NAME_RE_STR = re.compile(r"^[^:\s][^:\r\n]*$") _VALID_HEADER_VALUE_RE_BYTE = re.compile(rb"^\S[^\r\n]*$|^$") _VALID_HEADER_VALUE_RE_STR = re.compile(r"^\S[^\r\n]*$|^$") _HEADER_VALIDATORS_STR = (_VALID_HEADER_NAME_RE_STR, _VALID_HEADER_VALUE_RE_STR) _HEADER_VALIDATORS_BYTE = (_VALID_HEADER_NAME_RE_BYTE, _VALID_HEADER_VALUE_RE_BYTE) HEADER_VALIDATORS = { bytes: _HEADER_VALIDATORS_BYTE, str: _HEADER_VALIDATORS_STR, } def to_native_string(string, encoding="ascii"): """Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise. """ if isinstance(string, builtin_str): out = string else: out = string.decode(encoding) return out def unicode_is_ascii(u_string): """Determine if unicode string only contains ASCII characters. :param str u_string: unicode string to check. Must be unicode and not Python 2 `str`. :rtype: bool """ assert isinstance(u_string, str) try: u_string.encode("ascii") return True except UnicodeEncodeError: return False ================================================ FILE: src/pip/_vendor/requests/adapters.py ================================================ """ requests.adapters ~~~~~~~~~~~~~~~~~ This module contains the transport adapters that Requests uses to define and maintain connections. """ import os.path import socket # noqa: F401 import typing import warnings from pip._vendor.urllib3.exceptions import ClosedPoolError, ConnectTimeoutError from pip._vendor.urllib3.exceptions import HTTPError as _HTTPError from pip._vendor.urllib3.exceptions import InvalidHeader as _InvalidHeader from pip._vendor.urllib3.exceptions import ( LocationValueError, MaxRetryError, NewConnectionError, ProtocolError, ) from pip._vendor.urllib3.exceptions import ProxyError as _ProxyError from pip._vendor.urllib3.exceptions import ReadTimeoutError, ResponseError from pip._vendor.urllib3.exceptions import SSLError as _SSLError from pip._vendor.urllib3.poolmanager import PoolManager, proxy_from_url from pip._vendor.urllib3.util import Timeout as TimeoutSauce from pip._vendor.urllib3.util import parse_url from pip._vendor.urllib3.util.retry import Retry from .auth import _basic_auth_str from .compat import basestring, urlparse from .cookies import extract_cookies_to_jar from .exceptions import ( ConnectionError, ConnectTimeout, InvalidHeader, InvalidProxyURL, InvalidSchema, InvalidURL, ProxyError, ReadTimeout, RetryError, SSLError, ) from .models import Response from .structures import CaseInsensitiveDict from .utils import ( DEFAULT_CA_BUNDLE_PATH, extract_zipped_paths, get_auth_from_url, get_encoding_from_headers, prepend_scheme_if_needed, select_proxy, urldefragauth, ) try: from pip._vendor.urllib3.contrib.socks import SOCKSProxyManager except ImportError: def SOCKSProxyManager(*args, **kwargs): raise InvalidSchema("Missing dependencies for SOCKS support.") if typing.TYPE_CHECKING: from .models import PreparedRequest DEFAULT_POOLBLOCK = False DEFAULT_POOLSIZE = 10 DEFAULT_RETRIES = 0 DEFAULT_POOL_TIMEOUT = None def _urllib3_request_context( request: "PreparedRequest", verify: "bool | str | None", client_cert: "typing.Tuple[str, str] | str | None", poolmanager: "PoolManager", ) -> "(typing.Dict[str, typing.Any], typing.Dict[str, typing.Any])": host_params = {} pool_kwargs = {} parsed_request_url = urlparse(request.url) scheme = parsed_request_url.scheme.lower() port = parsed_request_url.port cert_reqs = "CERT_REQUIRED" if verify is False: cert_reqs = "CERT_NONE" elif isinstance(verify, str): if not os.path.isdir(verify): pool_kwargs["ca_certs"] = verify else: pool_kwargs["ca_cert_dir"] = verify pool_kwargs["cert_reqs"] = cert_reqs if client_cert is not None: if isinstance(client_cert, tuple) and len(client_cert) == 2: pool_kwargs["cert_file"] = client_cert[0] pool_kwargs["key_file"] = client_cert[1] else: # According to our docs, we allow users to specify just the client # cert path pool_kwargs["cert_file"] = client_cert host_params = { "scheme": scheme, "host": parsed_request_url.hostname, "port": port, } return host_params, pool_kwargs class BaseAdapter: """The Base Transport Adapter""" def __init__(self): super().__init__() def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. """ raise NotImplementedError def close(self): """Cleans up adapter specific items.""" raise NotImplementedError class HTTPAdapter(BaseAdapter): """The built-in HTTP Adapter for urllib3. Provides a general-case interface for Requests sessions to contact HTTP and HTTPS urls by implementing the Transport Adapter interface. This class will usually be created by the :class:`Session ` class under the covers. :param pool_connections: The number of urllib3 connection pools to cache. :param pool_maxsize: The maximum number of connections to save in the pool. :param max_retries: The maximum number of retries each connection should attempt. Note, this applies only to failed DNS lookups, socket connections and connection timeouts, never to requests where data has made it to the server. By default, Requests does not retry failed connections. If you need granular control over the conditions under which we retry a request, import urllib3's ``Retry`` class and pass that instead. :param pool_block: Whether the connection pool should block for connections. Usage:: >>> import requests >>> s = requests.Session() >>> a = requests.adapters.HTTPAdapter(max_retries=3) >>> s.mount('http://', a) """ __attrs__ = [ "max_retries", "config", "_pool_connections", "_pool_maxsize", "_pool_block", ] def __init__( self, pool_connections=DEFAULT_POOLSIZE, pool_maxsize=DEFAULT_POOLSIZE, max_retries=DEFAULT_RETRIES, pool_block=DEFAULT_POOLBLOCK, ): if max_retries == DEFAULT_RETRIES: self.max_retries = Retry(0, read=False) else: self.max_retries = Retry.from_int(max_retries) self.config = {} self.proxy_manager = {} super().__init__() self._pool_connections = pool_connections self._pool_maxsize = pool_maxsize self._pool_block = pool_block self.init_poolmanager(pool_connections, pool_maxsize, block=pool_block) def __getstate__(self): return {attr: getattr(self, attr, None) for attr in self.__attrs__} def __setstate__(self, state): # Can't handle by adding 'proxy_manager' to self.__attrs__ because # self.poolmanager uses a lambda function, which isn't pickleable. self.proxy_manager = {} self.config = {} for attr, value in state.items(): setattr(self, attr, value) self.init_poolmanager( self._pool_connections, self._pool_maxsize, block=self._pool_block ) def init_poolmanager( self, connections, maxsize, block=DEFAULT_POOLBLOCK, **pool_kwargs ): """Initializes a urllib3 PoolManager. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param connections: The number of urllib3 connection pools to cache. :param maxsize: The maximum number of connections to save in the pool. :param block: Block when no free connections are available. :param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager. """ # save these values for pickling self._pool_connections = connections self._pool_maxsize = maxsize self._pool_block = block self.poolmanager = PoolManager( num_pools=connections, maxsize=maxsize, block=block, **pool_kwargs, ) def proxy_manager_for(self, proxy, **proxy_kwargs): """Return urllib3 ProxyManager for the given proxy. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param proxy: The proxy to return a urllib3 ProxyManager for. :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager. :returns: ProxyManager :rtype: urllib3.ProxyManager """ if proxy in self.proxy_manager: manager = self.proxy_manager[proxy] elif proxy.lower().startswith("socks"): username, password = get_auth_from_url(proxy) manager = self.proxy_manager[proxy] = SOCKSProxyManager( proxy, username=username, password=password, num_pools=self._pool_connections, maxsize=self._pool_maxsize, block=self._pool_block, **proxy_kwargs, ) else: proxy_headers = self.proxy_headers(proxy) manager = self.proxy_manager[proxy] = proxy_from_url( proxy, proxy_headers=proxy_headers, num_pools=self._pool_connections, maxsize=self._pool_maxsize, block=self._pool_block, **proxy_kwargs, ) return manager def cert_verify(self, conn, url, verify, cert): """Verify a SSL certificate. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param conn: The urllib3 connection object associated with the cert. :param url: The requested URL. :param verify: Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: The SSL certificate to verify. """ if url.lower().startswith("https") and verify: cert_loc = None # Allow self-specified cert location. if verify is not True: cert_loc = verify if not cert_loc: cert_loc = extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH) if not cert_loc or not os.path.exists(cert_loc): raise OSError( f"Could not find a suitable TLS CA certificate bundle, " f"invalid path: {cert_loc}" ) conn.cert_reqs = "CERT_REQUIRED" if not os.path.isdir(cert_loc): conn.ca_certs = cert_loc else: conn.ca_cert_dir = cert_loc else: conn.cert_reqs = "CERT_NONE" conn.ca_certs = None conn.ca_cert_dir = None if cert: if not isinstance(cert, basestring): conn.cert_file = cert[0] conn.key_file = cert[1] else: conn.cert_file = cert conn.key_file = None if conn.cert_file and not os.path.exists(conn.cert_file): raise OSError( f"Could not find the TLS certificate file, " f"invalid path: {conn.cert_file}" ) if conn.key_file and not os.path.exists(conn.key_file): raise OSError( f"Could not find the TLS key file, invalid path: {conn.key_file}" ) def build_response(self, req, resp): """Builds a :class:`Response ` object from a urllib3 response. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter ` :param req: The :class:`PreparedRequest ` used to generate the response. :param resp: The urllib3 response object. :rtype: requests.Response """ response = Response() # Fallback to None if there's no status_code, for whatever reason. response.status_code = getattr(resp, "status", None) # Make headers case-insensitive. response.headers = CaseInsensitiveDict(getattr(resp, "headers", {})) # Set encoding. response.encoding = get_encoding_from_headers(response.headers) response.raw = resp response.reason = response.raw.reason if isinstance(req.url, bytes): response.url = req.url.decode("utf-8") else: response.url = req.url # Add new cookies from the server. extract_cookies_to_jar(response.cookies, req, resp) # Give the Response some context. response.request = req response.connection = self return response def build_connection_pool_key_attributes(self, request, verify, cert=None): """Build the PoolKey attributes used by urllib3 to return a connection. This looks at the PreparedRequest, the user-specified verify value, and the value of the cert parameter to determine what PoolKey values to use to select a connection from a given urllib3 Connection Pool. The SSL related pool key arguments are not consistently set. As of this writing, use the following to determine what keys may be in that dictionary: * If ``verify`` is ``True``, ``"ssl_context"`` will be set and will be the default Requests SSL Context * If ``verify`` is ``False``, ``"ssl_context"`` will not be set but ``"cert_reqs"`` will be set * If ``verify`` is a string, (i.e., it is a user-specified trust bundle) ``"ca_certs"`` will be set if the string is not a directory recognized by :py:func:`os.path.isdir`, otherwise ``"ca_cert_dir"`` will be set. * If ``"cert"`` is specified, ``"cert_file"`` will always be set. If ``"cert"`` is a tuple with a second item, ``"key_file"`` will also be present To override these settings, one may subclass this class, call this method and use the above logic to change parameters as desired. For example, if one wishes to use a custom :py:class:`ssl.SSLContext` one must both set ``"ssl_context"`` and based on what else they require, alter the other keys to ensure the desired behaviour. :param request: The PreparedReqest being sent over the connection. :type request: :class:`~requests.models.PreparedRequest` :param verify: Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. :param cert: (optional) Any user-provided SSL certificate for client authentication (a.k.a., mTLS). This may be a string (i.e., just the path to a file which holds both certificate and key) or a tuple of length 2 with the certificate file path and key file path. :returns: A tuple of two dictionaries. The first is the "host parameters" portion of the Pool Key including scheme, hostname, and port. The second is a dictionary of SSLContext related parameters. """ return _urllib3_request_context(request, verify, cert, self.poolmanager) def get_connection_with_tls_context(self, request, verify, proxies=None, cert=None): """Returns a urllib3 connection for the given request and TLS settings. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` object to be sent over the connection. :param verify: Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. :param proxies: (optional) The proxies dictionary to apply to the request. :param cert: (optional) Any user-provided SSL certificate to be used for client authentication (a.k.a., mTLS). :rtype: urllib3.ConnectionPool """ proxy = select_proxy(request.url, proxies) try: host_params, pool_kwargs = self.build_connection_pool_key_attributes( request, verify, cert, ) except ValueError as e: raise InvalidURL(e, request=request) if proxy: proxy = prepend_scheme_if_needed(proxy, "http") proxy_url = parse_url(proxy) if not proxy_url.host: raise InvalidProxyURL( "Please check proxy URL. It is malformed " "and could be missing the host." ) proxy_manager = self.proxy_manager_for(proxy) conn = proxy_manager.connection_from_host( **host_params, pool_kwargs=pool_kwargs ) else: # Only scheme should be lower case conn = self.poolmanager.connection_from_host( **host_params, pool_kwargs=pool_kwargs ) return conn def get_connection(self, url, proxies=None): """DEPRECATED: Users should move to `get_connection_with_tls_context` for all subclasses of HTTPAdapter using Requests>=2.32.2. Returns a urllib3 connection for the given URL. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param url: The URL to connect to. :param proxies: (optional) A Requests-style dictionary of proxies used on this request. :rtype: urllib3.ConnectionPool """ warnings.warn( ( "`get_connection` has been deprecated in favor of " "`get_connection_with_tls_context`. Custom HTTPAdapter subclasses " "will need to migrate for Requests>=2.32.2. Please see " "https://github.com/psf/requests/pull/6710 for more details." ), DeprecationWarning, ) proxy = select_proxy(url, proxies) if proxy: proxy = prepend_scheme_if_needed(proxy, "http") proxy_url = parse_url(proxy) if not proxy_url.host: raise InvalidProxyURL( "Please check proxy URL. It is malformed " "and could be missing the host." ) proxy_manager = self.proxy_manager_for(proxy) conn = proxy_manager.connection_from_url(url) else: # Only scheme should be lower case parsed = urlparse(url) url = parsed.geturl() conn = self.poolmanager.connection_from_url(url) return conn def close(self): """Disposes of any internal state. Currently, this closes the PoolManager and any active ProxyManager, which closes any pooled connections. """ self.poolmanager.clear() for proxy in self.proxy_manager.values(): proxy.clear() def request_url(self, request, proxies): """Obtain the url to use when making the final request. If the message is being sent through a HTTP proxy, the full URL has to be used. Otherwise, we should only use the path portion of the URL. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` being sent. :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs. :rtype: str """ proxy = select_proxy(request.url, proxies) scheme = urlparse(request.url).scheme is_proxied_http_request = proxy and scheme != "https" using_socks_proxy = False if proxy: proxy_scheme = urlparse(proxy).scheme.lower() using_socks_proxy = proxy_scheme.startswith("socks") url = request.path_url if url.startswith("//"): # Don't confuse urllib3 url = f"/{url.lstrip('/')}" if is_proxied_http_request and not using_socks_proxy: url = urldefragauth(request.url) return url def add_headers(self, request, **kwargs): """Add any headers needed by the connection. As of v2.0 this does nothing by default, but is left for overriding by users that subclass the :class:`HTTPAdapter `. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` to add headers to. :param kwargs: The keyword arguments from the call to send(). """ pass def proxy_headers(self, proxy): """Returns a dictionary of the headers to add to any request sent through a proxy. This works with urllib3 magic to ensure that they are correctly sent to the proxy, rather than in a tunnelled request if CONNECT is being used. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param proxy: The url of the proxy being used for this request. :rtype: dict """ headers = {} username, password = get_auth_from_url(proxy) if username: headers["Proxy-Authorization"] = _basic_auth_str(username, password) return headers def send( self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None ): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response """ try: conn = self.get_connection_with_tls_context( request, verify, proxies=proxies, cert=cert ) except LocationValueError as e: raise InvalidURL(e, request=request) self.cert_verify(conn, request.url, verify, cert) url = self.request_url(request, proxies) self.add_headers( request, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, ) chunked = not (request.body is None or "Content-Length" in request.headers) if isinstance(timeout, tuple): try: connect, read = timeout timeout = TimeoutSauce(connect=connect, read=read) except ValueError: raise ValueError( f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " f"or a single float to set both timeouts to the same value." ) elif isinstance(timeout, TimeoutSauce): pass else: timeout = TimeoutSauce(connect=timeout, read=timeout) try: resp = conn.urlopen( method=request.method, url=url, body=request.body, headers=request.headers, redirect=False, assert_same_host=False, preload_content=False, decode_content=False, retries=self.max_retries, timeout=timeout, chunked=chunked, ) except (ProtocolError, OSError) as err: raise ConnectionError(err, request=request) except MaxRetryError as e: if isinstance(e.reason, ConnectTimeoutError): # TODO: Remove this in 3.0.0: see #2811 if not isinstance(e.reason, NewConnectionError): raise ConnectTimeout(e, request=request) if isinstance(e.reason, ResponseError): raise RetryError(e, request=request) if isinstance(e.reason, _ProxyError): raise ProxyError(e, request=request) if isinstance(e.reason, _SSLError): # This branch is for urllib3 v1.22 and later. raise SSLError(e, request=request) raise ConnectionError(e, request=request) except ClosedPoolError as e: raise ConnectionError(e, request=request) except _ProxyError as e: raise ProxyError(e) except (_SSLError, _HTTPError) as e: if isinstance(e, _SSLError): # This branch is for urllib3 versions earlier than v1.22 raise SSLError(e, request=request) elif isinstance(e, ReadTimeoutError): raise ReadTimeout(e, request=request) elif isinstance(e, _InvalidHeader): raise InvalidHeader(e, request=request) else: raise return self.build_response(request, resp) ================================================ FILE: src/pip/_vendor/requests/api.py ================================================ """ requests.api ~~~~~~~~~~~~ This module implements the Requests API. :copyright: (c) 2012 by Kenneth Reitz. :license: Apache2, see LICENSE for more details. """ from . import sessions def request(method, url, **kwargs): """Constructs and sends a :class:`Request `. :param method: method for the new :class:`Request` object: ``GET``, ``OPTIONS``, ``HEAD``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary, list of tuples or bytes to send in the query string for the :class:`Request`. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. :param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload. ``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')`` or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content_type'`` is a string defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers to add for the file. :param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth. :param timeout: (optional) How many seconds to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple :param allow_redirects: (optional) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to ``True``. :type allow_redirects: bool :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy. :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. Defaults to ``True``. :param stream: (optional) if ``False``, the response content will be immediately downloaded. :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. :return: :class:`Response ` object :rtype: requests.Response Usage:: >>> import requests >>> req = requests.request('GET', 'https://httpbin.org/get') >>> req """ # By using the 'with' statement we are sure the session is closed, thus we # avoid leaving sockets open which can trigger a ResourceWarning in some # cases, and look like a memory leak in others. with sessions.Session() as session: return session.request(method=method, url=url, **kwargs) def get(url, params=None, **kwargs): r"""Sends a GET request. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary, list of tuples or bytes to send in the query string for the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response """ return request("get", url, params=params, **kwargs) def options(url, **kwargs): r"""Sends an OPTIONS request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response """ return request("options", url, **kwargs) def head(url, **kwargs): r"""Sends a HEAD request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. If `allow_redirects` is not provided, it will be set to `False` (as opposed to the default :meth:`request` behavior). :return: :class:`Response ` object :rtype: requests.Response """ kwargs.setdefault("allow_redirects", False) return request("head", url, **kwargs) def post(url, data=None, json=None, **kwargs): r"""Sends a POST request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response """ return request("post", url, data=data, json=json, **kwargs) def put(url, data=None, **kwargs): r"""Sends a PUT request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response """ return request("put", url, data=data, **kwargs) def patch(url, data=None, **kwargs): r"""Sends a PATCH request. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response """ return request("patch", url, data=data, **kwargs) def delete(url, **kwargs): r"""Sends a DELETE request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response ` object :rtype: requests.Response """ return request("delete", url, **kwargs) ================================================ FILE: src/pip/_vendor/requests/auth.py ================================================ """ requests.auth ~~~~~~~~~~~~~ This module contains the authentication handlers for Requests. """ import hashlib import os import re import threading import time import warnings from base64 import b64encode from ._internal_utils import to_native_string from .compat import basestring, str, urlparse from .cookies import extract_cookies_to_jar from .utils import parse_dict_header CONTENT_TYPE_FORM_URLENCODED = "application/x-www-form-urlencoded" CONTENT_TYPE_MULTI_PART = "multipart/form-data" def _basic_auth_str(username, password): """Returns a Basic Auth string.""" # "I want us to put a big-ol' comment on top of it that # says that this behaviour is dumb but we need to preserve # it because people are relying on it." # - Lukasa # # These are here solely to maintain backwards compatibility # for things like ints. This will be removed in 3.0.0. if not isinstance(username, basestring): warnings.warn( "Non-string usernames will no longer be supported in Requests " "3.0.0. Please convert the object you've passed in ({!r}) to " "a string or bytes object in the near future to avoid " "problems.".format(username), category=DeprecationWarning, ) username = str(username) if not isinstance(password, basestring): warnings.warn( "Non-string passwords will no longer be supported in Requests " "3.0.0. Please convert the object you've passed in ({!r}) to " "a string or bytes object in the near future to avoid " "problems.".format(type(password)), category=DeprecationWarning, ) password = str(password) # -- End Removal -- if isinstance(username, str): username = username.encode("latin1") if isinstance(password, str): password = password.encode("latin1") authstr = "Basic " + to_native_string( b64encode(b":".join((username, password))).strip() ) return authstr class AuthBase: """Base class that all auth implementations derive from""" def __call__(self, r): raise NotImplementedError("Auth hooks must be callable.") class HTTPBasicAuth(AuthBase): """Attaches HTTP Basic Authentication to the given Request object.""" def __init__(self, username, password): self.username = username self.password = password def __eq__(self, other): return all( [ self.username == getattr(other, "username", None), self.password == getattr(other, "password", None), ] ) def __ne__(self, other): return not self == other def __call__(self, r): r.headers["Authorization"] = _basic_auth_str(self.username, self.password) return r class HTTPProxyAuth(HTTPBasicAuth): """Attaches HTTP Proxy Authentication to a given Request object.""" def __call__(self, r): r.headers["Proxy-Authorization"] = _basic_auth_str(self.username, self.password) return r class HTTPDigestAuth(AuthBase): """Attaches HTTP Digest Authentication to the given Request object.""" def __init__(self, username, password): self.username = username self.password = password # Keep state in per-thread local storage self._thread_local = threading.local() def init_per_thread_state(self): # Ensure state is initialized just once per-thread if not hasattr(self._thread_local, "init"): self._thread_local.init = True self._thread_local.last_nonce = "" self._thread_local.nonce_count = 0 self._thread_local.chal = {} self._thread_local.pos = None self._thread_local.num_401_calls = None def build_digest_header(self, method, url): """ :rtype: str """ realm = self._thread_local.chal["realm"] nonce = self._thread_local.chal["nonce"] qop = self._thread_local.chal.get("qop") algorithm = self._thread_local.chal.get("algorithm") opaque = self._thread_local.chal.get("opaque") hash_utf8 = None if algorithm is None: _algorithm = "MD5" else: _algorithm = algorithm.upper() # lambdas assume digest modules are imported at the top level if _algorithm == "MD5" or _algorithm == "MD5-SESS": def md5_utf8(x): if isinstance(x, str): x = x.encode("utf-8") return hashlib.md5(x).hexdigest() hash_utf8 = md5_utf8 elif _algorithm == "SHA": def sha_utf8(x): if isinstance(x, str): x = x.encode("utf-8") return hashlib.sha1(x).hexdigest() hash_utf8 = sha_utf8 elif _algorithm == "SHA-256": def sha256_utf8(x): if isinstance(x, str): x = x.encode("utf-8") return hashlib.sha256(x).hexdigest() hash_utf8 = sha256_utf8 elif _algorithm == "SHA-512": def sha512_utf8(x): if isinstance(x, str): x = x.encode("utf-8") return hashlib.sha512(x).hexdigest() hash_utf8 = sha512_utf8 KD = lambda s, d: hash_utf8(f"{s}:{d}") # noqa:E731 if hash_utf8 is None: return None # XXX not implemented yet entdig = None p_parsed = urlparse(url) #: path is request-uri defined in RFC 2616 which should not be empty path = p_parsed.path or "/" if p_parsed.query: path += f"?{p_parsed.query}" A1 = f"{self.username}:{realm}:{self.password}" A2 = f"{method}:{path}" HA1 = hash_utf8(A1) HA2 = hash_utf8(A2) if nonce == self._thread_local.last_nonce: self._thread_local.nonce_count += 1 else: self._thread_local.nonce_count = 1 ncvalue = f"{self._thread_local.nonce_count:08x}" s = str(self._thread_local.nonce_count).encode("utf-8") s += nonce.encode("utf-8") s += time.ctime().encode("utf-8") s += os.urandom(8) cnonce = hashlib.sha1(s).hexdigest()[:16] if _algorithm == "MD5-SESS": HA1 = hash_utf8(f"{HA1}:{nonce}:{cnonce}") if not qop: respdig = KD(HA1, f"{nonce}:{HA2}") elif qop == "auth" or "auth" in qop.split(","): noncebit = f"{nonce}:{ncvalue}:{cnonce}:auth:{HA2}" respdig = KD(HA1, noncebit) else: # XXX handle auth-int. return None self._thread_local.last_nonce = nonce # XXX should the partial digests be encoded too? base = ( f'username="{self.username}", realm="{realm}", nonce="{nonce}", ' f'uri="{path}", response="{respdig}"' ) if opaque: base += f', opaque="{opaque}"' if algorithm: base += f', algorithm="{algorithm}"' if entdig: base += f', digest="{entdig}"' if qop: base += f', qop="auth", nc={ncvalue}, cnonce="{cnonce}"' return f"Digest {base}" def handle_redirect(self, r, **kwargs): """Reset num_401_calls counter on redirects.""" if r.is_redirect: self._thread_local.num_401_calls = 1 def handle_401(self, r, **kwargs): """ Takes the given response and tries digest-auth, if needed. :rtype: requests.Response """ # If response is not 4xx, do not auth # See https://github.com/psf/requests/issues/3772 if not 400 <= r.status_code < 500: self._thread_local.num_401_calls = 1 return r if self._thread_local.pos is not None: # Rewind the file position indicator of the body to where # it was to resend the request. r.request.body.seek(self._thread_local.pos) s_auth = r.headers.get("www-authenticate", "") if "digest" in s_auth.lower() and self._thread_local.num_401_calls < 2: self._thread_local.num_401_calls += 1 pat = re.compile(r"digest ", flags=re.IGNORECASE) self._thread_local.chal = parse_dict_header(pat.sub("", s_auth, count=1)) # Consume content and release the original connection # to allow our new request to reuse the same one. r.content r.close() prep = r.request.copy() extract_cookies_to_jar(prep._cookies, r.request, r.raw) prep.prepare_cookies(prep._cookies) prep.headers["Authorization"] = self.build_digest_header( prep.method, prep.url ) _r = r.connection.send(prep, **kwargs) _r.history.append(r) _r.request = prep return _r self._thread_local.num_401_calls = 1 return r def __call__(self, r): # Initialize per-thread state, if needed self.init_per_thread_state() # If we have a saved nonce, skip the 401 if self._thread_local.last_nonce: r.headers["Authorization"] = self.build_digest_header(r.method, r.url) try: self._thread_local.pos = r.body.tell() except AttributeError: # In the case of HTTPDigestAuth being reused and the body of # the previous request was a file-like object, pos has the # file position of the previous body. Ensure it's set to # None. self._thread_local.pos = None r.register_hook("response", self.handle_401) r.register_hook("response", self.handle_redirect) self._thread_local.num_401_calls = 1 return r def __eq__(self, other): return all( [ self.username == getattr(other, "username", None), self.password == getattr(other, "password", None), ] ) def __ne__(self, other): return not self == other ================================================ FILE: src/pip/_vendor/requests/certs.py ================================================ #!/usr/bin/env python """ requests.certs ~~~~~~~~~~~~~~ This module returns the preferred default CA certificate bundle. There is only one — the one from the certifi package. If you are packaging Requests, e.g., for a Linux distribution or a managed environment, you can change the definition of where() to return a separately packaged CA bundle. """ from pip._vendor.certifi import where if __name__ == "__main__": print(where()) ================================================ FILE: src/pip/_vendor/requests/compat.py ================================================ """ requests.compat ~~~~~~~~~~~~~~~ This module previously handled import compatibility issues between Python 2 and Python 3. It remains for backwards compatibility until the next major version. """ import sys # ------- # urllib3 # ------- from pip._vendor.urllib3 import __version__ as urllib3_version # Detect which major version of urllib3 is being used. try: is_urllib3_1 = int(urllib3_version.split(".")[0]) == 1 except (TypeError, AttributeError): # If we can't discern a version, prefer old functionality. is_urllib3_1 = True # ------------------- # Character Detection # ------------------- def _resolve_char_detection(): """Find supported character detection libraries.""" chardet = None return chardet chardet = _resolve_char_detection() # ------- # Pythons # ------- # Syntax sugar. _ver = sys.version_info #: Python 2.x? is_py2 = _ver[0] == 2 #: Python 3.x? is_py3 = _ver[0] == 3 # Note: We've patched out simplejson support in pip because it prevents # upgrading simplejson on Windows. import json from json import JSONDecodeError # Keep OrderedDict for backwards compatibility. from collections import OrderedDict from collections.abc import Callable, Mapping, MutableMapping from http import cookiejar as cookielib from http.cookies import Morsel from io import StringIO # -------------- # Legacy Imports # -------------- from urllib.parse import ( quote, quote_plus, unquote, unquote_plus, urldefrag, urlencode, urljoin, urlparse, urlsplit, urlunparse, ) from urllib.request import ( getproxies, getproxies_environment, parse_http_list, proxy_bypass, proxy_bypass_environment, ) builtin_str = str str = str bytes = bytes basestring = (str, bytes) numeric_types = (int, float) integer_types = (int,) ================================================ FILE: src/pip/_vendor/requests/cookies.py ================================================ """ requests.cookies ~~~~~~~~~~~~~~~~ Compatibility code to be able to use `http.cookiejar.CookieJar` with requests. requests.utils imports from here, so be careful with imports. """ import calendar import copy import time from ._internal_utils import to_native_string from .compat import Morsel, MutableMapping, cookielib, urlparse, urlunparse try: import threading except ImportError: import dummy_threading as threading class MockRequest: """Wraps a `requests.Request` to mimic a `urllib2.Request`. The code in `http.cookiejar.CookieJar` expects this interface in order to correctly manage cookie policies, i.e., determine whether a cookie can be set, given the domains of the request and the cookie. The original request object is read-only. The client is responsible for collecting the new headers via `get_new_headers()` and interpreting them appropriately. You probably want `get_cookie_header`, defined below. """ def __init__(self, request): self._r = request self._new_headers = {} self.type = urlparse(self._r.url).scheme def get_type(self): return self.type def get_host(self): return urlparse(self._r.url).netloc def get_origin_req_host(self): return self.get_host() def get_full_url(self): # Only return the response's URL if the user hadn't set the Host # header if not self._r.headers.get("Host"): return self._r.url # If they did set it, retrieve it and reconstruct the expected domain host = to_native_string(self._r.headers["Host"], encoding="utf-8") parsed = urlparse(self._r.url) # Reconstruct the URL as we expect it return urlunparse( [ parsed.scheme, host, parsed.path, parsed.params, parsed.query, parsed.fragment, ] ) def is_unverifiable(self): return True def has_header(self, name): return name in self._r.headers or name in self._new_headers def get_header(self, name, default=None): return self._r.headers.get(name, self._new_headers.get(name, default)) def add_header(self, key, val): """cookiejar has no legitimate use for this method; add it back if you find one.""" raise NotImplementedError( "Cookie headers should be added with add_unredirected_header()" ) def add_unredirected_header(self, name, value): self._new_headers[name] = value def get_new_headers(self): return self._new_headers @property def unverifiable(self): return self.is_unverifiable() @property def origin_req_host(self): return self.get_origin_req_host() @property def host(self): return self.get_host() class MockResponse: """Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`. ...what? Basically, expose the parsed HTTP headers from the server response the way `http.cookiejar` expects to see them. """ def __init__(self, headers): """Make a MockResponse for `cookiejar` to read. :param headers: a httplib.HTTPMessage or analogous carrying the headers """ self._headers = headers def info(self): return self._headers def getheaders(self, name): self._headers.getheaders(name) def extract_cookies_to_jar(jar, request, response): """Extract the cookies from the response into a CookieJar. :param jar: http.cookiejar.CookieJar (not necessarily a RequestsCookieJar) :param request: our own requests.Request object :param response: urllib3.HTTPResponse object """ if not (hasattr(response, "_original_response") and response._original_response): return # the _original_response field is the wrapped httplib.HTTPResponse object, req = MockRequest(request) # pull out the HTTPMessage with the headers and put it in the mock: res = MockResponse(response._original_response.msg) jar.extract_cookies(res, req) def get_cookie_header(jar, request): """ Produce an appropriate Cookie header string to be sent with `request`, or None. :rtype: str """ r = MockRequest(request) jar.add_cookie_header(r) return r.get_new_headers().get("Cookie") def remove_cookie_by_name(cookiejar, name, domain=None, path=None): """Unsets a cookie by name, by default over all domains and paths. Wraps CookieJar.clear(), is O(n). """ clearables = [] for cookie in cookiejar: if cookie.name != name: continue if domain is not None and domain != cookie.domain: continue if path is not None and path != cookie.path: continue clearables.append((cookie.domain, cookie.path, cookie.name)) for domain, path, name in clearables: cookiejar.clear(domain, path, name) class CookieConflictError(RuntimeError): """There are two cookies that meet the criteria specified in the cookie jar. Use .get and .set and include domain and path args in order to be more specific. """ class RequestsCookieJar(cookielib.CookieJar, MutableMapping): """Compatibility class; is a http.cookiejar.CookieJar, but exposes a dict interface. This is the CookieJar we create by default for requests and sessions that don't specify one, since some clients may expect response.cookies and session.cookies to support dict operations. Requests does not use the dict interface internally; it's just for compatibility with external client code. All requests code should work out of the box with externally provided instances of ``CookieJar``, e.g. ``LWPCookieJar`` and ``FileCookieJar``. Unlike a regular CookieJar, this class is pickleable. .. warning:: dictionary operations that are normally O(1) may be O(n). """ def get(self, name, default=None, domain=None, path=None): """Dict-like get() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains. .. warning:: operation is O(n), not O(1). """ try: return self._find_no_duplicates(name, domain, path) except KeyError: return default def set(self, name, value, **kwargs): """Dict-like set() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains. """ # support client code that unsets cookies by assignment of a None value: if value is None: remove_cookie_by_name( self, name, domain=kwargs.get("domain"), path=kwargs.get("path") ) return if isinstance(value, Morsel): c = morsel_to_cookie(value) else: c = create_cookie(name, value, **kwargs) self.set_cookie(c) return c def iterkeys(self): """Dict-like iterkeys() that returns an iterator of names of cookies from the jar. .. seealso:: itervalues() and iteritems(). """ for cookie in iter(self): yield cookie.name def keys(self): """Dict-like keys() that returns a list of names of cookies from the jar. .. seealso:: values() and items(). """ return list(self.iterkeys()) def itervalues(self): """Dict-like itervalues() that returns an iterator of values of cookies from the jar. .. seealso:: iterkeys() and iteritems(). """ for cookie in iter(self): yield cookie.value def values(self): """Dict-like values() that returns a list of values of cookies from the jar. .. seealso:: keys() and items(). """ return list(self.itervalues()) def iteritems(self): """Dict-like iteritems() that returns an iterator of name-value tuples from the jar. .. seealso:: iterkeys() and itervalues(). """ for cookie in iter(self): yield cookie.name, cookie.value def items(self): """Dict-like items() that returns a list of name-value tuples from the jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a vanilla python dict of key value pairs. .. seealso:: keys() and values(). """ return list(self.iteritems()) def list_domains(self): """Utility method to list all the domains in the jar.""" domains = [] for cookie in iter(self): if cookie.domain not in domains: domains.append(cookie.domain) return domains def list_paths(self): """Utility method to list all the paths in the jar.""" paths = [] for cookie in iter(self): if cookie.path not in paths: paths.append(cookie.path) return paths def multiple_domains(self): """Returns True if there are multiple domains in the jar. Returns False otherwise. :rtype: bool """ domains = [] for cookie in iter(self): if cookie.domain is not None and cookie.domain in domains: return True domains.append(cookie.domain) return False # there is only one domain in jar def get_dict(self, domain=None, path=None): """Takes as an argument an optional domain and path and returns a plain old Python dict of name-value pairs of cookies that meet the requirements. :rtype: dict """ dictionary = {} for cookie in iter(self): if (domain is None or cookie.domain == domain) and ( path is None or cookie.path == path ): dictionary[cookie.name] = cookie.value return dictionary def __contains__(self, name): try: return super().__contains__(name) except CookieConflictError: return True def __getitem__(self, name): """Dict-like __getitem__() for compatibility with client code. Throws exception if there are more than one cookie with name. In that case, use the more explicit get() method instead. .. warning:: operation is O(n), not O(1). """ return self._find_no_duplicates(name) def __setitem__(self, name, value): """Dict-like __setitem__ for compatibility with client code. Throws exception if there is already a cookie of that name in the jar. In that case, use the more explicit set() method instead. """ self.set(name, value) def __delitem__(self, name): """Deletes a cookie given a name. Wraps ``http.cookiejar.CookieJar``'s ``remove_cookie_by_name()``. """ remove_cookie_by_name(self, name) def set_cookie(self, cookie, *args, **kwargs): if ( hasattr(cookie.value, "startswith") and cookie.value.startswith('"') and cookie.value.endswith('"') ): cookie.value = cookie.value.replace('\\"', "") return super().set_cookie(cookie, *args, **kwargs) def update(self, other): """Updates this jar with cookies from another CookieJar or dict-like""" if isinstance(other, cookielib.CookieJar): for cookie in other: self.set_cookie(copy.copy(cookie)) else: super().update(other) def _find(self, name, domain=None, path=None): """Requests uses this method internally to get cookie values. If there are conflicting cookies, _find arbitrarily chooses one. See _find_no_duplicates if you want an exception thrown if there are conflicting cookies. :param name: a string containing name of cookie :param domain: (optional) string containing domain of cookie :param path: (optional) string containing path of cookie :return: cookie.value """ for cookie in iter(self): if cookie.name == name: if domain is None or cookie.domain == domain: if path is None or cookie.path == path: return cookie.value raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}") def _find_no_duplicates(self, name, domain=None, path=None): """Both ``__get_item__`` and ``get`` call this function: it's never used elsewhere in Requests. :param name: a string containing name of cookie :param domain: (optional) string containing domain of cookie :param path: (optional) string containing path of cookie :raises KeyError: if cookie is not found :raises CookieConflictError: if there are multiple cookies that match name and optionally domain and path :return: cookie.value """ toReturn = None for cookie in iter(self): if cookie.name == name: if domain is None or cookie.domain == domain: if path is None or cookie.path == path: if toReturn is not None: # if there are multiple cookies that meet passed in criteria raise CookieConflictError( f"There are multiple cookies with name, {name!r}" ) # we will eventually return this as long as no cookie conflict toReturn = cookie.value if toReturn: return toReturn raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}") def __getstate__(self): """Unlike a normal CookieJar, this class is pickleable.""" state = self.__dict__.copy() # remove the unpickleable RLock object state.pop("_cookies_lock") return state def __setstate__(self, state): """Unlike a normal CookieJar, this class is pickleable.""" self.__dict__.update(state) if "_cookies_lock" not in self.__dict__: self._cookies_lock = threading.RLock() def copy(self): """Return a copy of this RequestsCookieJar.""" new_cj = RequestsCookieJar() new_cj.set_policy(self.get_policy()) new_cj.update(self) return new_cj def get_policy(self): """Return the CookiePolicy instance used.""" return self._policy def _copy_cookie_jar(jar): if jar is None: return None if hasattr(jar, "copy"): # We're dealing with an instance of RequestsCookieJar return jar.copy() # We're dealing with a generic CookieJar instance new_jar = copy.copy(jar) new_jar.clear() for cookie in jar: new_jar.set_cookie(copy.copy(cookie)) return new_jar def create_cookie(name, value, **kwargs): """Make a cookie from underspecified parameters. By default, the pair of `name` and `value` will be set for the domain '' and sent on every request (this is sometimes called a "supercookie"). """ result = { "version": 0, "name": name, "value": value, "port": None, "domain": "", "path": "/", "secure": False, "expires": None, "discard": True, "comment": None, "comment_url": None, "rest": {"HttpOnly": None}, "rfc2109": False, } badargs = set(kwargs) - set(result) if badargs: raise TypeError( f"create_cookie() got unexpected keyword arguments: {list(badargs)}" ) result.update(kwargs) result["port_specified"] = bool(result["port"]) result["domain_specified"] = bool(result["domain"]) result["domain_initial_dot"] = result["domain"].startswith(".") result["path_specified"] = bool(result["path"]) return cookielib.Cookie(**result) def morsel_to_cookie(morsel): """Convert a Morsel object into a Cookie containing the one k/v pair.""" expires = None if morsel["max-age"]: try: expires = int(time.time() + int(morsel["max-age"])) except ValueError: raise TypeError(f"max-age: {morsel['max-age']} must be integer") elif morsel["expires"]: time_template = "%a, %d-%b-%Y %H:%M:%S GMT" expires = calendar.timegm(time.strptime(morsel["expires"], time_template)) return create_cookie( comment=morsel["comment"], comment_url=bool(morsel["comment"]), discard=False, domain=morsel["domain"], expires=expires, name=morsel.key, path=morsel["path"], port=None, rest={"HttpOnly": morsel["httponly"]}, rfc2109=False, secure=bool(morsel["secure"]), value=morsel.value, version=morsel["version"] or 0, ) def cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True): """Returns a CookieJar from a key/value dictionary. :param cookie_dict: Dict of key/values to insert into CookieJar. :param cookiejar: (optional) A cookiejar to add the cookies to. :param overwrite: (optional) If False, will not replace cookies already in the jar with new ones. :rtype: CookieJar """ if cookiejar is None: cookiejar = RequestsCookieJar() if cookie_dict is not None: names_from_jar = [cookie.name for cookie in cookiejar] for name in cookie_dict: if overwrite or (name not in names_from_jar): cookiejar.set_cookie(create_cookie(name, cookie_dict[name])) return cookiejar def merge_cookies(cookiejar, cookies): """Add cookies to cookiejar and returns a merged CookieJar. :param cookiejar: CookieJar object to add the cookies to. :param cookies: Dictionary or CookieJar object to be added. :rtype: CookieJar """ if not isinstance(cookiejar, cookielib.CookieJar): raise ValueError("You can only merge into CookieJar") if isinstance(cookies, dict): cookiejar = cookiejar_from_dict(cookies, cookiejar=cookiejar, overwrite=False) elif isinstance(cookies, cookielib.CookieJar): try: cookiejar.update(cookies) except AttributeError: for cookie_in_jar in cookies: cookiejar.set_cookie(cookie_in_jar) return cookiejar ================================================ FILE: src/pip/_vendor/requests/exceptions.py ================================================ """ requests.exceptions ~~~~~~~~~~~~~~~~~~~ This module contains the set of Requests' exceptions. """ from pip._vendor.urllib3.exceptions import HTTPError as BaseHTTPError from .compat import JSONDecodeError as CompatJSONDecodeError class RequestException(IOError): """There was an ambiguous exception that occurred while handling your request. """ def __init__(self, *args, **kwargs): """Initialize RequestException with `request` and `response` objects.""" response = kwargs.pop("response", None) self.response = response self.request = kwargs.pop("request", None) if response is not None and not self.request and hasattr(response, "request"): self.request = self.response.request super().__init__(*args, **kwargs) class InvalidJSONError(RequestException): """A JSON error occurred.""" class JSONDecodeError(InvalidJSONError, CompatJSONDecodeError): """Couldn't decode the text into json""" def __init__(self, *args, **kwargs): """ Construct the JSONDecodeError instance first with all args. Then use it's args to construct the IOError so that the json specific args aren't used as IOError specific args and the error message from JSONDecodeError is preserved. """ CompatJSONDecodeError.__init__(self, *args) InvalidJSONError.__init__(self, *self.args, **kwargs) def __reduce__(self): """ The __reduce__ method called when pickling the object must be the one from the JSONDecodeError (be it json/simplejson) as it expects all the arguments for instantiation, not just one like the IOError, and the MRO would by default call the __reduce__ method from the IOError due to the inheritance order. """ return CompatJSONDecodeError.__reduce__(self) class HTTPError(RequestException): """An HTTP error occurred.""" class ConnectionError(RequestException): """A Connection error occurred.""" class ProxyError(ConnectionError): """A proxy error occurred.""" class SSLError(ConnectionError): """An SSL error occurred.""" class Timeout(RequestException): """The request timed out. Catching this error will catch both :exc:`~requests.exceptions.ConnectTimeout` and :exc:`~requests.exceptions.ReadTimeout` errors. """ class ConnectTimeout(ConnectionError, Timeout): """The request timed out while trying to connect to the remote server. Requests that produced this error are safe to retry. """ class ReadTimeout(Timeout): """The server did not send any data in the allotted amount of time.""" class URLRequired(RequestException): """A valid URL is required to make a request.""" class TooManyRedirects(RequestException): """Too many redirects.""" class MissingSchema(RequestException, ValueError): """The URL scheme (e.g. http or https) is missing.""" class InvalidSchema(RequestException, ValueError): """The URL scheme provided is either invalid or unsupported.""" class InvalidURL(RequestException, ValueError): """The URL provided was somehow invalid.""" class InvalidHeader(RequestException, ValueError): """The header value provided was somehow invalid.""" class InvalidProxyURL(InvalidURL): """The proxy URL provided is invalid.""" class ChunkedEncodingError(RequestException): """The server declared chunked encoding but sent an invalid chunk.""" class ContentDecodingError(RequestException, BaseHTTPError): """Failed to decode response content.""" class StreamConsumedError(RequestException, TypeError): """The content for this response was already consumed.""" class RetryError(RequestException): """Custom retries logic failed""" class UnrewindableBodyError(RequestException): """Requests encountered an error when trying to rewind a body.""" # Warnings class RequestsWarning(Warning): """Base warning for Requests.""" class FileModeWarning(RequestsWarning, DeprecationWarning): """A file was opened in text mode, but Requests determined its binary length.""" class RequestsDependencyWarning(RequestsWarning): """An imported dependency doesn't match the expected version range.""" ================================================ FILE: src/pip/_vendor/requests/help.py ================================================ """Module containing bug report helper(s).""" import json import platform import ssl import sys from pip._vendor import idna from pip._vendor import urllib3 from . import __version__ as requests_version charset_normalizer = None chardet = None try: from pip._vendor.urllib3.contrib import pyopenssl except ImportError: pyopenssl = None OpenSSL = None cryptography = None else: import cryptography import OpenSSL def _implementation(): """Return a dict with the Python implementation and version. Provide both the name and the version of the Python implementation currently running. For example, on CPython 3.10.3 it will return {'name': 'CPython', 'version': '3.10.3'}. This function works best on CPython and PyPy: in particular, it probably doesn't work for Jython or IronPython. Future investigation should be done to work out the correct shape of the code for those platforms. """ implementation = platform.python_implementation() if implementation == "CPython": implementation_version = platform.python_version() elif implementation == "PyPy": implementation_version = "{}.{}.{}".format( sys.pypy_version_info.major, sys.pypy_version_info.minor, sys.pypy_version_info.micro, ) if sys.pypy_version_info.releaselevel != "final": implementation_version = "".join( [implementation_version, sys.pypy_version_info.releaselevel] ) elif implementation == "Jython": implementation_version = platform.python_version() # Complete Guess elif implementation == "IronPython": implementation_version = platform.python_version() # Complete Guess else: implementation_version = "Unknown" return {"name": implementation, "version": implementation_version} def info(): """Generate information for a bug report.""" try: platform_info = { "system": platform.system(), "release": platform.release(), } except OSError: platform_info = { "system": "Unknown", "release": "Unknown", } implementation_info = _implementation() urllib3_info = {"version": urllib3.__version__} charset_normalizer_info = {"version": None} chardet_info = {"version": None} if charset_normalizer: charset_normalizer_info = {"version": charset_normalizer.__version__} if chardet: chardet_info = {"version": chardet.__version__} pyopenssl_info = { "version": None, "openssl_version": "", } if OpenSSL: pyopenssl_info = { "version": OpenSSL.__version__, "openssl_version": f"{OpenSSL.SSL.OPENSSL_VERSION_NUMBER:x}", } cryptography_info = { "version": getattr(cryptography, "__version__", ""), } idna_info = { "version": getattr(idna, "__version__", ""), } system_ssl = ssl.OPENSSL_VERSION_NUMBER system_ssl_info = {"version": f"{system_ssl:x}" if system_ssl is not None else ""} return { "platform": platform_info, "implementation": implementation_info, "system_ssl": system_ssl_info, "using_pyopenssl": pyopenssl is not None, "using_charset_normalizer": chardet is None, "pyOpenSSL": pyopenssl_info, "urllib3": urllib3_info, "chardet": chardet_info, "charset_normalizer": charset_normalizer_info, "cryptography": cryptography_info, "idna": idna_info, "requests": { "version": requests_version, }, } def main(): """Pretty-print the bug information as JSON.""" print(json.dumps(info(), sort_keys=True, indent=2)) if __name__ == "__main__": main() ================================================ FILE: src/pip/_vendor/requests/hooks.py ================================================ """ requests.hooks ~~~~~~~~~~~~~~ This module provides the capabilities for the Requests hooks system. Available hooks: ``response``: The response generated from a Request. """ HOOKS = ["response"] def default_hooks(): return {event: [] for event in HOOKS} # TODO: response is the only one def dispatch_hook(key, hooks, hook_data, **kwargs): """Dispatches a hook dictionary on a given piece of data.""" hooks = hooks or {} hooks = hooks.get(key) if hooks: if hasattr(hooks, "__call__"): hooks = [hooks] for hook in hooks: _hook_data = hook(hook_data, **kwargs) if _hook_data is not None: hook_data = _hook_data return hook_data ================================================ FILE: src/pip/_vendor/requests/models.py ================================================ """ requests.models ~~~~~~~~~~~~~~~ This module contains the primary objects that power Requests. """ import datetime # Import encoding now, to avoid implicit import later. # Implicit import within threads may cause LookupError when standard library is in a ZIP, # such as in Embedded Python. See https://github.com/psf/requests/issues/3578. import encodings.idna # noqa: F401 from io import UnsupportedOperation from pip._vendor.urllib3.exceptions import ( DecodeError, LocationParseError, ProtocolError, ReadTimeoutError, SSLError, ) from pip._vendor.urllib3.fields import RequestField from pip._vendor.urllib3.filepost import encode_multipart_formdata from pip._vendor.urllib3.util import parse_url from ._internal_utils import to_native_string, unicode_is_ascii from .auth import HTTPBasicAuth from .compat import ( Callable, JSONDecodeError, Mapping, basestring, builtin_str, chardet, cookielib, ) from .compat import json as complexjson from .compat import urlencode, urlsplit, urlunparse from .cookies import _copy_cookie_jar, cookiejar_from_dict, get_cookie_header from .exceptions import ( ChunkedEncodingError, ConnectionError, ContentDecodingError, HTTPError, InvalidJSONError, InvalidURL, ) from .exceptions import JSONDecodeError as RequestsJSONDecodeError from .exceptions import MissingSchema from .exceptions import SSLError as RequestsSSLError from .exceptions import StreamConsumedError from .hooks import default_hooks from .status_codes import codes from .structures import CaseInsensitiveDict from .utils import ( check_header_validity, get_auth_from_url, guess_filename, guess_json_utf, iter_slices, parse_header_links, requote_uri, stream_decode_response_unicode, super_len, to_key_val_list, ) #: The set of HTTP status codes that indicate an automatically #: processable redirect. REDIRECT_STATI = ( codes.moved, # 301 codes.found, # 302 codes.other, # 303 codes.temporary_redirect, # 307 codes.permanent_redirect, # 308 ) DEFAULT_REDIRECT_LIMIT = 30 CONTENT_CHUNK_SIZE = 10 * 1024 ITER_CHUNK_SIZE = 512 class RequestEncodingMixin: @property def path_url(self): """Build the path URL to use.""" url = [] p = urlsplit(self.url) path = p.path if not path: path = "/" url.append(path) query = p.query if query: url.append("?") url.append(query) return "".join(url) @staticmethod def _encode_params(data): """Encode parameters in a piece of data. Will successfully encode parameters when passed as a dict or a list of 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary if parameters are supplied as a dict. """ if isinstance(data, (str, bytes)): return data elif hasattr(data, "read"): return data elif hasattr(data, "__iter__"): result = [] for k, vs in to_key_val_list(data): if isinstance(vs, basestring) or not hasattr(vs, "__iter__"): vs = [vs] for v in vs: if v is not None: result.append( ( k.encode("utf-8") if isinstance(k, str) else k, v.encode("utf-8") if isinstance(v, str) else v, ) ) return urlencode(result, doseq=True) else: return data @staticmethod def _encode_files(files, data): """Build the body for a multipart/form-data request. Will successfully encode files when passed as a dict or a list of tuples. Order is retained if data is a list of tuples but arbitrary if parameters are supplied as a dict. The tuples may be 2-tuples (filename, fileobj), 3-tuples (filename, fileobj, contentype) or 4-tuples (filename, fileobj, contentype, custom_headers). """ if not files: raise ValueError("Files must be provided.") elif isinstance(data, basestring): raise ValueError("Data must not be a string.") new_fields = [] fields = to_key_val_list(data or {}) files = to_key_val_list(files or {}) for field, val in fields: if isinstance(val, basestring) or not hasattr(val, "__iter__"): val = [val] for v in val: if v is not None: # Don't call str() on bytestrings: in Py3 it all goes wrong. if not isinstance(v, bytes): v = str(v) new_fields.append( ( field.decode("utf-8") if isinstance(field, bytes) else field, v.encode("utf-8") if isinstance(v, str) else v, ) ) for k, v in files: # support for explicit filename ft = None fh = None if isinstance(v, (tuple, list)): if len(v) == 2: fn, fp = v elif len(v) == 3: fn, fp, ft = v else: fn, fp, ft, fh = v else: fn = guess_filename(v) or k fp = v if isinstance(fp, (str, bytes, bytearray)): fdata = fp elif hasattr(fp, "read"): fdata = fp.read() elif fp is None: continue else: fdata = fp rf = RequestField(name=k, data=fdata, filename=fn, headers=fh) rf.make_multipart(content_type=ft) new_fields.append(rf) body, content_type = encode_multipart_formdata(new_fields) return body, content_type class RequestHooksMixin: def register_hook(self, event, hook): """Properly register a hook.""" if event not in self.hooks: raise ValueError(f'Unsupported event specified, with event name "{event}"') if isinstance(hook, Callable): self.hooks[event].append(hook) elif hasattr(hook, "__iter__"): self.hooks[event].extend(h for h in hook if isinstance(h, Callable)) def deregister_hook(self, event, hook): """Deregister a previously registered hook. Returns True if the hook existed, False if not. """ try: self.hooks[event].remove(hook) return True except ValueError: return False class Request(RequestHooksMixin): """A user-created :class:`Request ` object. Used to prepare a :class:`PreparedRequest `, which is sent to the server. :param method: HTTP method to use. :param url: URL to send. :param headers: dictionary of headers to send. :param files: dictionary of {filename: fileobject} files to multipart upload. :param data: the body to attach to the request. If a dictionary or list of tuples ``[(key, value)]`` is provided, form-encoding will take place. :param json: json for the body to attach to the request (if files or data is not specified). :param params: URL parameters to append to the URL. If a dictionary or list of tuples ``[(key, value)]`` is provided, form-encoding will take place. :param auth: Auth handler or (user, pass) tuple. :param cookies: dictionary or CookieJar of cookies to attach to this request. :param hooks: dictionary of callback hooks, for internal usage. Usage:: >>> import requests >>> req = requests.Request('GET', 'https://httpbin.org/get') >>> req.prepare() """ def __init__( self, method=None, url=None, headers=None, files=None, data=None, params=None, auth=None, cookies=None, hooks=None, json=None, ): # Default empty dicts for dict params. data = [] if data is None else data files = [] if files is None else files headers = {} if headers is None else headers params = {} if params is None else params hooks = {} if hooks is None else hooks self.hooks = default_hooks() for k, v in list(hooks.items()): self.register_hook(event=k, hook=v) self.method = method self.url = url self.headers = headers self.files = files self.data = data self.json = json self.params = params self.auth = auth self.cookies = cookies def __repr__(self): return f"" def prepare(self): """Constructs a :class:`PreparedRequest ` for transmission and returns it.""" p = PreparedRequest() p.prepare( method=self.method, url=self.url, headers=self.headers, files=self.files, data=self.data, json=self.json, params=self.params, auth=self.auth, cookies=self.cookies, hooks=self.hooks, ) return p class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): """The fully mutable :class:`PreparedRequest ` object, containing the exact bytes that will be sent to the server. Instances are generated from a :class:`Request ` object, and should not be instantiated manually; doing so may produce undesirable effects. Usage:: >>> import requests >>> req = requests.Request('GET', 'https://httpbin.org/get') >>> r = req.prepare() >>> r >>> s = requests.Session() >>> s.send(r) """ def __init__(self): #: HTTP verb to send to the server. self.method = None #: HTTP URL to send the request to. self.url = None #: dictionary of HTTP headers. self.headers = None # The `CookieJar` used to create the Cookie header will be stored here # after prepare_cookies is called self._cookies = None #: request body to send to the server. self.body = None #: dictionary of callback hooks, for internal usage. self.hooks = default_hooks() #: integer denoting starting position of a readable file-like body. self._body_position = None def prepare( self, method=None, url=None, headers=None, files=None, data=None, params=None, auth=None, cookies=None, hooks=None, json=None, ): """Prepares the entire request with the given parameters.""" self.prepare_method(method) self.prepare_url(url, params) self.prepare_headers(headers) self.prepare_cookies(cookies) self.prepare_body(data, files, json) self.prepare_auth(auth, url) # Note that prepare_auth must be last to enable authentication schemes # such as OAuth to work on a fully prepared request. # This MUST go after prepare_auth. Authenticators could add a hook self.prepare_hooks(hooks) def __repr__(self): return f"" def copy(self): p = PreparedRequest() p.method = self.method p.url = self.url p.headers = self.headers.copy() if self.headers is not None else None p._cookies = _copy_cookie_jar(self._cookies) p.body = self.body p.hooks = self.hooks p._body_position = self._body_position return p def prepare_method(self, method): """Prepares the given HTTP method.""" self.method = method if self.method is not None: self.method = to_native_string(self.method.upper()) @staticmethod def _get_idna_encoded_host(host): from pip._vendor import idna try: host = idna.encode(host, uts46=True).decode("utf-8") except idna.IDNAError: raise UnicodeError return host def prepare_url(self, url, params): """Prepares the given HTTP URL.""" #: Accept objects that have string representations. #: We're unable to blindly call unicode/str functions #: as this will include the bytestring indicator (b'') #: on python 3.x. #: https://github.com/psf/requests/pull/2238 if isinstance(url, bytes): url = url.decode("utf8") else: url = str(url) # Remove leading whitespaces from url url = url.lstrip() # Don't do any URL preparation for non-HTTP schemes like `mailto`, # `data` etc to work around exceptions from `url_parse`, which # handles RFC 3986 only. if ":" in url and not url.lower().startswith("http"): self.url = url return # Support for unicode domain names and paths. try: scheme, auth, host, port, path, query, fragment = parse_url(url) except LocationParseError as e: raise InvalidURL(*e.args) if not scheme: raise MissingSchema( f"Invalid URL {url!r}: No scheme supplied. " f"Perhaps you meant https://{url}?" ) if not host: raise InvalidURL(f"Invalid URL {url!r}: No host supplied") # In general, we want to try IDNA encoding the hostname if the string contains # non-ASCII characters. This allows users to automatically get the correct IDNA # behaviour. For strings containing only ASCII characters, we need to also verify # it doesn't start with a wildcard (*), before allowing the unencoded hostname. if not unicode_is_ascii(host): try: host = self._get_idna_encoded_host(host) except UnicodeError: raise InvalidURL("URL has an invalid label.") elif host.startswith(("*", ".")): raise InvalidURL("URL has an invalid label.") # Carefully reconstruct the network location netloc = auth or "" if netloc: netloc += "@" netloc += host if port: netloc += f":{port}" # Bare domains aren't valid URLs. if not path: path = "/" if isinstance(params, (str, bytes)): params = to_native_string(params) enc_params = self._encode_params(params) if enc_params: if query: query = f"{query}&{enc_params}" else: query = enc_params url = requote_uri(urlunparse([scheme, netloc, path, None, query, fragment])) self.url = url def prepare_headers(self, headers): """Prepares the given HTTP headers.""" self.headers = CaseInsensitiveDict() if headers: for header in headers.items(): # Raise exception on invalid header value. check_header_validity(header) name, value = header self.headers[to_native_string(name)] = value def prepare_body(self, data, files, json=None): """Prepares the given HTTP body data.""" # Check if file, fo, generator, iterator. # If not, run through normal process. # Nottin' on you. body = None content_type = None if not data and json is not None: # urllib3 requires a bytes-like body. Python 2's json.dumps # provides this natively, but Python 3 gives a Unicode string. content_type = "application/json" try: body = complexjson.dumps(json, allow_nan=False) except ValueError as ve: raise InvalidJSONError(ve, request=self) if not isinstance(body, bytes): body = body.encode("utf-8") is_stream = all( [ hasattr(data, "__iter__"), not isinstance(data, (basestring, list, tuple, Mapping)), ] ) if is_stream: try: length = super_len(data) except (TypeError, AttributeError, UnsupportedOperation): length = None body = data if getattr(body, "tell", None) is not None: # Record the current file position before reading. # This will allow us to rewind a file in the event # of a redirect. try: self._body_position = body.tell() except OSError: # This differentiates from None, allowing us to catch # a failed `tell()` later when trying to rewind the body self._body_position = object() if files: raise NotImplementedError( "Streamed bodies and files are mutually exclusive." ) if length: self.headers["Content-Length"] = builtin_str(length) else: self.headers["Transfer-Encoding"] = "chunked" else: # Multi-part file uploads. if files: (body, content_type) = self._encode_files(files, data) else: if data: body = self._encode_params(data) if isinstance(data, basestring) or hasattr(data, "read"): content_type = None else: content_type = "application/x-www-form-urlencoded" self.prepare_content_length(body) # Add content-type if it wasn't explicitly provided. if content_type and ("content-type" not in self.headers): self.headers["Content-Type"] = content_type self.body = body def prepare_content_length(self, body): """Prepare Content-Length header based on request method and body""" if body is not None: length = super_len(body) if length: # If length exists, set it. Otherwise, we fallback # to Transfer-Encoding: chunked. self.headers["Content-Length"] = builtin_str(length) elif ( self.method not in ("GET", "HEAD") and self.headers.get("Content-Length") is None ): # Set Content-Length to 0 for methods that can have a body # but don't provide one. (i.e. not GET or HEAD) self.headers["Content-Length"] = "0" def prepare_auth(self, auth, url=""): """Prepares the given HTTP auth data.""" # If no Auth is explicitly provided, extract it from the URL first. if auth is None: url_auth = get_auth_from_url(self.url) auth = url_auth if any(url_auth) else None if auth: if isinstance(auth, tuple) and len(auth) == 2: # special-case basic HTTP auth auth = HTTPBasicAuth(*auth) # Allow auth to make its changes. r = auth(self) # Update self to reflect the auth changes. self.__dict__.update(r.__dict__) # Recompute Content-Length self.prepare_content_length(self.body) def prepare_cookies(self, cookies): """Prepares the given HTTP cookie data. This function eventually generates a ``Cookie`` header from the given cookies using cookielib. Due to cookielib's design, the header will not be regenerated if it already exists, meaning this function can only be called once for the life of the :class:`PreparedRequest ` object. Any subsequent calls to ``prepare_cookies`` will have no actual effect, unless the "Cookie" header is removed beforehand. """ if isinstance(cookies, cookielib.CookieJar): self._cookies = cookies else: self._cookies = cookiejar_from_dict(cookies) cookie_header = get_cookie_header(self._cookies, self) if cookie_header is not None: self.headers["Cookie"] = cookie_header def prepare_hooks(self, hooks): """Prepares the given hooks.""" # hooks can be passed as None to the prepare method and to this # method. To prevent iterating over None, simply use an empty list # if hooks is False-y hooks = hooks or [] for event in hooks: self.register_hook(event, hooks[event]) class Response: """The :class:`Response ` object, which contains a server's response to an HTTP request. """ __attrs__ = [ "_content", "status_code", "headers", "url", "history", "encoding", "reason", "cookies", "elapsed", "request", ] def __init__(self): self._content = False self._content_consumed = False self._next = None #: Integer Code of responded HTTP Status, e.g. 404 or 200. self.status_code = None #: Case-insensitive Dictionary of Response Headers. #: For example, ``headers['content-encoding']`` will return the #: value of a ``'Content-Encoding'`` response header. self.headers = CaseInsensitiveDict() #: File-like object representation of response (for advanced usage). #: Use of ``raw`` requires that ``stream=True`` be set on the request. #: This requirement does not apply for use internally to Requests. self.raw = None #: Final URL location of Response. self.url = None #: Encoding to decode with when accessing r.text. self.encoding = None #: A list of :class:`Response ` objects from #: the history of the Request. Any redirect responses will end #: up here. The list is sorted from the oldest to the most recent request. self.history = [] #: Textual reason of responded HTTP Status, e.g. "Not Found" or "OK". self.reason = None #: A CookieJar of Cookies the server sent back. self.cookies = cookiejar_from_dict({}) #: The amount of time elapsed between sending the request #: and the arrival of the response (as a timedelta). #: This property specifically measures the time taken between sending #: the first byte of the request and finishing parsing the headers. It #: is therefore unaffected by consuming the response content or the #: value of the ``stream`` keyword argument. self.elapsed = datetime.timedelta(0) #: The :class:`PreparedRequest ` object to which this #: is a response. self.request = None def __enter__(self): return self def __exit__(self, *args): self.close() def __getstate__(self): # Consume everything; accessing the content attribute makes # sure the content has been fully read. if not self._content_consumed: self.content return {attr: getattr(self, attr, None) for attr in self.__attrs__} def __setstate__(self, state): for name, value in state.items(): setattr(self, name, value) # pickled objects do not have .raw setattr(self, "_content_consumed", True) setattr(self, "raw", None) def __repr__(self): return f"" def __bool__(self): """Returns True if :attr:`status_code` is less than 400. This attribute checks if the status code of the response is between 400 and 600 to see if there was a client error or a server error. If the status code, is between 200 and 400, this will return True. This is **not** a check to see if the response code is ``200 OK``. """ return self.ok def __nonzero__(self): """Returns True if :attr:`status_code` is less than 400. This attribute checks if the status code of the response is between 400 and 600 to see if there was a client error or a server error. If the status code, is between 200 and 400, this will return True. This is **not** a check to see if the response code is ``200 OK``. """ return self.ok def __iter__(self): """Allows you to use a response as an iterator.""" return self.iter_content(128) @property def ok(self): """Returns True if :attr:`status_code` is less than 400, False if not. This attribute checks if the status code of the response is between 400 and 600 to see if there was a client error or a server error. If the status code is between 200 and 400, this will return True. This is **not** a check to see if the response code is ``200 OK``. """ try: self.raise_for_status() except HTTPError: return False return True @property def is_redirect(self): """True if this Response is a well-formed HTTP redirect that could have been processed automatically (by :meth:`Session.resolve_redirects`). """ return "location" in self.headers and self.status_code in REDIRECT_STATI @property def is_permanent_redirect(self): """True if this Response one of the permanent versions of redirect.""" return "location" in self.headers and self.status_code in ( codes.moved_permanently, codes.permanent_redirect, ) @property def next(self): """Returns a PreparedRequest for the next request in a redirect chain, if there is one.""" return self._next @property def apparent_encoding(self): """The apparent encoding, provided by the charset_normalizer or chardet libraries.""" if chardet is not None: return chardet.detect(self.content)["encoding"] else: # If no character detection library is available, we'll fall back # to a standard Python utf-8 str. return "utf-8" def iter_content(self, chunk_size=1, decode_unicode=False): """Iterates over the response data. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. The chunk size is the number of bytes it should read into memory. This is not necessarily the length of each item returned as decoding can take place. chunk_size must be of type int or None. A value of None will function differently depending on the value of `stream`. stream=True will read data as it arrives in whatever size the chunks are received. If stream=False, data is returned as a single chunk. If decode_unicode is True, content will be decoded using the best available encoding based on the response. """ def generate(): # Special case for urllib3. if hasattr(self.raw, "stream"): try: yield from self.raw.stream(chunk_size, decode_content=True) except ProtocolError as e: raise ChunkedEncodingError(e) except DecodeError as e: raise ContentDecodingError(e) except ReadTimeoutError as e: raise ConnectionError(e) except SSLError as e: raise RequestsSSLError(e) else: # Standard file-like object. while True: chunk = self.raw.read(chunk_size) if not chunk: break yield chunk self._content_consumed = True if self._content_consumed and isinstance(self._content, bool): raise StreamConsumedError() elif chunk_size is not None and not isinstance(chunk_size, int): raise TypeError( f"chunk_size must be an int, it is instead a {type(chunk_size)}." ) # simulate reading small chunks of the content reused_chunks = iter_slices(self._content, chunk_size) stream_chunks = generate() chunks = reused_chunks if self._content_consumed else stream_chunks if decode_unicode: chunks = stream_decode_response_unicode(chunks, self) return chunks def iter_lines( self, chunk_size=ITER_CHUNK_SIZE, decode_unicode=False, delimiter=None ): """Iterates over the response data, one line at a time. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. .. note:: This method is not reentrant safe. """ pending = None for chunk in self.iter_content( chunk_size=chunk_size, decode_unicode=decode_unicode ): if pending is not None: chunk = pending + chunk if delimiter: lines = chunk.split(delimiter) else: lines = chunk.splitlines() if lines and lines[-1] and chunk and lines[-1][-1] == chunk[-1]: pending = lines.pop() else: pending = None yield from lines if pending is not None: yield pending @property def content(self): """Content of the response, in bytes.""" if self._content is False: # Read the contents. if self._content_consumed: raise RuntimeError("The content for this response was already consumed") if self.status_code == 0 or self.raw is None: self._content = None else: self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b"" self._content_consumed = True # don't need to release the connection; that's been handled by urllib3 # since we exhausted the data. return self._content @property def text(self): """Content of the response, in unicode. If Response.encoding is None, encoding will be guessed using ``charset_normalizer`` or ``chardet``. The encoding of the response content is determined based solely on HTTP headers, following RFC 2616 to the letter. If you can take advantage of non-HTTP knowledge to make a better guess at the encoding, you should set ``r.encoding`` appropriately before accessing this property. """ # Try charset from content-type content = None encoding = self.encoding if not self.content: return "" # Fallback to auto-detected encoding. if self.encoding is None: encoding = self.apparent_encoding # Decode unicode from given encoding. try: content = str(self.content, encoding, errors="replace") except (LookupError, TypeError): # A LookupError is raised if the encoding was not found which could # indicate a misspelling or similar mistake. # # A TypeError can be raised if encoding is None # # So we try blindly encoding. content = str(self.content, errors="replace") return content def json(self, **kwargs): r"""Decodes the JSON response body (if any) as a Python object. This may return a dictionary, list, etc. depending on what is in the response. :param \*\*kwargs: Optional arguments that ``json.loads`` takes. :raises requests.exceptions.JSONDecodeError: If the response body does not contain valid json. """ if not self.encoding and self.content and len(self.content) > 3: # No encoding set. JSON RFC 4627 section 3 states we should expect # UTF-8, -16 or -32. Detect which one to use; If the detection or # decoding fails, fall back to `self.text` (using charset_normalizer to make # a best guess). encoding = guess_json_utf(self.content) if encoding is not None: try: return complexjson.loads(self.content.decode(encoding), **kwargs) except UnicodeDecodeError: # Wrong UTF codec detected; usually because it's not UTF-8 # but some other 8-bit codec. This is an RFC violation, # and the server didn't bother to tell us what codec *was* # used. pass except JSONDecodeError as e: raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) try: return complexjson.loads(self.text, **kwargs) except JSONDecodeError as e: # Catch JSON-related errors and raise as requests.JSONDecodeError # This aliases json.JSONDecodeError and simplejson.JSONDecodeError raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) @property def links(self): """Returns the parsed header links of the response, if any.""" header = self.headers.get("link") resolved_links = {} if header: links = parse_header_links(header) for link in links: key = link.get("rel") or link.get("url") resolved_links[key] = link return resolved_links def raise_for_status(self): """Raises :class:`HTTPError`, if one occurred.""" http_error_msg = "" if isinstance(self.reason, bytes): # We attempt to decode utf-8 first because some servers # choose to localize their reason strings. If the string # isn't utf-8, we fall back to iso-8859-1 for all other # encodings. (See PR #3538) try: reason = self.reason.decode("utf-8") except UnicodeDecodeError: reason = self.reason.decode("iso-8859-1") else: reason = self.reason if 400 <= self.status_code < 500: http_error_msg = ( f"{self.status_code} Client Error: {reason} for url: {self.url}" ) elif 500 <= self.status_code < 600: http_error_msg = ( f"{self.status_code} Server Error: {reason} for url: {self.url}" ) if http_error_msg: raise HTTPError(http_error_msg, response=self) def close(self): """Releases the connection back to the pool. Once this method has been called the underlying ``raw`` object must not be accessed again. *Note: Should not normally need to be called explicitly.* """ if not self._content_consumed: self.raw.close() release_conn = getattr(self.raw, "release_conn", None) if release_conn is not None: release_conn() ================================================ FILE: src/pip/_vendor/requests/packages.py ================================================ import sys from .compat import chardet # This code exists for backwards compatibility reasons. # I don't like it either. Just look the other way. :) for package in ("urllib3", "idna"): vendored_package = "pip._vendor." + package locals()[package] = __import__(vendored_package) # This traversal is apparently necessary such that the identities are # preserved (requests.packages.urllib3.* is urllib3.*) for mod in list(sys.modules): if mod == vendored_package or mod.startswith(vendored_package + '.'): unprefixed_mod = mod[len("pip._vendor."):] sys.modules['pip._vendor.requests.packages.' + unprefixed_mod] = sys.modules[mod] if chardet is not None: target = chardet.__name__ for mod in list(sys.modules): if mod == target or mod.startswith(f"{target}."): imported_mod = sys.modules[mod] sys.modules[f"requests.packages.{mod}"] = imported_mod mod = mod.replace(target, "chardet") sys.modules[f"requests.packages.{mod}"] = imported_mod ================================================ FILE: src/pip/_vendor/requests/sessions.py ================================================ """ requests.sessions ~~~~~~~~~~~~~~~~~ This module provides a Session object to manage and persist settings across requests (cookies, auth, proxies). """ import os import sys import time from collections import OrderedDict from datetime import timedelta from ._internal_utils import to_native_string from .adapters import HTTPAdapter from .auth import _basic_auth_str from .compat import Mapping, cookielib, urljoin, urlparse from .cookies import ( RequestsCookieJar, cookiejar_from_dict, extract_cookies_to_jar, merge_cookies, ) from .exceptions import ( ChunkedEncodingError, ContentDecodingError, InvalidSchema, TooManyRedirects, ) from .hooks import default_hooks, dispatch_hook # formerly defined here, reexposed here for backward compatibility from .models import ( # noqa: F401 DEFAULT_REDIRECT_LIMIT, REDIRECT_STATI, PreparedRequest, Request, ) from .status_codes import codes from .structures import CaseInsensitiveDict from .utils import ( # noqa: F401 DEFAULT_PORTS, default_headers, get_auth_from_url, get_environ_proxies, get_netrc_auth, requote_uri, resolve_proxies, rewind_body, should_bypass_proxies, to_key_val_list, ) # Preferred clock, based on which one is more accurate on a given system. if sys.platform == "win32": preferred_clock = time.perf_counter else: preferred_clock = time.time def merge_setting(request_setting, session_setting, dict_class=OrderedDict): """Determines appropriate setting for a given request, taking into account the explicit setting on that request, and the setting in the session. If a setting is a dictionary, they will be merged together using `dict_class` """ if session_setting is None: return request_setting if request_setting is None: return session_setting # Bypass if not a dictionary (e.g. verify) if not ( isinstance(session_setting, Mapping) and isinstance(request_setting, Mapping) ): return request_setting merged_setting = dict_class(to_key_val_list(session_setting)) merged_setting.update(to_key_val_list(request_setting)) # Remove keys that are set to None. Extract keys first to avoid altering # the dictionary during iteration. none_keys = [k for (k, v) in merged_setting.items() if v is None] for key in none_keys: del merged_setting[key] return merged_setting def merge_hooks(request_hooks, session_hooks, dict_class=OrderedDict): """Properly merges both requests and session hooks. This is necessary because when request_hooks == {'response': []}, the merge breaks Session hooks entirely. """ if session_hooks is None or session_hooks.get("response") == []: return request_hooks if request_hooks is None or request_hooks.get("response") == []: return session_hooks return merge_setting(request_hooks, session_hooks, dict_class) class SessionRedirectMixin: def get_redirect_target(self, resp): """Receives a Response. Returns a redirect URI or ``None``""" # Due to the nature of how requests processes redirects this method will # be called at least once upon the original response and at least twice # on each subsequent redirect response (if any). # If a custom mixin is used to handle this logic, it may be advantageous # to cache the redirect location onto the response object as a private # attribute. if resp.is_redirect: location = resp.headers["location"] # Currently the underlying http module on py3 decode headers # in latin1, but empirical evidence suggests that latin1 is very # rarely used with non-ASCII characters in HTTP headers. # It is more likely to get UTF8 header rather than latin1. # This causes incorrect handling of UTF8 encoded location headers. # To solve this, we re-encode the location in latin1. location = location.encode("latin1") return to_native_string(location, "utf8") return None def should_strip_auth(self, old_url, new_url): """Decide whether Authorization header should be removed when redirecting""" old_parsed = urlparse(old_url) new_parsed = urlparse(new_url) if old_parsed.hostname != new_parsed.hostname: return True # Special case: allow http -> https redirect when using the standard # ports. This isn't specified by RFC 7235, but is kept to avoid # breaking backwards compatibility with older versions of requests # that allowed any redirects on the same host. if ( old_parsed.scheme == "http" and old_parsed.port in (80, None) and new_parsed.scheme == "https" and new_parsed.port in (443, None) ): return False # Handle default port usage corresponding to scheme. changed_port = old_parsed.port != new_parsed.port changed_scheme = old_parsed.scheme != new_parsed.scheme default_port = (DEFAULT_PORTS.get(old_parsed.scheme, None), None) if ( not changed_scheme and old_parsed.port in default_port and new_parsed.port in default_port ): return False # Standard case: root URI must match return changed_port or changed_scheme def resolve_redirects( self, resp, req, stream=False, timeout=None, verify=True, cert=None, proxies=None, yield_requests=False, **adapter_kwargs, ): """Receives a Response. Returns a generator of Responses or Requests.""" hist = [] # keep track of history url = self.get_redirect_target(resp) previous_fragment = urlparse(req.url).fragment while url: prepared_request = req.copy() # Update history and keep track of redirects. # resp.history must ignore the original request in this loop hist.append(resp) resp.history = hist[1:] try: resp.content # Consume socket so it can be released except (ChunkedEncodingError, ContentDecodingError, RuntimeError): resp.raw.read(decode_content=False) if len(resp.history) >= self.max_redirects: raise TooManyRedirects( f"Exceeded {self.max_redirects} redirects.", response=resp ) # Release the connection back into the pool. resp.close() # Handle redirection without scheme (see: RFC 1808 Section 4) if url.startswith("//"): parsed_rurl = urlparse(resp.url) url = ":".join([to_native_string(parsed_rurl.scheme), url]) # Normalize url case and attach previous fragment if needed (RFC 7231 7.1.2) parsed = urlparse(url) if parsed.fragment == "" and previous_fragment: parsed = parsed._replace(fragment=previous_fragment) elif parsed.fragment: previous_fragment = parsed.fragment url = parsed.geturl() # Facilitate relative 'location' headers, as allowed by RFC 7231. # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource') # Compliant with RFC3986, we percent encode the url. if not parsed.netloc: url = urljoin(resp.url, requote_uri(url)) else: url = requote_uri(url) prepared_request.url = to_native_string(url) self.rebuild_method(prepared_request, resp) # https://github.com/psf/requests/issues/1084 if resp.status_code not in ( codes.temporary_redirect, codes.permanent_redirect, ): # https://github.com/psf/requests/issues/3490 purged_headers = ("Content-Length", "Content-Type", "Transfer-Encoding") for header in purged_headers: prepared_request.headers.pop(header, None) prepared_request.body = None headers = prepared_request.headers headers.pop("Cookie", None) # Extract any cookies sent on the response to the cookiejar # in the new request. Because we've mutated our copied prepared # request, use the old one that we haven't yet touched. extract_cookies_to_jar(prepared_request._cookies, req, resp.raw) merge_cookies(prepared_request._cookies, self.cookies) prepared_request.prepare_cookies(prepared_request._cookies) # Rebuild auth and proxy information. proxies = self.rebuild_proxies(prepared_request, proxies) self.rebuild_auth(prepared_request, resp) # A failed tell() sets `_body_position` to `object()`. This non-None # value ensures `rewindable` will be True, allowing us to raise an # UnrewindableBodyError, instead of hanging the connection. rewindable = prepared_request._body_position is not None and ( "Content-Length" in headers or "Transfer-Encoding" in headers ) # Attempt to rewind consumed file-like object. if rewindable: rewind_body(prepared_request) # Override the original request. req = prepared_request if yield_requests: yield req else: resp = self.send( req, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies, allow_redirects=False, **adapter_kwargs, ) extract_cookies_to_jar(self.cookies, prepared_request, resp.raw) # extract redirect url, if any, for the next loop url = self.get_redirect_target(resp) yield resp def rebuild_auth(self, prepared_request, response): """When being redirected we may want to strip authentication from the request to avoid leaking credentials. This method intelligently removes and reapplies authentication where possible to avoid credential loss. """ headers = prepared_request.headers url = prepared_request.url if "Authorization" in headers and self.should_strip_auth( response.request.url, url ): # If we get redirected to a new host, we should strip out any # authentication headers. del headers["Authorization"] # .netrc might have more auth for us on our new host. new_auth = get_netrc_auth(url) if self.trust_env else None if new_auth is not None: prepared_request.prepare_auth(new_auth) def rebuild_proxies(self, prepared_request, proxies): """This method re-evaluates the proxy configuration by considering the environment variables. If we are redirected to a URL covered by NO_PROXY, we strip the proxy configuration. Otherwise, we set missing proxy keys for this URL (in case they were stripped by a previous redirect). This method also replaces the Proxy-Authorization header where necessary. :rtype: dict """ headers = prepared_request.headers scheme = urlparse(prepared_request.url).scheme new_proxies = resolve_proxies(prepared_request, proxies, self.trust_env) if "Proxy-Authorization" in headers: del headers["Proxy-Authorization"] try: username, password = get_auth_from_url(new_proxies[scheme]) except KeyError: username, password = None, None # urllib3 handles proxy authorization for us in the standard adapter. # Avoid appending this to TLS tunneled requests where it may be leaked. if not scheme.startswith("https") and username and password: headers["Proxy-Authorization"] = _basic_auth_str(username, password) return new_proxies def rebuild_method(self, prepared_request, response): """When being redirected we may want to change the method of the request based on certain specs or browser behavior. """ method = prepared_request.method # https://tools.ietf.org/html/rfc7231#section-6.4.4 if response.status_code == codes.see_other and method != "HEAD": method = "GET" # Do what the browsers do, despite standards... # First, turn 302s into GETs. if response.status_code == codes.found and method != "HEAD": method = "GET" # Second, if a POST is responded to with a 301, turn it into a GET. # This bizarre behaviour is explained in Issue 1704. if response.status_code == codes.moved and method == "POST": method = "GET" prepared_request.method = method class Session(SessionRedirectMixin): """A Requests session. Provides cookie persistence, connection-pooling, and configuration. Basic Usage:: >>> import requests >>> s = requests.Session() >>> s.get('https://httpbin.org/get') Or as a context manager:: >>> with requests.Session() as s: ... s.get('https://httpbin.org/get') """ __attrs__ = [ "headers", "cookies", "auth", "proxies", "hooks", "params", "verify", "cert", "adapters", "stream", "trust_env", "max_redirects", ] def __init__(self): #: A case-insensitive dictionary of headers to be sent on each #: :class:`Request ` sent from this #: :class:`Session `. self.headers = default_headers() #: Default Authentication tuple or object to attach to #: :class:`Request `. self.auth = None #: Dictionary mapping protocol or protocol and host to the URL of the proxy #: (e.g. {'http': 'foo.bar:3128', 'http://host.name': 'foo.bar:4012'}) to #: be used on each :class:`Request `. self.proxies = {} #: Event-handling hooks. self.hooks = default_hooks() #: Dictionary of querystring data to attach to each #: :class:`Request `. The dictionary values may be lists for #: representing multivalued query parameters. self.params = {} #: Stream response content default. self.stream = False #: SSL Verification default. #: Defaults to `True`, requiring requests to verify the TLS certificate at the #: remote end. #: If verify is set to `False`, requests will accept any TLS certificate #: presented by the server, and will ignore hostname mismatches and/or #: expired certificates, which will make your application vulnerable to #: man-in-the-middle (MitM) attacks. #: Only set this to `False` for testing. self.verify = True #: SSL client certificate default, if String, path to ssl client #: cert file (.pem). If Tuple, ('cert', 'key') pair. self.cert = None #: Maximum number of redirects allowed. If the request exceeds this #: limit, a :class:`TooManyRedirects` exception is raised. #: This defaults to requests.models.DEFAULT_REDIRECT_LIMIT, which is #: 30. self.max_redirects = DEFAULT_REDIRECT_LIMIT #: Trust environment settings for proxy configuration, default #: authentication and similar. self.trust_env = True #: A CookieJar containing all currently outstanding cookies set on this #: session. By default it is a #: :class:`RequestsCookieJar `, but #: may be any other ``cookielib.CookieJar`` compatible object. self.cookies = cookiejar_from_dict({}) # Default connection adapters. self.adapters = OrderedDict() self.mount("https://", HTTPAdapter()) self.mount("http://", HTTPAdapter()) def __enter__(self): return self def __exit__(self, *args): self.close() def prepare_request(self, request): """Constructs a :class:`PreparedRequest ` for transmission and returns it. The :class:`PreparedRequest` has settings merged from the :class:`Request ` instance and those of the :class:`Session`. :param request: :class:`Request` instance to prepare with this session's settings. :rtype: requests.PreparedRequest """ cookies = request.cookies or {} # Bootstrap CookieJar. if not isinstance(cookies, cookielib.CookieJar): cookies = cookiejar_from_dict(cookies) # Merge with session cookies merged_cookies = merge_cookies( merge_cookies(RequestsCookieJar(), self.cookies), cookies ) # Set environment's basic authentication if not explicitly set. auth = request.auth if self.trust_env and not auth and not self.auth: auth = get_netrc_auth(request.url) p = PreparedRequest() p.prepare( method=request.method.upper(), url=request.url, files=request.files, data=request.data, json=request.json, headers=merge_setting( request.headers, self.headers, dict_class=CaseInsensitiveDict ), params=merge_setting(request.params, self.params), auth=merge_setting(auth, self.auth), cookies=merged_cookies, hooks=merge_hooks(request.hooks, self.hooks), ) return p def request( self, method, url, params=None, data=None, headers=None, cookies=None, files=None, auth=None, timeout=None, allow_redirects=True, proxies=None, hooks=None, stream=None, verify=None, cert=None, json=None, ): """Constructs a :class:`Request `, prepares it and sends it. Returns :class:`Response ` object. :param method: method for the new :class:`Request` object. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json to send in the body of the :class:`Request`. :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. :param files: (optional) Dictionary of ``'filename': file-like-objects`` for multipart encoding upload. :param auth: (optional) Auth tuple or callable to enable Basic/Digest/Custom HTTP Auth. :param timeout: (optional) How many seconds to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple :param allow_redirects: (optional) Set to True by default. :type allow_redirects: bool :param proxies: (optional) Dictionary mapping protocol or protocol and hostname to the URL of the proxy. :param hooks: (optional) Dictionary mapping hook name to one event or list of events, event must be callable. :param stream: (optional) whether to immediately download the response content. Defaults to ``False``. :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. Defaults to ``True``. When set to ``False``, requests will accept any TLS certificate presented by the server, and will ignore hostname mismatches and/or expired certificates, which will make your application vulnerable to man-in-the-middle (MitM) attacks. Setting verify to ``False`` may be useful during local development or testing. :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. :rtype: requests.Response """ # Create the Request. req = Request( method=method.upper(), url=url, headers=headers, files=files, data=data or {}, json=json, params=params or {}, auth=auth, cookies=cookies, hooks=hooks, ) prep = self.prepare_request(req) proxies = proxies or {} settings = self.merge_environment_settings( prep.url, proxies, stream, verify, cert ) # Send the request. send_kwargs = { "timeout": timeout, "allow_redirects": allow_redirects, } send_kwargs.update(settings) resp = self.send(prep, **send_kwargs) return resp def get(self, url, **kwargs): r"""Sends a GET request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response """ kwargs.setdefault("allow_redirects", True) return self.request("GET", url, **kwargs) def options(self, url, **kwargs): r"""Sends a OPTIONS request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response """ kwargs.setdefault("allow_redirects", True) return self.request("OPTIONS", url, **kwargs) def head(self, url, **kwargs): r"""Sends a HEAD request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response """ kwargs.setdefault("allow_redirects", False) return self.request("HEAD", url, **kwargs) def post(self, url, data=None, json=None, **kwargs): r"""Sends a POST request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response """ return self.request("POST", url, data=data, json=json, **kwargs) def put(self, url, data=None, **kwargs): r"""Sends a PUT request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response """ return self.request("PUT", url, data=data, **kwargs) def patch(self, url, data=None, **kwargs): r"""Sends a PATCH request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response """ return self.request("PATCH", url, data=data, **kwargs) def delete(self, url, **kwargs): r"""Sends a DELETE request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response """ return self.request("DELETE", url, **kwargs) def send(self, request, **kwargs): """Send a given PreparedRequest. :rtype: requests.Response """ # Set defaults that the hooks can utilize to ensure they always have # the correct parameters to reproduce the previous request. kwargs.setdefault("stream", self.stream) kwargs.setdefault("verify", self.verify) kwargs.setdefault("cert", self.cert) if "proxies" not in kwargs: kwargs["proxies"] = resolve_proxies(request, self.proxies, self.trust_env) # It's possible that users might accidentally send a Request object. # Guard against that specific failure case. if isinstance(request, Request): raise ValueError("You can only send PreparedRequests.") # Set up variables needed for resolve_redirects and dispatching of hooks allow_redirects = kwargs.pop("allow_redirects", True) stream = kwargs.get("stream") hooks = request.hooks # Get the appropriate adapter to use adapter = self.get_adapter(url=request.url) # Start time (approximately) of the request start = preferred_clock() # Send the request r = adapter.send(request, **kwargs) # Total elapsed time of the request (approximately) elapsed = preferred_clock() - start r.elapsed = timedelta(seconds=elapsed) # Response manipulation hooks r = dispatch_hook("response", hooks, r, **kwargs) # Persist cookies if r.history: # If the hooks create history then we want those cookies too for resp in r.history: extract_cookies_to_jar(self.cookies, resp.request, resp.raw) extract_cookies_to_jar(self.cookies, request, r.raw) # Resolve redirects if allowed. if allow_redirects: # Redirect resolving generator. gen = self.resolve_redirects(r, request, **kwargs) history = [resp for resp in gen] else: history = [] # Shuffle things around if there's history. if history: # Insert the first (original) request at the start history.insert(0, r) # Get the last request made r = history.pop() r.history = history # If redirects aren't being followed, store the response on the Request for Response.next(). if not allow_redirects: try: r._next = next( self.resolve_redirects(r, request, yield_requests=True, **kwargs) ) except StopIteration: pass if not stream: r.content return r def merge_environment_settings(self, url, proxies, stream, verify, cert): """ Check the environment and merge it with some settings. :rtype: dict """ # Gather clues from the surrounding environment. if self.trust_env: # Set environment's proxies. no_proxy = proxies.get("no_proxy") if proxies is not None else None env_proxies = get_environ_proxies(url, no_proxy=no_proxy) for k, v in env_proxies.items(): proxies.setdefault(k, v) # Look for requests environment configuration # and be compatible with cURL. if verify is True or verify is None: verify = ( os.environ.get("REQUESTS_CA_BUNDLE") or os.environ.get("CURL_CA_BUNDLE") or verify ) # Merge all the kwargs. proxies = merge_setting(proxies, self.proxies) stream = merge_setting(stream, self.stream) verify = merge_setting(verify, self.verify) cert = merge_setting(cert, self.cert) return {"proxies": proxies, "stream": stream, "verify": verify, "cert": cert} def get_adapter(self, url): """ Returns the appropriate connection adapter for the given URL. :rtype: requests.adapters.BaseAdapter """ for prefix, adapter in self.adapters.items(): if url.lower().startswith(prefix.lower()): return adapter # Nothing matches :-/ raise InvalidSchema(f"No connection adapters were found for {url!r}") def close(self): """Closes all adapters and as such the session""" for v in self.adapters.values(): v.close() def mount(self, prefix, adapter): """Registers a connection adapter to a prefix. Adapters are sorted in descending order by prefix length. """ self.adapters[prefix] = adapter keys_to_move = [k for k in self.adapters if len(k) < len(prefix)] for key in keys_to_move: self.adapters[key] = self.adapters.pop(key) def __getstate__(self): state = {attr: getattr(self, attr, None) for attr in self.__attrs__} return state def __setstate__(self, state): for attr, value in state.items(): setattr(self, attr, value) def session(): """ Returns a :class:`Session` for context-management. .. deprecated:: 1.0.0 This method has been deprecated since version 1.0.0 and is only kept for backwards compatibility. New code should use :class:`~requests.sessions.Session` to create a session. This may be removed at a future date. :rtype: Session """ return Session() ================================================ FILE: src/pip/_vendor/requests/status_codes.py ================================================ r""" The ``codes`` object defines a mapping from common names for HTTP statuses to their numerical codes, accessible either as attributes or as dictionary items. Example:: >>> import requests >>> requests.codes['temporary_redirect'] 307 >>> requests.codes.teapot 418 >>> requests.codes['\o/'] 200 Some codes have multiple names, and both upper- and lower-case versions of the names are allowed. For example, ``codes.ok``, ``codes.OK``, and ``codes.okay`` all correspond to the HTTP status code 200. """ from .structures import LookupDict _codes = { # Informational. 100: ("continue",), 101: ("switching_protocols",), 102: ("processing", "early-hints"), 103: ("checkpoint",), 122: ("uri_too_long", "request_uri_too_long"), 200: ("ok", "okay", "all_ok", "all_okay", "all_good", "\\o/", "✓"), 201: ("created",), 202: ("accepted",), 203: ("non_authoritative_info", "non_authoritative_information"), 204: ("no_content",), 205: ("reset_content", "reset"), 206: ("partial_content", "partial"), 207: ("multi_status", "multiple_status", "multi_stati", "multiple_stati"), 208: ("already_reported",), 226: ("im_used",), # Redirection. 300: ("multiple_choices",), 301: ("moved_permanently", "moved", "\\o-"), 302: ("found",), 303: ("see_other", "other"), 304: ("not_modified",), 305: ("use_proxy",), 306: ("switch_proxy",), 307: ("temporary_redirect", "temporary_moved", "temporary"), 308: ( "permanent_redirect", "resume_incomplete", "resume", ), # "resume" and "resume_incomplete" to be removed in 3.0 # Client Error. 400: ("bad_request", "bad"), 401: ("unauthorized",), 402: ("payment_required", "payment"), 403: ("forbidden",), 404: ("not_found", "-o-"), 405: ("method_not_allowed", "not_allowed"), 406: ("not_acceptable",), 407: ("proxy_authentication_required", "proxy_auth", "proxy_authentication"), 408: ("request_timeout", "timeout"), 409: ("conflict",), 410: ("gone",), 411: ("length_required",), 412: ("precondition_failed", "precondition"), 413: ("request_entity_too_large", "content_too_large"), 414: ("request_uri_too_large", "uri_too_long"), 415: ("unsupported_media_type", "unsupported_media", "media_type"), 416: ( "requested_range_not_satisfiable", "requested_range", "range_not_satisfiable", ), 417: ("expectation_failed",), 418: ("im_a_teapot", "teapot", "i_am_a_teapot"), 421: ("misdirected_request",), 422: ("unprocessable_entity", "unprocessable", "unprocessable_content"), 423: ("locked",), 424: ("failed_dependency", "dependency"), 425: ("unordered_collection", "unordered", "too_early"), 426: ("upgrade_required", "upgrade"), 428: ("precondition_required", "precondition"), 429: ("too_many_requests", "too_many"), 431: ("header_fields_too_large", "fields_too_large"), 444: ("no_response", "none"), 449: ("retry_with", "retry"), 450: ("blocked_by_windows_parental_controls", "parental_controls"), 451: ("unavailable_for_legal_reasons", "legal_reasons"), 499: ("client_closed_request",), # Server Error. 500: ("internal_server_error", "server_error", "/o\\", "✗"), 501: ("not_implemented",), 502: ("bad_gateway",), 503: ("service_unavailable", "unavailable"), 504: ("gateway_timeout",), 505: ("http_version_not_supported", "http_version"), 506: ("variant_also_negotiates",), 507: ("insufficient_storage",), 509: ("bandwidth_limit_exceeded", "bandwidth"), 510: ("not_extended",), 511: ("network_authentication_required", "network_auth", "network_authentication"), } codes = LookupDict(name="status_codes") def _init(): for code, titles in _codes.items(): for title in titles: setattr(codes, title, code) if not title.startswith(("\\", "/")): setattr(codes, title.upper(), code) def doc(code): names = ", ".join(f"``{n}``" for n in _codes[code]) return "* %d: %s" % (code, names) global __doc__ __doc__ = ( __doc__ + "\n" + "\n".join(doc(code) for code in sorted(_codes)) if __doc__ is not None else None ) _init() ================================================ FILE: src/pip/_vendor/requests/structures.py ================================================ """ requests.structures ~~~~~~~~~~~~~~~~~~~ Data structures that power Requests. """ from collections import OrderedDict from .compat import Mapping, MutableMapping class CaseInsensitiveDict(MutableMapping): """A case-insensitive ``dict``-like object. Implements all methods and operations of ``MutableMapping`` as well as dict's ``copy``. Also provides ``lower_items``. All keys are expected to be strings. The structure remembers the case of the last key to be set, and ``iter(instance)``, ``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()`` will contain case-sensitive keys. However, querying and contains testing is case insensitive:: cid = CaseInsensitiveDict() cid['Accept'] = 'application/json' cid['aCCEPT'] == 'application/json' # True list(cid) == ['Accept'] # True For example, ``headers['content-encoding']`` will return the value of a ``'Content-Encoding'`` response header, regardless of how the header name was originally stored. If the constructor, ``.update``, or equality comparison operations are given keys that have equal ``.lower()``s, the behavior is undefined. """ def __init__(self, data=None, **kwargs): self._store = OrderedDict() if data is None: data = {} self.update(data, **kwargs) def __setitem__(self, key, value): # Use the lowercased key for lookups, but store the actual # key alongside the value. self._store[key.lower()] = (key, value) def __getitem__(self, key): return self._store[key.lower()][1] def __delitem__(self, key): del self._store[key.lower()] def __iter__(self): return (casedkey for casedkey, mappedvalue in self._store.values()) def __len__(self): return len(self._store) def lower_items(self): """Like iteritems(), but with all lowercase keys.""" return ((lowerkey, keyval[1]) for (lowerkey, keyval) in self._store.items()) def __eq__(self, other): if isinstance(other, Mapping): other = CaseInsensitiveDict(other) else: return NotImplemented # Compare insensitively return dict(self.lower_items()) == dict(other.lower_items()) # Copy is required def copy(self): return CaseInsensitiveDict(self._store.values()) def __repr__(self): return str(dict(self.items())) class LookupDict(dict): """Dictionary lookup object.""" def __init__(self, name=None): self.name = name super().__init__() def __repr__(self): return f"" def __getitem__(self, key): # We allow fall-through here, so values default to None return self.__dict__.get(key, None) def get(self, key, default=None): return self.__dict__.get(key, default) ================================================ FILE: src/pip/_vendor/requests/utils.py ================================================ """ requests.utils ~~~~~~~~~~~~~~ This module provides utility functions that are used within Requests that are also useful for external consumption. """ import codecs import contextlib import io import os import re import socket import struct import sys import tempfile import warnings import zipfile from collections import OrderedDict from pip._vendor.urllib3.util import make_headers, parse_url from . import certs from .__version__ import __version__ # to_native_string is unused here, but imported here for backwards compatibility from ._internal_utils import ( # noqa: F401 _HEADER_VALIDATORS_BYTE, _HEADER_VALIDATORS_STR, HEADER_VALIDATORS, to_native_string, ) from .compat import ( Mapping, basestring, bytes, getproxies, getproxies_environment, integer_types, is_urllib3_1, ) from .compat import parse_http_list as _parse_list_header from .compat import ( proxy_bypass, proxy_bypass_environment, quote, str, unquote, urlparse, urlunparse, ) from .cookies import cookiejar_from_dict from .exceptions import ( FileModeWarning, InvalidHeader, InvalidURL, UnrewindableBodyError, ) from .structures import CaseInsensitiveDict NETRC_FILES = (".netrc", "_netrc") DEFAULT_CA_BUNDLE_PATH = certs.where() DEFAULT_PORTS = {"http": 80, "https": 443} # Ensure that ', ' is used to preserve previous delimiter behavior. DEFAULT_ACCEPT_ENCODING = ", ".join( re.split(r",\s*", make_headers(accept_encoding=True)["accept-encoding"]) ) if sys.platform == "win32": # provide a proxy_bypass version on Windows without DNS lookups def proxy_bypass_registry(host): try: import winreg except ImportError: return False try: internetSettings = winreg.OpenKey( winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Internet Settings", ) # ProxyEnable could be REG_SZ or REG_DWORD, normalizing it proxyEnable = int(winreg.QueryValueEx(internetSettings, "ProxyEnable")[0]) # ProxyOverride is almost always a string proxyOverride = winreg.QueryValueEx(internetSettings, "ProxyOverride")[0] except (OSError, ValueError): return False if not proxyEnable or not proxyOverride: return False # make a check value list from the registry entry: replace the # '' string by the localhost entry and the corresponding # canonical entry. proxyOverride = proxyOverride.split(";") # filter out empty strings to avoid re.match return true in the following code. proxyOverride = filter(None, proxyOverride) # now check if we match one of the registry values. for test in proxyOverride: if test == "": if "." not in host: return True test = test.replace(".", r"\.") # mask dots test = test.replace("*", r".*") # change glob sequence test = test.replace("?", r".") # change glob char if re.match(test, host, re.I): return True return False def proxy_bypass(host): # noqa """Return True, if the host should be bypassed. Checks proxy settings gathered from the environment, if specified, or the registry. """ if getproxies_environment(): return proxy_bypass_environment(host) else: return proxy_bypass_registry(host) def dict_to_sequence(d): """Returns an internal sequence dictionary update.""" if hasattr(d, "items"): d = d.items() return d def super_len(o): total_length = None current_position = 0 if not is_urllib3_1 and isinstance(o, str): # urllib3 2.x+ treats all strings as utf-8 instead # of latin-1 (iso-8859-1) like http.client. o = o.encode("utf-8") if hasattr(o, "__len__"): total_length = len(o) elif hasattr(o, "len"): total_length = o.len elif hasattr(o, "fileno"): try: fileno = o.fileno() except (io.UnsupportedOperation, AttributeError): # AttributeError is a surprising exception, seeing as how we've just checked # that `hasattr(o, 'fileno')`. It happens for objects obtained via # `Tarfile.extractfile()`, per issue 5229. pass else: total_length = os.fstat(fileno).st_size # Having used fstat to determine the file length, we need to # confirm that this file was opened up in binary mode. if "b" not in o.mode: warnings.warn( ( "Requests has determined the content-length for this " "request using the binary size of the file: however, the " "file has been opened in text mode (i.e. without the 'b' " "flag in the mode). This may lead to an incorrect " "content-length. In Requests 3.0, support will be removed " "for files in text mode." ), FileModeWarning, ) if hasattr(o, "tell"): try: current_position = o.tell() except OSError: # This can happen in some weird situations, such as when the file # is actually a special file descriptor like stdin. In this # instance, we don't know what the length is, so set it to zero and # let requests chunk it instead. if total_length is not None: current_position = total_length else: if hasattr(o, "seek") and total_length is None: # StringIO and BytesIO have seek but no usable fileno try: # seek to end of file o.seek(0, 2) total_length = o.tell() # seek back to current position to support # partially read file-like objects o.seek(current_position or 0) except OSError: total_length = 0 if total_length is None: total_length = 0 return max(0, total_length - current_position) def get_netrc_auth(url, raise_errors=False): """Returns the Requests tuple auth for a given url from netrc.""" netrc_file = os.environ.get("NETRC") if netrc_file is not None: netrc_locations = (netrc_file,) else: netrc_locations = (f"~/{f}" for f in NETRC_FILES) try: from netrc import NetrcParseError, netrc netrc_path = None for f in netrc_locations: loc = os.path.expanduser(f) if os.path.exists(loc): netrc_path = loc break # Abort early if there isn't one. if netrc_path is None: return ri = urlparse(url) host = ri.hostname try: _netrc = netrc(netrc_path).authenticators(host) if _netrc: # Return with login / password login_i = 0 if _netrc[0] else 1 return (_netrc[login_i], _netrc[2]) except (NetrcParseError, OSError): # If there was a parsing error or a permissions issue reading the file, # we'll just skip netrc auth unless explicitly asked to raise errors. if raise_errors: raise # App Engine hackiness. except (ImportError, AttributeError): pass def guess_filename(obj): """Tries to guess the filename of the given object.""" name = getattr(obj, "name", None) if name and isinstance(name, basestring) and name[0] != "<" and name[-1] != ">": return os.path.basename(name) def extract_zipped_paths(path): """Replace nonexistent paths that look like they refer to a member of a zip archive with the location of an extracted copy of the target, or else just return the provided path unchanged. """ if os.path.exists(path): # this is already a valid path, no need to do anything further return path # find the first valid part of the provided path and treat that as a zip archive # assume the rest of the path is the name of a member in the archive archive, member = os.path.split(path) while archive and not os.path.exists(archive): archive, prefix = os.path.split(archive) if not prefix: # If we don't check for an empty prefix after the split (in other words, archive remains unchanged after the split), # we _can_ end up in an infinite loop on a rare corner case affecting a small number of users break member = "/".join([prefix, member]) if not zipfile.is_zipfile(archive): return path zip_file = zipfile.ZipFile(archive) if member not in zip_file.namelist(): return path # we have a valid zip archive and a valid member of that archive tmp = tempfile.gettempdir() extracted_path = os.path.join(tmp, member.split("/")[-1]) if not os.path.exists(extracted_path): # use read + write to avoid the creating nested folders, we only want the file, avoids mkdir racing condition with atomic_open(extracted_path) as file_handler: file_handler.write(zip_file.read(member)) return extracted_path @contextlib.contextmanager def atomic_open(filename): """Write a file to the disk in an atomic fashion""" tmp_descriptor, tmp_name = tempfile.mkstemp(dir=os.path.dirname(filename)) try: with os.fdopen(tmp_descriptor, "wb") as tmp_handler: yield tmp_handler os.replace(tmp_name, filename) except BaseException: os.remove(tmp_name) raise def from_key_val_list(value): """Take an object and test to see if it can be represented as a dictionary. Unless it can not be represented as such, return an OrderedDict, e.g., :: >>> from_key_val_list([('key', 'val')]) OrderedDict([('key', 'val')]) >>> from_key_val_list('string') Traceback (most recent call last): ... ValueError: cannot encode objects that are not 2-tuples >>> from_key_val_list({'key': 'val'}) OrderedDict([('key', 'val')]) :rtype: OrderedDict """ if value is None: return None if isinstance(value, (str, bytes, bool, int)): raise ValueError("cannot encode objects that are not 2-tuples") return OrderedDict(value) def to_key_val_list(value): """Take an object and test to see if it can be represented as a dictionary. If it can be, return a list of tuples, e.g., :: >>> to_key_val_list([('key', 'val')]) [('key', 'val')] >>> to_key_val_list({'key': 'val'}) [('key', 'val')] >>> to_key_val_list('string') Traceback (most recent call last): ... ValueError: cannot encode objects that are not 2-tuples :rtype: list """ if value is None: return None if isinstance(value, (str, bytes, bool, int)): raise ValueError("cannot encode objects that are not 2-tuples") if isinstance(value, Mapping): value = value.items() return list(value) # From mitsuhiko/werkzeug (used with permission). def parse_list_header(value): """Parse lists as described by RFC 2068 Section 2. In particular, parse comma-separated lists where the elements of the list may include quoted-strings. A quoted-string could contain a comma. A non-quoted string could have quotes in the middle. Quotes are removed automatically after parsing. It basically works like :func:`parse_set_header` just that items may appear multiple times and case sensitivity is preserved. The return value is a standard :class:`list`: >>> parse_list_header('token, "quoted value"') ['token', 'quoted value'] To create a header from the :class:`list` again, use the :func:`dump_header` function. :param value: a string with a list header. :return: :class:`list` :rtype: list """ result = [] for item in _parse_list_header(value): if item[:1] == item[-1:] == '"': item = unquote_header_value(item[1:-1]) result.append(item) return result # From mitsuhiko/werkzeug (used with permission). def parse_dict_header(value): """Parse lists of key, value pairs as described by RFC 2068 Section 2 and convert them into a python dict: >>> d = parse_dict_header('foo="is a fish", bar="as well"') >>> type(d) is dict True >>> sorted(d.items()) [('bar', 'as well'), ('foo', 'is a fish')] If there is no value for a key it will be `None`: >>> parse_dict_header('key_without_value') {'key_without_value': None} To create a header from the :class:`dict` again, use the :func:`dump_header` function. :param value: a string with a dict header. :return: :class:`dict` :rtype: dict """ result = {} for item in _parse_list_header(value): if "=" not in item: result[item] = None continue name, value = item.split("=", 1) if value[:1] == value[-1:] == '"': value = unquote_header_value(value[1:-1]) result[name] = value return result # From mitsuhiko/werkzeug (used with permission). def unquote_header_value(value, is_filename=False): r"""Unquotes a header value. (Reversal of :func:`quote_header_value`). This does not use the real unquoting but what browsers are actually using for quoting. :param value: the header value to unquote. :rtype: str """ if value and value[0] == value[-1] == '"': # this is not the real unquoting, but fixing this so that the # RFC is met will result in bugs with internet explorer and # probably some other browsers as well. IE for example is # uploading files with "C:\foo\bar.txt" as filename value = value[1:-1] # if this is a filename and the starting characters look like # a UNC path, then just return the value without quotes. Using the # replace sequence below on a UNC path has the effect of turning # the leading double slash into a single slash and then # _fix_ie_filename() doesn't work correctly. See #458. if not is_filename or value[:2] != "\\\\": return value.replace("\\\\", "\\").replace('\\"', '"') return value def dict_from_cookiejar(cj): """Returns a key/value dictionary from a CookieJar. :param cj: CookieJar object to extract cookies from. :rtype: dict """ cookie_dict = {cookie.name: cookie.value for cookie in cj} return cookie_dict def add_dict_to_cookiejar(cj, cookie_dict): """Returns a CookieJar from a key/value dictionary. :param cj: CookieJar to insert cookies into. :param cookie_dict: Dict of key/values to insert into CookieJar. :rtype: CookieJar """ return cookiejar_from_dict(cookie_dict, cj) def get_encodings_from_content(content): """Returns encodings from given content string. :param content: bytestring to extract encodings from. """ warnings.warn( ( "In requests 3.0, get_encodings_from_content will be removed. For " "more information, please see the discussion on issue #2266. (This" " warning should only appear once.)" ), DeprecationWarning, ) charset_re = re.compile(r']', flags=re.I) pragma_re = re.compile(r']', flags=re.I) xml_re = re.compile(r'^<\?xml.*?encoding=["\']*(.+?)["\'>]') return ( charset_re.findall(content) + pragma_re.findall(content) + xml_re.findall(content) ) def _parse_content_type_header(header): """Returns content type and parameters from given header :param header: string :return: tuple containing content type and dictionary of parameters """ tokens = header.split(";") content_type, params = tokens[0].strip(), tokens[1:] params_dict = {} items_to_strip = "\"' " for param in params: param = param.strip() if param: key, value = param, True index_of_equals = param.find("=") if index_of_equals != -1: key = param[:index_of_equals].strip(items_to_strip) value = param[index_of_equals + 1 :].strip(items_to_strip) params_dict[key.lower()] = value return content_type, params_dict def get_encoding_from_headers(headers): """Returns encodings from given HTTP Header Dict. :param headers: dictionary to extract encoding from. :rtype: str """ content_type = headers.get("content-type") if not content_type: return None content_type, params = _parse_content_type_header(content_type) if "charset" in params: return params["charset"].strip("'\"") if "text" in content_type: return "ISO-8859-1" if "application/json" in content_type: # Assume UTF-8 based on RFC 4627: https://www.ietf.org/rfc/rfc4627.txt since the charset was unset return "utf-8" def stream_decode_response_unicode(iterator, r): """Stream decodes an iterator.""" if r.encoding is None: yield from iterator return decoder = codecs.getincrementaldecoder(r.encoding)(errors="replace") for chunk in iterator: rv = decoder.decode(chunk) if rv: yield rv rv = decoder.decode(b"", final=True) if rv: yield rv def iter_slices(string, slice_length): """Iterate over slices of a string.""" pos = 0 if slice_length is None or slice_length <= 0: slice_length = len(string) while pos < len(string): yield string[pos : pos + slice_length] pos += slice_length def get_unicode_from_response(r): """Returns the requested content back in unicode. :param r: Response object to get unicode content from. Tried: 1. charset from content-type 2. fall back and replace all unicode characters :rtype: str """ warnings.warn( ( "In requests 3.0, get_unicode_from_response will be removed. For " "more information, please see the discussion on issue #2266. (This" " warning should only appear once.)" ), DeprecationWarning, ) tried_encodings = [] # Try charset from content-type encoding = get_encoding_from_headers(r.headers) if encoding: try: return str(r.content, encoding) except UnicodeError: tried_encodings.append(encoding) # Fall back: try: return str(r.content, encoding, errors="replace") except TypeError: return r.content # The unreserved URI characters (RFC 3986) UNRESERVED_SET = frozenset( "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + "0123456789-._~" ) def unquote_unreserved(uri): """Un-escape any percent-escape sequences in a URI that are unreserved characters. This leaves all reserved, illegal and non-ASCII bytes encoded. :rtype: str """ parts = uri.split("%") for i in range(1, len(parts)): h = parts[i][0:2] if len(h) == 2 and h.isalnum(): try: c = chr(int(h, 16)) except ValueError: raise InvalidURL(f"Invalid percent-escape sequence: '{h}'") if c in UNRESERVED_SET: parts[i] = c + parts[i][2:] else: parts[i] = f"%{parts[i]}" else: parts[i] = f"%{parts[i]}" return "".join(parts) def requote_uri(uri): """Re-quote the given URI. This function passes the given URI through an unquote/quote cycle to ensure that it is fully and consistently quoted. :rtype: str """ safe_with_percent = "!#$%&'()*+,/:;=?@[]~" safe_without_percent = "!#$&'()*+,/:;=?@[]~" try: # Unquote only the unreserved characters # Then quote only illegal characters (do not quote reserved, # unreserved, or '%') return quote(unquote_unreserved(uri), safe=safe_with_percent) except InvalidURL: # We couldn't unquote the given URI, so let's try quoting it, but # there may be unquoted '%'s in the URI. We need to make sure they're # properly quoted so they do not cause issues elsewhere. return quote(uri, safe=safe_without_percent) def address_in_network(ip, net): """This function allows you to check if an IP belongs to a network subnet Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24 returns False if ip = 192.168.1.1 and net = 192.168.100.0/24 :rtype: bool """ ipaddr = struct.unpack("=L", socket.inet_aton(ip))[0] netaddr, bits = net.split("/") netmask = struct.unpack("=L", socket.inet_aton(dotted_netmask(int(bits))))[0] network = struct.unpack("=L", socket.inet_aton(netaddr))[0] & netmask return (ipaddr & netmask) == (network & netmask) def dotted_netmask(mask): """Converts mask from /xx format to xxx.xxx.xxx.xxx Example: if mask is 24 function returns 255.255.255.0 :rtype: str """ bits = 0xFFFFFFFF ^ (1 << 32 - mask) - 1 return socket.inet_ntoa(struct.pack(">I", bits)) def is_ipv4_address(string_ip): """ :rtype: bool """ try: socket.inet_aton(string_ip) except OSError: return False return True def is_valid_cidr(string_network): """ Very simple check of the cidr format in no_proxy variable. :rtype: bool """ if string_network.count("/") == 1: try: mask = int(string_network.split("/")[1]) except ValueError: return False if mask < 1 or mask > 32: return False try: socket.inet_aton(string_network.split("/")[0]) except OSError: return False else: return False return True @contextlib.contextmanager def set_environ(env_name, value): """Set the environment variable 'env_name' to 'value' Save previous value, yield, and then restore the previous value stored in the environment variable 'env_name'. If 'value' is None, do nothing""" value_changed = value is not None if value_changed: old_value = os.environ.get(env_name) os.environ[env_name] = value try: yield finally: if value_changed: if old_value is None: del os.environ[env_name] else: os.environ[env_name] = old_value def should_bypass_proxies(url, no_proxy): """ Returns whether we should bypass proxies or not. :rtype: bool """ # Prioritize lowercase environment variables over uppercase # to keep a consistent behaviour with other http projects (curl, wget). def get_proxy(key): return os.environ.get(key) or os.environ.get(key.upper()) # First check whether no_proxy is defined. If it is, check that the URL # we're getting isn't in the no_proxy list. no_proxy_arg = no_proxy if no_proxy is None: no_proxy = get_proxy("no_proxy") parsed = urlparse(url) if parsed.hostname is None: # URLs don't always have hostnames, e.g. file:/// urls. return True if no_proxy: # We need to check whether we match here. We need to see if we match # the end of the hostname, both with and without the port. no_proxy = (host for host in no_proxy.replace(" ", "").split(",") if host) if is_ipv4_address(parsed.hostname): for proxy_ip in no_proxy: if is_valid_cidr(proxy_ip): if address_in_network(parsed.hostname, proxy_ip): return True elif parsed.hostname == proxy_ip: # If no_proxy ip was defined in plain IP notation instead of cidr notation & # matches the IP of the index return True else: host_with_port = parsed.hostname if parsed.port: host_with_port += f":{parsed.port}" for host in no_proxy: if parsed.hostname.endswith(host) or host_with_port.endswith(host): # The URL does match something in no_proxy, so we don't want # to apply the proxies on this URL. return True with set_environ("no_proxy", no_proxy_arg): # parsed.hostname can be `None` in cases such as a file URI. try: bypass = proxy_bypass(parsed.hostname) except (TypeError, socket.gaierror): bypass = False if bypass: return True return False def get_environ_proxies(url, no_proxy=None): """ Return a dict of environment proxies. :rtype: dict """ if should_bypass_proxies(url, no_proxy=no_proxy): return {} else: return getproxies() def select_proxy(url, proxies): """Select a proxy for the url, if applicable. :param url: The url being for the request :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs """ proxies = proxies or {} urlparts = urlparse(url) if urlparts.hostname is None: return proxies.get(urlparts.scheme, proxies.get("all")) proxy_keys = [ urlparts.scheme + "://" + urlparts.hostname, urlparts.scheme, "all://" + urlparts.hostname, "all", ] proxy = None for proxy_key in proxy_keys: if proxy_key in proxies: proxy = proxies[proxy_key] break return proxy def resolve_proxies(request, proxies, trust_env=True): """This method takes proxy information from a request and configuration input to resolve a mapping of target proxies. This will consider settings such as NO_PROXY to strip proxy configurations. :param request: Request or PreparedRequest :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs :param trust_env: Boolean declaring whether to trust environment configs :rtype: dict """ proxies = proxies if proxies is not None else {} url = request.url scheme = urlparse(url).scheme no_proxy = proxies.get("no_proxy") new_proxies = proxies.copy() if trust_env and not should_bypass_proxies(url, no_proxy=no_proxy): environ_proxies = get_environ_proxies(url, no_proxy=no_proxy) proxy = environ_proxies.get(scheme, environ_proxies.get("all")) if proxy: new_proxies.setdefault(scheme, proxy) return new_proxies def default_user_agent(name="python-requests"): """ Return a string representing the default user agent. :rtype: str """ return f"{name}/{__version__}" def default_headers(): """ :rtype: requests.structures.CaseInsensitiveDict """ return CaseInsensitiveDict( { "User-Agent": default_user_agent(), "Accept-Encoding": DEFAULT_ACCEPT_ENCODING, "Accept": "*/*", "Connection": "keep-alive", } ) def parse_header_links(value): """Return a list of parsed link headers proxies. i.e. Link: ; rel=front; type="image/jpeg",; rel=back;type="image/jpeg" :rtype: list """ links = [] replace_chars = " '\"" value = value.strip(replace_chars) if not value: return links for val in re.split(", *<", value): try: url, params = val.split(";", 1) except ValueError: url, params = val, "" link = {"url": url.strip("<> '\"")} for param in params.split(";"): try: key, value = param.split("=") except ValueError: break link[key.strip(replace_chars)] = value.strip(replace_chars) links.append(link) return links # Null bytes; no need to recreate these on each call to guess_json_utf _null = "\x00".encode("ascii") # encoding to ASCII for Python 3 _null2 = _null * 2 _null3 = _null * 3 def guess_json_utf(data): """ :rtype: str """ # JSON always starts with two ASCII characters, so detection is as # easy as counting the nulls and from their location and count # determine the encoding. Also detect a BOM, if present. sample = data[:4] if sample in (codecs.BOM_UTF32_LE, codecs.BOM_UTF32_BE): return "utf-32" # BOM included if sample[:3] == codecs.BOM_UTF8: return "utf-8-sig" # BOM included, MS style (discouraged) if sample[:2] in (codecs.BOM_UTF16_LE, codecs.BOM_UTF16_BE): return "utf-16" # BOM included nullcount = sample.count(_null) if nullcount == 0: return "utf-8" if nullcount == 2: if sample[::2] == _null2: # 1st and 3rd are null return "utf-16-be" if sample[1::2] == _null2: # 2nd and 4th are null return "utf-16-le" # Did not detect 2 valid UTF-16 ascii-range characters if nullcount == 3: if sample[:3] == _null3: return "utf-32-be" if sample[1:] == _null3: return "utf-32-le" # Did not detect a valid UTF-32 ascii-range character return None def prepend_scheme_if_needed(url, new_scheme): """Given a URL that may or may not have a scheme, prepend the given scheme. Does not replace a present scheme with the one provided as an argument. :rtype: str """ parsed = parse_url(url) scheme, auth, host, port, path, query, fragment = parsed # A defect in urlparse determines that there isn't a netloc present in some # urls. We previously assumed parsing was overly cautious, and swapped the # netloc and path. Due to a lack of tests on the original defect, this is # maintained with parse_url for backwards compatibility. netloc = parsed.netloc if not netloc: netloc, path = path, netloc if auth: # parse_url doesn't provide the netloc with auth # so we'll add it ourselves. netloc = "@".join([auth, netloc]) if scheme is None: scheme = new_scheme if path is None: path = "" return urlunparse((scheme, netloc, path, "", query, fragment)) def get_auth_from_url(url): """Given a url with authentication components, extract them into a tuple of username,password. :rtype: (str,str) """ parsed = urlparse(url) try: auth = (unquote(parsed.username), unquote(parsed.password)) except (AttributeError, TypeError): auth = ("", "") return auth def check_header_validity(header): """Verifies that header parts don't contain leading whitespace reserved characters, or return characters. :param header: tuple, in the format (name, value). """ name, value = header _validate_header_part(header, name, 0) _validate_header_part(header, value, 1) def _validate_header_part(header, header_part, header_validator_index): if isinstance(header_part, str): validator = _HEADER_VALIDATORS_STR[header_validator_index] elif isinstance(header_part, bytes): validator = _HEADER_VALIDATORS_BYTE[header_validator_index] else: raise InvalidHeader( f"Header part ({header_part!r}) from {header} " f"must be of type str or bytes, not {type(header_part)}" ) if not validator.match(header_part): header_kind = "name" if header_validator_index == 0 else "value" raise InvalidHeader( f"Invalid leading whitespace, reserved character(s), or return " f"character(s) in header {header_kind}: {header_part!r}" ) def urldefragauth(url): """ Given a url remove the fragment and the authentication part. :rtype: str """ scheme, netloc, path, params, query, fragment = urlparse(url) # see func:`prepend_scheme_if_needed` if not netloc: netloc, path = path, netloc netloc = netloc.rsplit("@", 1)[-1] return urlunparse((scheme, netloc, path, params, query, "")) def rewind_body(prepared_request): """Move file pointer back to its recorded starting position so it can be read again on redirect. """ body_seek = getattr(prepared_request.body, "seek", None) if body_seek is not None and isinstance( prepared_request._body_position, integer_types ): try: body_seek(prepared_request._body_position) except OSError: raise UnrewindableBodyError( "An error occurred when rewinding request body for redirect." ) else: raise UnrewindableBodyError("Unable to rewind request body for redirect.") ================================================ FILE: src/pip/_vendor/requests.pyi ================================================ from requests import * ================================================ FILE: src/pip/_vendor/resolvelib/LICENSE ================================================ Copyright (c) 2018, Tzu-ping Chung Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ================================================ FILE: src/pip/_vendor/resolvelib/__init__.py ================================================ __all__ = [ "AbstractProvider", "AbstractResolver", "BaseReporter", "InconsistentCandidate", "RequirementsConflicted", "ResolutionError", "ResolutionImpossible", "ResolutionTooDeep", "Resolver", "__version__", ] __version__ = "1.2.1" from .providers import AbstractProvider from .reporters import BaseReporter from .resolvers import ( AbstractResolver, InconsistentCandidate, RequirementsConflicted, ResolutionError, ResolutionImpossible, ResolutionTooDeep, Resolver, ) ================================================ FILE: src/pip/_vendor/resolvelib/providers.py ================================================ from __future__ import annotations from typing import ( TYPE_CHECKING, Generic, Iterable, Iterator, Mapping, Sequence, ) from .structs import CT, KT, RT, Matches, RequirementInformation if TYPE_CHECKING: from typing import Any, Protocol class Preference(Protocol): def __lt__(self, __other: Any) -> bool: ... class AbstractProvider(Generic[RT, CT, KT]): """Delegate class to provide the required interface for the resolver.""" def identify(self, requirement_or_candidate: RT | CT) -> KT: """Given a requirement or candidate, return an identifier for it. This is used to identify, e.g. whether two requirements should have their specifier parts merged or a candidate matches a requirement via ``find_matches()``. """ raise NotImplementedError def get_preference( self, identifier: KT, resolutions: Mapping[KT, CT], candidates: Mapping[KT, Iterator[CT]], information: Mapping[KT, Iterator[RequirementInformation[RT, CT]]], backtrack_causes: Sequence[RequirementInformation[RT, CT]], ) -> Preference: """Produce a sort key for given requirement based on preference. As this is a sort key it will be called O(n) times per backtrack step, where n is the number of `identifier`s, if you have a check which is expensive in some sense. E.g. It needs to make O(n) checks per call or takes significant wall clock time, consider using `narrow_requirement_selection` to filter the `identifier`s, which is applied before this sort key is called. The preference is defined as "I think this requirement should be resolved first". The lower the return value is, the more preferred this group of arguments is. :param identifier: An identifier as returned by ``identify()``. This identifies the requirement being considered. :param resolutions: Mapping of candidates currently pinned by the resolver. Each key is an identifier, and the value is a candidate. The candidate may conflict with requirements from ``information``. :param candidates: Mapping of each dependency's possible candidates. Each value is an iterator of candidates. :param information: Mapping of requirement information of each package. Each value is an iterator of *requirement information*. :param backtrack_causes: Sequence of *requirement information* that are the requirements that caused the resolver to most recently backtrack. A *requirement information* instance is a named tuple with two members: * ``requirement`` specifies a requirement contributing to the current list of candidates. * ``parent`` specifies the candidate that provides (depended on) the requirement, or ``None`` to indicate a root requirement. The preference could depend on various issues, including (not necessarily in this order): * Is this package pinned in the current resolution result? * How relaxed is the requirement? Stricter ones should probably be worked on first? (I don't know, actually.) * How many possibilities are there to satisfy this requirement? Those with few left should likely be worked on first, I guess? * Are there any known conflicts for this requirement? We should probably work on those with the most known conflicts. A sortable value should be returned (this will be used as the ``key`` parameter of the built-in sorting function). The smaller the value is, the more preferred this requirement is (i.e. the sorting function is called with ``reverse=False``). """ raise NotImplementedError def find_matches( self, identifier: KT, requirements: Mapping[KT, Iterator[RT]], incompatibilities: Mapping[KT, Iterator[CT]], ) -> Matches[CT]: """Find all possible candidates that satisfy the given constraints. :param identifier: An identifier as returned by ``identify()``. All candidates returned by this method should produce the same identifier. :param requirements: A mapping of requirements that all returned candidates must satisfy. Each key is an identifier, and the value an iterator of requirements for that dependency. :param incompatibilities: A mapping of known incompatibile candidates of each dependency. Each key is an identifier, and the value an iterator of incompatibilities known to the resolver. All incompatibilities *must* be excluded from the return value. This should try to get candidates based on the requirements' types. For VCS, local, and archive requirements, the one-and-only match is returned, and for a "named" requirement, the index(es) should be consulted to find concrete candidates for this requirement. The return value should produce candidates ordered by preference; the most preferred candidate should come first. The return type may be one of the following: * A callable that returns an iterator that yields candidates. * An collection of candidates. * An iterable of candidates. This will be consumed immediately into a list of candidates. """ raise NotImplementedError def is_satisfied_by(self, requirement: RT, candidate: CT) -> bool: """Whether the given requirement can be satisfied by a candidate. The candidate is guaranteed to have been generated from the requirement. A boolean should be returned to indicate whether ``candidate`` is a viable solution to the requirement. """ raise NotImplementedError def get_dependencies(self, candidate: CT) -> Iterable[RT]: """Get dependencies of a candidate. This should return a collection of requirements that `candidate` specifies as its dependencies. """ raise NotImplementedError def narrow_requirement_selection( self, identifiers: Iterable[KT], resolutions: Mapping[KT, CT], candidates: Mapping[KT, Iterator[CT]], information: Mapping[KT, Iterator[RequirementInformation[RT, CT]]], backtrack_causes: Sequence[RequirementInformation[RT, CT]], ) -> Iterable[KT]: """ An optional method to narrow the selection of requirements being considered during resolution. This method is called O(1) time per backtrack step. :param identifiers: An iterable of `identifiers` as returned by ``identify()``. These identify all requirements currently being considered. :param resolutions: A mapping of candidates currently pinned by the resolver. Each key is an identifier, and the value is a candidate that may conflict with requirements from ``information``. :param candidates: A mapping of each dependency's possible candidates. Each value is an iterator of candidates. :param information: A mapping of requirement information for each package. Each value is an iterator of *requirement information*. :param backtrack_causes: A sequence of *requirement information* that are the requirements causing the resolver to most recently backtrack. A *requirement information* instance is a named tuple with two members: * ``requirement`` specifies a requirement contributing to the current list of candidates. * ``parent`` specifies the candidate that provides (is depended on for) the requirement, or ``None`` to indicate a root requirement. Must return a non-empty subset of `identifiers`, with the default implementation being to return `identifiers` unchanged. Those `identifiers` will then be passed to the sort key `get_preference` to pick the most prefered requirement to attempt to pin, unless `narrow_requirement_selection` returns only 1 requirement, in which case that will be used without calling the sort key `get_preference`. This method is designed to be used by the provider to optimize the dependency resolution, e.g. if a check cost is O(m) and it can be done against all identifiers at once then filtering the requirement selection here will cost O(m) but making it part of the sort key in `get_preference` will cost O(m*n), where n is the number of `identifiers`. Returns: Iterable[KT]: A non-empty subset of `identifiers`. """ return identifiers ================================================ FILE: src/pip/_vendor/resolvelib/py.typed ================================================ ================================================ FILE: src/pip/_vendor/resolvelib/reporters.py ================================================ from __future__ import annotations from typing import TYPE_CHECKING, Collection, Generic from .structs import CT, KT, RT, RequirementInformation, State if TYPE_CHECKING: from .resolvers import Criterion class BaseReporter(Generic[RT, CT, KT]): """Delegate class to provide progress reporting for the resolver.""" def starting(self) -> None: """Called before the resolution actually starts.""" def starting_round(self, index: int) -> None: """Called before each round of resolution starts. The index is zero-based. """ def ending_round(self, index: int, state: State[RT, CT, KT]) -> None: """Called before each round of resolution ends. This is NOT called if the resolution ends at this round. Use `ending` if you want to report finalization. The index is zero-based. """ def ending(self, state: State[RT, CT, KT]) -> None: """Called before the resolution ends successfully.""" def adding_requirement(self, requirement: RT, parent: CT | None) -> None: """Called when adding a new requirement into the resolve criteria. :param requirement: The additional requirement to be applied to filter the available candidaites. :param parent: The candidate that requires ``requirement`` as a dependency, or None if ``requirement`` is one of the root requirements passed in from ``Resolver.resolve()``. """ def resolving_conflicts( self, causes: Collection[RequirementInformation[RT, CT]] ) -> None: """Called when starting to attempt requirement conflict resolution. :param causes: The information on the collision that caused the backtracking. """ def rejecting_candidate(self, criterion: Criterion[RT, CT], candidate: CT) -> None: """Called when rejecting a candidate during backtracking.""" def pinning(self, candidate: CT) -> None: """Called when adding a candidate to the potential solution.""" ================================================ FILE: src/pip/_vendor/resolvelib/resolvers/__init__.py ================================================ from ..structs import RequirementInformation from .abstract import AbstractResolver, Result from .criterion import Criterion from .exceptions import ( InconsistentCandidate, RequirementsConflicted, ResolutionError, ResolutionImpossible, ResolutionTooDeep, ResolverException, ) from .resolution import Resolution, Resolver __all__ = [ "AbstractResolver", "Criterion", "InconsistentCandidate", "RequirementInformation", "RequirementsConflicted", "Resolution", "ResolutionError", "ResolutionImpossible", "ResolutionTooDeep", "Resolver", "ResolverException", "Result", ] ================================================ FILE: src/pip/_vendor/resolvelib/resolvers/abstract.py ================================================ from __future__ import annotations import collections from typing import TYPE_CHECKING, Any, Generic, Iterable, NamedTuple from ..structs import CT, KT, RT, DirectedGraph if TYPE_CHECKING: from ..providers import AbstractProvider from ..reporters import BaseReporter from .criterion import Criterion class Result(NamedTuple, Generic[RT, CT, KT]): mapping: dict[KT, CT] graph: DirectedGraph[KT | None] criteria: dict[KT, Criterion[RT, CT]] else: Result = collections.namedtuple("Result", ["mapping", "graph", "criteria"]) class AbstractResolver(Generic[RT, CT, KT]): """The thing that performs the actual resolution work.""" base_exception = Exception def __init__( self, provider: AbstractProvider[RT, CT, KT], reporter: BaseReporter[RT, CT, KT], ) -> None: self.provider = provider self.reporter = reporter def resolve(self, requirements: Iterable[RT], **kwargs: Any) -> Result[RT, CT, KT]: """Take a collection of constraints, spit out the resolution result. This returns a representation of the final resolution state, with one guarenteed attribute ``mapping`` that contains resolved candidates as values. The keys are their respective identifiers. :param requirements: A collection of constraints. :param kwargs: Additional keyword arguments that subclasses may accept. :raises: ``self.base_exception`` or its subclass. """ raise NotImplementedError ================================================ FILE: src/pip/_vendor/resolvelib/resolvers/criterion.py ================================================ from __future__ import annotations from typing import Collection, Generic, Iterable, Iterator from ..structs import CT, RT, RequirementInformation class Criterion(Generic[RT, CT]): """Representation of possible resolution results of a package. This holds three attributes: * `information` is a collection of `RequirementInformation` pairs. Each pair is a requirement contributing to this criterion, and the candidate that provides the requirement. * `incompatibilities` is a collection of all known not-to-work candidates to exclude from consideration. * `candidates` is a collection containing all possible candidates deducted from the union of contributing requirements and known incompatibilities. It should never be empty, except when the criterion is an attribute of a raised `RequirementsConflicted` (in which case it is always empty). .. note:: This class is intended to be externally immutable. **Do not** mutate any of its attribute containers. """ def __init__( self, candidates: Iterable[CT], information: Collection[RequirementInformation[RT, CT]], incompatibilities: Collection[CT], ) -> None: self.candidates = candidates self.information = information self.incompatibilities = incompatibilities def __repr__(self) -> str: requirements = ", ".join( f"({req!r}, via={parent!r})" for req, parent in self.information ) return f"Criterion({requirements})" def iter_requirement(self) -> Iterator[RT]: return (i.requirement for i in self.information) def iter_parent(self) -> Iterator[CT | None]: return (i.parent for i in self.information) ================================================ FILE: src/pip/_vendor/resolvelib/resolvers/exceptions.py ================================================ from __future__ import annotations from typing import TYPE_CHECKING, Collection, Generic from ..structs import CT, RT, RequirementInformation if TYPE_CHECKING: from .criterion import Criterion class ResolverException(Exception): """A base class for all exceptions raised by this module. Exceptions derived by this class should all be handled in this module. Any bubbling pass the resolver should be treated as a bug. """ class RequirementsConflicted(ResolverException, Generic[RT, CT]): def __init__(self, criterion: Criterion[RT, CT]) -> None: super().__init__(criterion) self.criterion = criterion def __str__(self) -> str: return "Requirements conflict: {}".format( ", ".join(repr(r) for r in self.criterion.iter_requirement()), ) class InconsistentCandidate(ResolverException, Generic[RT, CT]): def __init__(self, candidate: CT, criterion: Criterion[RT, CT]): super().__init__(candidate, criterion) self.candidate = candidate self.criterion = criterion def __str__(self) -> str: return "Provided candidate {!r} does not satisfy {}".format( self.candidate, ", ".join(repr(r) for r in self.criterion.iter_requirement()), ) class ResolutionError(ResolverException): pass class ResolutionImpossible(ResolutionError, Generic[RT, CT]): def __init__(self, causes: Collection[RequirementInformation[RT, CT]]): super().__init__(causes) # causes is a list of RequirementInformation objects self.causes = causes class ResolutionTooDeep(ResolutionError): def __init__(self, round_count: int) -> None: super().__init__(round_count) self.round_count = round_count ================================================ FILE: src/pip/_vendor/resolvelib/resolvers/resolution.py ================================================ from __future__ import annotations import collections import itertools import operator from typing import TYPE_CHECKING, Generic from ..structs import ( CT, KT, RT, DirectedGraph, IterableView, IteratorMapping, RequirementInformation, State, build_iter_view, ) from .abstract import AbstractResolver, Result from .criterion import Criterion from .exceptions import ( InconsistentCandidate, RequirementsConflicted, ResolutionImpossible, ResolutionTooDeep, ResolverException, ) if TYPE_CHECKING: from collections.abc import Collection, Iterable, Mapping from ..providers import AbstractProvider, Preference from ..reporters import BaseReporter _OPTIMISTIC_BACKJUMPING_RATIO: float = 0.1 def _build_result(state: State[RT, CT, KT]) -> Result[RT, CT, KT]: mapping = state.mapping all_keys: dict[int, KT | None] = {id(v): k for k, v in mapping.items()} all_keys[id(None)] = None graph: DirectedGraph[KT | None] = DirectedGraph() graph.add(None) # Sentinel as root dependencies' parent. connected: set[KT | None] = {None} for key, criterion in state.criteria.items(): if not _has_route_to_root(state.criteria, key, all_keys, connected): continue if key not in graph: graph.add(key) for p in criterion.iter_parent(): try: pkey = all_keys[id(p)] except KeyError: continue if pkey not in graph: graph.add(pkey) graph.connect(pkey, key) return Result( mapping={k: v for k, v in mapping.items() if k in connected}, graph=graph, criteria=state.criteria, ) class Resolution(Generic[RT, CT, KT]): """Stateful resolution object. This is designed as a one-off object that holds information to kick start the resolution process, and holds the results afterwards. """ def __init__( self, provider: AbstractProvider[RT, CT, KT], reporter: BaseReporter[RT, CT, KT], ) -> None: self._p = provider self._r = reporter self._states: list[State[RT, CT, KT]] = [] # Optimistic backjumping variables self._optimistic_backjumping_ratio = _OPTIMISTIC_BACKJUMPING_RATIO self._save_states: list[State[RT, CT, KT]] | None = None self._optimistic_start_round: int | None = None @property def state(self) -> State[RT, CT, KT]: try: return self._states[-1] except IndexError as e: raise AttributeError("state") from e def _push_new_state(self) -> None: """Push a new state into history. This new state will be used to hold resolution results of the next coming round. """ base = self._states[-1] state = State( mapping=base.mapping.copy(), criteria=base.criteria.copy(), backtrack_causes=base.backtrack_causes[:], ) self._states.append(state) def _add_to_criteria( self, criteria: dict[KT, Criterion[RT, CT]], requirement: RT, parent: CT | None, ) -> None: self._r.adding_requirement(requirement=requirement, parent=parent) identifier = self._p.identify(requirement_or_candidate=requirement) criterion = criteria.get(identifier) if criterion: incompatibilities = list(criterion.incompatibilities) else: incompatibilities = [] matches = self._p.find_matches( identifier=identifier, requirements=IteratorMapping( criteria, operator.methodcaller("iter_requirement"), {identifier: [requirement]}, ), incompatibilities=IteratorMapping( criteria, operator.attrgetter("incompatibilities"), {identifier: incompatibilities}, ), ) if criterion: information = list(criterion.information) information.append(RequirementInformation(requirement, parent)) else: information = [RequirementInformation(requirement, parent)] criterion = Criterion( candidates=build_iter_view(matches), information=information, incompatibilities=incompatibilities, ) if not criterion.candidates: raise RequirementsConflicted(criterion) criteria[identifier] = criterion def _remove_information_from_criteria( self, criteria: dict[KT, Criterion[RT, CT]], parents: Collection[KT] ) -> None: """Remove information from parents of criteria. Concretely, removes all values from each criterion's ``information`` field that have one of ``parents`` as provider of the requirement. :param criteria: The criteria to update. :param parents: Identifiers for which to remove information from all criteria. """ if not parents: return for key, criterion in criteria.items(): criteria[key] = Criterion( criterion.candidates, [ information for information in criterion.information if ( information.parent is None or self._p.identify(information.parent) not in parents ) ], criterion.incompatibilities, ) def _get_preference(self, name: KT) -> Preference: return self._p.get_preference( identifier=name, resolutions=self.state.mapping, candidates=IteratorMapping( self.state.criteria, operator.attrgetter("candidates"), ), information=IteratorMapping( self.state.criteria, operator.attrgetter("information"), ), backtrack_causes=self.state.backtrack_causes, ) def _is_current_pin_satisfying( self, name: KT, criterion: Criterion[RT, CT] ) -> bool: try: current_pin = self.state.mapping[name] except KeyError: return False return all( self._p.is_satisfied_by(requirement=r, candidate=current_pin) for r in criterion.iter_requirement() ) def _get_updated_criteria(self, candidate: CT) -> dict[KT, Criterion[RT, CT]]: criteria = self.state.criteria.copy() for requirement in self._p.get_dependencies(candidate=candidate): self._add_to_criteria(criteria, requirement, parent=candidate) return criteria def _attempt_to_pin_criterion(self, name: KT) -> list[Criterion[RT, CT]]: criterion = self.state.criteria[name] causes: list[Criterion[RT, CT]] = [] for candidate in criterion.candidates: try: criteria = self._get_updated_criteria(candidate) except RequirementsConflicted as e: self._r.rejecting_candidate(e.criterion, candidate) causes.append(e.criterion) continue # Check the newly-pinned candidate actually works. This should # always pass under normal circumstances, but in the case of a # faulty provider, we will raise an error to notify the implementer # to fix find_matches() and/or is_satisfied_by(). satisfied = all( self._p.is_satisfied_by(requirement=r, candidate=candidate) for r in criterion.iter_requirement() ) if not satisfied: raise InconsistentCandidate(candidate, criterion) self._r.pinning(candidate=candidate) self.state.criteria.update(criteria) # Put newly-pinned candidate at the end. This is essential because # backtracking looks at this mapping to get the last pin. self.state.mapping.pop(name, None) self.state.mapping[name] = candidate return [] # All candidates tried, nothing works. This criterion is a dead # end, signal for backtracking. return causes def _patch_criteria( self, incompatibilities_from_broken: list[tuple[KT, list[CT]]] ) -> bool: # Create a new state from the last known-to-work one, and apply # the previously gathered incompatibility information. for k, incompatibilities in incompatibilities_from_broken: if not incompatibilities: continue try: criterion = self.state.criteria[k] except KeyError: continue matches = self._p.find_matches( identifier=k, requirements=IteratorMapping( self.state.criteria, operator.methodcaller("iter_requirement"), ), incompatibilities=IteratorMapping( self.state.criteria, operator.attrgetter("incompatibilities"), {k: incompatibilities}, ), ) candidates: IterableView[CT] = build_iter_view(matches) if not candidates: return False incompatibilities.extend(criterion.incompatibilities) self.state.criteria[k] = Criterion( candidates=candidates, information=list(criterion.information), incompatibilities=incompatibilities, ) return True def _save_state(self) -> None: """Save states for potential rollback if optimistic backjumping fails.""" if self._save_states is None: self._save_states = [ State( mapping=s.mapping.copy(), criteria=s.criteria.copy(), backtrack_causes=s.backtrack_causes[:], ) for s in self._states ] def _rollback_states(self) -> None: """Rollback states and disable optimistic backjumping.""" self._optimistic_backjumping_ratio = 0.0 if self._save_states: self._states = self._save_states self._save_states = None def _backjump(self, causes: list[RequirementInformation[RT, CT]]) -> bool: """Perform backjumping. When we enter here, the stack is like this:: [ state Z ] [ state Y ] [ state X ] .... earlier states are irrelevant. 1. No pins worked for Z, so it does not have a pin. 2. We want to reset state Y to unpinned, and pin another candidate. 3. State X holds what state Y was before the pin, but does not have the incompatibility information gathered in state Y. Each iteration of the loop will: 1. Identify Z. The incompatibility is not always caused by the latest state. For example, given three requirements A, B and C, with dependencies A1, B1 and C1, where A1 and B1 are incompatible: the last state might be related to C, so we want to discard the previous state. 2. Discard Z. 3. Discard Y but remember its incompatibility information gathered previously, and the failure we're dealing with right now. 4. Push a new state Y' based on X, and apply the incompatibility information from Y to Y'. 5a. If this causes Y' to conflict, we need to backtrack again. Make Y' the new Z and go back to step 2. 5b. If the incompatibilities apply cleanly, end backtracking. """ incompatible_reqs: Iterable[CT | RT] = itertools.chain( (c.parent for c in causes if c.parent is not None), (c.requirement for c in causes), ) incompatible_deps = {self._p.identify(r) for r in incompatible_reqs} while len(self._states) >= 3: # Remove the state that triggered backtracking. del self._states[-1] # Optimistically backtrack to a state that caused the incompatibility broken_state = self.state while True: # Retrieve the last candidate pin and known incompatibilities. try: broken_state = self._states.pop() name, candidate = broken_state.mapping.popitem() except (IndexError, KeyError): raise ResolutionImpossible(causes) from None if ( not self._optimistic_backjumping_ratio and name not in incompatible_deps ): # For safe backjumping only backjump if the current dependency # is not the same as the incompatible dependency break # On the first time a non-safe backjump is done the state # is saved so we can restore it later if the resolution fails if ( self._optimistic_backjumping_ratio and self._save_states is None and name not in incompatible_deps ): self._save_state() # If the current dependencies and the incompatible dependencies # are overlapping then we have likely found a cause of the # incompatibility current_dependencies = { self._p.identify(d) for d in self._p.get_dependencies(candidate) } if not current_dependencies.isdisjoint(incompatible_deps): break # Fallback: We should not backtrack to the point where # broken_state.mapping is empty, so stop backtracking for # a chance for the resolution to recover if not broken_state.mapping: break # Guard: We need at least two state to remain to both # backtrack and push a new state if len(self._states) <= 1: raise ResolutionImpossible(causes) incompatibilities_from_broken = [ (k, list(v.incompatibilities)) for k, v in broken_state.criteria.items() ] # Also mark the newly known incompatibility. incompatibilities_from_broken.append((name, [candidate])) self._push_new_state() success = self._patch_criteria(incompatibilities_from_broken) # It works! Let's work on this new state. if success: return True # State does not work after applying known incompatibilities. # Try the still previous state. # No way to backtrack anymore. return False def _extract_causes( self, criteron: list[Criterion[RT, CT]] ) -> list[RequirementInformation[RT, CT]]: """Extract causes from list of criterion and deduplicate""" return list({id(i): i for c in criteron for i in c.information}.values()) def resolve(self, requirements: Iterable[RT], max_rounds: int) -> State[RT, CT, KT]: if self._states: raise RuntimeError("already resolved") self._r.starting() # Initialize the root state. self._states = [ State( mapping=collections.OrderedDict(), criteria={}, backtrack_causes=[], ) ] for r in requirements: try: self._add_to_criteria(self.state.criteria, r, parent=None) except RequirementsConflicted as e: raise ResolutionImpossible(e.criterion.information) from e # The root state is saved as a sentinel so the first ever pin can have # something to backtrack to if it fails. The root state is basically # pinning the virtual "root" package in the graph. self._push_new_state() # Variables for optimistic backjumping optimistic_rounds_cutoff: int | None = None optimistic_backjumping_start_round: int | None = None for round_index in range(max_rounds): self._r.starting_round(index=round_index) # Handle if optimistic backjumping has been running for too long if self._optimistic_backjumping_ratio and self._save_states is not None: if optimistic_backjumping_start_round is None: optimistic_backjumping_start_round = round_index optimistic_rounds_cutoff = int( (max_rounds - round_index) * self._optimistic_backjumping_ratio ) if optimistic_rounds_cutoff <= 0: self._rollback_states() continue elif optimistic_rounds_cutoff is not None: if ( round_index - optimistic_backjumping_start_round >= optimistic_rounds_cutoff ): self._rollback_states() continue unsatisfied_names = [ key for key, criterion in self.state.criteria.items() if not self._is_current_pin_satisfying(key, criterion) ] # All criteria are accounted for. Nothing more to pin, we are done! if not unsatisfied_names: self._r.ending(state=self.state) return self.state # keep track of satisfied names to calculate diff after pinning satisfied_names = set(self.state.criteria.keys()) - set(unsatisfied_names) if len(unsatisfied_names) > 1: narrowed_unstatisfied_names = list( self._p.narrow_requirement_selection( identifiers=unsatisfied_names, resolutions=self.state.mapping, candidates=IteratorMapping( self.state.criteria, operator.attrgetter("candidates"), ), information=IteratorMapping( self.state.criteria, operator.attrgetter("information"), ), backtrack_causes=self.state.backtrack_causes, ) ) else: narrowed_unstatisfied_names = unsatisfied_names # If there are no unsatisfied names use unsatisfied names if not narrowed_unstatisfied_names: raise RuntimeError("narrow_requirement_selection returned 0 names") # If there is only 1 unsatisfied name skip calling self._get_preference if len(narrowed_unstatisfied_names) > 1: # Choose the most preferred unpinned criterion to try. name = min(narrowed_unstatisfied_names, key=self._get_preference) else: name = narrowed_unstatisfied_names[0] failure_criterion = self._attempt_to_pin_criterion(name) if failure_criterion: causes = self._extract_causes(failure_criterion) # Backjump if pinning fails. The backjump process puts us in # an unpinned state, so we can work on it in the next round. self._r.resolving_conflicts(causes=causes) try: success = self._backjump(causes) except ResolutionImpossible: if self._optimistic_backjumping_ratio and self._save_states: failed_optimistic_backjumping = True else: raise else: failed_optimistic_backjumping = bool( not success and self._optimistic_backjumping_ratio and self._save_states ) if failed_optimistic_backjumping and self._save_states: self._rollback_states() else: self.state.backtrack_causes[:] = causes # Dead ends everywhere. Give up. if not success: raise ResolutionImpossible(self.state.backtrack_causes) else: # discard as information sources any invalidated names # (unsatisfied names that were previously satisfied) newly_unsatisfied_names = { key for key, criterion in self.state.criteria.items() if key in satisfied_names and not self._is_current_pin_satisfying(key, criterion) } self._remove_information_from_criteria( self.state.criteria, newly_unsatisfied_names ) # Pinning was successful. Push a new state to do another pin. self._push_new_state() self._r.ending_round(index=round_index, state=self.state) raise ResolutionTooDeep(max_rounds) class Resolver(AbstractResolver[RT, CT, KT]): """The thing that performs the actual resolution work.""" base_exception = ResolverException def resolve( # type: ignore[override] self, requirements: Iterable[RT], max_rounds: int = 100, ) -> Result[RT, CT, KT]: """Take a collection of constraints, spit out the resolution result. The return value is a representation to the final resolution result. It is a tuple subclass with three public members: * `mapping`: A dict of resolved candidates. Each key is an identifier of a requirement (as returned by the provider's `identify` method), and the value is the resolved candidate. * `graph`: A `DirectedGraph` instance representing the dependency tree. The vertices are keys of `mapping`, and each edge represents *why* a particular package is included. A special vertex `None` is included to represent parents of user-supplied requirements. * `criteria`: A dict of "criteria" that hold detailed information on how edges in the graph are derived. Each key is an identifier of a requirement, and the value is a `Criterion` instance. The following exceptions may be raised if a resolution cannot be found: * `ResolutionImpossible`: A resolution cannot be found for the given combination of requirements. The `causes` attribute of the exception is a list of (requirement, parent), giving the requirements that could not be satisfied. * `ResolutionTooDeep`: The dependency tree is too deeply nested and the resolver gave up. This is usually caused by a circular dependency, but you can try to resolve this by increasing the `max_rounds` argument. """ resolution = Resolution(self.provider, self.reporter) state = resolution.resolve(requirements, max_rounds=max_rounds) return _build_result(state) def _has_route_to_root( criteria: Mapping[KT, Criterion[RT, CT]], key: KT | None, all_keys: dict[int, KT | None], connected: set[KT | None], ) -> bool: if key in connected: return True if key not in criteria: return False assert key is not None for p in criteria[key].iter_parent(): try: pkey = all_keys[id(p)] except KeyError: continue if pkey in connected: connected.add(key) return True if _has_route_to_root(criteria, pkey, all_keys, connected): connected.add(key) return True return False ================================================ FILE: src/pip/_vendor/resolvelib/structs.py ================================================ from __future__ import annotations import itertools from collections import namedtuple from typing import ( TYPE_CHECKING, Callable, Generic, Iterable, Iterator, Mapping, NamedTuple, Sequence, TypeVar, Union, ) KT = TypeVar("KT") # Identifier. RT = TypeVar("RT") # Requirement. CT = TypeVar("CT") # Candidate. Matches = Union[Iterable[CT], Callable[[], Iterable[CT]]] if TYPE_CHECKING: from .resolvers.criterion import Criterion class RequirementInformation(NamedTuple, Generic[RT, CT]): requirement: RT parent: CT | None class State(NamedTuple, Generic[RT, CT, KT]): """Resolution state in a round.""" mapping: dict[KT, CT] criteria: dict[KT, Criterion[RT, CT]] backtrack_causes: list[RequirementInformation[RT, CT]] else: RequirementInformation = namedtuple( "RequirementInformation", ["requirement", "parent"] ) State = namedtuple("State", ["mapping", "criteria", "backtrack_causes"]) class DirectedGraph(Generic[KT]): """A graph structure with directed edges.""" def __init__(self) -> None: self._vertices: set[KT] = set() self._forwards: dict[KT, set[KT]] = {} # -> Set[] self._backwards: dict[KT, set[KT]] = {} # -> Set[] def __iter__(self) -> Iterator[KT]: return iter(self._vertices) def __len__(self) -> int: return len(self._vertices) def __contains__(self, key: KT) -> bool: return key in self._vertices def copy(self) -> DirectedGraph[KT]: """Return a shallow copy of this graph.""" other = type(self)() other._vertices = set(self._vertices) other._forwards = {k: set(v) for k, v in self._forwards.items()} other._backwards = {k: set(v) for k, v in self._backwards.items()} return other def add(self, key: KT) -> None: """Add a new vertex to the graph.""" if key in self._vertices: raise ValueError("vertex exists") self._vertices.add(key) self._forwards[key] = set() self._backwards[key] = set() def remove(self, key: KT) -> None: """Remove a vertex from the graph, disconnecting all edges from/to it.""" self._vertices.remove(key) for f in self._forwards.pop(key): self._backwards[f].remove(key) for t in self._backwards.pop(key): self._forwards[t].remove(key) def connected(self, f: KT, t: KT) -> bool: return f in self._backwards[t] and t in self._forwards[f] def connect(self, f: KT, t: KT) -> None: """Connect two existing vertices. Nothing happens if the vertices are already connected. """ if t not in self._vertices: raise KeyError(t) self._forwards[f].add(t) self._backwards[t].add(f) def iter_edges(self) -> Iterator[tuple[KT, KT]]: for f, children in self._forwards.items(): for t in children: yield f, t def iter_children(self, key: KT) -> Iterator[KT]: return iter(self._forwards[key]) def iter_parents(self, key: KT) -> Iterator[KT]: return iter(self._backwards[key]) class IteratorMapping(Mapping[KT, Iterator[CT]], Generic[RT, CT, KT]): def __init__( self, mapping: Mapping[KT, RT], accessor: Callable[[RT], Iterable[CT]], appends: Mapping[KT, Iterable[CT]] | None = None, ) -> None: self._mapping = mapping self._accessor = accessor self._appends: Mapping[KT, Iterable[CT]] = appends or {} def __repr__(self) -> str: return "IteratorMapping({!r}, {!r}, {!r})".format( self._mapping, self._accessor, self._appends, ) def __bool__(self) -> bool: return bool(self._mapping or self._appends) def __contains__(self, key: object) -> bool: return key in self._mapping or key in self._appends def __getitem__(self, k: KT) -> Iterator[CT]: try: v = self._mapping[k] except KeyError: return iter(self._appends[k]) return itertools.chain(self._accessor(v), self._appends.get(k, ())) def __iter__(self) -> Iterator[KT]: more = (k for k in self._appends if k not in self._mapping) return itertools.chain(self._mapping, more) def __len__(self) -> int: more = sum(1 for k in self._appends if k not in self._mapping) return len(self._mapping) + more class _FactoryIterableView(Iterable[RT]): """Wrap an iterator factory returned by `find_matches()`. Calling `iter()` on this class would invoke the underlying iterator factory, making it a "collection with ordering" that can be iterated through multiple times, but lacks random access methods presented in built-in Python sequence types. """ def __init__(self, factory: Callable[[], Iterable[RT]]) -> None: self._factory = factory self._iterable: Iterable[RT] | None = None def __repr__(self) -> str: return f"{type(self).__name__}({list(self)})" def __bool__(self) -> bool: try: next(iter(self)) except StopIteration: return False return True def __iter__(self) -> Iterator[RT]: iterable = self._factory() if self._iterable is None else self._iterable self._iterable, current = itertools.tee(iterable) return current class _SequenceIterableView(Iterable[RT]): """Wrap an iterable returned by find_matches(). This is essentially just a proxy to the underlying sequence that provides the same interface as `_FactoryIterableView`. """ def __init__(self, sequence: Sequence[RT]): self._sequence = sequence def __repr__(self) -> str: return f"{type(self).__name__}({self._sequence})" def __bool__(self) -> bool: return bool(self._sequence) def __iter__(self) -> Iterator[RT]: return iter(self._sequence) def build_iter_view(matches: Matches[CT]) -> Iterable[CT]: """Build an iterable view from the value returned by `find_matches()`.""" if callable(matches): return _FactoryIterableView(matches) if not isinstance(matches, Sequence): matches = list(matches) return _SequenceIterableView(matches) IterableView = Iterable ================================================ FILE: src/pip/_vendor/rich/LICENSE ================================================ Copyright (c) 2020 Will McGugan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: src/pip/_vendor/rich/__init__.py ================================================ """Rich text and beautiful formatting in the terminal.""" import os from typing import IO, TYPE_CHECKING, Any, Callable, Optional, Union from ._extension import load_ipython_extension # noqa: F401 __all__ = ["get_console", "reconfigure", "print", "inspect", "print_json"] if TYPE_CHECKING: from .console import Console # Global console used by alternative print _console: Optional["Console"] = None try: _IMPORT_CWD = os.path.abspath(os.getcwd()) except FileNotFoundError: # Can happen if the cwd has been deleted _IMPORT_CWD = "" def get_console() -> "Console": """Get a global :class:`~rich.console.Console` instance. This function is used when Rich requires a Console, and hasn't been explicitly given one. Returns: Console: A console instance. """ global _console if _console is None: from .console import Console _console = Console() return _console def reconfigure(*args: Any, **kwargs: Any) -> None: """Reconfigures the global console by replacing it with another. Args: *args (Any): Positional arguments for the replacement :class:`~rich.console.Console`. **kwargs (Any): Keyword arguments for the replacement :class:`~rich.console.Console`. """ from pip._vendor.rich.console import Console new_console = Console(*args, **kwargs) _console = get_console() _console.__dict__ = new_console.__dict__ def print( *objects: Any, sep: str = " ", end: str = "\n", file: Optional[IO[str]] = None, flush: bool = False, ) -> None: r"""Print object(s) supplied via positional arguments. This function has an identical signature to the built-in print. For more advanced features, see the :class:`~rich.console.Console` class. Args: sep (str, optional): Separator between printed objects. Defaults to " ". end (str, optional): Character to write at end of output. Defaults to "\\n". file (IO[str], optional): File to write to, or None for stdout. Defaults to None. flush (bool, optional): Has no effect as Rich always flushes output. Defaults to False. """ from .console import Console write_console = get_console() if file is None else Console(file=file) return write_console.print(*objects, sep=sep, end=end) def print_json( json: Optional[str] = None, *, data: Any = None, indent: Union[None, int, str] = 2, highlight: bool = True, skip_keys: bool = False, ensure_ascii: bool = False, check_circular: bool = True, allow_nan: bool = True, default: Optional[Callable[[Any], Any]] = None, sort_keys: bool = False, ) -> None: """Pretty prints JSON. Output will be valid JSON. Args: json (str): A string containing JSON. data (Any): If json is not supplied, then encode this data. indent (int, optional): Number of spaces to indent. Defaults to 2. highlight (bool, optional): Enable highlighting of output: Defaults to True. skip_keys (bool, optional): Skip keys not of a basic type. Defaults to False. ensure_ascii (bool, optional): Escape all non-ascii characters. Defaults to False. check_circular (bool, optional): Check for circular references. Defaults to True. allow_nan (bool, optional): Allow NaN and Infinity values. Defaults to True. default (Callable, optional): A callable that converts values that can not be encoded in to something that can be JSON encoded. Defaults to None. sort_keys (bool, optional): Sort dictionary keys. Defaults to False. """ get_console().print_json( json, data=data, indent=indent, highlight=highlight, skip_keys=skip_keys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, default=default, sort_keys=sort_keys, ) def inspect( obj: Any, *, console: Optional["Console"] = None, title: Optional[str] = None, help: bool = False, methods: bool = False, docs: bool = True, private: bool = False, dunder: bool = False, sort: bool = True, all: bool = False, value: bool = True, ) -> None: """Inspect any Python object. * inspect() to see summarized info. * inspect(, methods=True) to see methods. * inspect(, help=True) to see full (non-abbreviated) help. * inspect(, private=True) to see private attributes (single underscore). * inspect(, dunder=True) to see attributes beginning with double underscore. * inspect(, all=True) to see all attributes. Args: obj (Any): An object to inspect. title (str, optional): Title to display over inspect result, or None use type. Defaults to None. help (bool, optional): Show full help text rather than just first paragraph. Defaults to False. methods (bool, optional): Enable inspection of callables. Defaults to False. docs (bool, optional): Also render doc strings. Defaults to True. private (bool, optional): Show private attributes (beginning with underscore). Defaults to False. dunder (bool, optional): Show attributes starting with double underscore. Defaults to False. sort (bool, optional): Sort attributes alphabetically. Defaults to True. all (bool, optional): Show all attributes. Defaults to False. value (bool, optional): Pretty print value. Defaults to True. """ _console = console or get_console() from pip._vendor.rich._inspect import Inspect # Special case for inspect(inspect) is_inspect = obj is inspect _inspect = Inspect( obj, title=title, help=is_inspect or help, methods=is_inspect or methods, docs=is_inspect or docs, private=private, dunder=dunder, sort=sort, all=all, value=value, ) _console.print(_inspect) if __name__ == "__main__": # pragma: no cover print("Hello, **World**") ================================================ FILE: src/pip/_vendor/rich/__main__.py ================================================ import colorsys import io from time import process_time from pip._vendor.rich import box from pip._vendor.rich.color import Color from pip._vendor.rich.console import Console, ConsoleOptions, Group, RenderableType, RenderResult from pip._vendor.rich.markdown import Markdown from pip._vendor.rich.measure import Measurement from pip._vendor.rich.pretty import Pretty from pip._vendor.rich.segment import Segment from pip._vendor.rich.style import Style from pip._vendor.rich.syntax import Syntax from pip._vendor.rich.table import Table from pip._vendor.rich.text import Text class ColorBox: def __rich_console__( self, console: Console, options: ConsoleOptions ) -> RenderResult: for y in range(0, 5): for x in range(options.max_width): h = x / options.max_width l = 0.1 + ((y / 5) * 0.7) r1, g1, b1 = colorsys.hls_to_rgb(h, l, 1.0) r2, g2, b2 = colorsys.hls_to_rgb(h, l + 0.7 / 10, 1.0) bgcolor = Color.from_rgb(r1 * 255, g1 * 255, b1 * 255) color = Color.from_rgb(r2 * 255, g2 * 255, b2 * 255) yield Segment("▄", Style(color=color, bgcolor=bgcolor)) yield Segment.line() def __rich_measure__( self, console: "Console", options: ConsoleOptions ) -> Measurement: return Measurement(1, options.max_width) def make_test_card() -> Table: """Get a renderable that demonstrates a number of features.""" table = Table.grid(padding=1, pad_edge=True) table.title = "Rich features" table.add_column("Feature", no_wrap=True, justify="center", style="bold red") table.add_column("Demonstration") color_table = Table( box=None, expand=False, show_header=False, show_edge=False, pad_edge=False, ) color_table.add_row( ( "✓ [bold green]4-bit color[/]\n" "✓ [bold blue]8-bit color[/]\n" "✓ [bold magenta]Truecolor (16.7 million)[/]\n" "✓ [bold yellow]Dumb terminals[/]\n" "✓ [bold cyan]Automatic color conversion" ), ColorBox(), ) table.add_row("Colors", color_table) table.add_row( "Styles", "All ansi styles: [bold]bold[/], [dim]dim[/], [italic]italic[/italic], [underline]underline[/], [strike]strikethrough[/], [reverse]reverse[/], and even [blink]blink[/].", ) lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque in metus sed sapien ultricies pretium a at justo. Maecenas luctus velit et auctor maximus." lorem_table = Table.grid(padding=1, collapse_padding=True) lorem_table.pad_edge = False lorem_table.add_row( Text(lorem, justify="left", style="green"), Text(lorem, justify="center", style="yellow"), Text(lorem, justify="right", style="blue"), Text(lorem, justify="full", style="red"), ) table.add_row( "Text", Group( Text.from_markup( """Word wrap text. Justify [green]left[/], [yellow]center[/], [blue]right[/] or [red]full[/].\n""" ), lorem_table, ), ) def comparison(renderable1: RenderableType, renderable2: RenderableType) -> Table: table = Table(show_header=False, pad_edge=False, box=None, expand=True) table.add_column("1", ratio=1) table.add_column("2", ratio=1) table.add_row(renderable1, renderable2) return table table.add_row( "Asian\nlanguage\nsupport", ":flag_for_china: 该库支持中文,日文和韩文文本!\n:flag_for_japan: ライブラリは中国語、日本語、韓国語のテキストをサポートしています\n:flag_for_south_korea: 이 라이브러리는 중국어, 일본어 및 한국어 텍스트를 지원합니다", ) markup_example = ( "[bold magenta]Rich[/] supports a simple [i]bbcode[/i]-like [b]markup[/b] for [yellow]color[/], [underline]style[/], and emoji! " ":+1: :apple: :ant: :bear: :baguette_bread: :bus: " ) table.add_row("Markup", markup_example) example_table = Table( show_edge=False, show_header=True, expand=False, row_styles=["none", "dim"], box=box.SIMPLE, ) example_table.add_column("[green]Date", style="green", no_wrap=True) example_table.add_column("[blue]Title", style="blue") example_table.add_column( "[cyan]Production Budget", style="cyan", justify="right", no_wrap=True, ) example_table.add_column( "[magenta]Box Office", style="magenta", justify="right", no_wrap=True, ) example_table.add_row( "Dec 20, 2019", "Star Wars: The Rise of Skywalker", "$275,000,000", "$375,126,118", ) example_table.add_row( "May 25, 2018", "[b]Solo[/]: A Star Wars Story", "$275,000,000", "$393,151,347", ) example_table.add_row( "Dec 15, 2017", "Star Wars Ep. VIII: The Last Jedi", "$262,000,000", "[bold]$1,332,539,889[/bold]", ) example_table.add_row( "May 19, 1999", "Star Wars Ep. [b]I[/b]: [i]The phantom Menace", "$115,000,000", "$1,027,044,677", ) table.add_row("Tables", example_table) code = '''\ def iter_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]: """Iterate and generate a tuple with a flag for last value.""" iter_values = iter(values) try: previous_value = next(iter_values) except StopIteration: return for value in iter_values: yield False, previous_value previous_value = value yield True, previous_value''' pretty_data = { "foo": [ 3.1427, ( "Paul Atreides", "Vladimir Harkonnen", "Thufir Hawat", ), ], "atomic": (False, True, None), } table.add_row( "Syntax\nhighlighting\n&\npretty\nprinting", comparison( Syntax(code, "python3", line_numbers=True, indent_guides=True), Pretty(pretty_data, indent_guides=True), ), ) markdown_example = """\ # Markdown Supports much of the *markdown* __syntax__! - Headers - Basic formatting: **bold**, *italic*, `code` - Block quotes - Lists, and more... """ table.add_row( "Markdown", comparison("[cyan]" + markdown_example, Markdown(markdown_example)) ) table.add_row( "+more!", """Progress bars, columns, styled logging handler, tracebacks, etc...""", ) return table if __name__ == "__main__": # pragma: no cover from pip._vendor.rich.panel import Panel console = Console( file=io.StringIO(), force_terminal=True, ) test_card = make_test_card() # Print once to warm cache start = process_time() console.print(test_card) pre_cache_taken = round((process_time() - start) * 1000.0, 1) console.file = io.StringIO() start = process_time() console.print(test_card) taken = round((process_time() - start) * 1000.0, 1) c = Console(record=True) c.print(test_card) console = Console() console.print(f"[dim]rendered in [not dim]{pre_cache_taken}ms[/] (cold cache)") console.print(f"[dim]rendered in [not dim]{taken}ms[/] (warm cache)") console.print() console.print( Panel.fit( "[b magenta]Hope you enjoy using Rich![/]\n\n" "Please consider sponsoring me if you get value from my work.\n\n" "Even the price of a ☕ can brighten my day!\n\n" "https://github.com/sponsors/willmcgugan", border_style="red", title="Help ensure Rich is maintained", ) ) ================================================ FILE: src/pip/_vendor/rich/_cell_widths.py ================================================ # Auto generated by make_terminal_widths.py CELL_WIDTHS = [ (0, 0, 0), (1, 31, -1), (127, 159, -1), (173, 173, 0), (768, 879, 0), (1155, 1161, 0), (1425, 1469, 0), (1471, 1471, 0), (1473, 1474, 0), (1476, 1477, 0), (1479, 1479, 0), (1536, 1541, 0), (1552, 1562, 0), (1564, 1564, 0), (1611, 1631, 0), (1648, 1648, 0), (1750, 1757, 0), (1759, 1764, 0), (1767, 1768, 0), (1770, 1773, 0), (1807, 1807, 0), (1809, 1809, 0), (1840, 1866, 0), (1958, 1968, 0), (2027, 2035, 0), (2045, 2045, 0), (2070, 2073, 0), (2075, 2083, 0), (2085, 2087, 0), (2089, 2093, 0), (2137, 2139, 0), (2192, 2193, 0), (2200, 2207, 0), (2250, 2307, 0), (2362, 2364, 0), (2366, 2383, 0), (2385, 2391, 0), (2402, 2403, 0), (2433, 2435, 0), (2492, 2492, 0), (2494, 2500, 0), (2503, 2504, 0), (2507, 2509, 0), (2519, 2519, 0), (2530, 2531, 0), (2558, 2558, 0), (2561, 2563, 0), (2620, 2620, 0), (2622, 2626, 0), (2631, 2632, 0), (2635, 2637, 0), (2641, 2641, 0), (2672, 2673, 0), (2677, 2677, 0), (2689, 2691, 0), (2748, 2748, 0), (2750, 2757, 0), (2759, 2761, 0), (2763, 2765, 0), (2786, 2787, 0), (2810, 2815, 0), (2817, 2819, 0), (2876, 2876, 0), (2878, 2884, 0), (2887, 2888, 0), (2891, 2893, 0), (2901, 2903, 0), (2914, 2915, 0), (2946, 2946, 0), (3006, 3010, 0), (3014, 3016, 0), (3018, 3021, 0), (3031, 3031, 0), (3072, 3076, 0), (3132, 3132, 0), (3134, 3140, 0), (3142, 3144, 0), (3146, 3149, 0), (3157, 3158, 0), (3170, 3171, 0), (3201, 3203, 0), (3260, 3260, 0), (3262, 3268, 0), (3270, 3272, 0), (3274, 3277, 0), (3285, 3286, 0), (3298, 3299, 0), (3315, 3315, 0), (3328, 3331, 0), (3387, 3388, 0), (3390, 3396, 0), (3398, 3400, 0), (3402, 3405, 0), (3415, 3415, 0), (3426, 3427, 0), (3457, 3459, 0), (3530, 3530, 0), (3535, 3540, 0), (3542, 3542, 0), (3544, 3551, 0), (3570, 3571, 0), (3633, 3633, 0), (3636, 3642, 0), (3655, 3662, 0), (3761, 3761, 0), (3764, 3772, 0), (3784, 3790, 0), (3864, 3865, 0), (3893, 3893, 0), (3895, 3895, 0), (3897, 3897, 0), (3902, 3903, 0), (3953, 3972, 0), (3974, 3975, 0), (3981, 3991, 0), (3993, 4028, 0), (4038, 4038, 0), (4139, 4158, 0), (4182, 4185, 0), (4190, 4192, 0), (4194, 4196, 0), (4199, 4205, 0), (4209, 4212, 0), (4226, 4237, 0), (4239, 4239, 0), (4250, 4253, 0), (4352, 4447, 2), (4448, 4607, 0), (4957, 4959, 0), (5906, 5909, 0), (5938, 5940, 0), (5970, 5971, 0), (6002, 6003, 0), (6068, 6099, 0), (6109, 6109, 0), (6155, 6159, 0), (6277, 6278, 0), (6313, 6313, 0), (6432, 6443, 0), (6448, 6459, 0), (6679, 6683, 0), (6741, 6750, 0), (6752, 6780, 0), (6783, 6783, 0), (6832, 6862, 0), (6912, 6916, 0), (6964, 6980, 0), (7019, 7027, 0), (7040, 7042, 0), (7073, 7085, 0), (7142, 7155, 0), (7204, 7223, 0), (7376, 7378, 0), (7380, 7400, 0), (7405, 7405, 0), (7412, 7412, 0), (7415, 7417, 0), (7616, 7679, 0), (8203, 8207, 0), (8232, 8238, 0), (8288, 8292, 0), (8294, 8303, 0), (8400, 8432, 0), (8986, 8987, 2), (9001, 9002, 2), (9193, 9196, 2), (9200, 9200, 2), (9203, 9203, 2), (9725, 9726, 2), (9748, 9749, 2), (9800, 9811, 2), (9855, 9855, 2), (9875, 9875, 2), (9889, 9889, 2), (9898, 9899, 2), (9917, 9918, 2), (9924, 9925, 2), (9934, 9934, 2), (9940, 9940, 2), (9962, 9962, 2), (9970, 9971, 2), (9973, 9973, 2), (9978, 9978, 2), (9981, 9981, 2), (9989, 9989, 2), (9994, 9995, 2), (10024, 10024, 2), (10060, 10060, 2), (10062, 10062, 2), (10067, 10069, 2), (10071, 10071, 2), (10133, 10135, 2), (10160, 10160, 2), (10175, 10175, 2), (11035, 11036, 2), (11088, 11088, 2), (11093, 11093, 2), (11503, 11505, 0), (11647, 11647, 0), (11744, 11775, 0), (11904, 11929, 2), (11931, 12019, 2), (12032, 12245, 2), (12272, 12329, 2), (12330, 12335, 0), (12336, 12350, 2), (12353, 12438, 2), (12441, 12442, 0), (12443, 12543, 2), (12549, 12591, 2), (12593, 12686, 2), (12688, 12771, 2), (12783, 12830, 2), (12832, 12871, 2), (12880, 19903, 2), (19968, 42124, 2), (42128, 42182, 2), (42607, 42610, 0), (42612, 42621, 0), (42654, 42655, 0), (42736, 42737, 0), (43010, 43010, 0), (43014, 43014, 0), (43019, 43019, 0), (43043, 43047, 0), (43052, 43052, 0), (43136, 43137, 0), (43188, 43205, 0), (43232, 43249, 0), (43263, 43263, 0), (43302, 43309, 0), (43335, 43347, 0), (43360, 43388, 2), (43392, 43395, 0), (43443, 43456, 0), (43493, 43493, 0), (43561, 43574, 0), (43587, 43587, 0), (43596, 43597, 0), (43643, 43645, 0), (43696, 43696, 0), (43698, 43700, 0), (43703, 43704, 0), (43710, 43711, 0), (43713, 43713, 0), (43755, 43759, 0), (43765, 43766, 0), (44003, 44010, 0), (44012, 44013, 0), (44032, 55203, 2), (55216, 55295, 0), (63744, 64255, 2), (64286, 64286, 0), (65024, 65039, 0), (65040, 65049, 2), (65056, 65071, 0), (65072, 65106, 2), (65108, 65126, 2), (65128, 65131, 2), (65279, 65279, 0), (65281, 65376, 2), (65504, 65510, 2), (65529, 65531, 0), (66045, 66045, 0), (66272, 66272, 0), (66422, 66426, 0), (68097, 68099, 0), (68101, 68102, 0), (68108, 68111, 0), (68152, 68154, 0), (68159, 68159, 0), (68325, 68326, 0), (68900, 68903, 0), (69291, 69292, 0), (69373, 69375, 0), (69446, 69456, 0), (69506, 69509, 0), (69632, 69634, 0), (69688, 69702, 0), (69744, 69744, 0), (69747, 69748, 0), (69759, 69762, 0), (69808, 69818, 0), (69821, 69821, 0), (69826, 69826, 0), (69837, 69837, 0), (69888, 69890, 0), (69927, 69940, 0), (69957, 69958, 0), (70003, 70003, 0), (70016, 70018, 0), (70067, 70080, 0), (70089, 70092, 0), (70094, 70095, 0), (70188, 70199, 0), (70206, 70206, 0), (70209, 70209, 0), (70367, 70378, 0), (70400, 70403, 0), (70459, 70460, 0), (70462, 70468, 0), (70471, 70472, 0), (70475, 70477, 0), (70487, 70487, 0), (70498, 70499, 0), (70502, 70508, 0), (70512, 70516, 0), (70709, 70726, 0), (70750, 70750, 0), (70832, 70851, 0), (71087, 71093, 0), (71096, 71104, 0), (71132, 71133, 0), (71216, 71232, 0), (71339, 71351, 0), (71453, 71467, 0), (71724, 71738, 0), (71984, 71989, 0), (71991, 71992, 0), (71995, 71998, 0), (72000, 72000, 0), (72002, 72003, 0), (72145, 72151, 0), (72154, 72160, 0), (72164, 72164, 0), (72193, 72202, 0), (72243, 72249, 0), (72251, 72254, 0), (72263, 72263, 0), (72273, 72283, 0), (72330, 72345, 0), (72751, 72758, 0), (72760, 72767, 0), (72850, 72871, 0), (72873, 72886, 0), (73009, 73014, 0), (73018, 73018, 0), (73020, 73021, 0), (73023, 73029, 0), (73031, 73031, 0), (73098, 73102, 0), (73104, 73105, 0), (73107, 73111, 0), (73459, 73462, 0), (73472, 73473, 0), (73475, 73475, 0), (73524, 73530, 0), (73534, 73538, 0), (78896, 78912, 0), (78919, 78933, 0), (92912, 92916, 0), (92976, 92982, 0), (94031, 94031, 0), (94033, 94087, 0), (94095, 94098, 0), (94176, 94179, 2), (94180, 94180, 0), (94192, 94193, 0), (94208, 100343, 2), (100352, 101589, 2), (101632, 101640, 2), (110576, 110579, 2), (110581, 110587, 2), (110589, 110590, 2), (110592, 110882, 2), (110898, 110898, 2), (110928, 110930, 2), (110933, 110933, 2), (110948, 110951, 2), (110960, 111355, 2), (113821, 113822, 0), (113824, 113827, 0), (118528, 118573, 0), (118576, 118598, 0), (119141, 119145, 0), (119149, 119170, 0), (119173, 119179, 0), (119210, 119213, 0), (119362, 119364, 0), (121344, 121398, 0), (121403, 121452, 0), (121461, 121461, 0), (121476, 121476, 0), (121499, 121503, 0), (121505, 121519, 0), (122880, 122886, 0), (122888, 122904, 0), (122907, 122913, 0), (122915, 122916, 0), (122918, 122922, 0), (123023, 123023, 0), (123184, 123190, 0), (123566, 123566, 0), (123628, 123631, 0), (124140, 124143, 0), (125136, 125142, 0), (125252, 125258, 0), (126980, 126980, 2), (127183, 127183, 2), (127374, 127374, 2), (127377, 127386, 2), (127488, 127490, 2), (127504, 127547, 2), (127552, 127560, 2), (127568, 127569, 2), (127584, 127589, 2), (127744, 127776, 2), (127789, 127797, 2), (127799, 127868, 2), (127870, 127891, 2), (127904, 127946, 2), (127951, 127955, 2), (127968, 127984, 2), (127988, 127988, 2), (127992, 127994, 2), (127995, 127999, 0), (128000, 128062, 2), (128064, 128064, 2), (128066, 128252, 2), (128255, 128317, 2), (128331, 128334, 2), (128336, 128359, 2), (128378, 128378, 2), (128405, 128406, 2), (128420, 128420, 2), (128507, 128591, 2), (128640, 128709, 2), (128716, 128716, 2), (128720, 128722, 2), (128725, 128727, 2), (128732, 128735, 2), (128747, 128748, 2), (128756, 128764, 2), (128992, 129003, 2), (129008, 129008, 2), (129292, 129338, 2), (129340, 129349, 2), (129351, 129535, 2), (129648, 129660, 2), (129664, 129672, 2), (129680, 129725, 2), (129727, 129733, 2), (129742, 129755, 2), (129760, 129768, 2), (129776, 129784, 2), (131072, 196605, 2), (196608, 262141, 2), (917505, 917505, 0), (917536, 917631, 0), (917760, 917999, 0), ] ================================================ FILE: src/pip/_vendor/rich/_emoji_codes.py ================================================ EMOJI = { "1st_place_medal": "🥇", "2nd_place_medal": "🥈", "3rd_place_medal": "🥉", "ab_button_(blood_type)": "🆎", "atm_sign": "🏧", "a_button_(blood_type)": "🅰", "afghanistan": "🇦🇫", "albania": "🇦🇱", "algeria": "🇩🇿", "american_samoa": "🇦🇸", "andorra": "🇦🇩", "angola": "🇦🇴", "anguilla": "🇦🇮", "antarctica": "🇦🇶", "antigua_&_barbuda": "🇦🇬", "aquarius": "♒", "argentina": "🇦🇷", "aries": "♈", "armenia": "🇦🇲", "aruba": "🇦🇼", "ascension_island": "🇦🇨", "australia": "🇦🇺", "austria": "🇦🇹", "azerbaijan": "🇦🇿", "back_arrow": "🔙", "b_button_(blood_type)": "🅱", "bahamas": "🇧🇸", "bahrain": "🇧🇭", "bangladesh": "🇧🇩", "barbados": "🇧🇧", "belarus": "🇧🇾", "belgium": "🇧🇪", "belize": "🇧🇿", "benin": "🇧🇯", "bermuda": "🇧🇲", "bhutan": "🇧🇹", "bolivia": "🇧🇴", "bosnia_&_herzegovina": "🇧🇦", "botswana": "🇧🇼", "bouvet_island": "🇧🇻", "brazil": "🇧🇷", "british_indian_ocean_territory": "🇮🇴", "british_virgin_islands": "🇻🇬", "brunei": "🇧🇳", "bulgaria": "🇧🇬", "burkina_faso": "🇧🇫", "burundi": "🇧🇮", "cl_button": "🆑", "cool_button": "🆒", "cambodia": "🇰🇭", "cameroon": "🇨🇲", "canada": "🇨🇦", "canary_islands": "🇮🇨", "cancer": "♋", "cape_verde": "🇨🇻", "capricorn": "♑", "caribbean_netherlands": "🇧🇶", "cayman_islands": "🇰🇾", "central_african_republic": "🇨🇫", "ceuta_&_melilla": "🇪🇦", "chad": "🇹🇩", "chile": "🇨🇱", "china": "🇨🇳", "christmas_island": "🇨🇽", "christmas_tree": "🎄", "clipperton_island": "🇨🇵", "cocos_(keeling)_islands": "🇨🇨", "colombia": "🇨🇴", "comoros": "🇰🇲", "congo_-_brazzaville": "🇨🇬", "congo_-_kinshasa": "🇨🇩", "cook_islands": "🇨🇰", "costa_rica": "🇨🇷", "croatia": "🇭🇷", "cuba": "🇨🇺", "curaçao": "🇨🇼", "cyprus": "🇨🇾", "czechia": "🇨🇿", "côte_d’ivoire": "🇨🇮", "denmark": "🇩🇰", "diego_garcia": "🇩🇬", "djibouti": "🇩🇯", "dominica": "🇩🇲", "dominican_republic": "🇩🇴", "end_arrow": "🔚", "ecuador": "🇪🇨", "egypt": "🇪🇬", "el_salvador": "🇸🇻", "england": "🏴\U000e0067\U000e0062\U000e0065\U000e006e\U000e0067\U000e007f", "equatorial_guinea": "🇬🇶", "eritrea": "🇪🇷", "estonia": "🇪🇪", "ethiopia": "🇪🇹", "european_union": "🇪🇺", "free_button": "🆓", "falkland_islands": "🇫🇰", "faroe_islands": "🇫🇴", "fiji": "🇫🇯", "finland": "🇫🇮", "france": "🇫🇷", "french_guiana": "🇬🇫", "french_polynesia": "🇵🇫", "french_southern_territories": "🇹🇫", "gabon": "🇬🇦", "gambia": "🇬🇲", "gemini": "♊", "georgia": "🇬🇪", "germany": "🇩🇪", "ghana": "🇬🇭", "gibraltar": "🇬🇮", "greece": "🇬🇷", "greenland": "🇬🇱", "grenada": "🇬🇩", "guadeloupe": "🇬🇵", "guam": "🇬🇺", "guatemala": "🇬🇹", "guernsey": "🇬🇬", "guinea": "🇬🇳", "guinea-bissau": "🇬🇼", "guyana": "🇬🇾", "haiti": "🇭🇹", "heard_&_mcdonald_islands": "🇭🇲", "honduras": "🇭🇳", "hong_kong_sar_china": "🇭🇰", "hungary": "🇭🇺", "id_button": "🆔", "iceland": "🇮🇸", "india": "🇮🇳", "indonesia": "🇮🇩", "iran": "🇮🇷", "iraq": "🇮🇶", "ireland": "🇮🇪", "isle_of_man": "🇮🇲", "israel": "🇮🇱", "italy": "🇮🇹", "jamaica": "🇯🇲", "japan": "🗾", "japanese_acceptable_button": "🉑", "japanese_application_button": "🈸", "japanese_bargain_button": "🉐", "japanese_castle": "🏯", "japanese_congratulations_button": "㊗", "japanese_discount_button": "🈹", "japanese_dolls": "🎎", "japanese_free_of_charge_button": "🈚", "japanese_here_button": "🈁", "japanese_monthly_amount_button": "🈷", "japanese_no_vacancy_button": "🈵", "japanese_not_free_of_charge_button": "🈶", "japanese_open_for_business_button": "🈺", "japanese_passing_grade_button": "🈴", "japanese_post_office": "🏣", "japanese_prohibited_button": "🈲", "japanese_reserved_button": "🈯", "japanese_secret_button": "㊙", "japanese_service_charge_button": "🈂", "japanese_symbol_for_beginner": "🔰", "japanese_vacancy_button": "🈳", "jersey": "🇯🇪", "jordan": "🇯🇴", "kazakhstan": "🇰🇿", "kenya": "🇰🇪", "kiribati": "🇰🇮", "kosovo": "🇽🇰", "kuwait": "🇰🇼", "kyrgyzstan": "🇰🇬", "laos": "🇱🇦", "latvia": "🇱🇻", "lebanon": "🇱🇧", "leo": "♌", "lesotho": "🇱🇸", "liberia": "🇱🇷", "libra": "♎", "libya": "🇱🇾", "liechtenstein": "🇱🇮", "lithuania": "🇱🇹", "luxembourg": "🇱🇺", "macau_sar_china": "🇲🇴", "macedonia": "🇲🇰", "madagascar": "🇲🇬", "malawi": "🇲🇼", "malaysia": "🇲🇾", "maldives": "🇲🇻", "mali": "🇲🇱", "malta": "🇲🇹", "marshall_islands": "🇲🇭", "martinique": "🇲🇶", "mauritania": "🇲🇷", "mauritius": "🇲🇺", "mayotte": "🇾🇹", "mexico": "🇲🇽", "micronesia": "🇫🇲", "moldova": "🇲🇩", "monaco": "🇲🇨", "mongolia": "🇲🇳", "montenegro": "🇲🇪", "montserrat": "🇲🇸", "morocco": "🇲🇦", "mozambique": "🇲🇿", "mrs._claus": "🤶", "mrs._claus_dark_skin_tone": "🤶🏿", "mrs._claus_light_skin_tone": "🤶🏻", "mrs._claus_medium-dark_skin_tone": "🤶🏾", "mrs._claus_medium-light_skin_tone": "🤶🏼", "mrs._claus_medium_skin_tone": "🤶🏽", "myanmar_(burma)": "🇲🇲", "new_button": "🆕", "ng_button": "🆖", "namibia": "🇳🇦", "nauru": "🇳🇷", "nepal": "🇳🇵", "netherlands": "🇳🇱", "new_caledonia": "🇳🇨", "new_zealand": "🇳🇿", "nicaragua": "🇳🇮", "niger": "🇳🇪", "nigeria": "🇳🇬", "niue": "🇳🇺", "norfolk_island": "🇳🇫", "north_korea": "🇰🇵", "northern_mariana_islands": "🇲🇵", "norway": "🇳🇴", "ok_button": "🆗", "ok_hand": "👌", "ok_hand_dark_skin_tone": "👌🏿", "ok_hand_light_skin_tone": "👌🏻", "ok_hand_medium-dark_skin_tone": "👌🏾", "ok_hand_medium-light_skin_tone": "👌🏼", "ok_hand_medium_skin_tone": "👌🏽", "on!_arrow": "🔛", "o_button_(blood_type)": "🅾", "oman": "🇴🇲", "ophiuchus": "⛎", "p_button": "🅿", "pakistan": "🇵🇰", "palau": "🇵🇼", "palestinian_territories": "🇵🇸", "panama": "🇵🇦", "papua_new_guinea": "🇵🇬", "paraguay": "🇵🇾", "peru": "🇵🇪", "philippines": "🇵🇭", "pisces": "♓", "pitcairn_islands": "🇵🇳", "poland": "🇵🇱", "portugal": "🇵🇹", "puerto_rico": "🇵🇷", "qatar": "🇶🇦", "romania": "🇷🇴", "russia": "🇷🇺", "rwanda": "🇷🇼", "réunion": "🇷🇪", "soon_arrow": "🔜", "sos_button": "🆘", "sagittarius": "♐", "samoa": "🇼🇸", "san_marino": "🇸🇲", "santa_claus": "🎅", "santa_claus_dark_skin_tone": "🎅🏿", "santa_claus_light_skin_tone": "🎅🏻", "santa_claus_medium-dark_skin_tone": "🎅🏾", "santa_claus_medium-light_skin_tone": "🎅🏼", "santa_claus_medium_skin_tone": "🎅🏽", "saudi_arabia": "🇸🇦", "scorpio": "♏", "scotland": "🏴\U000e0067\U000e0062\U000e0073\U000e0063\U000e0074\U000e007f", "senegal": "🇸🇳", "serbia": "🇷🇸", "seychelles": "🇸🇨", "sierra_leone": "🇸🇱", "singapore": "🇸🇬", "sint_maarten": "🇸🇽", "slovakia": "🇸🇰", "slovenia": "🇸🇮", "solomon_islands": "🇸🇧", "somalia": "🇸🇴", "south_africa": "🇿🇦", "south_georgia_&_south_sandwich_islands": "🇬🇸", "south_korea": "🇰🇷", "south_sudan": "🇸🇸", "spain": "🇪🇸", "sri_lanka": "🇱🇰", "st._barthélemy": "🇧🇱", "st._helena": "🇸🇭", "st._kitts_&_nevis": "🇰🇳", "st._lucia": "🇱🇨", "st._martin": "🇲🇫", "st._pierre_&_miquelon": "🇵🇲", "st._vincent_&_grenadines": "🇻🇨", "statue_of_liberty": "🗽", "sudan": "🇸🇩", "suriname": "🇸🇷", "svalbard_&_jan_mayen": "🇸🇯", "swaziland": "🇸🇿", "sweden": "🇸🇪", "switzerland": "🇨🇭", "syria": "🇸🇾", "são_tomé_&_príncipe": "🇸🇹", "t-rex": "🦖", "top_arrow": "🔝", "taiwan": "🇹🇼", "tajikistan": "🇹🇯", "tanzania": "🇹🇿", "taurus": "♉", "thailand": "🇹🇭", "timor-leste": "🇹🇱", "togo": "🇹🇬", "tokelau": "🇹🇰", "tokyo_tower": "🗼", "tonga": "🇹🇴", "trinidad_&_tobago": "🇹🇹", "tristan_da_cunha": "🇹🇦", "tunisia": "🇹🇳", "turkey": "🦃", "turkmenistan": "🇹🇲", "turks_&_caicos_islands": "🇹🇨", "tuvalu": "🇹🇻", "u.s._outlying_islands": "🇺🇲", "u.s._virgin_islands": "🇻🇮", "up!_button": "🆙", "uganda": "🇺🇬", "ukraine": "🇺🇦", "united_arab_emirates": "🇦🇪", "united_kingdom": "🇬🇧", "united_nations": "🇺🇳", "united_states": "🇺🇸", "uruguay": "🇺🇾", "uzbekistan": "🇺🇿", "vs_button": "🆚", "vanuatu": "🇻🇺", "vatican_city": "🇻🇦", "venezuela": "🇻🇪", "vietnam": "🇻🇳", "virgo": "♍", "wales": "🏴\U000e0067\U000e0062\U000e0077\U000e006c\U000e0073\U000e007f", "wallis_&_futuna": "🇼🇫", "western_sahara": "🇪🇭", "yemen": "🇾🇪", "zambia": "🇿🇲", "zimbabwe": "🇿🇼", "abacus": "🧮", "adhesive_bandage": "🩹", "admission_tickets": "🎟", "adult": "🧑", "adult_dark_skin_tone": "🧑🏿", "adult_light_skin_tone": "🧑🏻", "adult_medium-dark_skin_tone": "🧑🏾", "adult_medium-light_skin_tone": "🧑🏼", "adult_medium_skin_tone": "🧑🏽", "aerial_tramway": "🚡", "airplane": "✈", "airplane_arrival": "🛬", "airplane_departure": "🛫", "alarm_clock": "⏰", "alembic": "⚗", "alien": "👽", "alien_monster": "👾", "ambulance": "🚑", "american_football": "🏈", "amphora": "🏺", "anchor": "⚓", "anger_symbol": "💢", "angry_face": "😠", "angry_face_with_horns": "👿", "anguished_face": "😧", "ant": "🐜", "antenna_bars": "📶", "anxious_face_with_sweat": "😰", "articulated_lorry": "🚛", "artist_palette": "🎨", "astonished_face": "😲", "atom_symbol": "⚛", "auto_rickshaw": "🛺", "automobile": "🚗", "avocado": "🥑", "axe": "🪓", "baby": "👶", "baby_angel": "👼", "baby_angel_dark_skin_tone": "👼🏿", "baby_angel_light_skin_tone": "👼🏻", "baby_angel_medium-dark_skin_tone": "👼🏾", "baby_angel_medium-light_skin_tone": "👼🏼", "baby_angel_medium_skin_tone": "👼🏽", "baby_bottle": "🍼", "baby_chick": "🐤", "baby_dark_skin_tone": "👶🏿", "baby_light_skin_tone": "👶🏻", "baby_medium-dark_skin_tone": "👶🏾", "baby_medium-light_skin_tone": "👶🏼", "baby_medium_skin_tone": "👶🏽", "baby_symbol": "🚼", "backhand_index_pointing_down": "👇", "backhand_index_pointing_down_dark_skin_tone": "👇🏿", "backhand_index_pointing_down_light_skin_tone": "👇🏻", "backhand_index_pointing_down_medium-dark_skin_tone": "👇🏾", "backhand_index_pointing_down_medium-light_skin_tone": "👇🏼", "backhand_index_pointing_down_medium_skin_tone": "👇🏽", "backhand_index_pointing_left": "👈", "backhand_index_pointing_left_dark_skin_tone": "👈🏿", "backhand_index_pointing_left_light_skin_tone": "👈🏻", "backhand_index_pointing_left_medium-dark_skin_tone": "👈🏾", "backhand_index_pointing_left_medium-light_skin_tone": "👈🏼", "backhand_index_pointing_left_medium_skin_tone": "👈🏽", "backhand_index_pointing_right": "👉", "backhand_index_pointing_right_dark_skin_tone": "👉🏿", "backhand_index_pointing_right_light_skin_tone": "👉🏻", "backhand_index_pointing_right_medium-dark_skin_tone": "👉🏾", "backhand_index_pointing_right_medium-light_skin_tone": "👉🏼", "backhand_index_pointing_right_medium_skin_tone": "👉🏽", "backhand_index_pointing_up": "👆", "backhand_index_pointing_up_dark_skin_tone": "👆🏿", "backhand_index_pointing_up_light_skin_tone": "👆🏻", "backhand_index_pointing_up_medium-dark_skin_tone": "👆🏾", "backhand_index_pointing_up_medium-light_skin_tone": "👆🏼", "backhand_index_pointing_up_medium_skin_tone": "👆🏽", "bacon": "🥓", "badger": "🦡", "badminton": "🏸", "bagel": "🥯", "baggage_claim": "🛄", "baguette_bread": "🥖", "balance_scale": "⚖", "bald": "🦲", "bald_man": "👨\u200d🦲", "bald_woman": "👩\u200d🦲", "ballet_shoes": "🩰", "balloon": "🎈", "ballot_box_with_ballot": "🗳", "ballot_box_with_check": "☑", "banana": "🍌", "banjo": "🪕", "bank": "🏦", "bar_chart": "📊", "barber_pole": "💈", "baseball": "⚾", "basket": "🧺", "basketball": "🏀", "bat": "🦇", "bathtub": "🛁", "battery": "🔋", "beach_with_umbrella": "🏖", "beaming_face_with_smiling_eyes": "😁", "bear_face": "🐻", "bearded_person": "🧔", "bearded_person_dark_skin_tone": "🧔🏿", "bearded_person_light_skin_tone": "🧔🏻", "bearded_person_medium-dark_skin_tone": "🧔🏾", "bearded_person_medium-light_skin_tone": "🧔🏼", "bearded_person_medium_skin_tone": "🧔🏽", "beating_heart": "💓", "bed": "🛏", "beer_mug": "🍺", "bell": "🔔", "bell_with_slash": "🔕", "bellhop_bell": "🛎", "bento_box": "🍱", "beverage_box": "🧃", "bicycle": "🚲", "bikini": "👙", "billed_cap": "🧢", "biohazard": "☣", "bird": "🐦", "birthday_cake": "🎂", "black_circle": "⚫", "black_flag": "🏴", "black_heart": "🖤", "black_large_square": "⬛", "black_medium-small_square": "◾", "black_medium_square": "◼", "black_nib": "✒", "black_small_square": "▪", "black_square_button": "🔲", "blond-haired_man": "👱\u200d♂️", "blond-haired_man_dark_skin_tone": "👱🏿\u200d♂️", "blond-haired_man_light_skin_tone": "👱🏻\u200d♂️", "blond-haired_man_medium-dark_skin_tone": "👱🏾\u200d♂️", "blond-haired_man_medium-light_skin_tone": "👱🏼\u200d♂️", "blond-haired_man_medium_skin_tone": "👱🏽\u200d♂️", "blond-haired_person": "👱", "blond-haired_person_dark_skin_tone": "👱🏿", "blond-haired_person_light_skin_tone": "👱🏻", "blond-haired_person_medium-dark_skin_tone": "👱🏾", "blond-haired_person_medium-light_skin_tone": "👱🏼", "blond-haired_person_medium_skin_tone": "👱🏽", "blond-haired_woman": "👱\u200d♀️", "blond-haired_woman_dark_skin_tone": "👱🏿\u200d♀️", "blond-haired_woman_light_skin_tone": "👱🏻\u200d♀️", "blond-haired_woman_medium-dark_skin_tone": "👱🏾\u200d♀️", "blond-haired_woman_medium-light_skin_tone": "👱🏼\u200d♀️", "blond-haired_woman_medium_skin_tone": "👱🏽\u200d♀️", "blossom": "🌼", "blowfish": "🐡", "blue_book": "📘", "blue_circle": "🔵", "blue_heart": "💙", "blue_square": "🟦", "boar": "🐗", "bomb": "💣", "bone": "🦴", "bookmark": "🔖", "bookmark_tabs": "📑", "books": "📚", "bottle_with_popping_cork": "🍾", "bouquet": "💐", "bow_and_arrow": "🏹", "bowl_with_spoon": "🥣", "bowling": "🎳", "boxing_glove": "🥊", "boy": "👦", "boy_dark_skin_tone": "👦🏿", "boy_light_skin_tone": "👦🏻", "boy_medium-dark_skin_tone": "👦🏾", "boy_medium-light_skin_tone": "👦🏼", "boy_medium_skin_tone": "👦🏽", "brain": "🧠", "bread": "🍞", "breast-feeding": "🤱", "breast-feeding_dark_skin_tone": "🤱🏿", "breast-feeding_light_skin_tone": "🤱🏻", "breast-feeding_medium-dark_skin_tone": "🤱🏾", "breast-feeding_medium-light_skin_tone": "🤱🏼", "breast-feeding_medium_skin_tone": "🤱🏽", "brick": "🧱", "bride_with_veil": "👰", "bride_with_veil_dark_skin_tone": "👰🏿", "bride_with_veil_light_skin_tone": "👰🏻", "bride_with_veil_medium-dark_skin_tone": "👰🏾", "bride_with_veil_medium-light_skin_tone": "👰🏼", "bride_with_veil_medium_skin_tone": "👰🏽", "bridge_at_night": "🌉", "briefcase": "💼", "briefs": "🩲", "bright_button": "🔆", "broccoli": "🥦", "broken_heart": "💔", "broom": "🧹", "brown_circle": "🟤", "brown_heart": "🤎", "brown_square": "🟫", "bug": "🐛", "building_construction": "🏗", "bullet_train": "🚅", "burrito": "🌯", "bus": "🚌", "bus_stop": "🚏", "bust_in_silhouette": "👤", "busts_in_silhouette": "👥", "butter": "🧈", "butterfly": "🦋", "cactus": "🌵", "calendar": "📆", "call_me_hand": "🤙", "call_me_hand_dark_skin_tone": "🤙🏿", "call_me_hand_light_skin_tone": "🤙🏻", "call_me_hand_medium-dark_skin_tone": "🤙🏾", "call_me_hand_medium-light_skin_tone": "🤙🏼", "call_me_hand_medium_skin_tone": "🤙🏽", "camel": "🐫", "camera": "📷", "camera_with_flash": "📸", "camping": "🏕", "candle": "🕯", "candy": "🍬", "canned_food": "🥫", "canoe": "🛶", "card_file_box": "🗃", "card_index": "📇", "card_index_dividers": "🗂", "carousel_horse": "🎠", "carp_streamer": "🎏", "carrot": "🥕", "castle": "🏰", "cat": "🐱", "cat_face": "🐱", "cat_face_with_tears_of_joy": "😹", "cat_face_with_wry_smile": "😼", "chains": "⛓", "chair": "🪑", "chart_decreasing": "📉", "chart_increasing": "📈", "chart_increasing_with_yen": "💹", "cheese_wedge": "🧀", "chequered_flag": "🏁", "cherries": "🍒", "cherry_blossom": "🌸", "chess_pawn": "♟", "chestnut": "🌰", "chicken": "🐔", "child": "🧒", "child_dark_skin_tone": "🧒🏿", "child_light_skin_tone": "🧒🏻", "child_medium-dark_skin_tone": "🧒🏾", "child_medium-light_skin_tone": "🧒🏼", "child_medium_skin_tone": "🧒🏽", "children_crossing": "🚸", "chipmunk": "🐿", "chocolate_bar": "🍫", "chopsticks": "🥢", "church": "⛪", "cigarette": "🚬", "cinema": "🎦", "circled_m": "Ⓜ", "circus_tent": "🎪", "cityscape": "🏙", "cityscape_at_dusk": "🌆", "clamp": "🗜", "clapper_board": "🎬", "clapping_hands": "👏", "clapping_hands_dark_skin_tone": "👏🏿", "clapping_hands_light_skin_tone": "👏🏻", "clapping_hands_medium-dark_skin_tone": "👏🏾", "clapping_hands_medium-light_skin_tone": "👏🏼", "clapping_hands_medium_skin_tone": "👏🏽", "classical_building": "🏛", "clinking_beer_mugs": "🍻", "clinking_glasses": "🥂", "clipboard": "📋", "clockwise_vertical_arrows": "🔃", "closed_book": "📕", "closed_mailbox_with_lowered_flag": "📪", "closed_mailbox_with_raised_flag": "📫", "closed_umbrella": "🌂", "cloud": "☁", "cloud_with_lightning": "🌩", "cloud_with_lightning_and_rain": "⛈", "cloud_with_rain": "🌧", "cloud_with_snow": "🌨", "clown_face": "🤡", "club_suit": "♣", "clutch_bag": "👝", "coat": "🧥", "cocktail_glass": "🍸", "coconut": "🥥", "coffin": "⚰", "cold_face": "🥶", "collision": "💥", "comet": "☄", "compass": "🧭", "computer_disk": "💽", "computer_mouse": "🖱", "confetti_ball": "🎊", "confounded_face": "😖", "confused_face": "😕", "construction": "🚧", "construction_worker": "👷", "construction_worker_dark_skin_tone": "👷🏿", "construction_worker_light_skin_tone": "👷🏻", "construction_worker_medium-dark_skin_tone": "👷🏾", "construction_worker_medium-light_skin_tone": "👷🏼", "construction_worker_medium_skin_tone": "👷🏽", "control_knobs": "🎛", "convenience_store": "🏪", "cooked_rice": "🍚", "cookie": "🍪", "cooking": "🍳", "copyright": "©", "couch_and_lamp": "🛋", "counterclockwise_arrows_button": "🔄", "couple_with_heart": "💑", "couple_with_heart_man_man": "👨\u200d❤️\u200d👨", "couple_with_heart_woman_man": "👩\u200d❤️\u200d👨", "couple_with_heart_woman_woman": "👩\u200d❤️\u200d👩", "cow": "🐮", "cow_face": "🐮", "cowboy_hat_face": "🤠", "crab": "🦀", "crayon": "🖍", "credit_card": "💳", "crescent_moon": "🌙", "cricket": "🦗", "cricket_game": "🏏", "crocodile": "🐊", "croissant": "🥐", "cross_mark": "❌", "cross_mark_button": "❎", "crossed_fingers": "🤞", "crossed_fingers_dark_skin_tone": "🤞🏿", "crossed_fingers_light_skin_tone": "🤞🏻", "crossed_fingers_medium-dark_skin_tone": "🤞🏾", "crossed_fingers_medium-light_skin_tone": "🤞🏼", "crossed_fingers_medium_skin_tone": "🤞🏽", "crossed_flags": "🎌", "crossed_swords": "⚔", "crown": "👑", "crying_cat_face": "😿", "crying_face": "😢", "crystal_ball": "🔮", "cucumber": "🥒", "cupcake": "🧁", "cup_with_straw": "🥤", "curling_stone": "🥌", "curly_hair": "🦱", "curly-haired_man": "👨\u200d🦱", "curly-haired_woman": "👩\u200d🦱", "curly_loop": "➰", "currency_exchange": "💱", "curry_rice": "🍛", "custard": "🍮", "customs": "🛃", "cut_of_meat": "🥩", "cyclone": "🌀", "dagger": "🗡", "dango": "🍡", "dashing_away": "💨", "deaf_person": "🧏", "deciduous_tree": "🌳", "deer": "🦌", "delivery_truck": "🚚", "department_store": "🏬", "derelict_house": "🏚", "desert": "🏜", "desert_island": "🏝", "desktop_computer": "🖥", "detective": "🕵", "detective_dark_skin_tone": "🕵🏿", "detective_light_skin_tone": "🕵🏻", "detective_medium-dark_skin_tone": "🕵🏾", "detective_medium-light_skin_tone": "🕵🏼", "detective_medium_skin_tone": "🕵🏽", "diamond_suit": "♦", "diamond_with_a_dot": "💠", "dim_button": "🔅", "direct_hit": "🎯", "disappointed_face": "😞", "diving_mask": "🤿", "diya_lamp": "🪔", "dizzy": "💫", "dizzy_face": "😵", "dna": "🧬", "dog": "🐶", "dog_face": "🐶", "dollar_banknote": "💵", "dolphin": "🐬", "door": "🚪", "dotted_six-pointed_star": "🔯", "double_curly_loop": "➿", "double_exclamation_mark": "‼", "doughnut": "🍩", "dove": "🕊", "down-left_arrow": "↙", "down-right_arrow": "↘", "down_arrow": "⬇", "downcast_face_with_sweat": "😓", "downwards_button": "🔽", "dragon": "🐉", "dragon_face": "🐲", "dress": "👗", "drooling_face": "🤤", "drop_of_blood": "🩸", "droplet": "💧", "drum": "🥁", "duck": "🦆", "dumpling": "🥟", "dvd": "📀", "e-mail": "📧", "eagle": "🦅", "ear": "👂", "ear_dark_skin_tone": "👂🏿", "ear_light_skin_tone": "👂🏻", "ear_medium-dark_skin_tone": "👂🏾", "ear_medium-light_skin_tone": "👂🏼", "ear_medium_skin_tone": "👂🏽", "ear_of_corn": "🌽", "ear_with_hearing_aid": "🦻", "egg": "🍳", "eggplant": "🍆", "eight-pointed_star": "✴", "eight-spoked_asterisk": "✳", "eight-thirty": "🕣", "eight_o’clock": "🕗", "eject_button": "⏏", "electric_plug": "🔌", "elephant": "🐘", "eleven-thirty": "🕦", "eleven_o’clock": "🕚", "elf": "🧝", "elf_dark_skin_tone": "🧝🏿", "elf_light_skin_tone": "🧝🏻", "elf_medium-dark_skin_tone": "🧝🏾", "elf_medium-light_skin_tone": "🧝🏼", "elf_medium_skin_tone": "🧝🏽", "envelope": "✉", "envelope_with_arrow": "📩", "euro_banknote": "💶", "evergreen_tree": "🌲", "ewe": "🐑", "exclamation_mark": "❗", "exclamation_question_mark": "⁉", "exploding_head": "🤯", "expressionless_face": "😑", "eye": "👁", "eye_in_speech_bubble": "👁️\u200d🗨️", "eyes": "👀", "face_blowing_a_kiss": "😘", "face_savoring_food": "😋", "face_screaming_in_fear": "😱", "face_vomiting": "🤮", "face_with_hand_over_mouth": "🤭", "face_with_head-bandage": "🤕", "face_with_medical_mask": "😷", "face_with_monocle": "🧐", "face_with_open_mouth": "😮", "face_with_raised_eyebrow": "🤨", "face_with_rolling_eyes": "🙄", "face_with_steam_from_nose": "😤", "face_with_symbols_on_mouth": "🤬", "face_with_tears_of_joy": "😂", "face_with_thermometer": "🤒", "face_with_tongue": "😛", "face_without_mouth": "😶", "factory": "🏭", "fairy": "🧚", "fairy_dark_skin_tone": "🧚🏿", "fairy_light_skin_tone": "🧚🏻", "fairy_medium-dark_skin_tone": "🧚🏾", "fairy_medium-light_skin_tone": "🧚🏼", "fairy_medium_skin_tone": "🧚🏽", "falafel": "🧆", "fallen_leaf": "🍂", "family": "👪", "family_man_boy": "👨\u200d👦", "family_man_boy_boy": "👨\u200d👦\u200d👦", "family_man_girl": "👨\u200d👧", "family_man_girl_boy": "👨\u200d👧\u200d👦", "family_man_girl_girl": "👨\u200d👧\u200d👧", "family_man_man_boy": "👨\u200d👨\u200d👦", "family_man_man_boy_boy": "👨\u200d👨\u200d👦\u200d👦", "family_man_man_girl": "👨\u200d👨\u200d👧", "family_man_man_girl_boy": "👨\u200d👨\u200d👧\u200d👦", "family_man_man_girl_girl": "👨\u200d👨\u200d👧\u200d👧", "family_man_woman_boy": "👨\u200d👩\u200d👦", "family_man_woman_boy_boy": "👨\u200d👩\u200d👦\u200d👦", "family_man_woman_girl": "👨\u200d👩\u200d👧", "family_man_woman_girl_boy": "👨\u200d👩\u200d👧\u200d👦", "family_man_woman_girl_girl": "👨\u200d👩\u200d👧\u200d👧", "family_woman_boy": "👩\u200d👦", "family_woman_boy_boy": "👩\u200d👦\u200d👦", "family_woman_girl": "👩\u200d👧", "family_woman_girl_boy": "👩\u200d👧\u200d👦", "family_woman_girl_girl": "👩\u200d👧\u200d👧", "family_woman_woman_boy": "👩\u200d👩\u200d👦", "family_woman_woman_boy_boy": "👩\u200d👩\u200d👦\u200d👦", "family_woman_woman_girl": "👩\u200d👩\u200d👧", "family_woman_woman_girl_boy": "👩\u200d👩\u200d👧\u200d👦", "family_woman_woman_girl_girl": "👩\u200d👩\u200d👧\u200d👧", "fast-forward_button": "⏩", "fast_down_button": "⏬", "fast_reverse_button": "⏪", "fast_up_button": "⏫", "fax_machine": "📠", "fearful_face": "😨", "female_sign": "♀", "ferris_wheel": "🎡", "ferry": "⛴", "field_hockey": "🏑", "file_cabinet": "🗄", "file_folder": "📁", "film_frames": "🎞", "film_projector": "📽", "fire": "🔥", "fire_extinguisher": "🧯", "firecracker": "🧨", "fire_engine": "🚒", "fireworks": "🎆", "first_quarter_moon": "🌓", "first_quarter_moon_face": "🌛", "fish": "🐟", "fish_cake_with_swirl": "🍥", "fishing_pole": "🎣", "five-thirty": "🕠", "five_o’clock": "🕔", "flag_in_hole": "⛳", "flamingo": "🦩", "flashlight": "🔦", "flat_shoe": "🥿", "fleur-de-lis": "⚜", "flexed_biceps": "💪", "flexed_biceps_dark_skin_tone": "💪🏿", "flexed_biceps_light_skin_tone": "💪🏻", "flexed_biceps_medium-dark_skin_tone": "💪🏾", "flexed_biceps_medium-light_skin_tone": "💪🏼", "flexed_biceps_medium_skin_tone": "💪🏽", "floppy_disk": "💾", "flower_playing_cards": "🎴", "flushed_face": "😳", "flying_disc": "🥏", "flying_saucer": "🛸", "fog": "🌫", "foggy": "🌁", "folded_hands": "🙏", "folded_hands_dark_skin_tone": "🙏🏿", "folded_hands_light_skin_tone": "🙏🏻", "folded_hands_medium-dark_skin_tone": "🙏🏾", "folded_hands_medium-light_skin_tone": "🙏🏼", "folded_hands_medium_skin_tone": "🙏🏽", "foot": "🦶", "footprints": "👣", "fork_and_knife": "🍴", "fork_and_knife_with_plate": "🍽", "fortune_cookie": "🥠", "fountain": "⛲", "fountain_pen": "🖋", "four-thirty": "🕟", "four_leaf_clover": "🍀", "four_o’clock": "🕓", "fox_face": "🦊", "framed_picture": "🖼", "french_fries": "🍟", "fried_shrimp": "🍤", "frog_face": "🐸", "front-facing_baby_chick": "🐥", "frowning_face": "☹", "frowning_face_with_open_mouth": "😦", "fuel_pump": "⛽", "full_moon": "🌕", "full_moon_face": "🌝", "funeral_urn": "⚱", "game_die": "🎲", "garlic": "🧄", "gear": "⚙", "gem_stone": "💎", "genie": "🧞", "ghost": "👻", "giraffe": "🦒", "girl": "👧", "girl_dark_skin_tone": "👧🏿", "girl_light_skin_tone": "👧🏻", "girl_medium-dark_skin_tone": "👧🏾", "girl_medium-light_skin_tone": "👧🏼", "girl_medium_skin_tone": "👧🏽", "glass_of_milk": "🥛", "glasses": "👓", "globe_showing_americas": "🌎", "globe_showing_asia-australia": "🌏", "globe_showing_europe-africa": "🌍", "globe_with_meridians": "🌐", "gloves": "🧤", "glowing_star": "🌟", "goal_net": "🥅", "goat": "🐐", "goblin": "👺", "goggles": "🥽", "gorilla": "🦍", "graduation_cap": "🎓", "grapes": "🍇", "green_apple": "🍏", "green_book": "📗", "green_circle": "🟢", "green_heart": "💚", "green_salad": "🥗", "green_square": "🟩", "grimacing_face": "😬", "grinning_cat_face": "😺", "grinning_cat_face_with_smiling_eyes": "😸", "grinning_face": "😀", "grinning_face_with_big_eyes": "😃", "grinning_face_with_smiling_eyes": "😄", "grinning_face_with_sweat": "😅", "grinning_squinting_face": "😆", "growing_heart": "💗", "guard": "💂", "guard_dark_skin_tone": "💂🏿", "guard_light_skin_tone": "💂🏻", "guard_medium-dark_skin_tone": "💂🏾", "guard_medium-light_skin_tone": "💂🏼", "guard_medium_skin_tone": "💂🏽", "guide_dog": "🦮", "guitar": "🎸", "hamburger": "🍔", "hammer": "🔨", "hammer_and_pick": "⚒", "hammer_and_wrench": "🛠", "hamster_face": "🐹", "hand_with_fingers_splayed": "🖐", "hand_with_fingers_splayed_dark_skin_tone": "🖐🏿", "hand_with_fingers_splayed_light_skin_tone": "🖐🏻", "hand_with_fingers_splayed_medium-dark_skin_tone": "🖐🏾", "hand_with_fingers_splayed_medium-light_skin_tone": "🖐🏼", "hand_with_fingers_splayed_medium_skin_tone": "🖐🏽", "handbag": "👜", "handshake": "🤝", "hatching_chick": "🐣", "headphone": "🎧", "hear-no-evil_monkey": "🙉", "heart_decoration": "💟", "heart_suit": "♥", "heart_with_arrow": "💘", "heart_with_ribbon": "💝", "heavy_check_mark": "✔", "heavy_division_sign": "➗", "heavy_dollar_sign": "💲", "heavy_heart_exclamation": "❣", "heavy_large_circle": "⭕", "heavy_minus_sign": "➖", "heavy_multiplication_x": "✖", "heavy_plus_sign": "➕", "hedgehog": "🦔", "helicopter": "🚁", "herb": "🌿", "hibiscus": "🌺", "high-heeled_shoe": "👠", "high-speed_train": "🚄", "high_voltage": "⚡", "hiking_boot": "🥾", "hindu_temple": "🛕", "hippopotamus": "🦛", "hole": "🕳", "honey_pot": "🍯", "honeybee": "🐝", "horizontal_traffic_light": "🚥", "horse": "🐴", "horse_face": "🐴", "horse_racing": "🏇", "horse_racing_dark_skin_tone": "🏇🏿", "horse_racing_light_skin_tone": "🏇🏻", "horse_racing_medium-dark_skin_tone": "🏇🏾", "horse_racing_medium-light_skin_tone": "🏇🏼", "horse_racing_medium_skin_tone": "🏇🏽", "hospital": "🏥", "hot_beverage": "☕", "hot_dog": "🌭", "hot_face": "🥵", "hot_pepper": "🌶", "hot_springs": "♨", "hotel": "🏨", "hourglass_done": "⌛", "hourglass_not_done": "⏳", "house": "🏠", "house_with_garden": "🏡", "houses": "🏘", "hugging_face": "🤗", "hundred_points": "💯", "hushed_face": "😯", "ice": "🧊", "ice_cream": "🍨", "ice_hockey": "🏒", "ice_skate": "⛸", "inbox_tray": "📥", "incoming_envelope": "📨", "index_pointing_up": "☝", "index_pointing_up_dark_skin_tone": "☝🏿", "index_pointing_up_light_skin_tone": "☝🏻", "index_pointing_up_medium-dark_skin_tone": "☝🏾", "index_pointing_up_medium-light_skin_tone": "☝🏼", "index_pointing_up_medium_skin_tone": "☝🏽", "infinity": "♾", "information": "ℹ", "input_latin_letters": "🔤", "input_latin_lowercase": "🔡", "input_latin_uppercase": "🔠", "input_numbers": "🔢", "input_symbols": "🔣", "jack-o-lantern": "🎃", "jeans": "👖", "jigsaw": "🧩", "joker": "🃏", "joystick": "🕹", "kaaba": "🕋", "kangaroo": "🦘", "key": "🔑", "keyboard": "⌨", "keycap_#": "#️⃣", "keycap_*": "*️⃣", "keycap_0": "0️⃣", "keycap_1": "1️⃣", "keycap_10": "🔟", "keycap_2": "2️⃣", "keycap_3": "3️⃣", "keycap_4": "4️⃣", "keycap_5": "5️⃣", "keycap_6": "6️⃣", "keycap_7": "7️⃣", "keycap_8": "8️⃣", "keycap_9": "9️⃣", "kick_scooter": "🛴", "kimono": "👘", "kiss": "💋", "kiss_man_man": "👨\u200d❤️\u200d💋\u200d👨", "kiss_mark": "💋", "kiss_woman_man": "👩\u200d❤️\u200d💋\u200d👨", "kiss_woman_woman": "👩\u200d❤️\u200d💋\u200d👩", "kissing_cat_face": "😽", "kissing_face": "😗", "kissing_face_with_closed_eyes": "😚", "kissing_face_with_smiling_eyes": "😙", "kitchen_knife": "🔪", "kite": "🪁", "kiwi_fruit": "🥝", "koala": "🐨", "lab_coat": "🥼", "label": "🏷", "lacrosse": "🥍", "lady_beetle": "🐞", "laptop_computer": "💻", "large_blue_diamond": "🔷", "large_orange_diamond": "🔶", "last_quarter_moon": "🌗", "last_quarter_moon_face": "🌜", "last_track_button": "⏮", "latin_cross": "✝", "leaf_fluttering_in_wind": "🍃", "leafy_green": "🥬", "ledger": "📒", "left-facing_fist": "🤛", "left-facing_fist_dark_skin_tone": "🤛🏿", "left-facing_fist_light_skin_tone": "🤛🏻", "left-facing_fist_medium-dark_skin_tone": "🤛🏾", "left-facing_fist_medium-light_skin_tone": "🤛🏼", "left-facing_fist_medium_skin_tone": "🤛🏽", "left-right_arrow": "↔", "left_arrow": "⬅", "left_arrow_curving_right": "↪", "left_luggage": "🛅", "left_speech_bubble": "🗨", "leg": "🦵", "lemon": "🍋", "leopard": "🐆", "level_slider": "🎚", "light_bulb": "💡", "light_rail": "🚈", "link": "🔗", "linked_paperclips": "🖇", "lion_face": "🦁", "lipstick": "💄", "litter_in_bin_sign": "🚮", "lizard": "🦎", "llama": "🦙", "lobster": "🦞", "locked": "🔒", "locked_with_key": "🔐", "locked_with_pen": "🔏", "locomotive": "🚂", "lollipop": "🍭", "lotion_bottle": "🧴", "loudly_crying_face": "😭", "loudspeaker": "📢", "love-you_gesture": "🤟", "love-you_gesture_dark_skin_tone": "🤟🏿", "love-you_gesture_light_skin_tone": "🤟🏻", "love-you_gesture_medium-dark_skin_tone": "🤟🏾", "love-you_gesture_medium-light_skin_tone": "🤟🏼", "love-you_gesture_medium_skin_tone": "🤟🏽", "love_hotel": "🏩", "love_letter": "💌", "luggage": "🧳", "lying_face": "🤥", "mage": "🧙", "mage_dark_skin_tone": "🧙🏿", "mage_light_skin_tone": "🧙🏻", "mage_medium-dark_skin_tone": "🧙🏾", "mage_medium-light_skin_tone": "🧙🏼", "mage_medium_skin_tone": "🧙🏽", "magnet": "🧲", "magnifying_glass_tilted_left": "🔍", "magnifying_glass_tilted_right": "🔎", "mahjong_red_dragon": "🀄", "male_sign": "♂", "man": "👨", "man_and_woman_holding_hands": "👫", "man_artist": "👨\u200d🎨", "man_artist_dark_skin_tone": "👨🏿\u200d🎨", "man_artist_light_skin_tone": "👨🏻\u200d🎨", "man_artist_medium-dark_skin_tone": "👨🏾\u200d🎨", "man_artist_medium-light_skin_tone": "👨🏼\u200d🎨", "man_artist_medium_skin_tone": "👨🏽\u200d🎨", "man_astronaut": "👨\u200d🚀", "man_astronaut_dark_skin_tone": "👨🏿\u200d🚀", "man_astronaut_light_skin_tone": "👨🏻\u200d🚀", "man_astronaut_medium-dark_skin_tone": "👨🏾\u200d🚀", "man_astronaut_medium-light_skin_tone": "👨🏼\u200d🚀", "man_astronaut_medium_skin_tone": "👨🏽\u200d🚀", "man_biking": "🚴\u200d♂️", "man_biking_dark_skin_tone": "🚴🏿\u200d♂️", "man_biking_light_skin_tone": "🚴🏻\u200d♂️", "man_biking_medium-dark_skin_tone": "🚴🏾\u200d♂️", "man_biking_medium-light_skin_tone": "🚴🏼\u200d♂️", "man_biking_medium_skin_tone": "🚴🏽\u200d♂️", "man_bouncing_ball": "⛹️\u200d♂️", "man_bouncing_ball_dark_skin_tone": "⛹🏿\u200d♂️", "man_bouncing_ball_light_skin_tone": "⛹🏻\u200d♂️", "man_bouncing_ball_medium-dark_skin_tone": "⛹🏾\u200d♂️", "man_bouncing_ball_medium-light_skin_tone": "⛹🏼\u200d♂️", "man_bouncing_ball_medium_skin_tone": "⛹🏽\u200d♂️", "man_bowing": "🙇\u200d♂️", "man_bowing_dark_skin_tone": "🙇🏿\u200d♂️", "man_bowing_light_skin_tone": "🙇🏻\u200d♂️", "man_bowing_medium-dark_skin_tone": "🙇🏾\u200d♂️", "man_bowing_medium-light_skin_tone": "🙇🏼\u200d♂️", "man_bowing_medium_skin_tone": "🙇🏽\u200d♂️", "man_cartwheeling": "🤸\u200d♂️", "man_cartwheeling_dark_skin_tone": "🤸🏿\u200d♂️", "man_cartwheeling_light_skin_tone": "🤸🏻\u200d♂️", "man_cartwheeling_medium-dark_skin_tone": "🤸🏾\u200d♂️", "man_cartwheeling_medium-light_skin_tone": "🤸🏼\u200d♂️", "man_cartwheeling_medium_skin_tone": "🤸🏽\u200d♂️", "man_climbing": "🧗\u200d♂️", "man_climbing_dark_skin_tone": "🧗🏿\u200d♂️", "man_climbing_light_skin_tone": "🧗🏻\u200d♂️", "man_climbing_medium-dark_skin_tone": "🧗🏾\u200d♂️", "man_climbing_medium-light_skin_tone": "🧗🏼\u200d♂️", "man_climbing_medium_skin_tone": "🧗🏽\u200d♂️", "man_construction_worker": "👷\u200d♂️", "man_construction_worker_dark_skin_tone": "👷🏿\u200d♂️", "man_construction_worker_light_skin_tone": "👷🏻\u200d♂️", "man_construction_worker_medium-dark_skin_tone": "👷🏾\u200d♂️", "man_construction_worker_medium-light_skin_tone": "👷🏼\u200d♂️", "man_construction_worker_medium_skin_tone": "👷🏽\u200d♂️", "man_cook": "👨\u200d🍳", "man_cook_dark_skin_tone": "👨🏿\u200d🍳", "man_cook_light_skin_tone": "👨🏻\u200d🍳", "man_cook_medium-dark_skin_tone": "👨🏾\u200d🍳", "man_cook_medium-light_skin_tone": "👨🏼\u200d🍳", "man_cook_medium_skin_tone": "👨🏽\u200d🍳", "man_dancing": "🕺", "man_dancing_dark_skin_tone": "🕺🏿", "man_dancing_light_skin_tone": "🕺🏻", "man_dancing_medium-dark_skin_tone": "🕺🏾", "man_dancing_medium-light_skin_tone": "🕺🏼", "man_dancing_medium_skin_tone": "🕺🏽", "man_dark_skin_tone": "👨🏿", "man_detective": "🕵️\u200d♂️", "man_detective_dark_skin_tone": "🕵🏿\u200d♂️", "man_detective_light_skin_tone": "🕵🏻\u200d♂️", "man_detective_medium-dark_skin_tone": "🕵🏾\u200d♂️", "man_detective_medium-light_skin_tone": "🕵🏼\u200d♂️", "man_detective_medium_skin_tone": "🕵🏽\u200d♂️", "man_elf": "🧝\u200d♂️", "man_elf_dark_skin_tone": "🧝🏿\u200d♂️", "man_elf_light_skin_tone": "🧝🏻\u200d♂️", "man_elf_medium-dark_skin_tone": "🧝🏾\u200d♂️", "man_elf_medium-light_skin_tone": "🧝🏼\u200d♂️", "man_elf_medium_skin_tone": "🧝🏽\u200d♂️", "man_facepalming": "🤦\u200d♂️", "man_facepalming_dark_skin_tone": "🤦🏿\u200d♂️", "man_facepalming_light_skin_tone": "🤦🏻\u200d♂️", "man_facepalming_medium-dark_skin_tone": "🤦🏾\u200d♂️", "man_facepalming_medium-light_skin_tone": "🤦🏼\u200d♂️", "man_facepalming_medium_skin_tone": "🤦🏽\u200d♂️", "man_factory_worker": "👨\u200d🏭", "man_factory_worker_dark_skin_tone": "👨🏿\u200d🏭", "man_factory_worker_light_skin_tone": "👨🏻\u200d🏭", "man_factory_worker_medium-dark_skin_tone": "👨🏾\u200d🏭", "man_factory_worker_medium-light_skin_tone": "👨🏼\u200d🏭", "man_factory_worker_medium_skin_tone": "👨🏽\u200d🏭", "man_fairy": "🧚\u200d♂️", "man_fairy_dark_skin_tone": "🧚🏿\u200d♂️", "man_fairy_light_skin_tone": "🧚🏻\u200d♂️", "man_fairy_medium-dark_skin_tone": "🧚🏾\u200d♂️", "man_fairy_medium-light_skin_tone": "🧚🏼\u200d♂️", "man_fairy_medium_skin_tone": "🧚🏽\u200d♂️", "man_farmer": "👨\u200d🌾", "man_farmer_dark_skin_tone": "👨🏿\u200d🌾", "man_farmer_light_skin_tone": "👨🏻\u200d🌾", "man_farmer_medium-dark_skin_tone": "👨🏾\u200d🌾", "man_farmer_medium-light_skin_tone": "👨🏼\u200d🌾", "man_farmer_medium_skin_tone": "👨🏽\u200d🌾", "man_firefighter": "👨\u200d🚒", "man_firefighter_dark_skin_tone": "👨🏿\u200d🚒", "man_firefighter_light_skin_tone": "👨🏻\u200d🚒", "man_firefighter_medium-dark_skin_tone": "👨🏾\u200d🚒", "man_firefighter_medium-light_skin_tone": "👨🏼\u200d🚒", "man_firefighter_medium_skin_tone": "👨🏽\u200d🚒", "man_frowning": "🙍\u200d♂️", "man_frowning_dark_skin_tone": "🙍🏿\u200d♂️", "man_frowning_light_skin_tone": "🙍🏻\u200d♂️", "man_frowning_medium-dark_skin_tone": "🙍🏾\u200d♂️", "man_frowning_medium-light_skin_tone": "🙍🏼\u200d♂️", "man_frowning_medium_skin_tone": "🙍🏽\u200d♂️", "man_genie": "🧞\u200d♂️", "man_gesturing_no": "🙅\u200d♂️", "man_gesturing_no_dark_skin_tone": "🙅🏿\u200d♂️", "man_gesturing_no_light_skin_tone": "🙅🏻\u200d♂️", "man_gesturing_no_medium-dark_skin_tone": "🙅🏾\u200d♂️", "man_gesturing_no_medium-light_skin_tone": "🙅🏼\u200d♂️", "man_gesturing_no_medium_skin_tone": "🙅🏽\u200d♂️", "man_gesturing_ok": "🙆\u200d♂️", "man_gesturing_ok_dark_skin_tone": "🙆🏿\u200d♂️", "man_gesturing_ok_light_skin_tone": "🙆🏻\u200d♂️", "man_gesturing_ok_medium-dark_skin_tone": "🙆🏾\u200d♂️", "man_gesturing_ok_medium-light_skin_tone": "🙆🏼\u200d♂️", "man_gesturing_ok_medium_skin_tone": "🙆🏽\u200d♂️", "man_getting_haircut": "💇\u200d♂️", "man_getting_haircut_dark_skin_tone": "💇🏿\u200d♂️", "man_getting_haircut_light_skin_tone": "💇🏻\u200d♂️", "man_getting_haircut_medium-dark_skin_tone": "💇🏾\u200d♂️", "man_getting_haircut_medium-light_skin_tone": "💇🏼\u200d♂️", "man_getting_haircut_medium_skin_tone": "💇🏽\u200d♂️", "man_getting_massage": "💆\u200d♂️", "man_getting_massage_dark_skin_tone": "💆🏿\u200d♂️", "man_getting_massage_light_skin_tone": "💆🏻\u200d♂️", "man_getting_massage_medium-dark_skin_tone": "💆🏾\u200d♂️", "man_getting_massage_medium-light_skin_tone": "💆🏼\u200d♂️", "man_getting_massage_medium_skin_tone": "💆🏽\u200d♂️", "man_golfing": "🏌️\u200d♂️", "man_golfing_dark_skin_tone": "🏌🏿\u200d♂️", "man_golfing_light_skin_tone": "🏌🏻\u200d♂️", "man_golfing_medium-dark_skin_tone": "🏌🏾\u200d♂️", "man_golfing_medium-light_skin_tone": "🏌🏼\u200d♂️", "man_golfing_medium_skin_tone": "🏌🏽\u200d♂️", "man_guard": "💂\u200d♂️", "man_guard_dark_skin_tone": "💂🏿\u200d♂️", "man_guard_light_skin_tone": "💂🏻\u200d♂️", "man_guard_medium-dark_skin_tone": "💂🏾\u200d♂️", "man_guard_medium-light_skin_tone": "💂🏼\u200d♂️", "man_guard_medium_skin_tone": "💂🏽\u200d♂️", "man_health_worker": "👨\u200d⚕️", "man_health_worker_dark_skin_tone": "👨🏿\u200d⚕️", "man_health_worker_light_skin_tone": "👨🏻\u200d⚕️", "man_health_worker_medium-dark_skin_tone": "👨🏾\u200d⚕️", "man_health_worker_medium-light_skin_tone": "👨🏼\u200d⚕️", "man_health_worker_medium_skin_tone": "👨🏽\u200d⚕️", "man_in_lotus_position": "🧘\u200d♂️", "man_in_lotus_position_dark_skin_tone": "🧘🏿\u200d♂️", "man_in_lotus_position_light_skin_tone": "🧘🏻\u200d♂️", "man_in_lotus_position_medium-dark_skin_tone": "🧘🏾\u200d♂️", "man_in_lotus_position_medium-light_skin_tone": "🧘🏼\u200d♂️", "man_in_lotus_position_medium_skin_tone": "🧘🏽\u200d♂️", "man_in_manual_wheelchair": "👨\u200d🦽", "man_in_motorized_wheelchair": "👨\u200d🦼", "man_in_steamy_room": "🧖\u200d♂️", "man_in_steamy_room_dark_skin_tone": "🧖🏿\u200d♂️", "man_in_steamy_room_light_skin_tone": "🧖🏻\u200d♂️", "man_in_steamy_room_medium-dark_skin_tone": "🧖🏾\u200d♂️", "man_in_steamy_room_medium-light_skin_tone": "🧖🏼\u200d♂️", "man_in_steamy_room_medium_skin_tone": "🧖🏽\u200d♂️", "man_in_suit_levitating": "🕴", "man_in_suit_levitating_dark_skin_tone": "🕴🏿", "man_in_suit_levitating_light_skin_tone": "🕴🏻", "man_in_suit_levitating_medium-dark_skin_tone": "🕴🏾", "man_in_suit_levitating_medium-light_skin_tone": "🕴🏼", "man_in_suit_levitating_medium_skin_tone": "🕴🏽", "man_in_tuxedo": "🤵", "man_in_tuxedo_dark_skin_tone": "🤵🏿", "man_in_tuxedo_light_skin_tone": "🤵🏻", "man_in_tuxedo_medium-dark_skin_tone": "🤵🏾", "man_in_tuxedo_medium-light_skin_tone": "🤵🏼", "man_in_tuxedo_medium_skin_tone": "🤵🏽", "man_judge": "👨\u200d⚖️", "man_judge_dark_skin_tone": "👨🏿\u200d⚖️", "man_judge_light_skin_tone": "👨🏻\u200d⚖️", "man_judge_medium-dark_skin_tone": "👨🏾\u200d⚖️", "man_judge_medium-light_skin_tone": "👨🏼\u200d⚖️", "man_judge_medium_skin_tone": "👨🏽\u200d⚖️", "man_juggling": "🤹\u200d♂️", "man_juggling_dark_skin_tone": "🤹🏿\u200d♂️", "man_juggling_light_skin_tone": "🤹🏻\u200d♂️", "man_juggling_medium-dark_skin_tone": "🤹🏾\u200d♂️", "man_juggling_medium-light_skin_tone": "🤹🏼\u200d♂️", "man_juggling_medium_skin_tone": "🤹🏽\u200d♂️", "man_lifting_weights": "🏋️\u200d♂️", "man_lifting_weights_dark_skin_tone": "🏋🏿\u200d♂️", "man_lifting_weights_light_skin_tone": "🏋🏻\u200d♂️", "man_lifting_weights_medium-dark_skin_tone": "🏋🏾\u200d♂️", "man_lifting_weights_medium-light_skin_tone": "🏋🏼\u200d♂️", "man_lifting_weights_medium_skin_tone": "🏋🏽\u200d♂️", "man_light_skin_tone": "👨🏻", "man_mage": "🧙\u200d♂️", "man_mage_dark_skin_tone": "🧙🏿\u200d♂️", "man_mage_light_skin_tone": "🧙🏻\u200d♂️", "man_mage_medium-dark_skin_tone": "🧙🏾\u200d♂️", "man_mage_medium-light_skin_tone": "🧙🏼\u200d♂️", "man_mage_medium_skin_tone": "🧙🏽\u200d♂️", "man_mechanic": "👨\u200d🔧", "man_mechanic_dark_skin_tone": "👨🏿\u200d🔧", "man_mechanic_light_skin_tone": "👨🏻\u200d🔧", "man_mechanic_medium-dark_skin_tone": "👨🏾\u200d🔧", "man_mechanic_medium-light_skin_tone": "👨🏼\u200d🔧", "man_mechanic_medium_skin_tone": "👨🏽\u200d🔧", "man_medium-dark_skin_tone": "👨🏾", "man_medium-light_skin_tone": "👨🏼", "man_medium_skin_tone": "👨🏽", "man_mountain_biking": "🚵\u200d♂️", "man_mountain_biking_dark_skin_tone": "🚵🏿\u200d♂️", "man_mountain_biking_light_skin_tone": "🚵🏻\u200d♂️", "man_mountain_biking_medium-dark_skin_tone": "🚵🏾\u200d♂️", "man_mountain_biking_medium-light_skin_tone": "🚵🏼\u200d♂️", "man_mountain_biking_medium_skin_tone": "🚵🏽\u200d♂️", "man_office_worker": "👨\u200d💼", "man_office_worker_dark_skin_tone": "👨🏿\u200d💼", "man_office_worker_light_skin_tone": "👨🏻\u200d💼", "man_office_worker_medium-dark_skin_tone": "👨🏾\u200d💼", "man_office_worker_medium-light_skin_tone": "👨🏼\u200d💼", "man_office_worker_medium_skin_tone": "👨🏽\u200d💼", "man_pilot": "👨\u200d✈️", "man_pilot_dark_skin_tone": "👨🏿\u200d✈️", "man_pilot_light_skin_tone": "👨🏻\u200d✈️", "man_pilot_medium-dark_skin_tone": "👨🏾\u200d✈️", "man_pilot_medium-light_skin_tone": "👨🏼\u200d✈️", "man_pilot_medium_skin_tone": "👨🏽\u200d✈️", "man_playing_handball": "🤾\u200d♂️", "man_playing_handball_dark_skin_tone": "🤾🏿\u200d♂️", "man_playing_handball_light_skin_tone": "🤾🏻\u200d♂️", "man_playing_handball_medium-dark_skin_tone": "🤾🏾\u200d♂️", "man_playing_handball_medium-light_skin_tone": "🤾🏼\u200d♂️", "man_playing_handball_medium_skin_tone": "🤾🏽\u200d♂️", "man_playing_water_polo": "🤽\u200d♂️", "man_playing_water_polo_dark_skin_tone": "🤽🏿\u200d♂️", "man_playing_water_polo_light_skin_tone": "🤽🏻\u200d♂️", "man_playing_water_polo_medium-dark_skin_tone": "🤽🏾\u200d♂️", "man_playing_water_polo_medium-light_skin_tone": "🤽🏼\u200d♂️", "man_playing_water_polo_medium_skin_tone": "🤽🏽\u200d♂️", "man_police_officer": "👮\u200d♂️", "man_police_officer_dark_skin_tone": "👮🏿\u200d♂️", "man_police_officer_light_skin_tone": "👮🏻\u200d♂️", "man_police_officer_medium-dark_skin_tone": "👮🏾\u200d♂️", "man_police_officer_medium-light_skin_tone": "👮🏼\u200d♂️", "man_police_officer_medium_skin_tone": "👮🏽\u200d♂️", "man_pouting": "🙎\u200d♂️", "man_pouting_dark_skin_tone": "🙎🏿\u200d♂️", "man_pouting_light_skin_tone": "🙎🏻\u200d♂️", "man_pouting_medium-dark_skin_tone": "🙎🏾\u200d♂️", "man_pouting_medium-light_skin_tone": "🙎🏼\u200d♂️", "man_pouting_medium_skin_tone": "🙎🏽\u200d♂️", "man_raising_hand": "🙋\u200d♂️", "man_raising_hand_dark_skin_tone": "🙋🏿\u200d♂️", "man_raising_hand_light_skin_tone": "🙋🏻\u200d♂️", "man_raising_hand_medium-dark_skin_tone": "🙋🏾\u200d♂️", "man_raising_hand_medium-light_skin_tone": "🙋🏼\u200d♂️", "man_raising_hand_medium_skin_tone": "🙋🏽\u200d♂️", "man_rowing_boat": "🚣\u200d♂️", "man_rowing_boat_dark_skin_tone": "🚣🏿\u200d♂️", "man_rowing_boat_light_skin_tone": "🚣🏻\u200d♂️", "man_rowing_boat_medium-dark_skin_tone": "🚣🏾\u200d♂️", "man_rowing_boat_medium-light_skin_tone": "🚣🏼\u200d♂️", "man_rowing_boat_medium_skin_tone": "🚣🏽\u200d♂️", "man_running": "🏃\u200d♂️", "man_running_dark_skin_tone": "🏃🏿\u200d♂️", "man_running_light_skin_tone": "🏃🏻\u200d♂️", "man_running_medium-dark_skin_tone": "🏃🏾\u200d♂️", "man_running_medium-light_skin_tone": "🏃🏼\u200d♂️", "man_running_medium_skin_tone": "🏃🏽\u200d♂️", "man_scientist": "👨\u200d🔬", "man_scientist_dark_skin_tone": "👨🏿\u200d🔬", "man_scientist_light_skin_tone": "👨🏻\u200d🔬", "man_scientist_medium-dark_skin_tone": "👨🏾\u200d🔬", "man_scientist_medium-light_skin_tone": "👨🏼\u200d🔬", "man_scientist_medium_skin_tone": "👨🏽\u200d🔬", "man_shrugging": "🤷\u200d♂️", "man_shrugging_dark_skin_tone": "🤷🏿\u200d♂️", "man_shrugging_light_skin_tone": "🤷🏻\u200d♂️", "man_shrugging_medium-dark_skin_tone": "🤷🏾\u200d♂️", "man_shrugging_medium-light_skin_tone": "🤷🏼\u200d♂️", "man_shrugging_medium_skin_tone": "🤷🏽\u200d♂️", "man_singer": "👨\u200d🎤", "man_singer_dark_skin_tone": "👨🏿\u200d🎤", "man_singer_light_skin_tone": "👨🏻\u200d🎤", "man_singer_medium-dark_skin_tone": "👨🏾\u200d🎤", "man_singer_medium-light_skin_tone": "👨🏼\u200d🎤", "man_singer_medium_skin_tone": "👨🏽\u200d🎤", "man_student": "👨\u200d🎓", "man_student_dark_skin_tone": "👨🏿\u200d🎓", "man_student_light_skin_tone": "👨🏻\u200d🎓", "man_student_medium-dark_skin_tone": "👨🏾\u200d🎓", "man_student_medium-light_skin_tone": "👨🏼\u200d🎓", "man_student_medium_skin_tone": "👨🏽\u200d🎓", "man_surfing": "🏄\u200d♂️", "man_surfing_dark_skin_tone": "🏄🏿\u200d♂️", "man_surfing_light_skin_tone": "🏄🏻\u200d♂️", "man_surfing_medium-dark_skin_tone": "🏄🏾\u200d♂️", "man_surfing_medium-light_skin_tone": "🏄🏼\u200d♂️", "man_surfing_medium_skin_tone": "🏄🏽\u200d♂️", "man_swimming": "🏊\u200d♂️", "man_swimming_dark_skin_tone": "🏊🏿\u200d♂️", "man_swimming_light_skin_tone": "🏊🏻\u200d♂️", "man_swimming_medium-dark_skin_tone": "🏊🏾\u200d♂️", "man_swimming_medium-light_skin_tone": "🏊🏼\u200d♂️", "man_swimming_medium_skin_tone": "🏊🏽\u200d♂️", "man_teacher": "👨\u200d🏫", "man_teacher_dark_skin_tone": "👨🏿\u200d🏫", "man_teacher_light_skin_tone": "👨🏻\u200d🏫", "man_teacher_medium-dark_skin_tone": "👨🏾\u200d🏫", "man_teacher_medium-light_skin_tone": "👨🏼\u200d🏫", "man_teacher_medium_skin_tone": "👨🏽\u200d🏫", "man_technologist": "👨\u200d💻", "man_technologist_dark_skin_tone": "👨🏿\u200d💻", "man_technologist_light_skin_tone": "👨🏻\u200d💻", "man_technologist_medium-dark_skin_tone": "👨🏾\u200d💻", "man_technologist_medium-light_skin_tone": "👨🏼\u200d💻", "man_technologist_medium_skin_tone": "👨🏽\u200d💻", "man_tipping_hand": "💁\u200d♂️", "man_tipping_hand_dark_skin_tone": "💁🏿\u200d♂️", "man_tipping_hand_light_skin_tone": "💁🏻\u200d♂️", "man_tipping_hand_medium-dark_skin_tone": "💁🏾\u200d♂️", "man_tipping_hand_medium-light_skin_tone": "💁🏼\u200d♂️", "man_tipping_hand_medium_skin_tone": "💁🏽\u200d♂️", "man_vampire": "🧛\u200d♂️", "man_vampire_dark_skin_tone": "🧛🏿\u200d♂️", "man_vampire_light_skin_tone": "🧛🏻\u200d♂️", "man_vampire_medium-dark_skin_tone": "🧛🏾\u200d♂️", "man_vampire_medium-light_skin_tone": "🧛🏼\u200d♂️", "man_vampire_medium_skin_tone": "🧛🏽\u200d♂️", "man_walking": "🚶\u200d♂️", "man_walking_dark_skin_tone": "🚶🏿\u200d♂️", "man_walking_light_skin_tone": "🚶🏻\u200d♂️", "man_walking_medium-dark_skin_tone": "🚶🏾\u200d♂️", "man_walking_medium-light_skin_tone": "🚶🏼\u200d♂️", "man_walking_medium_skin_tone": "🚶🏽\u200d♂️", "man_wearing_turban": "👳\u200d♂️", "man_wearing_turban_dark_skin_tone": "👳🏿\u200d♂️", "man_wearing_turban_light_skin_tone": "👳🏻\u200d♂️", "man_wearing_turban_medium-dark_skin_tone": "👳🏾\u200d♂️", "man_wearing_turban_medium-light_skin_tone": "👳🏼\u200d♂️", "man_wearing_turban_medium_skin_tone": "👳🏽\u200d♂️", "man_with_probing_cane": "👨\u200d🦯", "man_with_chinese_cap": "👲", "man_with_chinese_cap_dark_skin_tone": "👲🏿", "man_with_chinese_cap_light_skin_tone": "👲🏻", "man_with_chinese_cap_medium-dark_skin_tone": "👲🏾", "man_with_chinese_cap_medium-light_skin_tone": "👲🏼", "man_with_chinese_cap_medium_skin_tone": "👲🏽", "man_zombie": "🧟\u200d♂️", "mango": "🥭", "mantelpiece_clock": "🕰", "manual_wheelchair": "🦽", "man’s_shoe": "👞", "map_of_japan": "🗾", "maple_leaf": "🍁", "martial_arts_uniform": "🥋", "mate": "🧉", "meat_on_bone": "🍖", "mechanical_arm": "🦾", "mechanical_leg": "🦿", "medical_symbol": "⚕", "megaphone": "📣", "melon": "🍈", "memo": "📝", "men_with_bunny_ears": "👯\u200d♂️", "men_wrestling": "🤼\u200d♂️", "menorah": "🕎", "men’s_room": "🚹", "mermaid": "🧜\u200d♀️", "mermaid_dark_skin_tone": "🧜🏿\u200d♀️", "mermaid_light_skin_tone": "🧜🏻\u200d♀️", "mermaid_medium-dark_skin_tone": "🧜🏾\u200d♀️", "mermaid_medium-light_skin_tone": "🧜🏼\u200d♀️", "mermaid_medium_skin_tone": "🧜🏽\u200d♀️", "merman": "🧜\u200d♂️", "merman_dark_skin_tone": "🧜🏿\u200d♂️", "merman_light_skin_tone": "🧜🏻\u200d♂️", "merman_medium-dark_skin_tone": "🧜🏾\u200d♂️", "merman_medium-light_skin_tone": "🧜🏼\u200d♂️", "merman_medium_skin_tone": "🧜🏽\u200d♂️", "merperson": "🧜", "merperson_dark_skin_tone": "🧜🏿", "merperson_light_skin_tone": "🧜🏻", "merperson_medium-dark_skin_tone": "🧜🏾", "merperson_medium-light_skin_tone": "🧜🏼", "merperson_medium_skin_tone": "🧜🏽", "metro": "🚇", "microbe": "🦠", "microphone": "🎤", "microscope": "🔬", "middle_finger": "🖕", "middle_finger_dark_skin_tone": "🖕🏿", "middle_finger_light_skin_tone": "🖕🏻", "middle_finger_medium-dark_skin_tone": "🖕🏾", "middle_finger_medium-light_skin_tone": "🖕🏼", "middle_finger_medium_skin_tone": "🖕🏽", "military_medal": "🎖", "milky_way": "🌌", "minibus": "🚐", "moai": "🗿", "mobile_phone": "📱", "mobile_phone_off": "📴", "mobile_phone_with_arrow": "📲", "money-mouth_face": "🤑", "money_bag": "💰", "money_with_wings": "💸", "monkey": "🐒", "monkey_face": "🐵", "monorail": "🚝", "moon_cake": "🥮", "moon_viewing_ceremony": "🎑", "mosque": "🕌", "mosquito": "🦟", "motor_boat": "🛥", "motor_scooter": "🛵", "motorcycle": "🏍", "motorized_wheelchair": "🦼", "motorway": "🛣", "mount_fuji": "🗻", "mountain": "⛰", "mountain_cableway": "🚠", "mountain_railway": "🚞", "mouse": "🐭", "mouse_face": "🐭", "mouth": "👄", "movie_camera": "🎥", "mushroom": "🍄", "musical_keyboard": "🎹", "musical_note": "🎵", "musical_notes": "🎶", "musical_score": "🎼", "muted_speaker": "🔇", "nail_polish": "💅", "nail_polish_dark_skin_tone": "💅🏿", "nail_polish_light_skin_tone": "💅🏻", "nail_polish_medium-dark_skin_tone": "💅🏾", "nail_polish_medium-light_skin_tone": "💅🏼", "nail_polish_medium_skin_tone": "💅🏽", "name_badge": "📛", "national_park": "🏞", "nauseated_face": "🤢", "nazar_amulet": "🧿", "necktie": "👔", "nerd_face": "🤓", "neutral_face": "😐", "new_moon": "🌑", "new_moon_face": "🌚", "newspaper": "📰", "next_track_button": "⏭", "night_with_stars": "🌃", "nine-thirty": "🕤", "nine_o’clock": "🕘", "no_bicycles": "🚳", "no_entry": "⛔", "no_littering": "🚯", "no_mobile_phones": "📵", "no_one_under_eighteen": "🔞", "no_pedestrians": "🚷", "no_smoking": "🚭", "non-potable_water": "🚱", "nose": "👃", "nose_dark_skin_tone": "👃🏿", "nose_light_skin_tone": "👃🏻", "nose_medium-dark_skin_tone": "👃🏾", "nose_medium-light_skin_tone": "👃🏼", "nose_medium_skin_tone": "👃🏽", "notebook": "📓", "notebook_with_decorative_cover": "📔", "nut_and_bolt": "🔩", "octopus": "🐙", "oden": "🍢", "office_building": "🏢", "ogre": "👹", "oil_drum": "🛢", "old_key": "🗝", "old_man": "👴", "old_man_dark_skin_tone": "👴🏿", "old_man_light_skin_tone": "👴🏻", "old_man_medium-dark_skin_tone": "👴🏾", "old_man_medium-light_skin_tone": "👴🏼", "old_man_medium_skin_tone": "👴🏽", "old_woman": "👵", "old_woman_dark_skin_tone": "👵🏿", "old_woman_light_skin_tone": "👵🏻", "old_woman_medium-dark_skin_tone": "👵🏾", "old_woman_medium-light_skin_tone": "👵🏼", "old_woman_medium_skin_tone": "👵🏽", "older_adult": "🧓", "older_adult_dark_skin_tone": "🧓🏿", "older_adult_light_skin_tone": "🧓🏻", "older_adult_medium-dark_skin_tone": "🧓🏾", "older_adult_medium-light_skin_tone": "🧓🏼", "older_adult_medium_skin_tone": "🧓🏽", "om": "🕉", "oncoming_automobile": "🚘", "oncoming_bus": "🚍", "oncoming_fist": "👊", "oncoming_fist_dark_skin_tone": "👊🏿", "oncoming_fist_light_skin_tone": "👊🏻", "oncoming_fist_medium-dark_skin_tone": "👊🏾", "oncoming_fist_medium-light_skin_tone": "👊🏼", "oncoming_fist_medium_skin_tone": "👊🏽", "oncoming_police_car": "🚔", "oncoming_taxi": "🚖", "one-piece_swimsuit": "🩱", "one-thirty": "🕜", "one_o’clock": "🕐", "onion": "🧅", "open_book": "📖", "open_file_folder": "📂", "open_hands": "👐", "open_hands_dark_skin_tone": "👐🏿", "open_hands_light_skin_tone": "👐🏻", "open_hands_medium-dark_skin_tone": "👐🏾", "open_hands_medium-light_skin_tone": "👐🏼", "open_hands_medium_skin_tone": "👐🏽", "open_mailbox_with_lowered_flag": "📭", "open_mailbox_with_raised_flag": "📬", "optical_disk": "💿", "orange_book": "📙", "orange_circle": "🟠", "orange_heart": "🧡", "orange_square": "🟧", "orangutan": "🦧", "orthodox_cross": "☦", "otter": "🦦", "outbox_tray": "📤", "owl": "🦉", "ox": "🐂", "oyster": "🦪", "package": "📦", "page_facing_up": "📄", "page_with_curl": "📃", "pager": "📟", "paintbrush": "🖌", "palm_tree": "🌴", "palms_up_together": "🤲", "palms_up_together_dark_skin_tone": "🤲🏿", "palms_up_together_light_skin_tone": "🤲🏻", "palms_up_together_medium-dark_skin_tone": "🤲🏾", "palms_up_together_medium-light_skin_tone": "🤲🏼", "palms_up_together_medium_skin_tone": "🤲🏽", "pancakes": "🥞", "panda_face": "🐼", "paperclip": "📎", "parrot": "🦜", "part_alternation_mark": "〽", "party_popper": "🎉", "partying_face": "🥳", "passenger_ship": "🛳", "passport_control": "🛂", "pause_button": "⏸", "paw_prints": "🐾", "peace_symbol": "☮", "peach": "🍑", "peacock": "🦚", "peanuts": "🥜", "pear": "🍐", "pen": "🖊", "pencil": "📝", "penguin": "🐧", "pensive_face": "😔", "people_holding_hands": "🧑\u200d🤝\u200d🧑", "people_with_bunny_ears": "👯", "people_wrestling": "🤼", "performing_arts": "🎭", "persevering_face": "😣", "person_biking": "🚴", "person_biking_dark_skin_tone": "🚴🏿", "person_biking_light_skin_tone": "🚴🏻", "person_biking_medium-dark_skin_tone": "🚴🏾", "person_biking_medium-light_skin_tone": "🚴🏼", "person_biking_medium_skin_tone": "🚴🏽", "person_bouncing_ball": "⛹", "person_bouncing_ball_dark_skin_tone": "⛹🏿", "person_bouncing_ball_light_skin_tone": "⛹🏻", "person_bouncing_ball_medium-dark_skin_tone": "⛹🏾", "person_bouncing_ball_medium-light_skin_tone": "⛹🏼", "person_bouncing_ball_medium_skin_tone": "⛹🏽", "person_bowing": "🙇", "person_bowing_dark_skin_tone": "🙇🏿", "person_bowing_light_skin_tone": "🙇🏻", "person_bowing_medium-dark_skin_tone": "🙇🏾", "person_bowing_medium-light_skin_tone": "🙇🏼", "person_bowing_medium_skin_tone": "🙇🏽", "person_cartwheeling": "🤸", "person_cartwheeling_dark_skin_tone": "🤸🏿", "person_cartwheeling_light_skin_tone": "🤸🏻", "person_cartwheeling_medium-dark_skin_tone": "🤸🏾", "person_cartwheeling_medium-light_skin_tone": "🤸🏼", "person_cartwheeling_medium_skin_tone": "🤸🏽", "person_climbing": "🧗", "person_climbing_dark_skin_tone": "🧗🏿", "person_climbing_light_skin_tone": "🧗🏻", "person_climbing_medium-dark_skin_tone": "🧗🏾", "person_climbing_medium-light_skin_tone": "🧗🏼", "person_climbing_medium_skin_tone": "🧗🏽", "person_facepalming": "🤦", "person_facepalming_dark_skin_tone": "🤦🏿", "person_facepalming_light_skin_tone": "🤦🏻", "person_facepalming_medium-dark_skin_tone": "🤦🏾", "person_facepalming_medium-light_skin_tone": "🤦🏼", "person_facepalming_medium_skin_tone": "🤦🏽", "person_fencing": "🤺", "person_frowning": "🙍", "person_frowning_dark_skin_tone": "🙍🏿", "person_frowning_light_skin_tone": "🙍🏻", "person_frowning_medium-dark_skin_tone": "🙍🏾", "person_frowning_medium-light_skin_tone": "🙍🏼", "person_frowning_medium_skin_tone": "🙍🏽", "person_gesturing_no": "🙅", "person_gesturing_no_dark_skin_tone": "🙅🏿", "person_gesturing_no_light_skin_tone": "🙅🏻", "person_gesturing_no_medium-dark_skin_tone": "🙅🏾", "person_gesturing_no_medium-light_skin_tone": "🙅🏼", "person_gesturing_no_medium_skin_tone": "🙅🏽", "person_gesturing_ok": "🙆", "person_gesturing_ok_dark_skin_tone": "🙆🏿", "person_gesturing_ok_light_skin_tone": "🙆🏻", "person_gesturing_ok_medium-dark_skin_tone": "🙆🏾", "person_gesturing_ok_medium-light_skin_tone": "🙆🏼", "person_gesturing_ok_medium_skin_tone": "🙆🏽", "person_getting_haircut": "💇", "person_getting_haircut_dark_skin_tone": "💇🏿", "person_getting_haircut_light_skin_tone": "💇🏻", "person_getting_haircut_medium-dark_skin_tone": "💇🏾", "person_getting_haircut_medium-light_skin_tone": "💇🏼", "person_getting_haircut_medium_skin_tone": "💇🏽", "person_getting_massage": "💆", "person_getting_massage_dark_skin_tone": "💆🏿", "person_getting_massage_light_skin_tone": "💆🏻", "person_getting_massage_medium-dark_skin_tone": "💆🏾", "person_getting_massage_medium-light_skin_tone": "💆🏼", "person_getting_massage_medium_skin_tone": "💆🏽", "person_golfing": "🏌", "person_golfing_dark_skin_tone": "🏌🏿", "person_golfing_light_skin_tone": "🏌🏻", "person_golfing_medium-dark_skin_tone": "🏌🏾", "person_golfing_medium-light_skin_tone": "🏌🏼", "person_golfing_medium_skin_tone": "🏌🏽", "person_in_bed": "🛌", "person_in_bed_dark_skin_tone": "🛌🏿", "person_in_bed_light_skin_tone": "🛌🏻", "person_in_bed_medium-dark_skin_tone": "🛌🏾", "person_in_bed_medium-light_skin_tone": "🛌🏼", "person_in_bed_medium_skin_tone": "🛌🏽", "person_in_lotus_position": "🧘", "person_in_lotus_position_dark_skin_tone": "🧘🏿", "person_in_lotus_position_light_skin_tone": "🧘🏻", "person_in_lotus_position_medium-dark_skin_tone": "🧘🏾", "person_in_lotus_position_medium-light_skin_tone": "🧘🏼", "person_in_lotus_position_medium_skin_tone": "🧘🏽", "person_in_steamy_room": "🧖", "person_in_steamy_room_dark_skin_tone": "🧖🏿", "person_in_steamy_room_light_skin_tone": "🧖🏻", "person_in_steamy_room_medium-dark_skin_tone": "🧖🏾", "person_in_steamy_room_medium-light_skin_tone": "🧖🏼", "person_in_steamy_room_medium_skin_tone": "🧖🏽", "person_juggling": "🤹", "person_juggling_dark_skin_tone": "🤹🏿", "person_juggling_light_skin_tone": "🤹🏻", "person_juggling_medium-dark_skin_tone": "🤹🏾", "person_juggling_medium-light_skin_tone": "🤹🏼", "person_juggling_medium_skin_tone": "🤹🏽", "person_kneeling": "🧎", "person_lifting_weights": "🏋", "person_lifting_weights_dark_skin_tone": "🏋🏿", "person_lifting_weights_light_skin_tone": "🏋🏻", "person_lifting_weights_medium-dark_skin_tone": "🏋🏾", "person_lifting_weights_medium-light_skin_tone": "🏋🏼", "person_lifting_weights_medium_skin_tone": "🏋🏽", "person_mountain_biking": "🚵", "person_mountain_biking_dark_skin_tone": "🚵🏿", "person_mountain_biking_light_skin_tone": "🚵🏻", "person_mountain_biking_medium-dark_skin_tone": "🚵🏾", "person_mountain_biking_medium-light_skin_tone": "🚵🏼", "person_mountain_biking_medium_skin_tone": "🚵🏽", "person_playing_handball": "🤾", "person_playing_handball_dark_skin_tone": "🤾🏿", "person_playing_handball_light_skin_tone": "🤾🏻", "person_playing_handball_medium-dark_skin_tone": "🤾🏾", "person_playing_handball_medium-light_skin_tone": "🤾🏼", "person_playing_handball_medium_skin_tone": "🤾🏽", "person_playing_water_polo": "🤽", "person_playing_water_polo_dark_skin_tone": "🤽🏿", "person_playing_water_polo_light_skin_tone": "🤽🏻", "person_playing_water_polo_medium-dark_skin_tone": "🤽🏾", "person_playing_water_polo_medium-light_skin_tone": "🤽🏼", "person_playing_water_polo_medium_skin_tone": "🤽🏽", "person_pouting": "🙎", "person_pouting_dark_skin_tone": "🙎🏿", "person_pouting_light_skin_tone": "🙎🏻", "person_pouting_medium-dark_skin_tone": "🙎🏾", "person_pouting_medium-light_skin_tone": "🙎🏼", "person_pouting_medium_skin_tone": "🙎🏽", "person_raising_hand": "🙋", "person_raising_hand_dark_skin_tone": "🙋🏿", "person_raising_hand_light_skin_tone": "🙋🏻", "person_raising_hand_medium-dark_skin_tone": "🙋🏾", "person_raising_hand_medium-light_skin_tone": "🙋🏼", "person_raising_hand_medium_skin_tone": "🙋🏽", "person_rowing_boat": "🚣", "person_rowing_boat_dark_skin_tone": "🚣🏿", "person_rowing_boat_light_skin_tone": "🚣🏻", "person_rowing_boat_medium-dark_skin_tone": "🚣🏾", "person_rowing_boat_medium-light_skin_tone": "🚣🏼", "person_rowing_boat_medium_skin_tone": "🚣🏽", "person_running": "🏃", "person_running_dark_skin_tone": "🏃🏿", "person_running_light_skin_tone": "🏃🏻", "person_running_medium-dark_skin_tone": "🏃🏾", "person_running_medium-light_skin_tone": "🏃🏼", "person_running_medium_skin_tone": "🏃🏽", "person_shrugging": "🤷", "person_shrugging_dark_skin_tone": "🤷🏿", "person_shrugging_light_skin_tone": "🤷🏻", "person_shrugging_medium-dark_skin_tone": "🤷🏾", "person_shrugging_medium-light_skin_tone": "🤷🏼", "person_shrugging_medium_skin_tone": "🤷🏽", "person_standing": "🧍", "person_surfing": "🏄", "person_surfing_dark_skin_tone": "🏄🏿", "person_surfing_light_skin_tone": "🏄🏻", "person_surfing_medium-dark_skin_tone": "🏄🏾", "person_surfing_medium-light_skin_tone": "🏄🏼", "person_surfing_medium_skin_tone": "🏄🏽", "person_swimming": "🏊", "person_swimming_dark_skin_tone": "🏊🏿", "person_swimming_light_skin_tone": "🏊🏻", "person_swimming_medium-dark_skin_tone": "🏊🏾", "person_swimming_medium-light_skin_tone": "🏊🏼", "person_swimming_medium_skin_tone": "🏊🏽", "person_taking_bath": "🛀", "person_taking_bath_dark_skin_tone": "🛀🏿", "person_taking_bath_light_skin_tone": "🛀🏻", "person_taking_bath_medium-dark_skin_tone": "🛀🏾", "person_taking_bath_medium-light_skin_tone": "🛀🏼", "person_taking_bath_medium_skin_tone": "🛀🏽", "person_tipping_hand": "💁", "person_tipping_hand_dark_skin_tone": "💁🏿", "person_tipping_hand_light_skin_tone": "💁🏻", "person_tipping_hand_medium-dark_skin_tone": "💁🏾", "person_tipping_hand_medium-light_skin_tone": "💁🏼", "person_tipping_hand_medium_skin_tone": "💁🏽", "person_walking": "🚶", "person_walking_dark_skin_tone": "🚶🏿", "person_walking_light_skin_tone": "🚶🏻", "person_walking_medium-dark_skin_tone": "🚶🏾", "person_walking_medium-light_skin_tone": "🚶🏼", "person_walking_medium_skin_tone": "🚶🏽", "person_wearing_turban": "👳", "person_wearing_turban_dark_skin_tone": "👳🏿", "person_wearing_turban_light_skin_tone": "👳🏻", "person_wearing_turban_medium-dark_skin_tone": "👳🏾", "person_wearing_turban_medium-light_skin_tone": "👳🏼", "person_wearing_turban_medium_skin_tone": "👳🏽", "petri_dish": "🧫", "pick": "⛏", "pie": "🥧", "pig": "🐷", "pig_face": "🐷", "pig_nose": "🐽", "pile_of_poo": "💩", "pill": "💊", "pinching_hand": "🤏", "pine_decoration": "🎍", "pineapple": "🍍", "ping_pong": "🏓", "pirate_flag": "🏴\u200d☠️", "pistol": "🔫", "pizza": "🍕", "place_of_worship": "🛐", "play_button": "▶", "play_or_pause_button": "⏯", "pleading_face": "🥺", "police_car": "🚓", "police_car_light": "🚨", "police_officer": "👮", "police_officer_dark_skin_tone": "👮🏿", "police_officer_light_skin_tone": "👮🏻", "police_officer_medium-dark_skin_tone": "👮🏾", "police_officer_medium-light_skin_tone": "👮🏼", "police_officer_medium_skin_tone": "👮🏽", "poodle": "🐩", "pool_8_ball": "🎱", "popcorn": "🍿", "post_office": "🏣", "postal_horn": "📯", "postbox": "📮", "pot_of_food": "🍲", "potable_water": "🚰", "potato": "🥔", "poultry_leg": "🍗", "pound_banknote": "💷", "pouting_cat_face": "😾", "pouting_face": "😡", "prayer_beads": "📿", "pregnant_woman": "🤰", "pregnant_woman_dark_skin_tone": "🤰🏿", "pregnant_woman_light_skin_tone": "🤰🏻", "pregnant_woman_medium-dark_skin_tone": "🤰🏾", "pregnant_woman_medium-light_skin_tone": "🤰🏼", "pregnant_woman_medium_skin_tone": "🤰🏽", "pretzel": "🥨", "probing_cane": "🦯", "prince": "🤴", "prince_dark_skin_tone": "🤴🏿", "prince_light_skin_tone": "🤴🏻", "prince_medium-dark_skin_tone": "🤴🏾", "prince_medium-light_skin_tone": "🤴🏼", "prince_medium_skin_tone": "🤴🏽", "princess": "👸", "princess_dark_skin_tone": "👸🏿", "princess_light_skin_tone": "👸🏻", "princess_medium-dark_skin_tone": "👸🏾", "princess_medium-light_skin_tone": "👸🏼", "princess_medium_skin_tone": "👸🏽", "printer": "🖨", "prohibited": "🚫", "purple_circle": "🟣", "purple_heart": "💜", "purple_square": "🟪", "purse": "👛", "pushpin": "📌", "question_mark": "❓", "rabbit": "🐰", "rabbit_face": "🐰", "raccoon": "🦝", "racing_car": "🏎", "radio": "📻", "radio_button": "🔘", "radioactive": "☢", "railway_car": "🚃", "railway_track": "🛤", "rainbow": "🌈", "rainbow_flag": "🏳️\u200d🌈", "raised_back_of_hand": "🤚", "raised_back_of_hand_dark_skin_tone": "🤚🏿", "raised_back_of_hand_light_skin_tone": "🤚🏻", "raised_back_of_hand_medium-dark_skin_tone": "🤚🏾", "raised_back_of_hand_medium-light_skin_tone": "🤚🏼", "raised_back_of_hand_medium_skin_tone": "🤚🏽", "raised_fist": "✊", "raised_fist_dark_skin_tone": "✊🏿", "raised_fist_light_skin_tone": "✊🏻", "raised_fist_medium-dark_skin_tone": "✊🏾", "raised_fist_medium-light_skin_tone": "✊🏼", "raised_fist_medium_skin_tone": "✊🏽", "raised_hand": "✋", "raised_hand_dark_skin_tone": "✋🏿", "raised_hand_light_skin_tone": "✋🏻", "raised_hand_medium-dark_skin_tone": "✋🏾", "raised_hand_medium-light_skin_tone": "✋🏼", "raised_hand_medium_skin_tone": "✋🏽", "raising_hands": "🙌", "raising_hands_dark_skin_tone": "🙌🏿", "raising_hands_light_skin_tone": "🙌🏻", "raising_hands_medium-dark_skin_tone": "🙌🏾", "raising_hands_medium-light_skin_tone": "🙌🏼", "raising_hands_medium_skin_tone": "🙌🏽", "ram": "🐏", "rat": "🐀", "razor": "🪒", "ringed_planet": "🪐", "receipt": "🧾", "record_button": "⏺", "recycling_symbol": "♻", "red_apple": "🍎", "red_circle": "🔴", "red_envelope": "🧧", "red_hair": "🦰", "red-haired_man": "👨\u200d🦰", "red-haired_woman": "👩\u200d🦰", "red_heart": "❤", "red_paper_lantern": "🏮", "red_square": "🟥", "red_triangle_pointed_down": "🔻", "red_triangle_pointed_up": "🔺", "registered": "®", "relieved_face": "😌", "reminder_ribbon": "🎗", "repeat_button": "🔁", "repeat_single_button": "🔂", "rescue_worker’s_helmet": "⛑", "restroom": "🚻", "reverse_button": "◀", "revolving_hearts": "💞", "rhinoceros": "🦏", "ribbon": "🎀", "rice_ball": "🍙", "rice_cracker": "🍘", "right-facing_fist": "🤜", "right-facing_fist_dark_skin_tone": "🤜🏿", "right-facing_fist_light_skin_tone": "🤜🏻", "right-facing_fist_medium-dark_skin_tone": "🤜🏾", "right-facing_fist_medium-light_skin_tone": "🤜🏼", "right-facing_fist_medium_skin_tone": "🤜🏽", "right_anger_bubble": "🗯", "right_arrow": "➡", "right_arrow_curving_down": "⤵", "right_arrow_curving_left": "↩", "right_arrow_curving_up": "⤴", "ring": "💍", "roasted_sweet_potato": "🍠", "robot_face": "🤖", "rocket": "🚀", "roll_of_paper": "🧻", "rolled-up_newspaper": "🗞", "roller_coaster": "🎢", "rolling_on_the_floor_laughing": "🤣", "rooster": "🐓", "rose": "🌹", "rosette": "🏵", "round_pushpin": "📍", "rugby_football": "🏉", "running_shirt": "🎽", "running_shoe": "👟", "sad_but_relieved_face": "😥", "safety_pin": "🧷", "safety_vest": "🦺", "salt": "🧂", "sailboat": "⛵", "sake": "🍶", "sandwich": "🥪", "sari": "🥻", "satellite": "📡", "satellite_antenna": "📡", "sauropod": "🦕", "saxophone": "🎷", "scarf": "🧣", "school": "🏫", "school_backpack": "🎒", "scissors": "✂", "scorpion": "🦂", "scroll": "📜", "seat": "💺", "see-no-evil_monkey": "🙈", "seedling": "🌱", "selfie": "🤳", "selfie_dark_skin_tone": "🤳🏿", "selfie_light_skin_tone": "🤳🏻", "selfie_medium-dark_skin_tone": "🤳🏾", "selfie_medium-light_skin_tone": "🤳🏼", "selfie_medium_skin_tone": "🤳🏽", "service_dog": "🐕\u200d🦺", "seven-thirty": "🕢", "seven_o’clock": "🕖", "shallow_pan_of_food": "🥘", "shamrock": "☘", "shark": "🦈", "shaved_ice": "🍧", "sheaf_of_rice": "🌾", "shield": "🛡", "shinto_shrine": "⛩", "ship": "🚢", "shooting_star": "🌠", "shopping_bags": "🛍", "shopping_cart": "🛒", "shortcake": "🍰", "shorts": "🩳", "shower": "🚿", "shrimp": "🦐", "shuffle_tracks_button": "🔀", "shushing_face": "🤫", "sign_of_the_horns": "🤘", "sign_of_the_horns_dark_skin_tone": "🤘🏿", "sign_of_the_horns_light_skin_tone": "🤘🏻", "sign_of_the_horns_medium-dark_skin_tone": "🤘🏾", "sign_of_the_horns_medium-light_skin_tone": "🤘🏼", "sign_of_the_horns_medium_skin_tone": "🤘🏽", "six-thirty": "🕡", "six_o’clock": "🕕", "skateboard": "🛹", "skier": "⛷", "skis": "🎿", "skull": "💀", "skull_and_crossbones": "☠", "skunk": "🦨", "sled": "🛷", "sleeping_face": "😴", "sleepy_face": "😪", "slightly_frowning_face": "🙁", "slightly_smiling_face": "🙂", "slot_machine": "🎰", "sloth": "🦥", "small_airplane": "🛩", "small_blue_diamond": "🔹", "small_orange_diamond": "🔸", "smiling_cat_face_with_heart-eyes": "😻", "smiling_face": "☺", "smiling_face_with_halo": "😇", "smiling_face_with_3_hearts": "🥰", "smiling_face_with_heart-eyes": "😍", "smiling_face_with_horns": "😈", "smiling_face_with_smiling_eyes": "😊", "smiling_face_with_sunglasses": "😎", "smirking_face": "😏", "snail": "🐌", "snake": "🐍", "sneezing_face": "🤧", "snow-capped_mountain": "🏔", "snowboarder": "🏂", "snowboarder_dark_skin_tone": "🏂🏿", "snowboarder_light_skin_tone": "🏂🏻", "snowboarder_medium-dark_skin_tone": "🏂🏾", "snowboarder_medium-light_skin_tone": "🏂🏼", "snowboarder_medium_skin_tone": "🏂🏽", "snowflake": "❄", "snowman": "☃", "snowman_without_snow": "⛄", "soap": "🧼", "soccer_ball": "⚽", "socks": "🧦", "softball": "🥎", "soft_ice_cream": "🍦", "spade_suit": "♠", "spaghetti": "🍝", "sparkle": "❇", "sparkler": "🎇", "sparkles": "✨", "sparkling_heart": "💖", "speak-no-evil_monkey": "🙊", "speaker_high_volume": "🔊", "speaker_low_volume": "🔈", "speaker_medium_volume": "🔉", "speaking_head": "🗣", "speech_balloon": "💬", "speedboat": "🚤", "spider": "🕷", "spider_web": "🕸", "spiral_calendar": "🗓", "spiral_notepad": "🗒", "spiral_shell": "🐚", "spoon": "🥄", "sponge": "🧽", "sport_utility_vehicle": "🚙", "sports_medal": "🏅", "spouting_whale": "🐳", "squid": "🦑", "squinting_face_with_tongue": "😝", "stadium": "🏟", "star-struck": "🤩", "star_and_crescent": "☪", "star_of_david": "✡", "station": "🚉", "steaming_bowl": "🍜", "stethoscope": "🩺", "stop_button": "⏹", "stop_sign": "🛑", "stopwatch": "⏱", "straight_ruler": "📏", "strawberry": "🍓", "studio_microphone": "🎙", "stuffed_flatbread": "🥙", "sun": "☀", "sun_behind_cloud": "⛅", "sun_behind_large_cloud": "🌥", "sun_behind_rain_cloud": "🌦", "sun_behind_small_cloud": "🌤", "sun_with_face": "🌞", "sunflower": "🌻", "sunglasses": "😎", "sunrise": "🌅", "sunrise_over_mountains": "🌄", "sunset": "🌇", "superhero": "🦸", "supervillain": "🦹", "sushi": "🍣", "suspension_railway": "🚟", "swan": "🦢", "sweat_droplets": "💦", "synagogue": "🕍", "syringe": "💉", "t-shirt": "👕", "taco": "🌮", "takeout_box": "🥡", "tanabata_tree": "🎋", "tangerine": "🍊", "taxi": "🚕", "teacup_without_handle": "🍵", "tear-off_calendar": "📆", "teddy_bear": "🧸", "telephone": "☎", "telephone_receiver": "📞", "telescope": "🔭", "television": "📺", "ten-thirty": "🕥", "ten_o’clock": "🕙", "tennis": "🎾", "tent": "⛺", "test_tube": "🧪", "thermometer": "🌡", "thinking_face": "🤔", "thought_balloon": "💭", "thread": "🧵", "three-thirty": "🕞", "three_o’clock": "🕒", "thumbs_down": "👎", "thumbs_down_dark_skin_tone": "👎🏿", "thumbs_down_light_skin_tone": "👎🏻", "thumbs_down_medium-dark_skin_tone": "👎🏾", "thumbs_down_medium-light_skin_tone": "👎🏼", "thumbs_down_medium_skin_tone": "👎🏽", "thumbs_up": "👍", "thumbs_up_dark_skin_tone": "👍🏿", "thumbs_up_light_skin_tone": "👍🏻", "thumbs_up_medium-dark_skin_tone": "👍🏾", "thumbs_up_medium-light_skin_tone": "👍🏼", "thumbs_up_medium_skin_tone": "👍🏽", "ticket": "🎫", "tiger": "🐯", "tiger_face": "🐯", "timer_clock": "⏲", "tired_face": "😫", "toolbox": "🧰", "toilet": "🚽", "tomato": "🍅", "tongue": "👅", "tooth": "🦷", "top_hat": "🎩", "tornado": "🌪", "trackball": "🖲", "tractor": "🚜", "trade_mark": "™", "train": "🚋", "tram": "🚊", "tram_car": "🚋", "triangular_flag": "🚩", "triangular_ruler": "📐", "trident_emblem": "🔱", "trolleybus": "🚎", "trophy": "🏆", "tropical_drink": "🍹", "tropical_fish": "🐠", "trumpet": "🎺", "tulip": "🌷", "tumbler_glass": "🥃", "turtle": "🐢", "twelve-thirty": "🕧", "twelve_o’clock": "🕛", "two-hump_camel": "🐫", "two-thirty": "🕝", "two_hearts": "💕", "two_men_holding_hands": "👬", "two_o’clock": "🕑", "two_women_holding_hands": "👭", "umbrella": "☂", "umbrella_on_ground": "⛱", "umbrella_with_rain_drops": "☔", "unamused_face": "😒", "unicorn_face": "🦄", "unlocked": "🔓", "up-down_arrow": "↕", "up-left_arrow": "↖", "up-right_arrow": "↗", "up_arrow": "⬆", "upside-down_face": "🙃", "upwards_button": "🔼", "vampire": "🧛", "vampire_dark_skin_tone": "🧛🏿", "vampire_light_skin_tone": "🧛🏻", "vampire_medium-dark_skin_tone": "🧛🏾", "vampire_medium-light_skin_tone": "🧛🏼", "vampire_medium_skin_tone": "🧛🏽", "vertical_traffic_light": "🚦", "vibration_mode": "📳", "victory_hand": "✌", "victory_hand_dark_skin_tone": "✌🏿", "victory_hand_light_skin_tone": "✌🏻", "victory_hand_medium-dark_skin_tone": "✌🏾", "victory_hand_medium-light_skin_tone": "✌🏼", "victory_hand_medium_skin_tone": "✌🏽", "video_camera": "📹", "video_game": "🎮", "videocassette": "📼", "violin": "🎻", "volcano": "🌋", "volleyball": "🏐", "vulcan_salute": "🖖", "vulcan_salute_dark_skin_tone": "🖖🏿", "vulcan_salute_light_skin_tone": "🖖🏻", "vulcan_salute_medium-dark_skin_tone": "🖖🏾", "vulcan_salute_medium-light_skin_tone": "🖖🏼", "vulcan_salute_medium_skin_tone": "🖖🏽", "waffle": "🧇", "waning_crescent_moon": "🌘", "waning_gibbous_moon": "🌖", "warning": "⚠", "wastebasket": "🗑", "watch": "⌚", "water_buffalo": "🐃", "water_closet": "🚾", "water_wave": "🌊", "watermelon": "🍉", "waving_hand": "👋", "waving_hand_dark_skin_tone": "👋🏿", "waving_hand_light_skin_tone": "👋🏻", "waving_hand_medium-dark_skin_tone": "👋🏾", "waving_hand_medium-light_skin_tone": "👋🏼", "waving_hand_medium_skin_tone": "👋🏽", "wavy_dash": "〰", "waxing_crescent_moon": "🌒", "waxing_gibbous_moon": "🌔", "weary_cat_face": "🙀", "weary_face": "😩", "wedding": "💒", "whale": "🐳", "wheel_of_dharma": "☸", "wheelchair_symbol": "♿", "white_circle": "⚪", "white_exclamation_mark": "❕", "white_flag": "🏳", "white_flower": "💮", "white_hair": "🦳", "white-haired_man": "👨\u200d🦳", "white-haired_woman": "👩\u200d🦳", "white_heart": "🤍", "white_heavy_check_mark": "✅", "white_large_square": "⬜", "white_medium-small_square": "◽", "white_medium_square": "◻", "white_medium_star": "⭐", "white_question_mark": "❔", "white_small_square": "▫", "white_square_button": "🔳", "wilted_flower": "🥀", "wind_chime": "🎐", "wind_face": "🌬", "wine_glass": "🍷", "winking_face": "😉", "winking_face_with_tongue": "😜", "wolf_face": "🐺", "woman": "👩", "woman_artist": "👩\u200d🎨", "woman_artist_dark_skin_tone": "👩🏿\u200d🎨", "woman_artist_light_skin_tone": "👩🏻\u200d🎨", "woman_artist_medium-dark_skin_tone": "👩🏾\u200d🎨", "woman_artist_medium-light_skin_tone": "👩🏼\u200d🎨", "woman_artist_medium_skin_tone": "👩🏽\u200d🎨", "woman_astronaut": "👩\u200d🚀", "woman_astronaut_dark_skin_tone": "👩🏿\u200d🚀", "woman_astronaut_light_skin_tone": "👩🏻\u200d🚀", "woman_astronaut_medium-dark_skin_tone": "👩🏾\u200d🚀", "woman_astronaut_medium-light_skin_tone": "👩🏼\u200d🚀", "woman_astronaut_medium_skin_tone": "👩🏽\u200d🚀", "woman_biking": "🚴\u200d♀️", "woman_biking_dark_skin_tone": "🚴🏿\u200d♀️", "woman_biking_light_skin_tone": "🚴🏻\u200d♀️", "woman_biking_medium-dark_skin_tone": "🚴🏾\u200d♀️", "woman_biking_medium-light_skin_tone": "🚴🏼\u200d♀️", "woman_biking_medium_skin_tone": "🚴🏽\u200d♀️", "woman_bouncing_ball": "⛹️\u200d♀️", "woman_bouncing_ball_dark_skin_tone": "⛹🏿\u200d♀️", "woman_bouncing_ball_light_skin_tone": "⛹🏻\u200d♀️", "woman_bouncing_ball_medium-dark_skin_tone": "⛹🏾\u200d♀️", "woman_bouncing_ball_medium-light_skin_tone": "⛹🏼\u200d♀️", "woman_bouncing_ball_medium_skin_tone": "⛹🏽\u200d♀️", "woman_bowing": "🙇\u200d♀️", "woman_bowing_dark_skin_tone": "🙇🏿\u200d♀️", "woman_bowing_light_skin_tone": "🙇🏻\u200d♀️", "woman_bowing_medium-dark_skin_tone": "🙇🏾\u200d♀️", "woman_bowing_medium-light_skin_tone": "🙇🏼\u200d♀️", "woman_bowing_medium_skin_tone": "🙇🏽\u200d♀️", "woman_cartwheeling": "🤸\u200d♀️", "woman_cartwheeling_dark_skin_tone": "🤸🏿\u200d♀️", "woman_cartwheeling_light_skin_tone": "🤸🏻\u200d♀️", "woman_cartwheeling_medium-dark_skin_tone": "🤸🏾\u200d♀️", "woman_cartwheeling_medium-light_skin_tone": "🤸🏼\u200d♀️", "woman_cartwheeling_medium_skin_tone": "🤸🏽\u200d♀️", "woman_climbing": "🧗\u200d♀️", "woman_climbing_dark_skin_tone": "🧗🏿\u200d♀️", "woman_climbing_light_skin_tone": "🧗🏻\u200d♀️", "woman_climbing_medium-dark_skin_tone": "🧗🏾\u200d♀️", "woman_climbing_medium-light_skin_tone": "🧗🏼\u200d♀️", "woman_climbing_medium_skin_tone": "🧗🏽\u200d♀️", "woman_construction_worker": "👷\u200d♀️", "woman_construction_worker_dark_skin_tone": "👷🏿\u200d♀️", "woman_construction_worker_light_skin_tone": "👷🏻\u200d♀️", "woman_construction_worker_medium-dark_skin_tone": "👷🏾\u200d♀️", "woman_construction_worker_medium-light_skin_tone": "👷🏼\u200d♀️", "woman_construction_worker_medium_skin_tone": "👷🏽\u200d♀️", "woman_cook": "👩\u200d🍳", "woman_cook_dark_skin_tone": "👩🏿\u200d🍳", "woman_cook_light_skin_tone": "👩🏻\u200d🍳", "woman_cook_medium-dark_skin_tone": "👩🏾\u200d🍳", "woman_cook_medium-light_skin_tone": "👩🏼\u200d🍳", "woman_cook_medium_skin_tone": "👩🏽\u200d🍳", "woman_dancing": "💃", "woman_dancing_dark_skin_tone": "💃🏿", "woman_dancing_light_skin_tone": "💃🏻", "woman_dancing_medium-dark_skin_tone": "💃🏾", "woman_dancing_medium-light_skin_tone": "💃🏼", "woman_dancing_medium_skin_tone": "💃🏽", "woman_dark_skin_tone": "👩🏿", "woman_detective": "🕵️\u200d♀️", "woman_detective_dark_skin_tone": "🕵🏿\u200d♀️", "woman_detective_light_skin_tone": "🕵🏻\u200d♀️", "woman_detective_medium-dark_skin_tone": "🕵🏾\u200d♀️", "woman_detective_medium-light_skin_tone": "🕵🏼\u200d♀️", "woman_detective_medium_skin_tone": "🕵🏽\u200d♀️", "woman_elf": "🧝\u200d♀️", "woman_elf_dark_skin_tone": "🧝🏿\u200d♀️", "woman_elf_light_skin_tone": "🧝🏻\u200d♀️", "woman_elf_medium-dark_skin_tone": "🧝🏾\u200d♀️", "woman_elf_medium-light_skin_tone": "🧝🏼\u200d♀️", "woman_elf_medium_skin_tone": "🧝🏽\u200d♀️", "woman_facepalming": "🤦\u200d♀️", "woman_facepalming_dark_skin_tone": "🤦🏿\u200d♀️", "woman_facepalming_light_skin_tone": "🤦🏻\u200d♀️", "woman_facepalming_medium-dark_skin_tone": "🤦🏾\u200d♀️", "woman_facepalming_medium-light_skin_tone": "🤦🏼\u200d♀️", "woman_facepalming_medium_skin_tone": "🤦🏽\u200d♀️", "woman_factory_worker": "👩\u200d🏭", "woman_factory_worker_dark_skin_tone": "👩🏿\u200d🏭", "woman_factory_worker_light_skin_tone": "👩🏻\u200d🏭", "woman_factory_worker_medium-dark_skin_tone": "👩🏾\u200d🏭", "woman_factory_worker_medium-light_skin_tone": "👩🏼\u200d🏭", "woman_factory_worker_medium_skin_tone": "👩🏽\u200d🏭", "woman_fairy": "🧚\u200d♀️", "woman_fairy_dark_skin_tone": "🧚🏿\u200d♀️", "woman_fairy_light_skin_tone": "🧚🏻\u200d♀️", "woman_fairy_medium-dark_skin_tone": "🧚🏾\u200d♀️", "woman_fairy_medium-light_skin_tone": "🧚🏼\u200d♀️", "woman_fairy_medium_skin_tone": "🧚🏽\u200d♀️", "woman_farmer": "👩\u200d🌾", "woman_farmer_dark_skin_tone": "👩🏿\u200d🌾", "woman_farmer_light_skin_tone": "👩🏻\u200d🌾", "woman_farmer_medium-dark_skin_tone": "👩🏾\u200d🌾", "woman_farmer_medium-light_skin_tone": "👩🏼\u200d🌾", "woman_farmer_medium_skin_tone": "👩🏽\u200d🌾", "woman_firefighter": "👩\u200d🚒", "woman_firefighter_dark_skin_tone": "👩🏿\u200d🚒", "woman_firefighter_light_skin_tone": "👩🏻\u200d🚒", "woman_firefighter_medium-dark_skin_tone": "👩🏾\u200d🚒", "woman_firefighter_medium-light_skin_tone": "👩🏼\u200d🚒", "woman_firefighter_medium_skin_tone": "👩🏽\u200d🚒", "woman_frowning": "🙍\u200d♀️", "woman_frowning_dark_skin_tone": "🙍🏿\u200d♀️", "woman_frowning_light_skin_tone": "🙍🏻\u200d♀️", "woman_frowning_medium-dark_skin_tone": "🙍🏾\u200d♀️", "woman_frowning_medium-light_skin_tone": "🙍🏼\u200d♀️", "woman_frowning_medium_skin_tone": "🙍🏽\u200d♀️", "woman_genie": "🧞\u200d♀️", "woman_gesturing_no": "🙅\u200d♀️", "woman_gesturing_no_dark_skin_tone": "🙅🏿\u200d♀️", "woman_gesturing_no_light_skin_tone": "🙅🏻\u200d♀️", "woman_gesturing_no_medium-dark_skin_tone": "🙅🏾\u200d♀️", "woman_gesturing_no_medium-light_skin_tone": "🙅🏼\u200d♀️", "woman_gesturing_no_medium_skin_tone": "🙅🏽\u200d♀️", "woman_gesturing_ok": "🙆\u200d♀️", "woman_gesturing_ok_dark_skin_tone": "🙆🏿\u200d♀️", "woman_gesturing_ok_light_skin_tone": "🙆🏻\u200d♀️", "woman_gesturing_ok_medium-dark_skin_tone": "🙆🏾\u200d♀️", "woman_gesturing_ok_medium-light_skin_tone": "🙆🏼\u200d♀️", "woman_gesturing_ok_medium_skin_tone": "🙆🏽\u200d♀️", "woman_getting_haircut": "💇\u200d♀️", "woman_getting_haircut_dark_skin_tone": "💇🏿\u200d♀️", "woman_getting_haircut_light_skin_tone": "💇🏻\u200d♀️", "woman_getting_haircut_medium-dark_skin_tone": "💇🏾\u200d♀️", "woman_getting_haircut_medium-light_skin_tone": "💇🏼\u200d♀️", "woman_getting_haircut_medium_skin_tone": "💇🏽\u200d♀️", "woman_getting_massage": "💆\u200d♀️", "woman_getting_massage_dark_skin_tone": "💆🏿\u200d♀️", "woman_getting_massage_light_skin_tone": "💆🏻\u200d♀️", "woman_getting_massage_medium-dark_skin_tone": "💆🏾\u200d♀️", "woman_getting_massage_medium-light_skin_tone": "💆🏼\u200d♀️", "woman_getting_massage_medium_skin_tone": "💆🏽\u200d♀️", "woman_golfing": "🏌️\u200d♀️", "woman_golfing_dark_skin_tone": "🏌🏿\u200d♀️", "woman_golfing_light_skin_tone": "🏌🏻\u200d♀️", "woman_golfing_medium-dark_skin_tone": "🏌🏾\u200d♀️", "woman_golfing_medium-light_skin_tone": "🏌🏼\u200d♀️", "woman_golfing_medium_skin_tone": "🏌🏽\u200d♀️", "woman_guard": "💂\u200d♀️", "woman_guard_dark_skin_tone": "💂🏿\u200d♀️", "woman_guard_light_skin_tone": "💂🏻\u200d♀️", "woman_guard_medium-dark_skin_tone": "💂🏾\u200d♀️", "woman_guard_medium-light_skin_tone": "💂🏼\u200d♀️", "woman_guard_medium_skin_tone": "💂🏽\u200d♀️", "woman_health_worker": "👩\u200d⚕️", "woman_health_worker_dark_skin_tone": "👩🏿\u200d⚕️", "woman_health_worker_light_skin_tone": "👩🏻\u200d⚕️", "woman_health_worker_medium-dark_skin_tone": "👩🏾\u200d⚕️", "woman_health_worker_medium-light_skin_tone": "👩🏼\u200d⚕️", "woman_health_worker_medium_skin_tone": "👩🏽\u200d⚕️", "woman_in_lotus_position": "🧘\u200d♀️", "woman_in_lotus_position_dark_skin_tone": "🧘🏿\u200d♀️", "woman_in_lotus_position_light_skin_tone": "🧘🏻\u200d♀️", "woman_in_lotus_position_medium-dark_skin_tone": "🧘🏾\u200d♀️", "woman_in_lotus_position_medium-light_skin_tone": "🧘🏼\u200d♀️", "woman_in_lotus_position_medium_skin_tone": "🧘🏽\u200d♀️", "woman_in_manual_wheelchair": "👩\u200d🦽", "woman_in_motorized_wheelchair": "👩\u200d🦼", "woman_in_steamy_room": "🧖\u200d♀️", "woman_in_steamy_room_dark_skin_tone": "🧖🏿\u200d♀️", "woman_in_steamy_room_light_skin_tone": "🧖🏻\u200d♀️", "woman_in_steamy_room_medium-dark_skin_tone": "🧖🏾\u200d♀️", "woman_in_steamy_room_medium-light_skin_tone": "🧖🏼\u200d♀️", "woman_in_steamy_room_medium_skin_tone": "🧖🏽\u200d♀️", "woman_judge": "👩\u200d⚖️", "woman_judge_dark_skin_tone": "👩🏿\u200d⚖️", "woman_judge_light_skin_tone": "👩🏻\u200d⚖️", "woman_judge_medium-dark_skin_tone": "👩🏾\u200d⚖️", "woman_judge_medium-light_skin_tone": "👩🏼\u200d⚖️", "woman_judge_medium_skin_tone": "👩🏽\u200d⚖️", "woman_juggling": "🤹\u200d♀️", "woman_juggling_dark_skin_tone": "🤹🏿\u200d♀️", "woman_juggling_light_skin_tone": "🤹🏻\u200d♀️", "woman_juggling_medium-dark_skin_tone": "🤹🏾\u200d♀️", "woman_juggling_medium-light_skin_tone": "🤹🏼\u200d♀️", "woman_juggling_medium_skin_tone": "🤹🏽\u200d♀️", "woman_lifting_weights": "🏋️\u200d♀️", "woman_lifting_weights_dark_skin_tone": "🏋🏿\u200d♀️", "woman_lifting_weights_light_skin_tone": "🏋🏻\u200d♀️", "woman_lifting_weights_medium-dark_skin_tone": "🏋🏾\u200d♀️", "woman_lifting_weights_medium-light_skin_tone": "🏋🏼\u200d♀️", "woman_lifting_weights_medium_skin_tone": "🏋🏽\u200d♀️", "woman_light_skin_tone": "👩🏻", "woman_mage": "🧙\u200d♀️", "woman_mage_dark_skin_tone": "🧙🏿\u200d♀️", "woman_mage_light_skin_tone": "🧙🏻\u200d♀️", "woman_mage_medium-dark_skin_tone": "🧙🏾\u200d♀️", "woman_mage_medium-light_skin_tone": "🧙🏼\u200d♀️", "woman_mage_medium_skin_tone": "🧙🏽\u200d♀️", "woman_mechanic": "👩\u200d🔧", "woman_mechanic_dark_skin_tone": "👩🏿\u200d🔧", "woman_mechanic_light_skin_tone": "👩🏻\u200d🔧", "woman_mechanic_medium-dark_skin_tone": "👩🏾\u200d🔧", "woman_mechanic_medium-light_skin_tone": "👩🏼\u200d🔧", "woman_mechanic_medium_skin_tone": "👩🏽\u200d🔧", "woman_medium-dark_skin_tone": "👩🏾", "woman_medium-light_skin_tone": "👩🏼", "woman_medium_skin_tone": "👩🏽", "woman_mountain_biking": "🚵\u200d♀️", "woman_mountain_biking_dark_skin_tone": "🚵🏿\u200d♀️", "woman_mountain_biking_light_skin_tone": "🚵🏻\u200d♀️", "woman_mountain_biking_medium-dark_skin_tone": "🚵🏾\u200d♀️", "woman_mountain_biking_medium-light_skin_tone": "🚵🏼\u200d♀️", "woman_mountain_biking_medium_skin_tone": "🚵🏽\u200d♀️", "woman_office_worker": "👩\u200d💼", "woman_office_worker_dark_skin_tone": "👩🏿\u200d💼", "woman_office_worker_light_skin_tone": "👩🏻\u200d💼", "woman_office_worker_medium-dark_skin_tone": "👩🏾\u200d💼", "woman_office_worker_medium-light_skin_tone": "👩🏼\u200d💼", "woman_office_worker_medium_skin_tone": "👩🏽\u200d💼", "woman_pilot": "👩\u200d✈️", "woman_pilot_dark_skin_tone": "👩🏿\u200d✈️", "woman_pilot_light_skin_tone": "👩🏻\u200d✈️", "woman_pilot_medium-dark_skin_tone": "👩🏾\u200d✈️", "woman_pilot_medium-light_skin_tone": "👩🏼\u200d✈️", "woman_pilot_medium_skin_tone": "👩🏽\u200d✈️", "woman_playing_handball": "🤾\u200d♀️", "woman_playing_handball_dark_skin_tone": "🤾🏿\u200d♀️", "woman_playing_handball_light_skin_tone": "🤾🏻\u200d♀️", "woman_playing_handball_medium-dark_skin_tone": "🤾🏾\u200d♀️", "woman_playing_handball_medium-light_skin_tone": "🤾🏼\u200d♀️", "woman_playing_handball_medium_skin_tone": "🤾🏽\u200d♀️", "woman_playing_water_polo": "🤽\u200d♀️", "woman_playing_water_polo_dark_skin_tone": "🤽🏿\u200d♀️", "woman_playing_water_polo_light_skin_tone": "🤽🏻\u200d♀️", "woman_playing_water_polo_medium-dark_skin_tone": "🤽🏾\u200d♀️", "woman_playing_water_polo_medium-light_skin_tone": "🤽🏼\u200d♀️", "woman_playing_water_polo_medium_skin_tone": "🤽🏽\u200d♀️", "woman_police_officer": "👮\u200d♀️", "woman_police_officer_dark_skin_tone": "👮🏿\u200d♀️", "woman_police_officer_light_skin_tone": "👮🏻\u200d♀️", "woman_police_officer_medium-dark_skin_tone": "👮🏾\u200d♀️", "woman_police_officer_medium-light_skin_tone": "👮🏼\u200d♀️", "woman_police_officer_medium_skin_tone": "👮🏽\u200d♀️", "woman_pouting": "🙎\u200d♀️", "woman_pouting_dark_skin_tone": "🙎🏿\u200d♀️", "woman_pouting_light_skin_tone": "🙎🏻\u200d♀️", "woman_pouting_medium-dark_skin_tone": "🙎🏾\u200d♀️", "woman_pouting_medium-light_skin_tone": "🙎🏼\u200d♀️", "woman_pouting_medium_skin_tone": "🙎🏽\u200d♀️", "woman_raising_hand": "🙋\u200d♀️", "woman_raising_hand_dark_skin_tone": "🙋🏿\u200d♀️", "woman_raising_hand_light_skin_tone": "🙋🏻\u200d♀️", "woman_raising_hand_medium-dark_skin_tone": "🙋🏾\u200d♀️", "woman_raising_hand_medium-light_skin_tone": "🙋🏼\u200d♀️", "woman_raising_hand_medium_skin_tone": "🙋🏽\u200d♀️", "woman_rowing_boat": "🚣\u200d♀️", "woman_rowing_boat_dark_skin_tone": "🚣🏿\u200d♀️", "woman_rowing_boat_light_skin_tone": "🚣🏻\u200d♀️", "woman_rowing_boat_medium-dark_skin_tone": "🚣🏾\u200d♀️", "woman_rowing_boat_medium-light_skin_tone": "🚣🏼\u200d♀️", "woman_rowing_boat_medium_skin_tone": "🚣🏽\u200d♀️", "woman_running": "🏃\u200d♀️", "woman_running_dark_skin_tone": "🏃🏿\u200d♀️", "woman_running_light_skin_tone": "🏃🏻\u200d♀️", "woman_running_medium-dark_skin_tone": "🏃🏾\u200d♀️", "woman_running_medium-light_skin_tone": "🏃🏼\u200d♀️", "woman_running_medium_skin_tone": "🏃🏽\u200d♀️", "woman_scientist": "👩\u200d🔬", "woman_scientist_dark_skin_tone": "👩🏿\u200d🔬", "woman_scientist_light_skin_tone": "👩🏻\u200d🔬", "woman_scientist_medium-dark_skin_tone": "👩🏾\u200d🔬", "woman_scientist_medium-light_skin_tone": "👩🏼\u200d🔬", "woman_scientist_medium_skin_tone": "👩🏽\u200d🔬", "woman_shrugging": "🤷\u200d♀️", "woman_shrugging_dark_skin_tone": "🤷🏿\u200d♀️", "woman_shrugging_light_skin_tone": "🤷🏻\u200d♀️", "woman_shrugging_medium-dark_skin_tone": "🤷🏾\u200d♀️", "woman_shrugging_medium-light_skin_tone": "🤷🏼\u200d♀️", "woman_shrugging_medium_skin_tone": "🤷🏽\u200d♀️", "woman_singer": "👩\u200d🎤", "woman_singer_dark_skin_tone": "👩🏿\u200d🎤", "woman_singer_light_skin_tone": "👩🏻\u200d🎤", "woman_singer_medium-dark_skin_tone": "👩🏾\u200d🎤", "woman_singer_medium-light_skin_tone": "👩🏼\u200d🎤", "woman_singer_medium_skin_tone": "👩🏽\u200d🎤", "woman_student": "👩\u200d🎓", "woman_student_dark_skin_tone": "👩🏿\u200d🎓", "woman_student_light_skin_tone": "👩🏻\u200d🎓", "woman_student_medium-dark_skin_tone": "👩🏾\u200d🎓", "woman_student_medium-light_skin_tone": "👩🏼\u200d🎓", "woman_student_medium_skin_tone": "👩🏽\u200d🎓", "woman_surfing": "🏄\u200d♀️", "woman_surfing_dark_skin_tone": "🏄🏿\u200d♀️", "woman_surfing_light_skin_tone": "🏄🏻\u200d♀️", "woman_surfing_medium-dark_skin_tone": "🏄🏾\u200d♀️", "woman_surfing_medium-light_skin_tone": "🏄🏼\u200d♀️", "woman_surfing_medium_skin_tone": "🏄🏽\u200d♀️", "woman_swimming": "🏊\u200d♀️", "woman_swimming_dark_skin_tone": "🏊🏿\u200d♀️", "woman_swimming_light_skin_tone": "🏊🏻\u200d♀️", "woman_swimming_medium-dark_skin_tone": "🏊🏾\u200d♀️", "woman_swimming_medium-light_skin_tone": "🏊🏼\u200d♀️", "woman_swimming_medium_skin_tone": "🏊🏽\u200d♀️", "woman_teacher": "👩\u200d🏫", "woman_teacher_dark_skin_tone": "👩🏿\u200d🏫", "woman_teacher_light_skin_tone": "👩🏻\u200d🏫", "woman_teacher_medium-dark_skin_tone": "👩🏾\u200d🏫", "woman_teacher_medium-light_skin_tone": "👩🏼\u200d🏫", "woman_teacher_medium_skin_tone": "👩🏽\u200d🏫", "woman_technologist": "👩\u200d💻", "woman_technologist_dark_skin_tone": "👩🏿\u200d💻", "woman_technologist_light_skin_tone": "👩🏻\u200d💻", "woman_technologist_medium-dark_skin_tone": "👩🏾\u200d💻", "woman_technologist_medium-light_skin_tone": "👩🏼\u200d💻", "woman_technologist_medium_skin_tone": "👩🏽\u200d💻", "woman_tipping_hand": "💁\u200d♀️", "woman_tipping_hand_dark_skin_tone": "💁🏿\u200d♀️", "woman_tipping_hand_light_skin_tone": "💁🏻\u200d♀️", "woman_tipping_hand_medium-dark_skin_tone": "💁🏾\u200d♀️", "woman_tipping_hand_medium-light_skin_tone": "💁🏼\u200d♀️", "woman_tipping_hand_medium_skin_tone": "💁🏽\u200d♀️", "woman_vampire": "🧛\u200d♀️", "woman_vampire_dark_skin_tone": "🧛🏿\u200d♀️", "woman_vampire_light_skin_tone": "🧛🏻\u200d♀️", "woman_vampire_medium-dark_skin_tone": "🧛🏾\u200d♀️", "woman_vampire_medium-light_skin_tone": "🧛🏼\u200d♀️", "woman_vampire_medium_skin_tone": "🧛🏽\u200d♀️", "woman_walking": "🚶\u200d♀️", "woman_walking_dark_skin_tone": "🚶🏿\u200d♀️", "woman_walking_light_skin_tone": "🚶🏻\u200d♀️", "woman_walking_medium-dark_skin_tone": "🚶🏾\u200d♀️", "woman_walking_medium-light_skin_tone": "🚶🏼\u200d♀️", "woman_walking_medium_skin_tone": "🚶🏽\u200d♀️", "woman_wearing_turban": "👳\u200d♀️", "woman_wearing_turban_dark_skin_tone": "👳🏿\u200d♀️", "woman_wearing_turban_light_skin_tone": "👳🏻\u200d♀️", "woman_wearing_turban_medium-dark_skin_tone": "👳🏾\u200d♀️", "woman_wearing_turban_medium-light_skin_tone": "👳🏼\u200d♀️", "woman_wearing_turban_medium_skin_tone": "👳🏽\u200d♀️", "woman_with_headscarf": "🧕", "woman_with_headscarf_dark_skin_tone": "🧕🏿", "woman_with_headscarf_light_skin_tone": "🧕🏻", "woman_with_headscarf_medium-dark_skin_tone": "🧕🏾", "woman_with_headscarf_medium-light_skin_tone": "🧕🏼", "woman_with_headscarf_medium_skin_tone": "🧕🏽", "woman_with_probing_cane": "👩\u200d🦯", "woman_zombie": "🧟\u200d♀️", "woman’s_boot": "👢", "woman’s_clothes": "👚", "woman’s_hat": "👒", "woman’s_sandal": "👡", "women_with_bunny_ears": "👯\u200d♀️", "women_wrestling": "🤼\u200d♀️", "women’s_room": "🚺", "woozy_face": "🥴", "world_map": "🗺", "worried_face": "😟", "wrapped_gift": "🎁", "wrench": "🔧", "writing_hand": "✍", "writing_hand_dark_skin_tone": "✍🏿", "writing_hand_light_skin_tone": "✍🏻", "writing_hand_medium-dark_skin_tone": "✍🏾", "writing_hand_medium-light_skin_tone": "✍🏼", "writing_hand_medium_skin_tone": "✍🏽", "yarn": "🧶", "yawning_face": "🥱", "yellow_circle": "🟡", "yellow_heart": "💛", "yellow_square": "🟨", "yen_banknote": "💴", "yo-yo": "🪀", "yin_yang": "☯", "zany_face": "🤪", "zebra": "🦓", "zipper-mouth_face": "🤐", "zombie": "🧟", "zzz": "💤", "åland_islands": "🇦🇽", "keycap_asterisk": "*⃣", "keycap_digit_eight": "8⃣", "keycap_digit_five": "5⃣", "keycap_digit_four": "4⃣", "keycap_digit_nine": "9⃣", "keycap_digit_one": "1⃣", "keycap_digit_seven": "7⃣", "keycap_digit_six": "6⃣", "keycap_digit_three": "3⃣", "keycap_digit_two": "2⃣", "keycap_digit_zero": "0⃣", "keycap_number_sign": "#⃣", "light_skin_tone": "🏻", "medium_light_skin_tone": "🏼", "medium_skin_tone": "🏽", "medium_dark_skin_tone": "🏾", "dark_skin_tone": "🏿", "regional_indicator_symbol_letter_a": "🇦", "regional_indicator_symbol_letter_b": "🇧", "regional_indicator_symbol_letter_c": "🇨", "regional_indicator_symbol_letter_d": "🇩", "regional_indicator_symbol_letter_e": "🇪", "regional_indicator_symbol_letter_f": "🇫", "regional_indicator_symbol_letter_g": "🇬", "regional_indicator_symbol_letter_h": "🇭", "regional_indicator_symbol_letter_i": "🇮", "regional_indicator_symbol_letter_j": "🇯", "regional_indicator_symbol_letter_k": "🇰", "regional_indicator_symbol_letter_l": "🇱", "regional_indicator_symbol_letter_m": "🇲", "regional_indicator_symbol_letter_n": "🇳", "regional_indicator_symbol_letter_o": "🇴", "regional_indicator_symbol_letter_p": "🇵", "regional_indicator_symbol_letter_q": "🇶", "regional_indicator_symbol_letter_r": "🇷", "regional_indicator_symbol_letter_s": "🇸", "regional_indicator_symbol_letter_t": "🇹", "regional_indicator_symbol_letter_u": "🇺", "regional_indicator_symbol_letter_v": "🇻", "regional_indicator_symbol_letter_w": "🇼", "regional_indicator_symbol_letter_x": "🇽", "regional_indicator_symbol_letter_y": "🇾", "regional_indicator_symbol_letter_z": "🇿", "airplane_arriving": "🛬", "space_invader": "👾", "football": "🏈", "anger": "💢", "angry": "😠", "anguished": "😧", "signal_strength": "📶", "arrows_counterclockwise": "🔄", "arrow_heading_down": "⤵", "arrow_heading_up": "⤴", "art": "🎨", "astonished": "😲", "athletic_shoe": "👟", "atm": "🏧", "car": "🚗", "red_car": "🚗", "angel": "👼", "back": "🔙", "badminton_racquet_and_shuttlecock": "🏸", "dollar": "💵", "euro": "💶", "pound": "💷", "yen": "💴", "barber": "💈", "bath": "🛀", "bear": "🐻", "heartbeat": "💓", "beer": "🍺", "no_bell": "🔕", "bento": "🍱", "bike": "🚲", "bicyclist": "🚴", "8ball": "🎱", "biohazard_sign": "☣", "birthday": "🎂", "black_circle_for_record": "⏺", "clubs": "♣", "diamonds": "♦", "arrow_double_down": "⏬", "hearts": "♥", "rewind": "⏪", "black_left__pointing_double_triangle_with_vertical_bar": "⏮", "arrow_backward": "◀", "black_medium_small_square": "◾", "question": "❓", "fast_forward": "⏩", "black_right__pointing_double_triangle_with_vertical_bar": "⏭", "arrow_forward": "▶", "black_right__pointing_triangle_with_double_vertical_bar": "⏯", "arrow_right": "➡", "spades": "♠", "black_square_for_stop": "⏹", "sunny": "☀", "phone": "☎", "recycle": "♻", "arrow_double_up": "⏫", "busstop": "🚏", "date": "📅", "flags": "🎏", "cat2": "🐈", "joy_cat": "😹", "smirk_cat": "😼", "chart_with_downwards_trend": "📉", "chart_with_upwards_trend": "📈", "chart": "💹", "mega": "📣", "checkered_flag": "🏁", "accept": "🉑", "ideograph_advantage": "🉐", "congratulations": "㊗", "secret": "㊙", "m": "Ⓜ", "city_sunset": "🌆", "clapper": "🎬", "clap": "👏", "beers": "🍻", "clock830": "🕣", "clock8": "🕗", "clock1130": "🕦", "clock11": "🕚", "clock530": "🕠", "clock5": "🕔", "clock430": "🕟", "clock4": "🕓", "clock930": "🕤", "clock9": "🕘", "clock130": "🕜", "clock1": "🕐", "clock730": "🕢", "clock7": "🕖", "clock630": "🕡", "clock6": "🕕", "clock1030": "🕥", "clock10": "🕙", "clock330": "🕞", "clock3": "🕒", "clock1230": "🕧", "clock12": "🕛", "clock230": "🕝", "clock2": "🕑", "arrows_clockwise": "🔃", "repeat": "🔁", "repeat_one": "🔂", "closed_lock_with_key": "🔐", "mailbox_closed": "📪", "mailbox": "📫", "cloud_with_tornado": "🌪", "cocktail": "🍸", "boom": "💥", "compression": "🗜", "confounded": "😖", "confused": "😕", "rice": "🍚", "cow2": "🐄", "cricket_bat_and_ball": "🏏", "x": "❌", "cry": "😢", "curry": "🍛", "dagger_knife": "🗡", "dancer": "💃", "dark_sunglasses": "🕶", "dash": "💨", "truck": "🚚", "derelict_house_building": "🏚", "diamond_shape_with_a_dot_inside": "💠", "dart": "🎯", "disappointed_relieved": "😥", "disappointed": "😞", "do_not_litter": "🚯", "dog2": "🐕", "flipper": "🐬", "loop": "➿", "bangbang": "‼", "double_vertical_bar": "⏸", "dove_of_peace": "🕊", "small_red_triangle_down": "🔻", "arrow_down_small": "🔽", "arrow_down": "⬇", "dromedary_camel": "🐪", "e__mail": "📧", "corn": "🌽", "ear_of_rice": "🌾", "earth_americas": "🌎", "earth_asia": "🌏", "earth_africa": "🌍", "eight_pointed_black_star": "✴", "eight_spoked_asterisk": "✳", "eject_symbol": "⏏", "bulb": "💡", "emoji_modifier_fitzpatrick_type__1__2": "🏻", "emoji_modifier_fitzpatrick_type__3": "🏼", "emoji_modifier_fitzpatrick_type__4": "🏽", "emoji_modifier_fitzpatrick_type__5": "🏾", "emoji_modifier_fitzpatrick_type__6": "🏿", "end": "🔚", "email": "✉", "european_castle": "🏰", "european_post_office": "🏤", "interrobang": "⁉", "expressionless": "😑", "eyeglasses": "👓", "massage": "💆", "yum": "😋", "scream": "😱", "kissing_heart": "😘", "sweat": "😓", "face_with_head__bandage": "🤕", "triumph": "😤", "mask": "😷", "no_good": "🙅", "ok_woman": "🙆", "open_mouth": "😮", "cold_sweat": "😰", "stuck_out_tongue": "😛", "stuck_out_tongue_closed_eyes": "😝", "stuck_out_tongue_winking_eye": "😜", "joy": "😂", "no_mouth": "😶", "santa": "🎅", "fax": "📠", "fearful": "😨", "field_hockey_stick_and_ball": "🏑", "first_quarter_moon_with_face": "🌛", "fish_cake": "🍥", "fishing_pole_and_fish": "🎣", "facepunch": "👊", "punch": "👊", "flag_for_afghanistan": "🇦🇫", "flag_for_albania": "🇦🇱", "flag_for_algeria": "🇩🇿", "flag_for_american_samoa": "🇦🇸", "flag_for_andorra": "🇦🇩", "flag_for_angola": "🇦🇴", "flag_for_anguilla": "🇦🇮", "flag_for_antarctica": "🇦🇶", "flag_for_antigua_&_barbuda": "🇦🇬", "flag_for_argentina": "🇦🇷", "flag_for_armenia": "🇦🇲", "flag_for_aruba": "🇦🇼", "flag_for_ascension_island": "🇦🇨", "flag_for_australia": "🇦🇺", "flag_for_austria": "🇦🇹", "flag_for_azerbaijan": "🇦🇿", "flag_for_bahamas": "🇧🇸", "flag_for_bahrain": "🇧🇭", "flag_for_bangladesh": "🇧🇩", "flag_for_barbados": "🇧🇧", "flag_for_belarus": "🇧🇾", "flag_for_belgium": "🇧🇪", "flag_for_belize": "🇧🇿", "flag_for_benin": "🇧🇯", "flag_for_bermuda": "🇧🇲", "flag_for_bhutan": "🇧🇹", "flag_for_bolivia": "🇧🇴", "flag_for_bosnia_&_herzegovina": "🇧🇦", "flag_for_botswana": "🇧🇼", "flag_for_bouvet_island": "🇧🇻", "flag_for_brazil": "🇧🇷", "flag_for_british_indian_ocean_territory": "🇮🇴", "flag_for_british_virgin_islands": "🇻🇬", "flag_for_brunei": "🇧🇳", "flag_for_bulgaria": "🇧🇬", "flag_for_burkina_faso": "🇧🇫", "flag_for_burundi": "🇧🇮", "flag_for_cambodia": "🇰🇭", "flag_for_cameroon": "🇨🇲", "flag_for_canada": "🇨🇦", "flag_for_canary_islands": "🇮🇨", "flag_for_cape_verde": "🇨🇻", "flag_for_caribbean_netherlands": "🇧🇶", "flag_for_cayman_islands": "🇰🇾", "flag_for_central_african_republic": "🇨🇫", "flag_for_ceuta_&_melilla": "🇪🇦", "flag_for_chad": "🇹🇩", "flag_for_chile": "🇨🇱", "flag_for_china": "🇨🇳", "flag_for_christmas_island": "🇨🇽", "flag_for_clipperton_island": "🇨🇵", "flag_for_cocos__islands": "🇨🇨", "flag_for_colombia": "🇨🇴", "flag_for_comoros": "🇰🇲", "flag_for_congo____brazzaville": "🇨🇬", "flag_for_congo____kinshasa": "🇨🇩", "flag_for_cook_islands": "🇨🇰", "flag_for_costa_rica": "🇨🇷", "flag_for_croatia": "🇭🇷", "flag_for_cuba": "🇨🇺", "flag_for_curaçao": "🇨🇼", "flag_for_cyprus": "🇨🇾", "flag_for_czech_republic": "🇨🇿", "flag_for_côte_d’ivoire": "🇨🇮", "flag_for_denmark": "🇩🇰", "flag_for_diego_garcia": "🇩🇬", "flag_for_djibouti": "🇩🇯", "flag_for_dominica": "🇩🇲", "flag_for_dominican_republic": "🇩🇴", "flag_for_ecuador": "🇪🇨", "flag_for_egypt": "🇪🇬", "flag_for_el_salvador": "🇸🇻", "flag_for_equatorial_guinea": "🇬🇶", "flag_for_eritrea": "🇪🇷", "flag_for_estonia": "🇪🇪", "flag_for_ethiopia": "🇪🇹", "flag_for_european_union": "🇪🇺", "flag_for_falkland_islands": "🇫🇰", "flag_for_faroe_islands": "🇫🇴", "flag_for_fiji": "🇫🇯", "flag_for_finland": "🇫🇮", "flag_for_france": "🇫🇷", "flag_for_french_guiana": "🇬🇫", "flag_for_french_polynesia": "🇵🇫", "flag_for_french_southern_territories": "🇹🇫", "flag_for_gabon": "🇬🇦", "flag_for_gambia": "🇬🇲", "flag_for_georgia": "🇬🇪", "flag_for_germany": "🇩🇪", "flag_for_ghana": "🇬🇭", "flag_for_gibraltar": "🇬🇮", "flag_for_greece": "🇬🇷", "flag_for_greenland": "🇬🇱", "flag_for_grenada": "🇬🇩", "flag_for_guadeloupe": "🇬🇵", "flag_for_guam": "🇬🇺", "flag_for_guatemala": "🇬🇹", "flag_for_guernsey": "🇬🇬", "flag_for_guinea": "🇬🇳", "flag_for_guinea__bissau": "🇬🇼", "flag_for_guyana": "🇬🇾", "flag_for_haiti": "🇭🇹", "flag_for_heard_&_mcdonald_islands": "🇭🇲", "flag_for_honduras": "🇭🇳", "flag_for_hong_kong": "🇭🇰", "flag_for_hungary": "🇭🇺", "flag_for_iceland": "🇮🇸", "flag_for_india": "🇮🇳", "flag_for_indonesia": "🇮🇩", "flag_for_iran": "🇮🇷", "flag_for_iraq": "🇮🇶", "flag_for_ireland": "🇮🇪", "flag_for_isle_of_man": "🇮🇲", "flag_for_israel": "🇮🇱", "flag_for_italy": "🇮🇹", "flag_for_jamaica": "🇯🇲", "flag_for_japan": "🇯🇵", "flag_for_jersey": "🇯🇪", "flag_for_jordan": "🇯🇴", "flag_for_kazakhstan": "🇰🇿", "flag_for_kenya": "🇰🇪", "flag_for_kiribati": "🇰🇮", "flag_for_kosovo": "🇽🇰", "flag_for_kuwait": "🇰🇼", "flag_for_kyrgyzstan": "🇰🇬", "flag_for_laos": "🇱🇦", "flag_for_latvia": "🇱🇻", "flag_for_lebanon": "🇱🇧", "flag_for_lesotho": "🇱🇸", "flag_for_liberia": "🇱🇷", "flag_for_libya": "🇱🇾", "flag_for_liechtenstein": "🇱🇮", "flag_for_lithuania": "🇱🇹", "flag_for_luxembourg": "🇱🇺", "flag_for_macau": "🇲🇴", "flag_for_macedonia": "🇲🇰", "flag_for_madagascar": "🇲🇬", "flag_for_malawi": "🇲🇼", "flag_for_malaysia": "🇲🇾", "flag_for_maldives": "🇲🇻", "flag_for_mali": "🇲🇱", "flag_for_malta": "🇲🇹", "flag_for_marshall_islands": "🇲🇭", "flag_for_martinique": "🇲🇶", "flag_for_mauritania": "🇲🇷", "flag_for_mauritius": "🇲🇺", "flag_for_mayotte": "🇾🇹", "flag_for_mexico": "🇲🇽", "flag_for_micronesia": "🇫🇲", "flag_for_moldova": "🇲🇩", "flag_for_monaco": "🇲🇨", "flag_for_mongolia": "🇲🇳", "flag_for_montenegro": "🇲🇪", "flag_for_montserrat": "🇲🇸", "flag_for_morocco": "🇲🇦", "flag_for_mozambique": "🇲🇿", "flag_for_myanmar": "🇲🇲", "flag_for_namibia": "🇳🇦", "flag_for_nauru": "🇳🇷", "flag_for_nepal": "🇳🇵", "flag_for_netherlands": "🇳🇱", "flag_for_new_caledonia": "🇳🇨", "flag_for_new_zealand": "🇳🇿", "flag_for_nicaragua": "🇳🇮", "flag_for_niger": "🇳🇪", "flag_for_nigeria": "🇳🇬", "flag_for_niue": "🇳🇺", "flag_for_norfolk_island": "🇳🇫", "flag_for_north_korea": "🇰🇵", "flag_for_northern_mariana_islands": "🇲🇵", "flag_for_norway": "🇳🇴", "flag_for_oman": "🇴🇲", "flag_for_pakistan": "🇵🇰", "flag_for_palau": "🇵🇼", "flag_for_palestinian_territories": "🇵🇸", "flag_for_panama": "🇵🇦", "flag_for_papua_new_guinea": "🇵🇬", "flag_for_paraguay": "🇵🇾", "flag_for_peru": "🇵🇪", "flag_for_philippines": "🇵🇭", "flag_for_pitcairn_islands": "🇵🇳", "flag_for_poland": "🇵🇱", "flag_for_portugal": "🇵🇹", "flag_for_puerto_rico": "🇵🇷", "flag_for_qatar": "🇶🇦", "flag_for_romania": "🇷🇴", "flag_for_russia": "🇷🇺", "flag_for_rwanda": "🇷🇼", "flag_for_réunion": "🇷🇪", "flag_for_samoa": "🇼🇸", "flag_for_san_marino": "🇸🇲", "flag_for_saudi_arabia": "🇸🇦", "flag_for_senegal": "🇸🇳", "flag_for_serbia": "🇷🇸", "flag_for_seychelles": "🇸🇨", "flag_for_sierra_leone": "🇸🇱", "flag_for_singapore": "🇸🇬", "flag_for_sint_maarten": "🇸🇽", "flag_for_slovakia": "🇸🇰", "flag_for_slovenia": "🇸🇮", "flag_for_solomon_islands": "🇸🇧", "flag_for_somalia": "🇸🇴", "flag_for_south_africa": "🇿🇦", "flag_for_south_georgia_&_south_sandwich_islands": "🇬🇸", "flag_for_south_korea": "🇰🇷", "flag_for_south_sudan": "🇸🇸", "flag_for_spain": "🇪🇸", "flag_for_sri_lanka": "🇱🇰", "flag_for_st._barthélemy": "🇧🇱", "flag_for_st._helena": "🇸🇭", "flag_for_st._kitts_&_nevis": "🇰🇳", "flag_for_st._lucia": "🇱🇨", "flag_for_st._martin": "🇲🇫", "flag_for_st._pierre_&_miquelon": "🇵🇲", "flag_for_st._vincent_&_grenadines": "🇻🇨", "flag_for_sudan": "🇸🇩", "flag_for_suriname": "🇸🇷", "flag_for_svalbard_&_jan_mayen": "🇸🇯", "flag_for_swaziland": "🇸🇿", "flag_for_sweden": "🇸🇪", "flag_for_switzerland": "🇨🇭", "flag_for_syria": "🇸🇾", "flag_for_são_tomé_&_príncipe": "🇸🇹", "flag_for_taiwan": "🇹🇼", "flag_for_tajikistan": "🇹🇯", "flag_for_tanzania": "🇹🇿", "flag_for_thailand": "🇹🇭", "flag_for_timor__leste": "🇹🇱", "flag_for_togo": "🇹🇬", "flag_for_tokelau": "🇹🇰", "flag_for_tonga": "🇹🇴", "flag_for_trinidad_&_tobago": "🇹🇹", "flag_for_tristan_da_cunha": "🇹🇦", "flag_for_tunisia": "🇹🇳", "flag_for_turkey": "🇹🇷", "flag_for_turkmenistan": "🇹🇲", "flag_for_turks_&_caicos_islands": "🇹🇨", "flag_for_tuvalu": "🇹🇻", "flag_for_u.s._outlying_islands": "🇺🇲", "flag_for_u.s._virgin_islands": "🇻🇮", "flag_for_uganda": "🇺🇬", "flag_for_ukraine": "🇺🇦", "flag_for_united_arab_emirates": "🇦🇪", "flag_for_united_kingdom": "🇬🇧", "flag_for_united_states": "🇺🇸", "flag_for_uruguay": "🇺🇾", "flag_for_uzbekistan": "🇺🇿", "flag_for_vanuatu": "🇻🇺", "flag_for_vatican_city": "🇻🇦", "flag_for_venezuela": "🇻🇪", "flag_for_vietnam": "🇻🇳", "flag_for_wallis_&_futuna": "🇼🇫", "flag_for_western_sahara": "🇪🇭", "flag_for_yemen": "🇾🇪", "flag_for_zambia": "🇿🇲", "flag_for_zimbabwe": "🇿🇼", "flag_for_åland_islands": "🇦🇽", "golf": "⛳", "fleur__de__lis": "⚜", "muscle": "💪", "flushed": "😳", "frame_with_picture": "🖼", "fries": "🍟", "frog": "🐸", "hatched_chick": "🐥", "frowning": "😦", "fuelpump": "⛽", "full_moon_with_face": "🌝", "gem": "💎", "star2": "🌟", "golfer": "🏌", "mortar_board": "🎓", "grimacing": "😬", "smile_cat": "😸", "grinning": "😀", "grin": "😁", "heartpulse": "💗", "guardsman": "💂", "haircut": "💇", "hamster": "🐹", "raising_hand": "🙋", "headphones": "🎧", "hear_no_evil": "🙉", "cupid": "💘", "gift_heart": "💝", "heart": "❤", "exclamation": "❗", "heavy_exclamation_mark": "❗", "heavy_heart_exclamation_mark_ornament": "❣", "o": "⭕", "helm_symbol": "⎈", "helmet_with_white_cross": "⛑", "high_heel": "👠", "bullettrain_side": "🚄", "bullettrain_front": "🚅", "high_brightness": "🔆", "zap": "⚡", "hocho": "🔪", "knife": "🔪", "bee": "🐝", "traffic_light": "🚥", "racehorse": "🐎", "coffee": "☕", "hotsprings": "♨", "hourglass": "⌛", "hourglass_flowing_sand": "⏳", "house_buildings": "🏘", "100": "💯", "hushed": "😯", "ice_hockey_stick_and_puck": "🏒", "imp": "👿", "information_desk_person": "💁", "information_source": "ℹ", "capital_abcd": "🔠", "abc": "🔤", "abcd": "🔡", "1234": "🔢", "symbols": "🔣", "izakaya_lantern": "🏮", "lantern": "🏮", "jack_o_lantern": "🎃", "dolls": "🎎", "japanese_goblin": "👺", "japanese_ogre": "👹", "beginner": "🔰", "zero": "0️⃣", "one": "1️⃣", "ten": "🔟", "two": "2️⃣", "three": "3️⃣", "four": "4️⃣", "five": "5️⃣", "six": "6️⃣", "seven": "7️⃣", "eight": "8️⃣", "nine": "9️⃣", "couplekiss": "💏", "kissing_cat": "😽", "kissing": "😗", "kissing_closed_eyes": "😚", "kissing_smiling_eyes": "😙", "beetle": "🐞", "large_blue_circle": "🔵", "last_quarter_moon_with_face": "🌜", "leaves": "🍃", "mag": "🔍", "left_right_arrow": "↔", "leftwards_arrow_with_hook": "↩", "arrow_left": "⬅", "lock": "🔒", "lock_with_ink_pen": "🔏", "sob": "😭", "low_brightness": "🔅", "lower_left_ballpoint_pen": "🖊", "lower_left_crayon": "🖍", "lower_left_fountain_pen": "🖋", "lower_left_paintbrush": "🖌", "mahjong": "🀄", "couple": "👫", "man_in_business_suit_levitating": "🕴", "man_with_gua_pi_mao": "👲", "man_with_turban": "👳", "mans_shoe": "👞", "shoe": "👞", "menorah_with_nine_branches": "🕎", "mens": "🚹", "minidisc": "💽", "iphone": "📱", "calling": "📲", "money__mouth_face": "🤑", "moneybag": "💰", "rice_scene": "🎑", "mountain_bicyclist": "🚵", "mouse2": "🐁", "lips": "👄", "moyai": "🗿", "notes": "🎶", "nail_care": "💅", "ab": "🆎", "negative_squared_cross_mark": "❎", "a": "🅰", "b": "🅱", "o2": "🅾", "parking": "🅿", "new_moon_with_face": "🌚", "no_entry_sign": "🚫", "underage": "🔞", "non__potable_water": "🚱", "arrow_upper_right": "↗", "arrow_upper_left": "↖", "office": "🏢", "older_man": "👴", "older_woman": "👵", "om_symbol": "🕉", "on": "🔛", "book": "📖", "unlock": "🔓", "mailbox_with_no_mail": "📭", "mailbox_with_mail": "📬", "cd": "💿", "tada": "🎉", "feet": "🐾", "walking": "🚶", "pencil2": "✏", "pensive": "😔", "persevere": "😣", "bow": "🙇", "raised_hands": "🙌", "person_with_ball": "⛹", "person_with_blond_hair": "👱", "pray": "🙏", "person_with_pouting_face": "🙎", "computer": "💻", "pig2": "🐖", "hankey": "💩", "poop": "💩", "shit": "💩", "bamboo": "🎍", "gun": "🔫", "black_joker": "🃏", "rotating_light": "🚨", "cop": "👮", "stew": "🍲", "pouch": "👝", "pouting_cat": "😾", "rage": "😡", "put_litter_in_its_place": "🚮", "rabbit2": "🐇", "racing_motorcycle": "🏍", "radioactive_sign": "☢", "fist": "✊", "hand": "✋", "raised_hand_with_fingers_splayed": "🖐", "raised_hand_with_part_between_middle_and_ring_fingers": "🖖", "blue_car": "🚙", "apple": "🍎", "relieved": "😌", "reversed_hand_with_middle_finger_extended": "🖕", "mag_right": "🔎", "arrow_right_hook": "↪", "sweet_potato": "🍠", "robot": "🤖", "rolled__up_newspaper": "🗞", "rowboat": "🚣", "runner": "🏃", "running": "🏃", "running_shirt_with_sash": "🎽", "boat": "⛵", "scales": "⚖", "school_satchel": "🎒", "scorpius": "♏", "see_no_evil": "🙈", "sheep": "🐑", "stars": "🌠", "cake": "🍰", "six_pointed_star": "🔯", "ski": "🎿", "sleeping_accommodation": "🛌", "sleeping": "😴", "sleepy": "😪", "sleuth_or_spy": "🕵", "heart_eyes_cat": "😻", "smiley_cat": "😺", "innocent": "😇", "heart_eyes": "😍", "smiling_imp": "😈", "smiley": "😃", "sweat_smile": "😅", "smile": "😄", "laughing": "😆", "satisfied": "😆", "blush": "😊", "smirk": "😏", "smoking": "🚬", "snow_capped_mountain": "🏔", "soccer": "⚽", "icecream": "🍦", "soon": "🔜", "arrow_lower_right": "↘", "arrow_lower_left": "↙", "speak_no_evil": "🙊", "speaker": "🔈", "mute": "🔇", "sound": "🔉", "loud_sound": "🔊", "speaking_head_in_silhouette": "🗣", "spiral_calendar_pad": "🗓", "spiral_note_pad": "🗒", "shell": "🐚", "sweat_drops": "💦", "u5272": "🈹", "u5408": "🈴", "u55b6": "🈺", "u6307": "🈯", "u6708": "🈷", "u6709": "🈶", "u6e80": "🈵", "u7121": "🈚", "u7533": "🈸", "u7981": "🈲", "u7a7a": "🈳", "cl": "🆑", "cool": "🆒", "free": "🆓", "id": "🆔", "koko": "🈁", "sa": "🈂", "new": "🆕", "ng": "🆖", "ok": "🆗", "sos": "🆘", "up": "🆙", "vs": "🆚", "steam_locomotive": "🚂", "ramen": "🍜", "partly_sunny": "⛅", "city_sunrise": "🌇", "surfer": "🏄", "swimmer": "🏊", "shirt": "👕", "tshirt": "👕", "table_tennis_paddle_and_ball": "🏓", "tea": "🍵", "tv": "📺", "three_button_mouse": "🖱", "+1": "👍", "thumbsup": "👍", "__1": "👎", "-1": "👎", "thumbsdown": "👎", "thunder_cloud_and_rain": "⛈", "tiger2": "🐅", "tophat": "🎩", "top": "🔝", "tm": "™", "train2": "🚆", "triangular_flag_on_post": "🚩", "trident": "🔱", "twisted_rightwards_arrows": "🔀", "unamused": "😒", "small_red_triangle": "🔺", "arrow_up_small": "🔼", "arrow_up_down": "↕", "upside__down_face": "🙃", "arrow_up": "⬆", "v": "✌", "vhs": "📼", "wc": "🚾", "ocean": "🌊", "waving_black_flag": "🏴", "wave": "👋", "waving_white_flag": "🏳", "moon": "🌔", "scream_cat": "🙀", "weary": "😩", "weight_lifter": "🏋", "whale2": "🐋", "wheelchair": "♿", "point_down": "👇", "grey_exclamation": "❕", "white_frowning_face": "☹", "white_check_mark": "✅", "point_left": "👈", "white_medium_small_square": "◽", "star": "⭐", "grey_question": "❔", "point_right": "👉", "relaxed": "☺", "white_sun_behind_cloud": "🌥", "white_sun_behind_cloud_with_rain": "🌦", "white_sun_with_small_cloud": "🌤", "point_up_2": "👆", "point_up": "☝", "wind_blowing_face": "🌬", "wink": "😉", "wolf": "🐺", "dancers": "👯", "boot": "👢", "womans_clothes": "👚", "womans_hat": "👒", "sandal": "👡", "womens": "🚺", "worried": "😟", "gift": "🎁", "zipper__mouth_face": "🤐", "regional_indicator_a": "🇦", "regional_indicator_b": "🇧", "regional_indicator_c": "🇨", "regional_indicator_d": "🇩", "regional_indicator_e": "🇪", "regional_indicator_f": "🇫", "regional_indicator_g": "🇬", "regional_indicator_h": "🇭", "regional_indicator_i": "🇮", "regional_indicator_j": "🇯", "regional_indicator_k": "🇰", "regional_indicator_l": "🇱", "regional_indicator_m": "🇲", "regional_indicator_n": "🇳", "regional_indicator_o": "🇴", "regional_indicator_p": "🇵", "regional_indicator_q": "🇶", "regional_indicator_r": "🇷", "regional_indicator_s": "🇸", "regional_indicator_t": "🇹", "regional_indicator_u": "🇺", "regional_indicator_v": "🇻", "regional_indicator_w": "🇼", "regional_indicator_x": "🇽", "regional_indicator_y": "🇾", "regional_indicator_z": "🇿", } ================================================ FILE: src/pip/_vendor/rich/_emoji_replace.py ================================================ from typing import Callable, Match, Optional import re from ._emoji_codes import EMOJI _ReStringMatch = Match[str] # regex match object _ReSubCallable = Callable[[_ReStringMatch], str] # Callable invoked by re.sub _EmojiSubMethod = Callable[[_ReSubCallable, str], str] # Sub method of a compiled re def _emoji_replace( text: str, default_variant: Optional[str] = None, _emoji_sub: _EmojiSubMethod = re.compile(r"(:(\S*?)(?:(?:\-)(emoji|text))?:)").sub, ) -> str: """Replace emoji code in text.""" get_emoji = EMOJI.__getitem__ variants = {"text": "\uFE0E", "emoji": "\uFE0F"} get_variant = variants.get default_variant_code = variants.get(default_variant, "") if default_variant else "" def do_replace(match: Match[str]) -> str: emoji_code, emoji_name, variant = match.groups() try: return get_emoji(emoji_name.lower()) + get_variant( variant, default_variant_code ) except KeyError: return emoji_code return _emoji_sub(do_replace, text) ================================================ FILE: src/pip/_vendor/rich/_export_format.py ================================================ CONSOLE_HTML_FORMAT = """\
{code}
""" CONSOLE_SVG_FORMAT = """\ {lines} {chrome} {backgrounds} {matrix} """ _SVG_FONT_FAMILY = "Rich Fira Code" _SVG_CLASSES_PREFIX = "rich-svg" ================================================ FILE: src/pip/_vendor/rich/_extension.py ================================================ from typing import Any def load_ipython_extension(ip: Any) -> None: # pragma: no cover # prevent circular import from pip._vendor.rich.pretty import install from pip._vendor.rich.traceback import install as tr_install install() tr_install() ================================================ FILE: src/pip/_vendor/rich/_fileno.py ================================================ from __future__ import annotations from typing import IO, Callable def get_fileno(file_like: IO[str]) -> int | None: """Get fileno() from a file, accounting for poorly implemented file-like objects. Args: file_like (IO): A file-like object. Returns: int | None: The result of fileno if available, or None if operation failed. """ fileno: Callable[[], int] | None = getattr(file_like, "fileno", None) if fileno is not None: try: return fileno() except Exception: # `fileno` is documented as potentially raising a OSError # Alas, from the issues, there are so many poorly implemented file-like objects, # that `fileno()` can raise just about anything. return None return None ================================================ FILE: src/pip/_vendor/rich/_inspect.py ================================================ import inspect from inspect import cleandoc, getdoc, getfile, isclass, ismodule, signature from typing import Any, Collection, Iterable, Optional, Tuple, Type, Union from .console import Group, RenderableType from .control import escape_control_codes from .highlighter import ReprHighlighter from .jupyter import JupyterMixin from .panel import Panel from .pretty import Pretty from .table import Table from .text import Text, TextType def _first_paragraph(doc: str) -> str: """Get the first paragraph from a docstring.""" paragraph, _, _ = doc.partition("\n\n") return paragraph class Inspect(JupyterMixin): """A renderable to inspect any Python Object. Args: obj (Any): An object to inspect. title (str, optional): Title to display over inspect result, or None use type. Defaults to None. help (bool, optional): Show full help text rather than just first paragraph. Defaults to False. methods (bool, optional): Enable inspection of callables. Defaults to False. docs (bool, optional): Also render doc strings. Defaults to True. private (bool, optional): Show private attributes (beginning with underscore). Defaults to False. dunder (bool, optional): Show attributes starting with double underscore. Defaults to False. sort (bool, optional): Sort attributes alphabetically. Defaults to True. all (bool, optional): Show all attributes. Defaults to False. value (bool, optional): Pretty print value of object. Defaults to True. """ def __init__( self, obj: Any, *, title: Optional[TextType] = None, help: bool = False, methods: bool = False, docs: bool = True, private: bool = False, dunder: bool = False, sort: bool = True, all: bool = True, value: bool = True, ) -> None: self.highlighter = ReprHighlighter() self.obj = obj self.title = title or self._make_title(obj) if all: methods = private = dunder = True self.help = help self.methods = methods self.docs = docs or help self.private = private or dunder self.dunder = dunder self.sort = sort self.value = value def _make_title(self, obj: Any) -> Text: """Make a default title.""" title_str = ( str(obj) if (isclass(obj) or callable(obj) or ismodule(obj)) else str(type(obj)) ) title_text = self.highlighter(title_str) return title_text def __rich__(self) -> Panel: return Panel.fit( Group(*self._render()), title=self.title, border_style="scope.border", padding=(0, 1), ) def _get_signature(self, name: str, obj: Any) -> Optional[Text]: """Get a signature for a callable.""" try: _signature = str(signature(obj)) + ":" except ValueError: _signature = "(...)" except TypeError: return None source_filename: Optional[str] = None try: source_filename = getfile(obj) except (OSError, TypeError): # OSError is raised if obj has no source file, e.g. when defined in REPL. pass callable_name = Text(name, style="inspect.callable") if source_filename: callable_name.stylize(f"link file://{source_filename}") signature_text = self.highlighter(_signature) qualname = name or getattr(obj, "__qualname__", name) # If obj is a module, there may be classes (which are callable) to display if inspect.isclass(obj): prefix = "class" elif inspect.iscoroutinefunction(obj): prefix = "async def" else: prefix = "def" qual_signature = Text.assemble( (f"{prefix} ", f"inspect.{prefix.replace(' ', '_')}"), (qualname, "inspect.callable"), signature_text, ) return qual_signature def _render(self) -> Iterable[RenderableType]: """Render object.""" def sort_items(item: Tuple[str, Any]) -> Tuple[bool, str]: key, (_error, value) = item return (callable(value), key.strip("_").lower()) def safe_getattr(attr_name: str) -> Tuple[Any, Any]: """Get attribute or any exception.""" try: return (None, getattr(obj, attr_name)) except Exception as error: return (error, None) obj = self.obj keys = dir(obj) total_items = len(keys) if not self.dunder: keys = [key for key in keys if not key.startswith("__")] if not self.private: keys = [key for key in keys if not key.startswith("_")] not_shown_count = total_items - len(keys) items = [(key, safe_getattr(key)) for key in keys] if self.sort: items.sort(key=sort_items) items_table = Table.grid(padding=(0, 1), expand=False) items_table.add_column(justify="right") add_row = items_table.add_row highlighter = self.highlighter if callable(obj): signature = self._get_signature("", obj) if signature is not None: yield signature yield "" if self.docs: _doc = self._get_formatted_doc(obj) if _doc is not None: doc_text = Text(_doc, style="inspect.help") doc_text = highlighter(doc_text) yield doc_text yield "" if self.value and not (isclass(obj) or callable(obj) or ismodule(obj)): yield Panel( Pretty(obj, indent_guides=True, max_length=10, max_string=60), border_style="inspect.value.border", ) yield "" for key, (error, value) in items: key_text = Text.assemble( ( key, "inspect.attr.dunder" if key.startswith("__") else "inspect.attr", ), (" =", "inspect.equals"), ) if error is not None: warning = key_text.copy() warning.stylize("inspect.error") add_row(warning, highlighter(repr(error))) continue if callable(value): if not self.methods: continue _signature_text = self._get_signature(key, value) if _signature_text is None: add_row(key_text, Pretty(value, highlighter=highlighter)) else: if self.docs: docs = self._get_formatted_doc(value) if docs is not None: _signature_text.append("\n" if "\n" in docs else " ") doc = highlighter(docs) doc.stylize("inspect.doc") _signature_text.append(doc) add_row(key_text, _signature_text) else: add_row(key_text, Pretty(value, highlighter=highlighter)) if items_table.row_count: yield items_table elif not_shown_count: yield Text.from_markup( f"[b cyan]{not_shown_count}[/][i] attribute(s) not shown.[/i] " f"Run [b][magenta]inspect[/]([not b]inspect[/])[/b] for options." ) def _get_formatted_doc(self, object_: Any) -> Optional[str]: """ Extract the docstring of an object, process it and returns it. The processing consists in cleaning up the docstring's indentation, taking only its 1st paragraph if `self.help` is not True, and escape its control codes. Args: object_ (Any): the object to get the docstring from. Returns: Optional[str]: the processed docstring, or None if no docstring was found. """ docs = getdoc(object_) if docs is None: return None docs = cleandoc(docs).strip() if not self.help: docs = _first_paragraph(docs) return escape_control_codes(docs) def get_object_types_mro(obj: Union[object, Type[Any]]) -> Tuple[type, ...]: """Returns the MRO of an object's class, or of the object itself if it's a class.""" if not hasattr(obj, "__mro__"): # N.B. we cannot use `if type(obj) is type` here because it doesn't work with # some types of classes, such as the ones that use abc.ABCMeta. obj = type(obj) return getattr(obj, "__mro__", ()) def get_object_types_mro_as_strings(obj: object) -> Collection[str]: """ Returns the MRO of an object's class as full qualified names, or of the object itself if it's a class. Examples: `object_types_mro_as_strings(JSONDecoder)` will return `['json.decoder.JSONDecoder', 'builtins.object']` """ return [ f'{getattr(type_, "__module__", "")}.{getattr(type_, "__qualname__", "")}' for type_ in get_object_types_mro(obj) ] def is_object_one_of_types( obj: object, fully_qualified_types_names: Collection[str] ) -> bool: """ Returns `True` if the given object's class (or the object itself, if it's a class) has one of the fully qualified names in its MRO. """ for type_name in get_object_types_mro_as_strings(obj): if type_name in fully_qualified_types_names: return True return False ================================================ FILE: src/pip/_vendor/rich/_log_render.py ================================================ from datetime import datetime from typing import Iterable, List, Optional, TYPE_CHECKING, Union, Callable from .text import Text, TextType if TYPE_CHECKING: from .console import Console, ConsoleRenderable, RenderableType from .table import Table FormatTimeCallable = Callable[[datetime], Text] class LogRender: def __init__( self, show_time: bool = True, show_level: bool = False, show_path: bool = True, time_format: Union[str, FormatTimeCallable] = "[%x %X]", omit_repeated_times: bool = True, level_width: Optional[int] = 8, ) -> None: self.show_time = show_time self.show_level = show_level self.show_path = show_path self.time_format = time_format self.omit_repeated_times = omit_repeated_times self.level_width = level_width self._last_time: Optional[Text] = None def __call__( self, console: "Console", renderables: Iterable["ConsoleRenderable"], log_time: Optional[datetime] = None, time_format: Optional[Union[str, FormatTimeCallable]] = None, level: TextType = "", path: Optional[str] = None, line_no: Optional[int] = None, link_path: Optional[str] = None, ) -> "Table": from .containers import Renderables from .table import Table output = Table.grid(padding=(0, 1)) output.expand = True if self.show_time: output.add_column(style="log.time") if self.show_level: output.add_column(style="log.level", width=self.level_width) output.add_column(ratio=1, style="log.message", overflow="fold") if self.show_path and path: output.add_column(style="log.path") row: List["RenderableType"] = [] if self.show_time: log_time = log_time or console.get_datetime() time_format = time_format or self.time_format if callable(time_format): log_time_display = time_format(log_time) else: log_time_display = Text(log_time.strftime(time_format)) if log_time_display == self._last_time and self.omit_repeated_times: row.append(Text(" " * len(log_time_display))) else: row.append(log_time_display) self._last_time = log_time_display if self.show_level: row.append(level) row.append(Renderables(renderables)) if self.show_path and path: path_text = Text() path_text.append( path, style=f"link file://{link_path}" if link_path else "" ) if line_no: path_text.append(":") path_text.append( f"{line_no}", style=f"link file://{link_path}#{line_no}" if link_path else "", ) row.append(path_text) output.add_row(*row) return output if __name__ == "__main__": # pragma: no cover from pip._vendor.rich.console import Console c = Console() c.print("[on blue]Hello", justify="right") c.log("[on blue]hello", justify="right") ================================================ FILE: src/pip/_vendor/rich/_loop.py ================================================ from typing import Iterable, Tuple, TypeVar T = TypeVar("T") def loop_first(values: Iterable[T]) -> Iterable[Tuple[bool, T]]: """Iterate and generate a tuple with a flag for first value.""" iter_values = iter(values) try: value = next(iter_values) except StopIteration: return yield True, value for value in iter_values: yield False, value def loop_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]: """Iterate and generate a tuple with a flag for last value.""" iter_values = iter(values) try: previous_value = next(iter_values) except StopIteration: return for value in iter_values: yield False, previous_value previous_value = value yield True, previous_value def loop_first_last(values: Iterable[T]) -> Iterable[Tuple[bool, bool, T]]: """Iterate and generate a tuple with a flag for first and last value.""" iter_values = iter(values) try: previous_value = next(iter_values) except StopIteration: return first = True for value in iter_values: yield first, False, previous_value first = False previous_value = value yield first, True, previous_value ================================================ FILE: src/pip/_vendor/rich/_null_file.py ================================================ from types import TracebackType from typing import IO, Iterable, Iterator, List, Optional, Type class NullFile(IO[str]): def close(self) -> None: pass def isatty(self) -> bool: return False def read(self, __n: int = 1) -> str: return "" def readable(self) -> bool: return False def readline(self, __limit: int = 1) -> str: return "" def readlines(self, __hint: int = 1) -> List[str]: return [] def seek(self, __offset: int, __whence: int = 1) -> int: return 0 def seekable(self) -> bool: return False def tell(self) -> int: return 0 def truncate(self, __size: Optional[int] = 1) -> int: return 0 def writable(self) -> bool: return False def writelines(self, __lines: Iterable[str]) -> None: pass def __next__(self) -> str: return "" def __iter__(self) -> Iterator[str]: return iter([""]) def __enter__(self) -> IO[str]: return self def __exit__( self, __t: Optional[Type[BaseException]], __value: Optional[BaseException], __traceback: Optional[TracebackType], ) -> None: pass def write(self, text: str) -> int: return 0 def flush(self) -> None: pass def fileno(self) -> int: return -1 NULL_FILE = NullFile() ================================================ FILE: src/pip/_vendor/rich/_palettes.py ================================================ from .palette import Palette # Taken from https://en.wikipedia.org/wiki/ANSI_escape_code (Windows 10 column) WINDOWS_PALETTE = Palette( [ (12, 12, 12), (197, 15, 31), (19, 161, 14), (193, 156, 0), (0, 55, 218), (136, 23, 152), (58, 150, 221), (204, 204, 204), (118, 118, 118), (231, 72, 86), (22, 198, 12), (249, 241, 165), (59, 120, 255), (180, 0, 158), (97, 214, 214), (242, 242, 242), ] ) # # The standard ansi colors (including bright variants) STANDARD_PALETTE = Palette( [ (0, 0, 0), (170, 0, 0), (0, 170, 0), (170, 85, 0), (0, 0, 170), (170, 0, 170), (0, 170, 170), (170, 170, 170), (85, 85, 85), (255, 85, 85), (85, 255, 85), (255, 255, 85), (85, 85, 255), (255, 85, 255), (85, 255, 255), (255, 255, 255), ] ) # The 256 color palette EIGHT_BIT_PALETTE = Palette( [ (0, 0, 0), (128, 0, 0), (0, 128, 0), (128, 128, 0), (0, 0, 128), (128, 0, 128), (0, 128, 128), (192, 192, 192), (128, 128, 128), (255, 0, 0), (0, 255, 0), (255, 255, 0), (0, 0, 255), (255, 0, 255), (0, 255, 255), (255, 255, 255), (0, 0, 0), (0, 0, 95), (0, 0, 135), (0, 0, 175), (0, 0, 215), (0, 0, 255), (0, 95, 0), (0, 95, 95), (0, 95, 135), (0, 95, 175), (0, 95, 215), (0, 95, 255), (0, 135, 0), (0, 135, 95), (0, 135, 135), (0, 135, 175), (0, 135, 215), (0, 135, 255), (0, 175, 0), (0, 175, 95), (0, 175, 135), (0, 175, 175), (0, 175, 215), (0, 175, 255), (0, 215, 0), (0, 215, 95), (0, 215, 135), (0, 215, 175), (0, 215, 215), (0, 215, 255), (0, 255, 0), (0, 255, 95), (0, 255, 135), (0, 255, 175), (0, 255, 215), (0, 255, 255), (95, 0, 0), (95, 0, 95), (95, 0, 135), (95, 0, 175), (95, 0, 215), (95, 0, 255), (95, 95, 0), (95, 95, 95), (95, 95, 135), (95, 95, 175), (95, 95, 215), (95, 95, 255), (95, 135, 0), (95, 135, 95), (95, 135, 135), (95, 135, 175), (95, 135, 215), (95, 135, 255), (95, 175, 0), (95, 175, 95), (95, 175, 135), (95, 175, 175), (95, 175, 215), (95, 175, 255), (95, 215, 0), (95, 215, 95), (95, 215, 135), (95, 215, 175), (95, 215, 215), (95, 215, 255), (95, 255, 0), (95, 255, 95), (95, 255, 135), (95, 255, 175), (95, 255, 215), (95, 255, 255), (135, 0, 0), (135, 0, 95), (135, 0, 135), (135, 0, 175), (135, 0, 215), (135, 0, 255), (135, 95, 0), (135, 95, 95), (135, 95, 135), (135, 95, 175), (135, 95, 215), (135, 95, 255), (135, 135, 0), (135, 135, 95), (135, 135, 135), (135, 135, 175), (135, 135, 215), (135, 135, 255), (135, 175, 0), (135, 175, 95), (135, 175, 135), (135, 175, 175), (135, 175, 215), (135, 175, 255), (135, 215, 0), (135, 215, 95), (135, 215, 135), (135, 215, 175), (135, 215, 215), (135, 215, 255), (135, 255, 0), (135, 255, 95), (135, 255, 135), (135, 255, 175), (135, 255, 215), (135, 255, 255), (175, 0, 0), (175, 0, 95), (175, 0, 135), (175, 0, 175), (175, 0, 215), (175, 0, 255), (175, 95, 0), (175, 95, 95), (175, 95, 135), (175, 95, 175), (175, 95, 215), (175, 95, 255), (175, 135, 0), (175, 135, 95), (175, 135, 135), (175, 135, 175), (175, 135, 215), (175, 135, 255), (175, 175, 0), (175, 175, 95), (175, 175, 135), (175, 175, 175), (175, 175, 215), (175, 175, 255), (175, 215, 0), (175, 215, 95), (175, 215, 135), (175, 215, 175), (175, 215, 215), (175, 215, 255), (175, 255, 0), (175, 255, 95), (175, 255, 135), (175, 255, 175), (175, 255, 215), (175, 255, 255), (215, 0, 0), (215, 0, 95), (215, 0, 135), (215, 0, 175), (215, 0, 215), (215, 0, 255), (215, 95, 0), (215, 95, 95), (215, 95, 135), (215, 95, 175), (215, 95, 215), (215, 95, 255), (215, 135, 0), (215, 135, 95), (215, 135, 135), (215, 135, 175), (215, 135, 215), (215, 135, 255), (215, 175, 0), (215, 175, 95), (215, 175, 135), (215, 175, 175), (215, 175, 215), (215, 175, 255), (215, 215, 0), (215, 215, 95), (215, 215, 135), (215, 215, 175), (215, 215, 215), (215, 215, 255), (215, 255, 0), (215, 255, 95), (215, 255, 135), (215, 255, 175), (215, 255, 215), (215, 255, 255), (255, 0, 0), (255, 0, 95), (255, 0, 135), (255, 0, 175), (255, 0, 215), (255, 0, 255), (255, 95, 0), (255, 95, 95), (255, 95, 135), (255, 95, 175), (255, 95, 215), (255, 95, 255), (255, 135, 0), (255, 135, 95), (255, 135, 135), (255, 135, 175), (255, 135, 215), (255, 135, 255), (255, 175, 0), (255, 175, 95), (255, 175, 135), (255, 175, 175), (255, 175, 215), (255, 175, 255), (255, 215, 0), (255, 215, 95), (255, 215, 135), (255, 215, 175), (255, 215, 215), (255, 215, 255), (255, 255, 0), (255, 255, 95), (255, 255, 135), (255, 255, 175), (255, 255, 215), (255, 255, 255), (8, 8, 8), (18, 18, 18), (28, 28, 28), (38, 38, 38), (48, 48, 48), (58, 58, 58), (68, 68, 68), (78, 78, 78), (88, 88, 88), (98, 98, 98), (108, 108, 108), (118, 118, 118), (128, 128, 128), (138, 138, 138), (148, 148, 148), (158, 158, 158), (168, 168, 168), (178, 178, 178), (188, 188, 188), (198, 198, 198), (208, 208, 208), (218, 218, 218), (228, 228, 228), (238, 238, 238), ] ) ================================================ FILE: src/pip/_vendor/rich/_pick.py ================================================ from typing import Optional def pick_bool(*values: Optional[bool]) -> bool: """Pick the first non-none bool or return the last value. Args: *values (bool): Any number of boolean or None values. Returns: bool: First non-none boolean. """ assert values, "1 or more values required" for value in values: if value is not None: return value return bool(value) ================================================ FILE: src/pip/_vendor/rich/_ratio.py ================================================ from fractions import Fraction from math import ceil from typing import cast, List, Optional, Sequence, Protocol class Edge(Protocol): """Any object that defines an edge (such as Layout).""" size: Optional[int] = None ratio: int = 1 minimum_size: int = 1 def ratio_resolve(total: int, edges: Sequence[Edge]) -> List[int]: """Divide total space to satisfy size, ratio, and minimum_size, constraints. The returned list of integers should add up to total in most cases, unless it is impossible to satisfy all the constraints. For instance, if there are two edges with a minimum size of 20 each and `total` is 30 then the returned list will be greater than total. In practice, this would mean that a Layout object would clip the rows that would overflow the screen height. Args: total (int): Total number of characters. edges (List[Edge]): Edges within total space. Returns: List[int]: Number of characters for each edge. """ # Size of edge or None for yet to be determined sizes = [(edge.size or None) for edge in edges] _Fraction = Fraction # While any edges haven't been calculated while None in sizes: # Get flexible edges and index to map these back on to sizes list flexible_edges = [ (index, edge) for index, (size, edge) in enumerate(zip(sizes, edges)) if size is None ] # Remaining space in total remaining = total - sum(size or 0 for size in sizes) if remaining <= 0: # No room for flexible edges return [ ((edge.minimum_size or 1) if size is None else size) for size, edge in zip(sizes, edges) ] # Calculate number of characters in a ratio portion portion = _Fraction( remaining, sum((edge.ratio or 1) for _, edge in flexible_edges) ) # If any edges will be less than their minimum, replace size with the minimum for index, edge in flexible_edges: if portion * edge.ratio <= edge.minimum_size: sizes[index] = edge.minimum_size # New fixed size will invalidate calculations, so we need to repeat the process break else: # Distribute flexible space and compensate for rounding error # Since edge sizes can only be integers we need to add the remainder # to the following line remainder = _Fraction(0) for index, edge in flexible_edges: size, remainder = divmod(portion * edge.ratio + remainder, 1) sizes[index] = size break # Sizes now contains integers only return cast(List[int], sizes) def ratio_reduce( total: int, ratios: List[int], maximums: List[int], values: List[int] ) -> List[int]: """Divide an integer total in to parts based on ratios. Args: total (int): The total to divide. ratios (List[int]): A list of integer ratios. maximums (List[int]): List of maximums values for each slot. values (List[int]): List of values Returns: List[int]: A list of integers guaranteed to sum to total. """ ratios = [ratio if _max else 0 for ratio, _max in zip(ratios, maximums)] total_ratio = sum(ratios) if not total_ratio: return values[:] total_remaining = total result: List[int] = [] append = result.append for ratio, maximum, value in zip(ratios, maximums, values): if ratio and total_ratio > 0: distributed = min(maximum, round(ratio * total_remaining / total_ratio)) append(value - distributed) total_remaining -= distributed total_ratio -= ratio else: append(value) return result def ratio_distribute( total: int, ratios: List[int], minimums: Optional[List[int]] = None ) -> List[int]: """Distribute an integer total in to parts based on ratios. Args: total (int): The total to divide. ratios (List[int]): A list of integer ratios. minimums (List[int]): List of minimum values for each slot. Returns: List[int]: A list of integers guaranteed to sum to total. """ if minimums: ratios = [ratio if _min else 0 for ratio, _min in zip(ratios, minimums)] total_ratio = sum(ratios) assert total_ratio > 0, "Sum of ratios must be > 0" total_remaining = total distributed_total: List[int] = [] append = distributed_total.append if minimums is None: _minimums = [0] * len(ratios) else: _minimums = minimums for ratio, minimum in zip(ratios, _minimums): if total_ratio > 0: distributed = max(minimum, ceil(ratio * total_remaining / total_ratio)) else: distributed = total_remaining append(distributed) total_ratio -= ratio total_remaining -= distributed return distributed_total if __name__ == "__main__": from dataclasses import dataclass @dataclass class E: size: Optional[int] = None ratio: int = 1 minimum_size: int = 1 resolved = ratio_resolve(110, [E(None, 1, 1), E(None, 1, 1), E(None, 1, 1)]) print(sum(resolved)) ================================================ FILE: src/pip/_vendor/rich/_spinners.py ================================================ """ Spinners are from: * cli-spinners: MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ SPINNERS = { "dots": { "interval": 80, "frames": "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏", }, "dots2": {"interval": 80, "frames": "⣾⣽⣻⢿⡿⣟⣯⣷"}, "dots3": { "interval": 80, "frames": "⠋⠙⠚⠞⠖⠦⠴⠲⠳⠓", }, "dots4": { "interval": 80, "frames": "⠄⠆⠇⠋⠙⠸⠰⠠⠰⠸⠙⠋⠇⠆", }, "dots5": { "interval": 80, "frames": "⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓⠋", }, "dots6": { "interval": 80, "frames": "⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁", }, "dots7": { "interval": 80, "frames": "⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈", }, "dots8": { "interval": 80, "frames": "⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈", }, "dots9": {"interval": 80, "frames": "⢹⢺⢼⣸⣇⡧⡗⡏"}, "dots10": {"interval": 80, "frames": "⢄⢂⢁⡁⡈⡐⡠"}, "dots11": {"interval": 100, "frames": "⠁⠂⠄⡀⢀⠠⠐⠈"}, "dots12": { "interval": 80, "frames": [ "⢀⠀", "⡀⠀", "⠄⠀", "⢂⠀", "⡂⠀", "⠅⠀", "⢃⠀", "⡃⠀", "⠍⠀", "⢋⠀", "⡋⠀", "⠍⠁", "⢋⠁", "⡋⠁", "⠍⠉", "⠋⠉", "⠋⠉", "⠉⠙", "⠉⠙", "⠉⠩", "⠈⢙", "⠈⡙", "⢈⠩", "⡀⢙", "⠄⡙", "⢂⠩", "⡂⢘", "⠅⡘", "⢃⠨", "⡃⢐", "⠍⡐", "⢋⠠", "⡋⢀", "⠍⡁", "⢋⠁", "⡋⠁", "⠍⠉", "⠋⠉", "⠋⠉", "⠉⠙", "⠉⠙", "⠉⠩", "⠈⢙", "⠈⡙", "⠈⠩", "⠀⢙", "⠀⡙", "⠀⠩", "⠀⢘", "⠀⡘", "⠀⠨", "⠀⢐", "⠀⡐", "⠀⠠", "⠀⢀", "⠀⡀", ], }, "dots8Bit": { "interval": 80, "frames": "⠀⠁⠂⠃⠄⠅⠆⠇⡀⡁⡂⡃⡄⡅⡆⡇⠈⠉⠊⠋⠌⠍⠎⠏⡈⡉⡊⡋⡌⡍⡎⡏⠐⠑⠒⠓⠔⠕⠖⠗⡐⡑⡒⡓⡔⡕⡖⡗⠘⠙⠚⠛⠜⠝⠞⠟⡘⡙" "⡚⡛⡜⡝⡞⡟⠠⠡⠢⠣⠤⠥⠦⠧⡠⡡⡢⡣⡤⡥⡦⡧⠨⠩⠪⠫⠬⠭⠮⠯⡨⡩⡪⡫⡬⡭⡮⡯⠰⠱⠲⠳⠴⠵⠶⠷⡰⡱⡲⡳⡴⡵⡶⡷⠸⠹⠺⠻" "⠼⠽⠾⠿⡸⡹⡺⡻⡼⡽⡾⡿⢀⢁⢂⢃⢄⢅⢆⢇⣀⣁⣂⣃⣄⣅⣆⣇⢈⢉⢊⢋⢌⢍⢎⢏⣈⣉⣊⣋⣌⣍⣎⣏⢐⢑⢒⢓⢔⢕⢖⢗⣐⣑⣒⣓⣔⣕" "⣖⣗⢘⢙⢚⢛⢜⢝⢞⢟⣘⣙⣚⣛⣜⣝⣞⣟⢠⢡⢢⢣⢤⢥⢦⢧⣠⣡⣢⣣⣤⣥⣦⣧⢨⢩⢪⢫⢬⢭⢮⢯⣨⣩⣪⣫⣬⣭⣮⣯⢰⢱⢲⢳⢴⢵⢶⢷" "⣰⣱⣲⣳⣴⣵⣶⣷⢸⢹⢺⢻⢼⢽⢾⢿⣸⣹⣺⣻⣼⣽⣾⣿", }, "line": {"interval": 130, "frames": ["-", "\\", "|", "/"]}, "line2": {"interval": 100, "frames": "⠂-–—–-"}, "pipe": {"interval": 100, "frames": "┤┘┴└├┌┬┐"}, "simpleDots": {"interval": 400, "frames": [". ", ".. ", "...", " "]}, "simpleDotsScrolling": { "interval": 200, "frames": [". ", ".. ", "...", " ..", " .", " "], }, "star": {"interval": 70, "frames": "✶✸✹✺✹✷"}, "star2": {"interval": 80, "frames": "+x*"}, "flip": { "interval": 70, "frames": "___-``'´-___", }, "hamburger": {"interval": 100, "frames": "☱☲☴"}, "growVertical": { "interval": 120, "frames": "▁▃▄▅▆▇▆▅▄▃", }, "growHorizontal": { "interval": 120, "frames": "▏▎▍▌▋▊▉▊▋▌▍▎", }, "balloon": {"interval": 140, "frames": " .oO@* "}, "balloon2": {"interval": 120, "frames": ".oO°Oo."}, "noise": {"interval": 100, "frames": "▓▒░"}, "bounce": {"interval": 120, "frames": "⠁⠂⠄⠂"}, "boxBounce": {"interval": 120, "frames": "▖▘▝▗"}, "boxBounce2": {"interval": 100, "frames": "▌▀▐▄"}, "triangle": {"interval": 50, "frames": "◢◣◤◥"}, "arc": {"interval": 100, "frames": "◜◠◝◞◡◟"}, "circle": {"interval": 120, "frames": "◡⊙◠"}, "squareCorners": {"interval": 180, "frames": "◰◳◲◱"}, "circleQuarters": {"interval": 120, "frames": "◴◷◶◵"}, "circleHalves": {"interval": 50, "frames": "◐◓◑◒"}, "squish": {"interval": 100, "frames": "╫╪"}, "toggle": {"interval": 250, "frames": "⊶⊷"}, "toggle2": {"interval": 80, "frames": "▫▪"}, "toggle3": {"interval": 120, "frames": "□■"}, "toggle4": {"interval": 100, "frames": "■□▪▫"}, "toggle5": {"interval": 100, "frames": "▮▯"}, "toggle6": {"interval": 300, "frames": "ဝ၀"}, "toggle7": {"interval": 80, "frames": "⦾⦿"}, "toggle8": {"interval": 100, "frames": "◍◌"}, "toggle9": {"interval": 100, "frames": "◉◎"}, "toggle10": {"interval": 100, "frames": "㊂㊀㊁"}, "toggle11": {"interval": 50, "frames": "⧇⧆"}, "toggle12": {"interval": 120, "frames": "☗☖"}, "toggle13": {"interval": 80, "frames": "=*-"}, "arrow": {"interval": 100, "frames": "←↖↑↗→↘↓↙"}, "arrow2": { "interval": 80, "frames": ["⬆️ ", "↗️ ", "➡️ ", "↘️ ", "⬇️ ", "↙️ ", "⬅️ ", "↖️ "], }, "arrow3": { "interval": 120, "frames": ["▹▹▹▹▹", "▸▹▹▹▹", "▹▸▹▹▹", "▹▹▸▹▹", "▹▹▹▸▹", "▹▹▹▹▸"], }, "bouncingBar": { "interval": 80, "frames": [ "[ ]", "[= ]", "[== ]", "[=== ]", "[ ===]", "[ ==]", "[ =]", "[ ]", "[ =]", "[ ==]", "[ ===]", "[====]", "[=== ]", "[== ]", "[= ]", ], }, "bouncingBall": { "interval": 80, "frames": [ "( ● )", "( ● )", "( ● )", "( ● )", "( ●)", "( ● )", "( ● )", "( ● )", "( ● )", "(● )", ], }, "smiley": {"interval": 200, "frames": ["😄 ", "😝 "]}, "monkey": {"interval": 300, "frames": ["🙈 ", "🙈 ", "🙉 ", "🙊 "]}, "hearts": {"interval": 100, "frames": ["💛 ", "💙 ", "💜 ", "💚 ", "❤️ "]}, "clock": { "interval": 100, "frames": [ "🕛 ", "🕐 ", "🕑 ", "🕒 ", "🕓 ", "🕔 ", "🕕 ", "🕖 ", "🕗 ", "🕘 ", "🕙 ", "🕚 ", ], }, "earth": {"interval": 180, "frames": ["🌍 ", "🌎 ", "🌏 "]}, "material": { "interval": 17, "frames": [ "█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "███████▁▁▁▁▁▁▁▁▁▁▁▁▁", "████████▁▁▁▁▁▁▁▁▁▁▁▁", "█████████▁▁▁▁▁▁▁▁▁▁▁", "█████████▁▁▁▁▁▁▁▁▁▁▁", "██████████▁▁▁▁▁▁▁▁▁▁", "███████████▁▁▁▁▁▁▁▁▁", "█████████████▁▁▁▁▁▁▁", "██████████████▁▁▁▁▁▁", "██████████████▁▁▁▁▁▁", "▁██████████████▁▁▁▁▁", "▁██████████████▁▁▁▁▁", "▁██████████████▁▁▁▁▁", "▁▁██████████████▁▁▁▁", "▁▁▁██████████████▁▁▁", "▁▁▁▁█████████████▁▁▁", "▁▁▁▁██████████████▁▁", "▁▁▁▁██████████████▁▁", "▁▁▁▁▁██████████████▁", "▁▁▁▁▁██████████████▁", "▁▁▁▁▁██████████████▁", "▁▁▁▁▁▁██████████████", "▁▁▁▁▁▁██████████████", "▁▁▁▁▁▁▁█████████████", "▁▁▁▁▁▁▁█████████████", "▁▁▁▁▁▁▁▁████████████", "▁▁▁▁▁▁▁▁████████████", "▁▁▁▁▁▁▁▁▁███████████", "▁▁▁▁▁▁▁▁▁███████████", "▁▁▁▁▁▁▁▁▁▁██████████", "▁▁▁▁▁▁▁▁▁▁██████████", "▁▁▁▁▁▁▁▁▁▁▁▁████████", "▁▁▁▁▁▁▁▁▁▁▁▁▁███████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████", "█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", "███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", "████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", "█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", "█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", "██████▁▁▁▁▁▁▁▁▁▁▁▁▁█", "████████▁▁▁▁▁▁▁▁▁▁▁▁", "█████████▁▁▁▁▁▁▁▁▁▁▁", "█████████▁▁▁▁▁▁▁▁▁▁▁", "█████████▁▁▁▁▁▁▁▁▁▁▁", "█████████▁▁▁▁▁▁▁▁▁▁▁", "███████████▁▁▁▁▁▁▁▁▁", "████████████▁▁▁▁▁▁▁▁", "████████████▁▁▁▁▁▁▁▁", "██████████████▁▁▁▁▁▁", "██████████████▁▁▁▁▁▁", "▁██████████████▁▁▁▁▁", "▁██████████████▁▁▁▁▁", "▁▁▁█████████████▁▁▁▁", "▁▁▁▁▁████████████▁▁▁", "▁▁▁▁▁████████████▁▁▁", "▁▁▁▁▁▁███████████▁▁▁", "▁▁▁▁▁▁▁▁█████████▁▁▁", "▁▁▁▁▁▁▁▁█████████▁▁▁", "▁▁▁▁▁▁▁▁▁█████████▁▁", "▁▁▁▁▁▁▁▁▁█████████▁▁", "▁▁▁▁▁▁▁▁▁▁█████████▁", "▁▁▁▁▁▁▁▁▁▁▁████████▁", "▁▁▁▁▁▁▁▁▁▁▁████████▁", "▁▁▁▁▁▁▁▁▁▁▁▁███████▁", "▁▁▁▁▁▁▁▁▁▁▁▁███████▁", "▁▁▁▁▁▁▁▁▁▁▁▁▁███████", "▁▁▁▁▁▁▁▁▁▁▁▁▁███████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", ], }, "moon": { "interval": 80, "frames": ["🌑 ", "🌒 ", "🌓 ", "🌔 ", "🌕 ", "🌖 ", "🌗 ", "🌘 "], }, "runner": {"interval": 140, "frames": ["🚶 ", "🏃 "]}, "pong": { "interval": 80, "frames": [ "▐⠂ ▌", "▐⠈ ▌", "▐ ⠂ ▌", "▐ ⠠ ▌", "▐ ⡀ ▌", "▐ ⠠ ▌", "▐ ⠂ ▌", "▐ ⠈ ▌", "▐ ⠂ ▌", "▐ ⠠ ▌", "▐ ⡀ ▌", "▐ ⠠ ▌", "▐ ⠂ ▌", "▐ ⠈ ▌", "▐ ⠂▌", "▐ ⠠▌", "▐ ⡀▌", "▐ ⠠ ▌", "▐ ⠂ ▌", "▐ ⠈ ▌", "▐ ⠂ ▌", "▐ ⠠ ▌", "▐ ⡀ ▌", "▐ ⠠ ▌", "▐ ⠂ ▌", "▐ ⠈ ▌", "▐ ⠂ ▌", "▐ ⠠ ▌", "▐ ⡀ ▌", "▐⠠ ▌", ], }, "shark": { "interval": 120, "frames": [ "▐|\\____________▌", "▐_|\\___________▌", "▐__|\\__________▌", "▐___|\\_________▌", "▐____|\\________▌", "▐_____|\\_______▌", "▐______|\\______▌", "▐_______|\\_____▌", "▐________|\\____▌", "▐_________|\\___▌", "▐__________|\\__▌", "▐___________|\\_▌", "▐____________|\\▌", "▐____________/|▌", "▐___________/|_▌", "▐__________/|__▌", "▐_________/|___▌", "▐________/|____▌", "▐_______/|_____▌", "▐______/|______▌", "▐_____/|_______▌", "▐____/|________▌", "▐___/|_________▌", "▐__/|__________▌", "▐_/|___________▌", "▐/|____________▌", ], }, "dqpb": {"interval": 100, "frames": "dqpb"}, "weather": { "interval": 100, "frames": [ "☀️ ", "☀️ ", "☀️ ", "🌤 ", "⛅️ ", "🌥 ", "☁️ ", "🌧 ", "🌨 ", "🌧 ", "🌨 ", "🌧 ", "🌨 ", "⛈ ", "🌨 ", "🌧 ", "🌨 ", "☁️ ", "🌥 ", "⛅️ ", "🌤 ", "☀️ ", "☀️ ", ], }, "christmas": {"interval": 400, "frames": "🌲🎄"}, "grenade": { "interval": 80, "frames": [ "، ", "′ ", " ´ ", " ‾ ", " ⸌", " ⸊", " |", " ⁎", " ⁕", " ෴ ", " ⁓", " ", " ", " ", ], }, "point": {"interval": 125, "frames": ["∙∙∙", "●∙∙", "∙●∙", "∙∙●", "∙∙∙"]}, "layer": {"interval": 150, "frames": "-=≡"}, "betaWave": { "interval": 80, "frames": [ "ρββββββ", "βρβββββ", "ββρββββ", "βββρβββ", "ββββρββ", "βββββρβ", "ββββββρ", ], }, "aesthetic": { "interval": 80, "frames": [ "▰▱▱▱▱▱▱", "▰▰▱▱▱▱▱", "▰▰▰▱▱▱▱", "▰▰▰▰▱▱▱", "▰▰▰▰▰▱▱", "▰▰▰▰▰▰▱", "▰▰▰▰▰▰▰", "▰▱▱▱▱▱▱", ], }, } ================================================ FILE: src/pip/_vendor/rich/_stack.py ================================================ from typing import List, TypeVar T = TypeVar("T") class Stack(List[T]): """A small shim over builtin list.""" @property def top(self) -> T: """Get top of stack.""" return self[-1] def push(self, item: T) -> None: """Push an item on to the stack (append in stack nomenclature).""" self.append(item) ================================================ FILE: src/pip/_vendor/rich/_timer.py ================================================ """ Timer context manager, only used in debug. """ from time import time import contextlib from typing import Generator @contextlib.contextmanager def timer(subject: str = "time") -> Generator[None, None, None]: """print the elapsed time. (only used in debugging)""" start = time() yield elapsed = time() - start elapsed_ms = elapsed * 1000 print(f"{subject} elapsed {elapsed_ms:.1f}ms") ================================================ FILE: src/pip/_vendor/rich/_win32_console.py ================================================ """Light wrapper around the Win32 Console API - this module should only be imported on Windows The API that this module wraps is documented at https://docs.microsoft.com/en-us/windows/console/console-functions """ import ctypes import sys from typing import Any windll: Any = None if sys.platform == "win32": windll = ctypes.LibraryLoader(ctypes.WinDLL) else: raise ImportError(f"{__name__} can only be imported on Windows") import time from ctypes import Structure, byref, wintypes from typing import IO, NamedTuple, Type, cast from pip._vendor.rich.color import ColorSystem from pip._vendor.rich.style import Style STDOUT = -11 ENABLE_VIRTUAL_TERMINAL_PROCESSING = 4 COORD = wintypes._COORD class LegacyWindowsError(Exception): pass class WindowsCoordinates(NamedTuple): """Coordinates in the Windows Console API are (y, x), not (x, y). This class is intended to prevent that confusion. Rows and columns are indexed from 0. This class can be used in place of wintypes._COORD in arguments and argtypes. """ row: int col: int @classmethod def from_param(cls, value: "WindowsCoordinates") -> COORD: """Converts a WindowsCoordinates into a wintypes _COORD structure. This classmethod is internally called by ctypes to perform the conversion. Args: value (WindowsCoordinates): The input coordinates to convert. Returns: wintypes._COORD: The converted coordinates struct. """ return COORD(value.col, value.row) class CONSOLE_SCREEN_BUFFER_INFO(Structure): _fields_ = [ ("dwSize", COORD), ("dwCursorPosition", COORD), ("wAttributes", wintypes.WORD), ("srWindow", wintypes.SMALL_RECT), ("dwMaximumWindowSize", COORD), ] class CONSOLE_CURSOR_INFO(ctypes.Structure): _fields_ = [("dwSize", wintypes.DWORD), ("bVisible", wintypes.BOOL)] _GetStdHandle = windll.kernel32.GetStdHandle _GetStdHandle.argtypes = [ wintypes.DWORD, ] _GetStdHandle.restype = wintypes.HANDLE def GetStdHandle(handle: int = STDOUT) -> wintypes.HANDLE: """Retrieves a handle to the specified standard device (standard input, standard output, or standard error). Args: handle (int): Integer identifier for the handle. Defaults to -11 (stdout). Returns: wintypes.HANDLE: The handle """ return cast(wintypes.HANDLE, _GetStdHandle(handle)) _GetConsoleMode = windll.kernel32.GetConsoleMode _GetConsoleMode.argtypes = [wintypes.HANDLE, wintypes.LPDWORD] _GetConsoleMode.restype = wintypes.BOOL def GetConsoleMode(std_handle: wintypes.HANDLE) -> int: """Retrieves the current input mode of a console's input buffer or the current output mode of a console screen buffer. Args: std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. Raises: LegacyWindowsError: If any error occurs while calling the Windows console API. Returns: int: Value representing the current console mode as documented at https://docs.microsoft.com/en-us/windows/console/getconsolemode#parameters """ console_mode = wintypes.DWORD() success = bool(_GetConsoleMode(std_handle, console_mode)) if not success: raise LegacyWindowsError("Unable to get legacy Windows Console Mode") return console_mode.value _FillConsoleOutputCharacterW = windll.kernel32.FillConsoleOutputCharacterW _FillConsoleOutputCharacterW.argtypes = [ wintypes.HANDLE, ctypes.c_char, wintypes.DWORD, cast(Type[COORD], WindowsCoordinates), ctypes.POINTER(wintypes.DWORD), ] _FillConsoleOutputCharacterW.restype = wintypes.BOOL def FillConsoleOutputCharacter( std_handle: wintypes.HANDLE, char: str, length: int, start: WindowsCoordinates, ) -> int: """Writes a character to the console screen buffer a specified number of times, beginning at the specified coordinates. Args: std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. char (str): The character to write. Must be a string of length 1. length (int): The number of times to write the character. start (WindowsCoordinates): The coordinates to start writing at. Returns: int: The number of characters written. """ character = ctypes.c_char(char.encode()) num_characters = wintypes.DWORD(length) num_written = wintypes.DWORD(0) _FillConsoleOutputCharacterW( std_handle, character, num_characters, start, byref(num_written), ) return num_written.value _FillConsoleOutputAttribute = windll.kernel32.FillConsoleOutputAttribute _FillConsoleOutputAttribute.argtypes = [ wintypes.HANDLE, wintypes.WORD, wintypes.DWORD, cast(Type[COORD], WindowsCoordinates), ctypes.POINTER(wintypes.DWORD), ] _FillConsoleOutputAttribute.restype = wintypes.BOOL def FillConsoleOutputAttribute( std_handle: wintypes.HANDLE, attributes: int, length: int, start: WindowsCoordinates, ) -> int: """Sets the character attributes for a specified number of character cells, beginning at the specified coordinates in a screen buffer. Args: std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. attributes (int): Integer value representing the foreground and background colours of the cells. length (int): The number of cells to set the output attribute of. start (WindowsCoordinates): The coordinates of the first cell whose attributes are to be set. Returns: int: The number of cells whose attributes were actually set. """ num_cells = wintypes.DWORD(length) style_attrs = wintypes.WORD(attributes) num_written = wintypes.DWORD(0) _FillConsoleOutputAttribute( std_handle, style_attrs, num_cells, start, byref(num_written) ) return num_written.value _SetConsoleTextAttribute = windll.kernel32.SetConsoleTextAttribute _SetConsoleTextAttribute.argtypes = [ wintypes.HANDLE, wintypes.WORD, ] _SetConsoleTextAttribute.restype = wintypes.BOOL def SetConsoleTextAttribute( std_handle: wintypes.HANDLE, attributes: wintypes.WORD ) -> bool: """Set the colour attributes for all text written after this function is called. Args: std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. attributes (int): Integer value representing the foreground and background colours. Returns: bool: True if the attribute was set successfully, otherwise False. """ return bool(_SetConsoleTextAttribute(std_handle, attributes)) _GetConsoleScreenBufferInfo = windll.kernel32.GetConsoleScreenBufferInfo _GetConsoleScreenBufferInfo.argtypes = [ wintypes.HANDLE, ctypes.POINTER(CONSOLE_SCREEN_BUFFER_INFO), ] _GetConsoleScreenBufferInfo.restype = wintypes.BOOL def GetConsoleScreenBufferInfo( std_handle: wintypes.HANDLE, ) -> CONSOLE_SCREEN_BUFFER_INFO: """Retrieves information about the specified console screen buffer. Args: std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. Returns: CONSOLE_SCREEN_BUFFER_INFO: A CONSOLE_SCREEN_BUFFER_INFO ctype struct contain information about screen size, cursor position, colour attributes, and more.""" console_screen_buffer_info = CONSOLE_SCREEN_BUFFER_INFO() _GetConsoleScreenBufferInfo(std_handle, byref(console_screen_buffer_info)) return console_screen_buffer_info _SetConsoleCursorPosition = windll.kernel32.SetConsoleCursorPosition _SetConsoleCursorPosition.argtypes = [ wintypes.HANDLE, cast(Type[COORD], WindowsCoordinates), ] _SetConsoleCursorPosition.restype = wintypes.BOOL def SetConsoleCursorPosition( std_handle: wintypes.HANDLE, coords: WindowsCoordinates ) -> bool: """Set the position of the cursor in the console screen Args: std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. coords (WindowsCoordinates): The coordinates to move the cursor to. Returns: bool: True if the function succeeds, otherwise False. """ return bool(_SetConsoleCursorPosition(std_handle, coords)) _GetConsoleCursorInfo = windll.kernel32.GetConsoleCursorInfo _GetConsoleCursorInfo.argtypes = [ wintypes.HANDLE, ctypes.POINTER(CONSOLE_CURSOR_INFO), ] _GetConsoleCursorInfo.restype = wintypes.BOOL def GetConsoleCursorInfo( std_handle: wintypes.HANDLE, cursor_info: CONSOLE_CURSOR_INFO ) -> bool: """Get the cursor info - used to get cursor visibility and width Args: std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. cursor_info (CONSOLE_CURSOR_INFO): CONSOLE_CURSOR_INFO ctype struct that receives information about the console's cursor. Returns: bool: True if the function succeeds, otherwise False. """ return bool(_GetConsoleCursorInfo(std_handle, byref(cursor_info))) _SetConsoleCursorInfo = windll.kernel32.SetConsoleCursorInfo _SetConsoleCursorInfo.argtypes = [ wintypes.HANDLE, ctypes.POINTER(CONSOLE_CURSOR_INFO), ] _SetConsoleCursorInfo.restype = wintypes.BOOL def SetConsoleCursorInfo( std_handle: wintypes.HANDLE, cursor_info: CONSOLE_CURSOR_INFO ) -> bool: """Set the cursor info - used for adjusting cursor visibility and width Args: std_handle (wintypes.HANDLE): A handle to the console input buffer or the console screen buffer. cursor_info (CONSOLE_CURSOR_INFO): CONSOLE_CURSOR_INFO ctype struct containing the new cursor info. Returns: bool: True if the function succeeds, otherwise False. """ return bool(_SetConsoleCursorInfo(std_handle, byref(cursor_info))) _SetConsoleTitle = windll.kernel32.SetConsoleTitleW _SetConsoleTitle.argtypes = [wintypes.LPCWSTR] _SetConsoleTitle.restype = wintypes.BOOL def SetConsoleTitle(title: str) -> bool: """Sets the title of the current console window Args: title (str): The new title of the console window. Returns: bool: True if the function succeeds, otherwise False. """ return bool(_SetConsoleTitle(title)) class LegacyWindowsTerm: """This class allows interaction with the legacy Windows Console API. It should only be used in the context of environments where virtual terminal processing is not available. However, if it is used in a Windows environment, the entire API should work. Args: file (IO[str]): The file which the Windows Console API HANDLE is retrieved from, defaults to sys.stdout. """ BRIGHT_BIT = 8 # Indices are ANSI color numbers, values are the corresponding Windows Console API color numbers ANSI_TO_WINDOWS = [ 0, # black The Windows colours are defined in wincon.h as follows: 4, # red define FOREGROUND_BLUE 0x0001 -- 0000 0001 2, # green define FOREGROUND_GREEN 0x0002 -- 0000 0010 6, # yellow define FOREGROUND_RED 0x0004 -- 0000 0100 1, # blue define FOREGROUND_INTENSITY 0x0008 -- 0000 1000 5, # magenta define BACKGROUND_BLUE 0x0010 -- 0001 0000 3, # cyan define BACKGROUND_GREEN 0x0020 -- 0010 0000 7, # white define BACKGROUND_RED 0x0040 -- 0100 0000 8, # bright black (grey) define BACKGROUND_INTENSITY 0x0080 -- 1000 0000 12, # bright red 10, # bright green 14, # bright yellow 9, # bright blue 13, # bright magenta 11, # bright cyan 15, # bright white ] def __init__(self, file: "IO[str]") -> None: handle = GetStdHandle(STDOUT) self._handle = handle default_text = GetConsoleScreenBufferInfo(handle).wAttributes self._default_text = default_text self._default_fore = default_text & 7 self._default_back = (default_text >> 4) & 7 self._default_attrs = self._default_fore | (self._default_back << 4) self._file = file self.write = file.write self.flush = file.flush @property def cursor_position(self) -> WindowsCoordinates: """Returns the current position of the cursor (0-based) Returns: WindowsCoordinates: The current cursor position. """ coord: COORD = GetConsoleScreenBufferInfo(self._handle).dwCursorPosition return WindowsCoordinates(row=coord.Y, col=coord.X) @property def screen_size(self) -> WindowsCoordinates: """Returns the current size of the console screen buffer, in character columns and rows Returns: WindowsCoordinates: The width and height of the screen as WindowsCoordinates. """ screen_size: COORD = GetConsoleScreenBufferInfo(self._handle).dwSize return WindowsCoordinates(row=screen_size.Y, col=screen_size.X) def write_text(self, text: str) -> None: """Write text directly to the terminal without any modification of styles Args: text (str): The text to write to the console """ self.write(text) self.flush() def write_styled(self, text: str, style: Style) -> None: """Write styled text to the terminal. Args: text (str): The text to write style (Style): The style of the text """ color = style.color bgcolor = style.bgcolor if style.reverse: color, bgcolor = bgcolor, color if color: fore = color.downgrade(ColorSystem.WINDOWS).number fore = fore if fore is not None else 7 # Default to ANSI 7: White if style.bold: fore = fore | self.BRIGHT_BIT if style.dim: fore = fore & ~self.BRIGHT_BIT fore = self.ANSI_TO_WINDOWS[fore] else: fore = self._default_fore if bgcolor: back = bgcolor.downgrade(ColorSystem.WINDOWS).number back = back if back is not None else 0 # Default to ANSI 0: Black back = self.ANSI_TO_WINDOWS[back] else: back = self._default_back assert fore is not None assert back is not None SetConsoleTextAttribute( self._handle, attributes=ctypes.c_ushort(fore | (back << 4)) ) self.write_text(text) SetConsoleTextAttribute(self._handle, attributes=self._default_text) def move_cursor_to(self, new_position: WindowsCoordinates) -> None: """Set the position of the cursor Args: new_position (WindowsCoordinates): The WindowsCoordinates representing the new position of the cursor. """ if new_position.col < 0 or new_position.row < 0: return SetConsoleCursorPosition(self._handle, coords=new_position) def erase_line(self) -> None: """Erase all content on the line the cursor is currently located at""" screen_size = self.screen_size cursor_position = self.cursor_position cells_to_erase = screen_size.col start_coordinates = WindowsCoordinates(row=cursor_position.row, col=0) FillConsoleOutputCharacter( self._handle, " ", length=cells_to_erase, start=start_coordinates ) FillConsoleOutputAttribute( self._handle, self._default_attrs, length=cells_to_erase, start=start_coordinates, ) def erase_end_of_line(self) -> None: """Erase all content from the cursor position to the end of that line""" cursor_position = self.cursor_position cells_to_erase = self.screen_size.col - cursor_position.col FillConsoleOutputCharacter( self._handle, " ", length=cells_to_erase, start=cursor_position ) FillConsoleOutputAttribute( self._handle, self._default_attrs, length=cells_to_erase, start=cursor_position, ) def erase_start_of_line(self) -> None: """Erase all content from the cursor position to the start of that line""" row, col = self.cursor_position start = WindowsCoordinates(row, 0) FillConsoleOutputCharacter(self._handle, " ", length=col, start=start) FillConsoleOutputAttribute( self._handle, self._default_attrs, length=col, start=start ) def move_cursor_up(self) -> None: """Move the cursor up a single cell""" cursor_position = self.cursor_position SetConsoleCursorPosition( self._handle, coords=WindowsCoordinates( row=cursor_position.row - 1, col=cursor_position.col ), ) def move_cursor_down(self) -> None: """Move the cursor down a single cell""" cursor_position = self.cursor_position SetConsoleCursorPosition( self._handle, coords=WindowsCoordinates( row=cursor_position.row + 1, col=cursor_position.col, ), ) def move_cursor_forward(self) -> None: """Move the cursor forward a single cell. Wrap to the next line if required.""" row, col = self.cursor_position if col == self.screen_size.col - 1: row += 1 col = 0 else: col += 1 SetConsoleCursorPosition( self._handle, coords=WindowsCoordinates(row=row, col=col) ) def move_cursor_to_column(self, column: int) -> None: """Move cursor to the column specified by the zero-based column index, staying on the same row Args: column (int): The zero-based column index to move the cursor to. """ row, _ = self.cursor_position SetConsoleCursorPosition(self._handle, coords=WindowsCoordinates(row, column)) def move_cursor_backward(self) -> None: """Move the cursor backward a single cell. Wrap to the previous line if required.""" row, col = self.cursor_position if col == 0: row -= 1 col = self.screen_size.col - 1 else: col -= 1 SetConsoleCursorPosition( self._handle, coords=WindowsCoordinates(row=row, col=col) ) def hide_cursor(self) -> None: """Hide the cursor""" current_cursor_size = self._get_cursor_size() invisible_cursor = CONSOLE_CURSOR_INFO(dwSize=current_cursor_size, bVisible=0) SetConsoleCursorInfo(self._handle, cursor_info=invisible_cursor) def show_cursor(self) -> None: """Show the cursor""" current_cursor_size = self._get_cursor_size() visible_cursor = CONSOLE_CURSOR_INFO(dwSize=current_cursor_size, bVisible=1) SetConsoleCursorInfo(self._handle, cursor_info=visible_cursor) def set_title(self, title: str) -> None: """Set the title of the terminal window Args: title (str): The new title of the console window """ assert len(title) < 255, "Console title must be less than 255 characters" SetConsoleTitle(title) def _get_cursor_size(self) -> int: """Get the percentage of the character cell that is filled by the cursor""" cursor_info = CONSOLE_CURSOR_INFO() GetConsoleCursorInfo(self._handle, cursor_info=cursor_info) return int(cursor_info.dwSize) if __name__ == "__main__": handle = GetStdHandle() from pip._vendor.rich.console import Console console = Console() term = LegacyWindowsTerm(sys.stdout) term.set_title("Win32 Console Examples") style = Style(color="black", bgcolor="red") heading = Style.parse("black on green") # Check colour output console.rule("Checking colour output") console.print("[on red]on red!") console.print("[blue]blue!") console.print("[yellow]yellow!") console.print("[bold yellow]bold yellow!") console.print("[bright_yellow]bright_yellow!") console.print("[dim bright_yellow]dim bright_yellow!") console.print("[italic cyan]italic cyan!") console.print("[bold white on blue]bold white on blue!") console.print("[reverse bold white on blue]reverse bold white on blue!") console.print("[bold black on cyan]bold black on cyan!") console.print("[black on green]black on green!") console.print("[blue on green]blue on green!") console.print("[white on black]white on black!") console.print("[black on white]black on white!") console.print("[#1BB152 on #DA812D]#1BB152 on #DA812D!") # Check cursor movement console.rule("Checking cursor movement") console.print() term.move_cursor_backward() term.move_cursor_backward() term.write_text("went back and wrapped to prev line") time.sleep(1) term.move_cursor_up() term.write_text("we go up") time.sleep(1) term.move_cursor_down() term.write_text("and down") time.sleep(1) term.move_cursor_up() term.move_cursor_backward() term.move_cursor_backward() term.write_text("we went up and back 2") time.sleep(1) term.move_cursor_down() term.move_cursor_backward() term.move_cursor_backward() term.write_text("we went down and back 2") time.sleep(1) # Check erasing of lines term.hide_cursor() console.print() console.rule("Checking line erasing") console.print("\n...Deleting to the start of the line...") term.write_text("The red arrow shows the cursor location, and direction of erase") time.sleep(1) term.move_cursor_to_column(16) term.write_styled("<", Style.parse("black on red")) term.move_cursor_backward() time.sleep(1) term.erase_start_of_line() time.sleep(1) console.print("\n\n...And to the end of the line...") term.write_text("The red arrow shows the cursor location, and direction of erase") time.sleep(1) term.move_cursor_to_column(16) term.write_styled(">", Style.parse("black on red")) time.sleep(1) term.erase_end_of_line() time.sleep(1) console.print("\n\n...Now the whole line will be erased...") term.write_styled("I'm going to disappear!", style=Style.parse("black on cyan")) time.sleep(1) term.erase_line() term.show_cursor() print("\n") ================================================ FILE: src/pip/_vendor/rich/_windows.py ================================================ import sys from dataclasses import dataclass @dataclass class WindowsConsoleFeatures: """Windows features available.""" vt: bool = False """The console supports VT codes.""" truecolor: bool = False """The console supports truecolor.""" try: import ctypes from ctypes import LibraryLoader if sys.platform == "win32": windll = LibraryLoader(ctypes.WinDLL) else: windll = None raise ImportError("Not windows") from pip._vendor.rich._win32_console import ( ENABLE_VIRTUAL_TERMINAL_PROCESSING, GetConsoleMode, GetStdHandle, LegacyWindowsError, ) except (AttributeError, ImportError, ValueError): # Fallback if we can't load the Windows DLL def get_windows_console_features() -> WindowsConsoleFeatures: features = WindowsConsoleFeatures() return features else: def get_windows_console_features() -> WindowsConsoleFeatures: """Get windows console features. Returns: WindowsConsoleFeatures: An instance of WindowsConsoleFeatures. """ handle = GetStdHandle() try: console_mode = GetConsoleMode(handle) success = True except LegacyWindowsError: console_mode = 0 success = False vt = bool(success and console_mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING) truecolor = False if vt: win_version = sys.getwindowsversion() truecolor = win_version.major > 10 or ( win_version.major == 10 and win_version.build >= 15063 ) features = WindowsConsoleFeatures(vt=vt, truecolor=truecolor) return features if __name__ == "__main__": import platform features = get_windows_console_features() from pip._vendor.rich import print print(f'platform="{platform.system()}"') print(repr(features)) ================================================ FILE: src/pip/_vendor/rich/_windows_renderer.py ================================================ from typing import Iterable, Sequence, Tuple, cast from pip._vendor.rich._win32_console import LegacyWindowsTerm, WindowsCoordinates from pip._vendor.rich.segment import ControlCode, ControlType, Segment def legacy_windows_render(buffer: Iterable[Segment], term: LegacyWindowsTerm) -> None: """Makes appropriate Windows Console API calls based on the segments in the buffer. Args: buffer (Iterable[Segment]): Iterable of Segments to convert to Win32 API calls. term (LegacyWindowsTerm): Used to call the Windows Console API. """ for text, style, control in buffer: if not control: if style: term.write_styled(text, style) else: term.write_text(text) else: control_codes: Sequence[ControlCode] = control for control_code in control_codes: control_type = control_code[0] if control_type == ControlType.CURSOR_MOVE_TO: _, x, y = cast(Tuple[ControlType, int, int], control_code) term.move_cursor_to(WindowsCoordinates(row=y - 1, col=x - 1)) elif control_type == ControlType.CARRIAGE_RETURN: term.write_text("\r") elif control_type == ControlType.HOME: term.move_cursor_to(WindowsCoordinates(0, 0)) elif control_type == ControlType.CURSOR_UP: term.move_cursor_up() elif control_type == ControlType.CURSOR_DOWN: term.move_cursor_down() elif control_type == ControlType.CURSOR_FORWARD: term.move_cursor_forward() elif control_type == ControlType.CURSOR_BACKWARD: term.move_cursor_backward() elif control_type == ControlType.CURSOR_MOVE_TO_COLUMN: _, column = cast(Tuple[ControlType, int], control_code) term.move_cursor_to_column(column - 1) elif control_type == ControlType.HIDE_CURSOR: term.hide_cursor() elif control_type == ControlType.SHOW_CURSOR: term.show_cursor() elif control_type == ControlType.ERASE_IN_LINE: _, mode = cast(Tuple[ControlType, int], control_code) if mode == 0: term.erase_end_of_line() elif mode == 1: term.erase_start_of_line() elif mode == 2: term.erase_line() elif control_type == ControlType.SET_WINDOW_TITLE: _, title = cast(Tuple[ControlType, str], control_code) term.set_title(title) ================================================ FILE: src/pip/_vendor/rich/_wrap.py ================================================ from __future__ import annotations import re from typing import Iterable from ._loop import loop_last from .cells import cell_len, chop_cells re_word = re.compile(r"\s*\S+\s*") def words(text: str) -> Iterable[tuple[int, int, str]]: """Yields each word from the text as a tuple containing (start_index, end_index, word). A "word" in this context may include the actual word and any whitespace to the right. """ position = 0 word_match = re_word.match(text, position) while word_match is not None: start, end = word_match.span() word = word_match.group(0) yield start, end, word word_match = re_word.match(text, end) def divide_line(text: str, width: int, fold: bool = True) -> list[int]: """Given a string of text, and a width (measured in cells), return a list of cell offsets which the string should be split at in order for it to fit within the given width. Args: text: The text to examine. width: The available cell width. fold: If True, words longer than `width` will be folded onto a new line. Returns: A list of indices to break the line at. """ break_positions: list[int] = [] # offsets to insert the breaks at append = break_positions.append cell_offset = 0 _cell_len = cell_len for start, _end, word in words(text): word_length = _cell_len(word.rstrip()) remaining_space = width - cell_offset word_fits_remaining_space = remaining_space >= word_length if word_fits_remaining_space: # Simplest case - the word fits within the remaining width for this line. cell_offset += _cell_len(word) else: # Not enough space remaining for this word on the current line. if word_length > width: # The word doesn't fit on any line, so we can't simply # place it on the next line... if fold: # Fold the word across multiple lines. folded_word = chop_cells(word, width=width) for last, line in loop_last(folded_word): if start: append(start) if last: cell_offset = _cell_len(line) else: start += len(line) else: # Folding isn't allowed, so crop the word. if start: append(start) cell_offset = _cell_len(word) elif cell_offset and start: # The word doesn't fit within the remaining space on the current # line, but it *can* fit on to the next (empty) line. append(start) cell_offset = _cell_len(word) return break_positions if __name__ == "__main__": # pragma: no cover from .console import Console console = Console(width=10) console.print("12345 abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ 12345") print(chop_cells("abcdefghijklmnopqrstuvwxyz", 10)) console = Console(width=20) console.rule() console.print("TextualはPythonの高速アプリケーション開発フレームワークです") console.rule() console.print("アプリケーションは1670万色を使用でき") ================================================ FILE: src/pip/_vendor/rich/abc.py ================================================ from abc import ABC class RichRenderable(ABC): """An abstract base class for Rich renderables. Note that there is no need to extend this class, the intended use is to check if an object supports the Rich renderable protocol. For example:: if isinstance(my_object, RichRenderable): console.print(my_object) """ @classmethod def __subclasshook__(cls, other: type) -> bool: """Check if this class supports the rich render protocol.""" return hasattr(other, "__rich_console__") or hasattr(other, "__rich__") if __name__ == "__main__": # pragma: no cover from pip._vendor.rich.text import Text t = Text() print(isinstance(Text, RichRenderable)) print(isinstance(t, RichRenderable)) class Foo: pass f = Foo() print(isinstance(f, RichRenderable)) print(isinstance("", RichRenderable)) ================================================ FILE: src/pip/_vendor/rich/align.py ================================================ from itertools import chain from typing import TYPE_CHECKING, Iterable, Optional, Literal from .constrain import Constrain from .jupyter import JupyterMixin from .measure import Measurement from .segment import Segment from .style import StyleType if TYPE_CHECKING: from .console import Console, ConsoleOptions, RenderableType, RenderResult AlignMethod = Literal["left", "center", "right"] VerticalAlignMethod = Literal["top", "middle", "bottom"] class Align(JupyterMixin): """Align a renderable by adding spaces if necessary. Args: renderable (RenderableType): A console renderable. align (AlignMethod): One of "left", "center", or "right"" style (StyleType, optional): An optional style to apply to the background. vertical (Optional[VerticalAlignMethod], optional): Optional vertical align, one of "top", "middle", or "bottom". Defaults to None. pad (bool, optional): Pad the right with spaces. Defaults to True. width (int, optional): Restrict contents to given width, or None to use default width. Defaults to None. height (int, optional): Set height of align renderable, or None to fit to contents. Defaults to None. Raises: ValueError: if ``align`` is not one of the expected values. """ def __init__( self, renderable: "RenderableType", align: AlignMethod = "left", style: Optional[StyleType] = None, *, vertical: Optional[VerticalAlignMethod] = None, pad: bool = True, width: Optional[int] = None, height: Optional[int] = None, ) -> None: if align not in ("left", "center", "right"): raise ValueError( f'invalid value for align, expected "left", "center", or "right" (not {align!r})' ) if vertical is not None and vertical not in ("top", "middle", "bottom"): raise ValueError( f'invalid value for vertical, expected "top", "middle", or "bottom" (not {vertical!r})' ) self.renderable = renderable self.align = align self.style = style self.vertical = vertical self.pad = pad self.width = width self.height = height def __repr__(self) -> str: return f"Align({self.renderable!r}, {self.align!r})" @classmethod def left( cls, renderable: "RenderableType", style: Optional[StyleType] = None, *, vertical: Optional[VerticalAlignMethod] = None, pad: bool = True, width: Optional[int] = None, height: Optional[int] = None, ) -> "Align": """Align a renderable to the left.""" return cls( renderable, "left", style=style, vertical=vertical, pad=pad, width=width, height=height, ) @classmethod def center( cls, renderable: "RenderableType", style: Optional[StyleType] = None, *, vertical: Optional[VerticalAlignMethod] = None, pad: bool = True, width: Optional[int] = None, height: Optional[int] = None, ) -> "Align": """Align a renderable to the center.""" return cls( renderable, "center", style=style, vertical=vertical, pad=pad, width=width, height=height, ) @classmethod def right( cls, renderable: "RenderableType", style: Optional[StyleType] = None, *, vertical: Optional[VerticalAlignMethod] = None, pad: bool = True, width: Optional[int] = None, height: Optional[int] = None, ) -> "Align": """Align a renderable to the right.""" return cls( renderable, "right", style=style, vertical=vertical, pad=pad, width=width, height=height, ) def __rich_console__( self, console: "Console", options: "ConsoleOptions" ) -> "RenderResult": align = self.align width = console.measure(self.renderable, options=options).maximum rendered = console.render( Constrain( self.renderable, width if self.width is None else min(width, self.width) ), options.update(height=None), ) lines = list(Segment.split_lines(rendered)) width, height = Segment.get_shape(lines) lines = Segment.set_shape(lines, width, height) new_line = Segment.line() excess_space = options.max_width - width style = console.get_style(self.style) if self.style is not None else None def generate_segments() -> Iterable[Segment]: if excess_space <= 0: # Exact fit for line in lines: yield from line yield new_line elif align == "left": # Pad on the right pad = Segment(" " * excess_space, style) if self.pad else None for line in lines: yield from line if pad: yield pad yield new_line elif align == "center": # Pad left and right left = excess_space // 2 pad = Segment(" " * left, style) pad_right = ( Segment(" " * (excess_space - left), style) if self.pad else None ) for line in lines: if left: yield pad yield from line if pad_right: yield pad_right yield new_line elif align == "right": # Padding on left pad = Segment(" " * excess_space, style) for line in lines: yield pad yield from line yield new_line blank_line = ( Segment(f"{' ' * (self.width or options.max_width)}\n", style) if self.pad else Segment("\n") ) def blank_lines(count: int) -> Iterable[Segment]: if count > 0: for _ in range(count): yield blank_line vertical_height = self.height or options.height iter_segments: Iterable[Segment] if self.vertical and vertical_height is not None: if self.vertical == "top": bottom_space = vertical_height - height iter_segments = chain(generate_segments(), blank_lines(bottom_space)) elif self.vertical == "middle": top_space = (vertical_height - height) // 2 bottom_space = vertical_height - top_space - height iter_segments = chain( blank_lines(top_space), generate_segments(), blank_lines(bottom_space), ) else: # self.vertical == "bottom": top_space = vertical_height - height iter_segments = chain(blank_lines(top_space), generate_segments()) else: iter_segments = generate_segments() if self.style: style = console.get_style(self.style) iter_segments = Segment.apply_style(iter_segments, style) yield from iter_segments def __rich_measure__( self, console: "Console", options: "ConsoleOptions" ) -> Measurement: measurement = Measurement.get(console, options, self.renderable) return measurement class VerticalCenter(JupyterMixin): """Vertically aligns a renderable. Warn: This class is deprecated and may be removed in a future version. Use Align class with `vertical="middle"`. Args: renderable (RenderableType): A renderable object. style (StyleType, optional): An optional style to apply to the background. Defaults to None. """ def __init__( self, renderable: "RenderableType", style: Optional[StyleType] = None, ) -> None: self.renderable = renderable self.style = style def __repr__(self) -> str: return f"VerticalCenter({self.renderable!r})" def __rich_console__( self, console: "Console", options: "ConsoleOptions" ) -> "RenderResult": style = console.get_style(self.style) if self.style is not None else None lines = console.render_lines( self.renderable, options.update(height=None), pad=False ) width, _height = Segment.get_shape(lines) new_line = Segment.line() height = options.height or options.size.height top_space = (height - len(lines)) // 2 bottom_space = height - top_space - len(lines) blank_line = Segment(f"{' ' * width}", style) def blank_lines(count: int) -> Iterable[Segment]: for _ in range(count): yield blank_line yield new_line if top_space > 0: yield from blank_lines(top_space) for line in lines: yield from line yield new_line if bottom_space > 0: yield from blank_lines(bottom_space) def __rich_measure__( self, console: "Console", options: "ConsoleOptions" ) -> Measurement: measurement = Measurement.get(console, options, self.renderable) return measurement if __name__ == "__main__": # pragma: no cover from pip._vendor.rich.console import Console, Group from pip._vendor.rich.highlighter import ReprHighlighter from pip._vendor.rich.panel import Panel highlighter = ReprHighlighter() console = Console() panel = Panel( Group( Align.left(highlighter("align='left'")), Align.center(highlighter("align='center'")), Align.right(highlighter("align='right'")), ), width=60, style="on dark_blue", title="Align", ) console.print( Align.center(panel, vertical="middle", style="on red", height=console.height) ) ================================================ FILE: src/pip/_vendor/rich/ansi.py ================================================ import re import sys from contextlib import suppress from typing import Iterable, NamedTuple, Optional from .color import Color from .style import Style from .text import Text re_ansi = re.compile( r""" (?:\x1b[0-?])| (?:\x1b\](.*?)\x1b\\)| (?:\x1b([(@-Z\\-_]|\[[0-?]*[ -/]*[@-~])) """, re.VERBOSE, ) class _AnsiToken(NamedTuple): """Result of ansi tokenized string.""" plain: str = "" sgr: Optional[str] = "" osc: Optional[str] = "" def _ansi_tokenize(ansi_text: str) -> Iterable[_AnsiToken]: """Tokenize a string in to plain text and ANSI codes. Args: ansi_text (str): A String containing ANSI codes. Yields: AnsiToken: A named tuple of (plain, sgr, osc) """ position = 0 sgr: Optional[str] osc: Optional[str] for match in re_ansi.finditer(ansi_text): start, end = match.span(0) osc, sgr = match.groups() if start > position: yield _AnsiToken(ansi_text[position:start]) if sgr: if sgr == "(": position = end + 1 continue if sgr.endswith("m"): yield _AnsiToken("", sgr[1:-1], osc) else: yield _AnsiToken("", sgr, osc) position = end if position < len(ansi_text): yield _AnsiToken(ansi_text[position:]) SGR_STYLE_MAP = { 1: "bold", 2: "dim", 3: "italic", 4: "underline", 5: "blink", 6: "blink2", 7: "reverse", 8: "conceal", 9: "strike", 21: "underline2", 22: "not dim not bold", 23: "not italic", 24: "not underline", 25: "not blink", 26: "not blink2", 27: "not reverse", 28: "not conceal", 29: "not strike", 30: "color(0)", 31: "color(1)", 32: "color(2)", 33: "color(3)", 34: "color(4)", 35: "color(5)", 36: "color(6)", 37: "color(7)", 39: "default", 40: "on color(0)", 41: "on color(1)", 42: "on color(2)", 43: "on color(3)", 44: "on color(4)", 45: "on color(5)", 46: "on color(6)", 47: "on color(7)", 49: "on default", 51: "frame", 52: "encircle", 53: "overline", 54: "not frame not encircle", 55: "not overline", 90: "color(8)", 91: "color(9)", 92: "color(10)", 93: "color(11)", 94: "color(12)", 95: "color(13)", 96: "color(14)", 97: "color(15)", 100: "on color(8)", 101: "on color(9)", 102: "on color(10)", 103: "on color(11)", 104: "on color(12)", 105: "on color(13)", 106: "on color(14)", 107: "on color(15)", } class AnsiDecoder: """Translate ANSI code in to styled Text.""" def __init__(self) -> None: self.style = Style.null() def decode(self, terminal_text: str) -> Iterable[Text]: """Decode ANSI codes in an iterable of lines. Args: lines (Iterable[str]): An iterable of lines of terminal output. Yields: Text: Marked up Text. """ for line in terminal_text.splitlines(): yield self.decode_line(line) def decode_line(self, line: str) -> Text: """Decode a line containing ansi codes. Args: line (str): A line of terminal output. Returns: Text: A Text instance marked up according to ansi codes. """ from_ansi = Color.from_ansi from_rgb = Color.from_rgb _Style = Style text = Text() append = text.append line = line.rsplit("\r", 1)[-1] for plain_text, sgr, osc in _ansi_tokenize(line): if plain_text: append(plain_text, self.style or None) elif osc is not None: if osc.startswith("8;"): _params, semicolon, link = osc[2:].partition(";") if semicolon: self.style = self.style.update_link(link or None) elif sgr is not None: # Translate in to semi-colon separated codes # Ignore invalid codes, because we want to be lenient codes = [ min(255, int(_code) if _code else 0) for _code in sgr.split(";") if _code.isdigit() or _code == "" ] iter_codes = iter(codes) for code in iter_codes: if code == 0: # reset self.style = _Style.null() elif code in SGR_STYLE_MAP: # styles self.style += _Style.parse(SGR_STYLE_MAP[code]) elif code == 38: #  Foreground with suppress(StopIteration): color_type = next(iter_codes) if color_type == 5: self.style += _Style.from_color( from_ansi(next(iter_codes)) ) elif color_type == 2: self.style += _Style.from_color( from_rgb( next(iter_codes), next(iter_codes), next(iter_codes), ) ) elif code == 48: # Background with suppress(StopIteration): color_type = next(iter_codes) if color_type == 5: self.style += _Style.from_color( None, from_ansi(next(iter_codes)) ) elif color_type == 2: self.style += _Style.from_color( None, from_rgb( next(iter_codes), next(iter_codes), next(iter_codes), ), ) return text if sys.platform != "win32" and __name__ == "__main__": # pragma: no cover import io import os import pty import sys decoder = AnsiDecoder() stdout = io.BytesIO() def read(fd: int) -> bytes: data = os.read(fd, 1024) stdout.write(data) return data pty.spawn(sys.argv[1:], read) from .console import Console console = Console(record=True) stdout_result = stdout.getvalue().decode("utf-8") print(stdout_result) for line in decoder.decode(stdout_result): console.print(line) console.save_html("stdout.html") ================================================ FILE: src/pip/_vendor/rich/bar.py ================================================ from typing import Optional, Union from .color import Color from .console import Console, ConsoleOptions, RenderResult from .jupyter import JupyterMixin from .measure import Measurement from .segment import Segment from .style import Style # There are left-aligned characters for 1/8 to 7/8, but # the right-aligned characters exist only for 1/8 and 4/8. BEGIN_BLOCK_ELEMENTS = ["█", "█", "█", "▐", "▐", "▐", "▕", "▕"] END_BLOCK_ELEMENTS = [" ", "▏", "▎", "▍", "▌", "▋", "▊", "▉"] FULL_BLOCK = "█" class Bar(JupyterMixin): """Renders a solid block bar. Args: size (float): Value for the end of the bar. begin (float): Begin point (between 0 and size, inclusive). end (float): End point (between 0 and size, inclusive). width (int, optional): Width of the bar, or ``None`` for maximum width. Defaults to None. color (Union[Color, str], optional): Color of the bar. Defaults to "default". bgcolor (Union[Color, str], optional): Color of bar background. Defaults to "default". """ def __init__( self, size: float, begin: float, end: float, *, width: Optional[int] = None, color: Union[Color, str] = "default", bgcolor: Union[Color, str] = "default", ): self.size = size self.begin = max(begin, 0) self.end = min(end, size) self.width = width self.style = Style(color=color, bgcolor=bgcolor) def __repr__(self) -> str: return f"Bar({self.size}, {self.begin}, {self.end})" def __rich_console__( self, console: Console, options: ConsoleOptions ) -> RenderResult: width = min( self.width if self.width is not None else options.max_width, options.max_width, ) if self.begin >= self.end: yield Segment(" " * width, self.style) yield Segment.line() return prefix_complete_eights = int(width * 8 * self.begin / self.size) prefix_bar_count = prefix_complete_eights // 8 prefix_eights_count = prefix_complete_eights % 8 body_complete_eights = int(width * 8 * self.end / self.size) body_bar_count = body_complete_eights // 8 body_eights_count = body_complete_eights % 8 # When start and end fall into the same cell, we ideally should render # a symbol that's "center-aligned", but there is no good symbol in Unicode. # In this case, we fall back to right-aligned block symbol for simplicity. prefix = " " * prefix_bar_count if prefix_eights_count: prefix += BEGIN_BLOCK_ELEMENTS[prefix_eights_count] body = FULL_BLOCK * body_bar_count if body_eights_count: body += END_BLOCK_ELEMENTS[body_eights_count] suffix = " " * (width - len(body)) yield Segment(prefix + body[len(prefix) :] + suffix, self.style) yield Segment.line() def __rich_measure__( self, console: Console, options: ConsoleOptions ) -> Measurement: return ( Measurement(self.width, self.width) if self.width is not None else Measurement(4, options.max_width) ) ================================================ FILE: src/pip/_vendor/rich/box.py ================================================ from typing import TYPE_CHECKING, Iterable, List, Literal from ._loop import loop_last if TYPE_CHECKING: from pip._vendor.rich.console import ConsoleOptions class Box: """Defines characters to render boxes. ┌─┬┐ top │ ││ head ├─┼┤ head_row │ ││ mid ├─┼┤ row ├─┼┤ foot_row │ ││ foot └─┴┘ bottom Args: box (str): Characters making up box. ascii (bool, optional): True if this box uses ascii characters only. Default is False. """ def __init__(self, box: str, *, ascii: bool = False) -> None: self._box = box self.ascii = ascii line1, line2, line3, line4, line5, line6, line7, line8 = box.splitlines() # top self.top_left, self.top, self.top_divider, self.top_right = iter(line1) # head self.head_left, _, self.head_vertical, self.head_right = iter(line2) # head_row ( self.head_row_left, self.head_row_horizontal, self.head_row_cross, self.head_row_right, ) = iter(line3) # mid self.mid_left, _, self.mid_vertical, self.mid_right = iter(line4) # row self.row_left, self.row_horizontal, self.row_cross, self.row_right = iter(line5) # foot_row ( self.foot_row_left, self.foot_row_horizontal, self.foot_row_cross, self.foot_row_right, ) = iter(line6) # foot self.foot_left, _, self.foot_vertical, self.foot_right = iter(line7) # bottom self.bottom_left, self.bottom, self.bottom_divider, self.bottom_right = iter( line8 ) def __repr__(self) -> str: return "Box(...)" def __str__(self) -> str: return self._box def substitute(self, options: "ConsoleOptions", safe: bool = True) -> "Box": """Substitute this box for another if it won't render due to platform issues. Args: options (ConsoleOptions): Console options used in rendering. safe (bool, optional): Substitute this for another Box if there are known problems displaying on the platform (currently only relevant on Windows). Default is True. Returns: Box: A different Box or the same Box. """ box = self if options.legacy_windows and safe: box = LEGACY_WINDOWS_SUBSTITUTIONS.get(box, box) if options.ascii_only and not box.ascii: box = ASCII return box def get_plain_headed_box(self) -> "Box": """If this box uses special characters for the borders of the header, then return the equivalent box that does not. Returns: Box: The most similar Box that doesn't use header-specific box characters. If the current Box already satisfies this criterion, then it's returned. """ return PLAIN_HEADED_SUBSTITUTIONS.get(self, self) def get_top(self, widths: Iterable[int]) -> str: """Get the top of a simple box. Args: widths (List[int]): Widths of columns. Returns: str: A string of box characters. """ parts: List[str] = [] append = parts.append append(self.top_left) for last, width in loop_last(widths): append(self.top * width) if not last: append(self.top_divider) append(self.top_right) return "".join(parts) def get_row( self, widths: Iterable[int], level: Literal["head", "row", "foot", "mid"] = "row", edge: bool = True, ) -> str: """Get the top of a simple box. Args: width (List[int]): Widths of columns. Returns: str: A string of box characters. """ if level == "head": left = self.head_row_left horizontal = self.head_row_horizontal cross = self.head_row_cross right = self.head_row_right elif level == "row": left = self.row_left horizontal = self.row_horizontal cross = self.row_cross right = self.row_right elif level == "mid": left = self.mid_left horizontal = " " cross = self.mid_vertical right = self.mid_right elif level == "foot": left = self.foot_row_left horizontal = self.foot_row_horizontal cross = self.foot_row_cross right = self.foot_row_right else: raise ValueError("level must be 'head', 'row' or 'foot'") parts: List[str] = [] append = parts.append if edge: append(left) for last, width in loop_last(widths): append(horizontal * width) if not last: append(cross) if edge: append(right) return "".join(parts) def get_bottom(self, widths: Iterable[int]) -> str: """Get the bottom of a simple box. Args: widths (List[int]): Widths of columns. Returns: str: A string of box characters. """ parts: List[str] = [] append = parts.append append(self.bottom_left) for last, width in loop_last(widths): append(self.bottom * width) if not last: append(self.bottom_divider) append(self.bottom_right) return "".join(parts) # fmt: off ASCII: Box = Box( "+--+\n" "| ||\n" "|-+|\n" "| ||\n" "|-+|\n" "|-+|\n" "| ||\n" "+--+\n", ascii=True, ) ASCII2: Box = Box( "+-++\n" "| ||\n" "+-++\n" "| ||\n" "+-++\n" "+-++\n" "| ||\n" "+-++\n", ascii=True, ) ASCII_DOUBLE_HEAD: Box = Box( "+-++\n" "| ||\n" "+=++\n" "| ||\n" "+-++\n" "+-++\n" "| ||\n" "+-++\n", ascii=True, ) SQUARE: Box = Box( "┌─┬┐\n" "│ ││\n" "├─┼┤\n" "│ ││\n" "├─┼┤\n" "├─┼┤\n" "│ ││\n" "└─┴┘\n" ) SQUARE_DOUBLE_HEAD: Box = Box( "┌─┬┐\n" "│ ││\n" "╞═╪╡\n" "│ ││\n" "├─┼┤\n" "├─┼┤\n" "│ ││\n" "└─┴┘\n" ) MINIMAL: Box = Box( " ╷ \n" " │ \n" "╶─┼╴\n" " │ \n" "╶─┼╴\n" "╶─┼╴\n" " │ \n" " ╵ \n" ) MINIMAL_HEAVY_HEAD: Box = Box( " ╷ \n" " │ \n" "╺━┿╸\n" " │ \n" "╶─┼╴\n" "╶─┼╴\n" " │ \n" " ╵ \n" ) MINIMAL_DOUBLE_HEAD: Box = Box( " ╷ \n" " │ \n" " ═╪ \n" " │ \n" " ─┼ \n" " ─┼ \n" " │ \n" " ╵ \n" ) SIMPLE: Box = Box( " \n" " \n" " ── \n" " \n" " \n" " ── \n" " \n" " \n" ) SIMPLE_HEAD: Box = Box( " \n" " \n" " ── \n" " \n" " \n" " \n" " \n" " \n" ) SIMPLE_HEAVY: Box = Box( " \n" " \n" " ━━ \n" " \n" " \n" " ━━ \n" " \n" " \n" ) HORIZONTALS: Box = Box( " ── \n" " \n" " ── \n" " \n" " ── \n" " ── \n" " \n" " ── \n" ) ROUNDED: Box = Box( "╭─┬╮\n" "│ ││\n" "├─┼┤\n" "│ ││\n" "├─┼┤\n" "├─┼┤\n" "│ ││\n" "╰─┴╯\n" ) HEAVY: Box = Box( "┏━┳┓\n" "┃ ┃┃\n" "┣━╋┫\n" "┃ ┃┃\n" "┣━╋┫\n" "┣━╋┫\n" "┃ ┃┃\n" "┗━┻┛\n" ) HEAVY_EDGE: Box = Box( "┏━┯┓\n" "┃ │┃\n" "┠─┼┨\n" "┃ │┃\n" "┠─┼┨\n" "┠─┼┨\n" "┃ │┃\n" "┗━┷┛\n" ) HEAVY_HEAD: Box = Box( "┏━┳┓\n" "┃ ┃┃\n" "┡━╇┩\n" "│ ││\n" "├─┼┤\n" "├─┼┤\n" "│ ││\n" "└─┴┘\n" ) DOUBLE: Box = Box( "╔═╦╗\n" "║ ║║\n" "╠═╬╣\n" "║ ║║\n" "╠═╬╣\n" "╠═╬╣\n" "║ ║║\n" "╚═╩╝\n" ) DOUBLE_EDGE: Box = Box( "╔═╤╗\n" "║ │║\n" "╟─┼╢\n" "║ │║\n" "╟─┼╢\n" "╟─┼╢\n" "║ │║\n" "╚═╧╝\n" ) MARKDOWN: Box = Box( " \n" "| ||\n" "|-||\n" "| ||\n" "|-||\n" "|-||\n" "| ||\n" " \n", ascii=True, ) # fmt: on # Map Boxes that don't render with raster fonts on to equivalent that do LEGACY_WINDOWS_SUBSTITUTIONS = { ROUNDED: SQUARE, MINIMAL_HEAVY_HEAD: MINIMAL, SIMPLE_HEAVY: SIMPLE, HEAVY: SQUARE, HEAVY_EDGE: SQUARE, HEAVY_HEAD: SQUARE, } # Map headed boxes to their headerless equivalents PLAIN_HEADED_SUBSTITUTIONS = { HEAVY_HEAD: SQUARE, SQUARE_DOUBLE_HEAD: SQUARE, MINIMAL_DOUBLE_HEAD: MINIMAL, MINIMAL_HEAVY_HEAD: MINIMAL, ASCII_DOUBLE_HEAD: ASCII2, } if __name__ == "__main__": # pragma: no cover from pip._vendor.rich.columns import Columns from pip._vendor.rich.panel import Panel from . import box as box from .console import Console from .table import Table from .text import Text console = Console(record=True) BOXES = [ "ASCII", "ASCII2", "ASCII_DOUBLE_HEAD", "SQUARE", "SQUARE_DOUBLE_HEAD", "MINIMAL", "MINIMAL_HEAVY_HEAD", "MINIMAL_DOUBLE_HEAD", "SIMPLE", "SIMPLE_HEAD", "SIMPLE_HEAVY", "HORIZONTALS", "ROUNDED", "HEAVY", "HEAVY_EDGE", "HEAVY_HEAD", "DOUBLE", "DOUBLE_EDGE", "MARKDOWN", ] console.print(Panel("[bold green]Box Constants", style="green"), justify="center") console.print() columns = Columns(expand=True, padding=2) for box_name in sorted(BOXES): table = Table( show_footer=True, style="dim", border_style="not dim", expand=True ) table.add_column("Header 1", "Footer 1") table.add_column("Header 2", "Footer 2") table.add_row("Cell", "Cell") table.add_row("Cell", "Cell") table.box = getattr(box, box_name) table.title = Text(f"box.{box_name}", style="magenta") columns.add_renderable(table) console.print(columns) # console.save_svg("box.svg") ================================================ FILE: src/pip/_vendor/rich/cells.py ================================================ from __future__ import annotations from functools import lru_cache from typing import Callable from ._cell_widths import CELL_WIDTHS # Ranges of unicode ordinals that produce a 1-cell wide character # This is non-exhaustive, but covers most common Western characters _SINGLE_CELL_UNICODE_RANGES: list[tuple[int, int]] = [ (0x20, 0x7E), # Latin (excluding non-printable) (0xA0, 0xAC), (0xAE, 0x002FF), (0x00370, 0x00482), # Greek / Cyrillic (0x02500, 0x025FC), # Box drawing, box elements, geometric shapes (0x02800, 0x028FF), # Braille ] # A set of characters that are a single cell wide _SINGLE_CELLS = frozenset( [ character for _start, _end in _SINGLE_CELL_UNICODE_RANGES for character in map(chr, range(_start, _end + 1)) ] ) # When called with a string this will return True if all # characters are single-cell, otherwise False _is_single_cell_widths: Callable[[str], bool] = _SINGLE_CELLS.issuperset @lru_cache(4096) def cached_cell_len(text: str) -> int: """Get the number of cells required to display text. This method always caches, which may use up a lot of memory. It is recommended to use `cell_len` over this method. Args: text (str): Text to display. Returns: int: Get the number of cells required to display text. """ if _is_single_cell_widths(text): return len(text) return sum(map(get_character_cell_size, text)) def cell_len(text: str, _cell_len: Callable[[str], int] = cached_cell_len) -> int: """Get the number of cells required to display text. Args: text (str): Text to display. Returns: int: Get the number of cells required to display text. """ if len(text) < 512: return _cell_len(text) if _is_single_cell_widths(text): return len(text) return sum(map(get_character_cell_size, text)) @lru_cache(maxsize=4096) def get_character_cell_size(character: str) -> int: """Get the cell size of a character. Args: character (str): A single character. Returns: int: Number of cells (0, 1 or 2) occupied by that character. """ codepoint = ord(character) _table = CELL_WIDTHS lower_bound = 0 upper_bound = len(_table) - 1 index = (lower_bound + upper_bound) // 2 while True: start, end, width = _table[index] if codepoint < start: upper_bound = index - 1 elif codepoint > end: lower_bound = index + 1 else: return 0 if width == -1 else width if upper_bound < lower_bound: break index = (lower_bound + upper_bound) // 2 return 1 def set_cell_size(text: str, total: int) -> str: """Set the length of a string to fit within given number of cells.""" if _is_single_cell_widths(text): size = len(text) if size < total: return text + " " * (total - size) return text[:total] if total <= 0: return "" cell_size = cell_len(text) if cell_size == total: return text if cell_size < total: return text + " " * (total - cell_size) start = 0 end = len(text) # Binary search until we find the right size while True: pos = (start + end) // 2 before = text[: pos + 1] before_len = cell_len(before) if before_len == total + 1 and cell_len(before[-1]) == 2: return before[:-1] + " " if before_len == total: return before if before_len > total: end = pos else: start = pos def chop_cells( text: str, width: int, ) -> list[str]: """Split text into lines such that each line fits within the available (cell) width. Args: text: The text to fold such that it fits in the given width. width: The width available (number of cells). Returns: A list of strings such that each string in the list has cell width less than or equal to the available width. """ _get_character_cell_size = get_character_cell_size lines: list[list[str]] = [[]] append_new_line = lines.append append_to_last_line = lines[-1].append total_width = 0 for character in text: cell_width = _get_character_cell_size(character) char_doesnt_fit = total_width + cell_width > width if char_doesnt_fit: append_new_line([character]) append_to_last_line = lines[-1].append total_width = cell_width else: append_to_last_line(character) total_width += cell_width return ["".join(line) for line in lines] if __name__ == "__main__": # pragma: no cover print(get_character_cell_size("😽")) for line in chop_cells("""这是对亚洲语言支持的测试。面对模棱两可的想法,拒绝猜测的诱惑。""", 8): print(line) for n in range(80, 1, -1): print(set_cell_size("""这是对亚洲语言支持的测试。面对模棱两可的想法,拒绝猜测的诱惑。""", n) + "|") print("x" * n) ================================================ FILE: src/pip/_vendor/rich/color.py ================================================ import re import sys from colorsys import rgb_to_hls from enum import IntEnum from functools import lru_cache from typing import TYPE_CHECKING, NamedTuple, Optional, Tuple from ._palettes import EIGHT_BIT_PALETTE, STANDARD_PALETTE, WINDOWS_PALETTE from .color_triplet import ColorTriplet from .repr import Result, rich_repr from .terminal_theme import DEFAULT_TERMINAL_THEME if TYPE_CHECKING: # pragma: no cover from .terminal_theme import TerminalTheme from .text import Text WINDOWS = sys.platform == "win32" class ColorSystem(IntEnum): """One of the 3 color system supported by terminals.""" STANDARD = 1 EIGHT_BIT = 2 TRUECOLOR = 3 WINDOWS = 4 def __repr__(self) -> str: return f"ColorSystem.{self.name}" def __str__(self) -> str: return repr(self) class ColorType(IntEnum): """Type of color stored in Color class.""" DEFAULT = 0 STANDARD = 1 EIGHT_BIT = 2 TRUECOLOR = 3 WINDOWS = 4 def __repr__(self) -> str: return f"ColorType.{self.name}" ANSI_COLOR_NAMES = { "black": 0, "red": 1, "green": 2, "yellow": 3, "blue": 4, "magenta": 5, "cyan": 6, "white": 7, "bright_black": 8, "bright_red": 9, "bright_green": 10, "bright_yellow": 11, "bright_blue": 12, "bright_magenta": 13, "bright_cyan": 14, "bright_white": 15, "grey0": 16, "gray0": 16, "navy_blue": 17, "dark_blue": 18, "blue3": 20, "blue1": 21, "dark_green": 22, "deep_sky_blue4": 25, "dodger_blue3": 26, "dodger_blue2": 27, "green4": 28, "spring_green4": 29, "turquoise4": 30, "deep_sky_blue3": 32, "dodger_blue1": 33, "green3": 40, "spring_green3": 41, "dark_cyan": 36, "light_sea_green": 37, "deep_sky_blue2": 38, "deep_sky_blue1": 39, "spring_green2": 47, "cyan3": 43, "dark_turquoise": 44, "turquoise2": 45, "green1": 46, "spring_green1": 48, "medium_spring_green": 49, "cyan2": 50, "cyan1": 51, "dark_red": 88, "deep_pink4": 125, "purple4": 55, "purple3": 56, "blue_violet": 57, "orange4": 94, "grey37": 59, "gray37": 59, "medium_purple4": 60, "slate_blue3": 62, "royal_blue1": 63, "chartreuse4": 64, "dark_sea_green4": 71, "pale_turquoise4": 66, "steel_blue": 67, "steel_blue3": 68, "cornflower_blue": 69, "chartreuse3": 76, "cadet_blue": 73, "sky_blue3": 74, "steel_blue1": 81, "pale_green3": 114, "sea_green3": 78, "aquamarine3": 79, "medium_turquoise": 80, "chartreuse2": 112, "sea_green2": 83, "sea_green1": 85, "aquamarine1": 122, "dark_slate_gray2": 87, "dark_magenta": 91, "dark_violet": 128, "purple": 129, "light_pink4": 95, "plum4": 96, "medium_purple3": 98, "slate_blue1": 99, "yellow4": 106, "wheat4": 101, "grey53": 102, "gray53": 102, "light_slate_grey": 103, "light_slate_gray": 103, "medium_purple": 104, "light_slate_blue": 105, "dark_olive_green3": 149, "dark_sea_green": 108, "light_sky_blue3": 110, "sky_blue2": 111, "dark_sea_green3": 150, "dark_slate_gray3": 116, "sky_blue1": 117, "chartreuse1": 118, "light_green": 120, "pale_green1": 156, "dark_slate_gray1": 123, "red3": 160, "medium_violet_red": 126, "magenta3": 164, "dark_orange3": 166, "indian_red": 167, "hot_pink3": 168, "medium_orchid3": 133, "medium_orchid": 134, "medium_purple2": 140, "dark_goldenrod": 136, "light_salmon3": 173, "rosy_brown": 138, "grey63": 139, "gray63": 139, "medium_purple1": 141, "gold3": 178, "dark_khaki": 143, "navajo_white3": 144, "grey69": 145, "gray69": 145, "light_steel_blue3": 146, "light_steel_blue": 147, "yellow3": 184, "dark_sea_green2": 157, "light_cyan3": 152, "light_sky_blue1": 153, "green_yellow": 154, "dark_olive_green2": 155, "dark_sea_green1": 193, "pale_turquoise1": 159, "deep_pink3": 162, "magenta2": 200, "hot_pink2": 169, "orchid": 170, "medium_orchid1": 207, "orange3": 172, "light_pink3": 174, "pink3": 175, "plum3": 176, "violet": 177, "light_goldenrod3": 179, "tan": 180, "misty_rose3": 181, "thistle3": 182, "plum2": 183, "khaki3": 185, "light_goldenrod2": 222, "light_yellow3": 187, "grey84": 188, "gray84": 188, "light_steel_blue1": 189, "yellow2": 190, "dark_olive_green1": 192, "honeydew2": 194, "light_cyan1": 195, "red1": 196, "deep_pink2": 197, "deep_pink1": 199, "magenta1": 201, "orange_red1": 202, "indian_red1": 204, "hot_pink": 206, "dark_orange": 208, "salmon1": 209, "light_coral": 210, "pale_violet_red1": 211, "orchid2": 212, "orchid1": 213, "orange1": 214, "sandy_brown": 215, "light_salmon1": 216, "light_pink1": 217, "pink1": 218, "plum1": 219, "gold1": 220, "navajo_white1": 223, "misty_rose1": 224, "thistle1": 225, "yellow1": 226, "light_goldenrod1": 227, "khaki1": 228, "wheat1": 229, "cornsilk1": 230, "grey100": 231, "gray100": 231, "grey3": 232, "gray3": 232, "grey7": 233, "gray7": 233, "grey11": 234, "gray11": 234, "grey15": 235, "gray15": 235, "grey19": 236, "gray19": 236, "grey23": 237, "gray23": 237, "grey27": 238, "gray27": 238, "grey30": 239, "gray30": 239, "grey35": 240, "gray35": 240, "grey39": 241, "gray39": 241, "grey42": 242, "gray42": 242, "grey46": 243, "gray46": 243, "grey50": 244, "gray50": 244, "grey54": 245, "gray54": 245, "grey58": 246, "gray58": 246, "grey62": 247, "gray62": 247, "grey66": 248, "gray66": 248, "grey70": 249, "gray70": 249, "grey74": 250, "gray74": 250, "grey78": 251, "gray78": 251, "grey82": 252, "gray82": 252, "grey85": 253, "gray85": 253, "grey89": 254, "gray89": 254, "grey93": 255, "gray93": 255, } class ColorParseError(Exception): """The color could not be parsed.""" RE_COLOR = re.compile( r"""^ \#([0-9a-f]{6})$| color\(([0-9]{1,3})\)$| rgb\(([\d\s,]+)\)$ """, re.VERBOSE, ) @rich_repr class Color(NamedTuple): """Terminal color definition.""" name: str """The name of the color (typically the input to Color.parse).""" type: ColorType """The type of the color.""" number: Optional[int] = None """The color number, if a standard color, or None.""" triplet: Optional[ColorTriplet] = None """A triplet of color components, if an RGB color.""" def __rich__(self) -> "Text": """Displays the actual color if Rich printed.""" from .style import Style from .text import Text return Text.assemble( f"", ) def __rich_repr__(self) -> Result: yield self.name yield self.type yield "number", self.number, None yield "triplet", self.triplet, None @property def system(self) -> ColorSystem: """Get the native color system for this color.""" if self.type == ColorType.DEFAULT: return ColorSystem.STANDARD return ColorSystem(int(self.type)) @property def is_system_defined(self) -> bool: """Check if the color is ultimately defined by the system.""" return self.system not in (ColorSystem.EIGHT_BIT, ColorSystem.TRUECOLOR) @property def is_default(self) -> bool: """Check if the color is a default color.""" return self.type == ColorType.DEFAULT def get_truecolor( self, theme: Optional["TerminalTheme"] = None, foreground: bool = True ) -> ColorTriplet: """Get an equivalent color triplet for this color. Args: theme (TerminalTheme, optional): Optional terminal theme, or None to use default. Defaults to None. foreground (bool, optional): True for a foreground color, or False for background. Defaults to True. Returns: ColorTriplet: A color triplet containing RGB components. """ if theme is None: theme = DEFAULT_TERMINAL_THEME if self.type == ColorType.TRUECOLOR: assert self.triplet is not None return self.triplet elif self.type == ColorType.EIGHT_BIT: assert self.number is not None return EIGHT_BIT_PALETTE[self.number] elif self.type == ColorType.STANDARD: assert self.number is not None return theme.ansi_colors[self.number] elif self.type == ColorType.WINDOWS: assert self.number is not None return WINDOWS_PALETTE[self.number] else: # self.type == ColorType.DEFAULT: assert self.number is None return theme.foreground_color if foreground else theme.background_color @classmethod def from_ansi(cls, number: int) -> "Color": """Create a Color number from it's 8-bit ansi number. Args: number (int): A number between 0-255 inclusive. Returns: Color: A new Color instance. """ return cls( name=f"color({number})", type=(ColorType.STANDARD if number < 16 else ColorType.EIGHT_BIT), number=number, ) @classmethod def from_triplet(cls, triplet: "ColorTriplet") -> "Color": """Create a truecolor RGB color from a triplet of values. Args: triplet (ColorTriplet): A color triplet containing red, green and blue components. Returns: Color: A new color object. """ return cls(name=triplet.hex, type=ColorType.TRUECOLOR, triplet=triplet) @classmethod def from_rgb(cls, red: float, green: float, blue: float) -> "Color": """Create a truecolor from three color components in the range(0->255). Args: red (float): Red component in range 0-255. green (float): Green component in range 0-255. blue (float): Blue component in range 0-255. Returns: Color: A new color object. """ return cls.from_triplet(ColorTriplet(int(red), int(green), int(blue))) @classmethod def default(cls) -> "Color": """Get a Color instance representing the default color. Returns: Color: Default color. """ return cls(name="default", type=ColorType.DEFAULT) @classmethod @lru_cache(maxsize=1024) def parse(cls, color: str) -> "Color": """Parse a color definition.""" original_color = color color = color.lower().strip() if color == "default": return cls(color, type=ColorType.DEFAULT) color_number = ANSI_COLOR_NAMES.get(color) if color_number is not None: return cls( color, type=(ColorType.STANDARD if color_number < 16 else ColorType.EIGHT_BIT), number=color_number, ) color_match = RE_COLOR.match(color) if color_match is None: raise ColorParseError(f"{original_color!r} is not a valid color") color_24, color_8, color_rgb = color_match.groups() if color_24: triplet = ColorTriplet( int(color_24[0:2], 16), int(color_24[2:4], 16), int(color_24[4:6], 16) ) return cls(color, ColorType.TRUECOLOR, triplet=triplet) elif color_8: number = int(color_8) if number > 255: raise ColorParseError(f"color number must be <= 255 in {color!r}") return cls( color, type=(ColorType.STANDARD if number < 16 else ColorType.EIGHT_BIT), number=number, ) else: # color_rgb: components = color_rgb.split(",") if len(components) != 3: raise ColorParseError( f"expected three components in {original_color!r}" ) red, green, blue = components triplet = ColorTriplet(int(red), int(green), int(blue)) if not all(component <= 255 for component in triplet): raise ColorParseError( f"color components must be <= 255 in {original_color!r}" ) return cls(color, ColorType.TRUECOLOR, triplet=triplet) @lru_cache(maxsize=1024) def get_ansi_codes(self, foreground: bool = True) -> Tuple[str, ...]: """Get the ANSI escape codes for this color.""" _type = self.type if _type == ColorType.DEFAULT: return ("39" if foreground else "49",) elif _type == ColorType.WINDOWS: number = self.number assert number is not None fore, back = (30, 40) if number < 8 else (82, 92) return (str(fore + number if foreground else back + number),) elif _type == ColorType.STANDARD: number = self.number assert number is not None fore, back = (30, 40) if number < 8 else (82, 92) return (str(fore + number if foreground else back + number),) elif _type == ColorType.EIGHT_BIT: assert self.number is not None return ("38" if foreground else "48", "5", str(self.number)) else: # self.standard == ColorStandard.TRUECOLOR: assert self.triplet is not None red, green, blue = self.triplet return ("38" if foreground else "48", "2", str(red), str(green), str(blue)) @lru_cache(maxsize=1024) def downgrade(self, system: ColorSystem) -> "Color": """Downgrade a color system to a system with fewer colors.""" if self.type in (ColorType.DEFAULT, system): return self # Convert to 8-bit color from truecolor color if system == ColorSystem.EIGHT_BIT and self.system == ColorSystem.TRUECOLOR: assert self.triplet is not None _h, l, s = rgb_to_hls(*self.triplet.normalized) # If saturation is under 15% assume it is grayscale if s < 0.15: gray = round(l * 25.0) if gray == 0: color_number = 16 elif gray == 25: color_number = 231 else: color_number = 231 + gray return Color(self.name, ColorType.EIGHT_BIT, number=color_number) red, green, blue = self.triplet six_red = red / 95 if red < 95 else 1 + (red - 95) / 40 six_green = green / 95 if green < 95 else 1 + (green - 95) / 40 six_blue = blue / 95 if blue < 95 else 1 + (blue - 95) / 40 color_number = ( 16 + 36 * round(six_red) + 6 * round(six_green) + round(six_blue) ) return Color(self.name, ColorType.EIGHT_BIT, number=color_number) # Convert to standard from truecolor or 8-bit elif system == ColorSystem.STANDARD: if self.system == ColorSystem.TRUECOLOR: assert self.triplet is not None triplet = self.triplet else: # self.system == ColorSystem.EIGHT_BIT assert self.number is not None triplet = ColorTriplet(*EIGHT_BIT_PALETTE[self.number]) color_number = STANDARD_PALETTE.match(triplet) return Color(self.name, ColorType.STANDARD, number=color_number) elif system == ColorSystem.WINDOWS: if self.system == ColorSystem.TRUECOLOR: assert self.triplet is not None triplet = self.triplet else: # self.system == ColorSystem.EIGHT_BIT assert self.number is not None if self.number < 16: return Color(self.name, ColorType.WINDOWS, number=self.number) triplet = ColorTriplet(*EIGHT_BIT_PALETTE[self.number]) color_number = WINDOWS_PALETTE.match(triplet) return Color(self.name, ColorType.WINDOWS, number=color_number) return self def parse_rgb_hex(hex_color: str) -> ColorTriplet: """Parse six hex characters in to RGB triplet.""" assert len(hex_color) == 6, "must be 6 characters" color = ColorTriplet( int(hex_color[0:2], 16), int(hex_color[2:4], 16), int(hex_color[4:6], 16) ) return color def blend_rgb( color1: ColorTriplet, color2: ColorTriplet, cross_fade: float = 0.5 ) -> ColorTriplet: """Blend one RGB color in to another.""" r1, g1, b1 = color1 r2, g2, b2 = color2 new_color = ColorTriplet( int(r1 + (r2 - r1) * cross_fade), int(g1 + (g2 - g1) * cross_fade), int(b1 + (b2 - b1) * cross_fade), ) return new_color if __name__ == "__main__": # pragma: no cover from .console import Console from .table import Table from .text import Text console = Console() table = Table(show_footer=False, show_edge=True) table.add_column("Color", width=10, overflow="ellipsis") table.add_column("Number", justify="right", style="yellow") table.add_column("Name", style="green") table.add_column("Hex", style="blue") table.add_column("RGB", style="magenta") colors = sorted((v, k) for k, v in ANSI_COLOR_NAMES.items()) for color_number, name in colors: if "grey" in name: continue color_cell = Text(" " * 10, style=f"on {name}") if color_number < 16: table.add_row(color_cell, f"{color_number}", Text(f'"{name}"')) else: color = EIGHT_BIT_PALETTE[color_number] # type: ignore[has-type] table.add_row( color_cell, str(color_number), Text(f'"{name}"'), color.hex, color.rgb ) console.print(table) ================================================ FILE: src/pip/_vendor/rich/color_triplet.py ================================================ from typing import NamedTuple, Tuple class ColorTriplet(NamedTuple): """The red, green, and blue components of a color.""" red: int """Red component in 0 to 255 range.""" green: int """Green component in 0 to 255 range.""" blue: int """Blue component in 0 to 255 range.""" @property def hex(self) -> str: """get the color triplet in CSS style.""" red, green, blue = self return f"#{red:02x}{green:02x}{blue:02x}" @property def rgb(self) -> str: """The color in RGB format. Returns: str: An rgb color, e.g. ``"rgb(100,23,255)"``. """ red, green, blue = self return f"rgb({red},{green},{blue})" @property def normalized(self) -> Tuple[float, float, float]: """Convert components into floats between 0 and 1. Returns: Tuple[float, float, float]: A tuple of three normalized colour components. """ red, green, blue = self return red / 255.0, green / 255.0, blue / 255.0 ================================================ FILE: src/pip/_vendor/rich/columns.py ================================================ from collections import defaultdict from itertools import chain from operator import itemgetter from typing import Dict, Iterable, List, Optional, Tuple from .align import Align, AlignMethod from .console import Console, ConsoleOptions, RenderableType, RenderResult from .constrain import Constrain from .measure import Measurement from .padding import Padding, PaddingDimensions from .table import Table from .text import TextType from .jupyter import JupyterMixin class Columns(JupyterMixin): """Display renderables in neat columns. Args: renderables (Iterable[RenderableType]): Any number of Rich renderables (including str). width (int, optional): The desired width of the columns, or None to auto detect. Defaults to None. padding (PaddingDimensions, optional): Optional padding around cells. Defaults to (0, 1). expand (bool, optional): Expand columns to full width. Defaults to False. equal (bool, optional): Arrange in to equal sized columns. Defaults to False. column_first (bool, optional): Align items from top to bottom (rather than left to right). Defaults to False. right_to_left (bool, optional): Start column from right hand side. Defaults to False. align (str, optional): Align value ("left", "right", or "center") or None for default. Defaults to None. title (TextType, optional): Optional title for Columns. """ def __init__( self, renderables: Optional[Iterable[RenderableType]] = None, padding: PaddingDimensions = (0, 1), *, width: Optional[int] = None, expand: bool = False, equal: bool = False, column_first: bool = False, right_to_left: bool = False, align: Optional[AlignMethod] = None, title: Optional[TextType] = None, ) -> None: self.renderables = list(renderables or []) self.width = width self.padding = padding self.expand = expand self.equal = equal self.column_first = column_first self.right_to_left = right_to_left self.align: Optional[AlignMethod] = align self.title = title def add_renderable(self, renderable: RenderableType) -> None: """Add a renderable to the columns. Args: renderable (RenderableType): Any renderable object. """ self.renderables.append(renderable) def __rich_console__( self, console: Console, options: ConsoleOptions ) -> RenderResult: render_str = console.render_str renderables = [ render_str(renderable) if isinstance(renderable, str) else renderable for renderable in self.renderables ] if not renderables: return _top, right, _bottom, left = Padding.unpack(self.padding) width_padding = max(left, right) max_width = options.max_width widths: Dict[int, int] = defaultdict(int) column_count = len(renderables) get_measurement = Measurement.get renderable_widths = [ get_measurement(console, options, renderable).maximum for renderable in renderables ] if self.equal: renderable_widths = [max(renderable_widths)] * len(renderable_widths) def iter_renderables( column_count: int, ) -> Iterable[Tuple[int, Optional[RenderableType]]]: item_count = len(renderables) if self.column_first: width_renderables = list(zip(renderable_widths, renderables)) column_lengths: List[int] = [item_count // column_count] * column_count for col_no in range(item_count % column_count): column_lengths[col_no] += 1 row_count = (item_count + column_count - 1) // column_count cells = [[-1] * column_count for _ in range(row_count)] row = col = 0 for index in range(item_count): cells[row][col] = index column_lengths[col] -= 1 if column_lengths[col]: row += 1 else: col += 1 row = 0 for index in chain.from_iterable(cells): if index == -1: break yield width_renderables[index] else: yield from zip(renderable_widths, renderables) # Pad odd elements with spaces if item_count % column_count: for _ in range(column_count - (item_count % column_count)): yield 0, None table = Table.grid(padding=self.padding, collapse_padding=True, pad_edge=False) table.expand = self.expand table.title = self.title if self.width is not None: column_count = (max_width) // (self.width + width_padding) for _ in range(column_count): table.add_column(width=self.width) else: while column_count > 1: widths.clear() column_no = 0 for renderable_width, _ in iter_renderables(column_count): widths[column_no] = max(widths[column_no], renderable_width) total_width = sum(widths.values()) + width_padding * ( len(widths) - 1 ) if total_width > max_width: column_count = len(widths) - 1 break else: column_no = (column_no + 1) % column_count else: break get_renderable = itemgetter(1) _renderables = [ get_renderable(_renderable) for _renderable in iter_renderables(column_count) ] if self.equal: _renderables = [ None if renderable is None else Constrain(renderable, renderable_widths[0]) for renderable in _renderables ] if self.align: align = self.align _Align = Align _renderables = [ None if renderable is None else _Align(renderable, align) for renderable in _renderables ] right_to_left = self.right_to_left add_row = table.add_row for start in range(0, len(_renderables), column_count): row = _renderables[start : start + column_count] if right_to_left: row = row[::-1] add_row(*row) yield table if __name__ == "__main__": # pragma: no cover import os console = Console() files = [f"{i} {s}" for i, s in enumerate(sorted(os.listdir()))] columns = Columns(files, padding=(0, 1), expand=False, equal=False) console.print(columns) console.rule() columns.column_first = True console.print(columns) columns.right_to_left = True console.rule() console.print(columns) ================================================ FILE: src/pip/_vendor/rich/console.py ================================================ import inspect import os import sys import threading import zlib from abc import ABC, abstractmethod from dataclasses import dataclass, field from datetime import datetime from functools import wraps from getpass import getpass from html import escape from inspect import isclass from itertools import islice from math import ceil from time import monotonic from types import FrameType, ModuleType, TracebackType from typing import ( IO, TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Literal, Mapping, NamedTuple, Optional, Protocol, TextIO, Tuple, Type, Union, cast, runtime_checkable, ) from pip._vendor.rich._null_file import NULL_FILE from . import errors, themes from ._emoji_replace import _emoji_replace from ._export_format import CONSOLE_HTML_FORMAT, CONSOLE_SVG_FORMAT from ._fileno import get_fileno from ._log_render import FormatTimeCallable, LogRender from .align import Align, AlignMethod from .color import ColorSystem, blend_rgb from .control import Control from .emoji import EmojiVariant from .highlighter import NullHighlighter, ReprHighlighter from .markup import render as render_markup from .measure import Measurement, measure_renderables from .pager import Pager, SystemPager from .pretty import Pretty, is_expandable from .protocol import rich_cast from .region import Region from .scope import render_scope from .screen import Screen from .segment import Segment from .style import Style, StyleType from .styled import Styled from .terminal_theme import DEFAULT_TERMINAL_THEME, SVG_EXPORT_THEME, TerminalTheme from .text import Text, TextType from .theme import Theme, ThemeStack if TYPE_CHECKING: from ._windows import WindowsConsoleFeatures from .live import Live from .status import Status JUPYTER_DEFAULT_COLUMNS = 115 JUPYTER_DEFAULT_LINES = 100 WINDOWS = sys.platform == "win32" HighlighterType = Callable[[Union[str, "Text"]], "Text"] JustifyMethod = Literal["default", "left", "center", "right", "full"] OverflowMethod = Literal["fold", "crop", "ellipsis", "ignore"] class NoChange: pass NO_CHANGE = NoChange() try: _STDIN_FILENO = sys.__stdin__.fileno() # type: ignore[union-attr] except Exception: _STDIN_FILENO = 0 try: _STDOUT_FILENO = sys.__stdout__.fileno() # type: ignore[union-attr] except Exception: _STDOUT_FILENO = 1 try: _STDERR_FILENO = sys.__stderr__.fileno() # type: ignore[union-attr] except Exception: _STDERR_FILENO = 2 _STD_STREAMS = (_STDIN_FILENO, _STDOUT_FILENO, _STDERR_FILENO) _STD_STREAMS_OUTPUT = (_STDOUT_FILENO, _STDERR_FILENO) _TERM_COLORS = { "kitty": ColorSystem.EIGHT_BIT, "256color": ColorSystem.EIGHT_BIT, "16color": ColorSystem.STANDARD, } class ConsoleDimensions(NamedTuple): """Size of the terminal.""" width: int """The width of the console in 'cells'.""" height: int """The height of the console in lines.""" @dataclass class ConsoleOptions: """Options for __rich_console__ method.""" size: ConsoleDimensions """Size of console.""" legacy_windows: bool """legacy_windows: flag for legacy windows.""" min_width: int """Minimum width of renderable.""" max_width: int """Maximum width of renderable.""" is_terminal: bool """True if the target is a terminal, otherwise False.""" encoding: str """Encoding of terminal.""" max_height: int """Height of container (starts as terminal)""" justify: Optional[JustifyMethod] = None """Justify value override for renderable.""" overflow: Optional[OverflowMethod] = None """Overflow value override for renderable.""" no_wrap: Optional[bool] = False """Disable wrapping for text.""" highlight: Optional[bool] = None """Highlight override for render_str.""" markup: Optional[bool] = None """Enable markup when rendering strings.""" height: Optional[int] = None @property def ascii_only(self) -> bool: """Check if renderables should use ascii only.""" return not self.encoding.startswith("utf") def copy(self) -> "ConsoleOptions": """Return a copy of the options. Returns: ConsoleOptions: a copy of self. """ options: ConsoleOptions = ConsoleOptions.__new__(ConsoleOptions) options.__dict__ = self.__dict__.copy() return options def update( self, *, width: Union[int, NoChange] = NO_CHANGE, min_width: Union[int, NoChange] = NO_CHANGE, max_width: Union[int, NoChange] = NO_CHANGE, justify: Union[Optional[JustifyMethod], NoChange] = NO_CHANGE, overflow: Union[Optional[OverflowMethod], NoChange] = NO_CHANGE, no_wrap: Union[Optional[bool], NoChange] = NO_CHANGE, highlight: Union[Optional[bool], NoChange] = NO_CHANGE, markup: Union[Optional[bool], NoChange] = NO_CHANGE, height: Union[Optional[int], NoChange] = NO_CHANGE, ) -> "ConsoleOptions": """Update values, return a copy.""" options = self.copy() if not isinstance(width, NoChange): options.min_width = options.max_width = max(0, width) if not isinstance(min_width, NoChange): options.min_width = min_width if not isinstance(max_width, NoChange): options.max_width = max_width if not isinstance(justify, NoChange): options.justify = justify if not isinstance(overflow, NoChange): options.overflow = overflow if not isinstance(no_wrap, NoChange): options.no_wrap = no_wrap if not isinstance(highlight, NoChange): options.highlight = highlight if not isinstance(markup, NoChange): options.markup = markup if not isinstance(height, NoChange): if height is not None: options.max_height = height options.height = None if height is None else max(0, height) return options def update_width(self, width: int) -> "ConsoleOptions": """Update just the width, return a copy. Args: width (int): New width (sets both min_width and max_width) Returns: ~ConsoleOptions: New console options instance. """ options = self.copy() options.min_width = options.max_width = max(0, width) return options def update_height(self, height: int) -> "ConsoleOptions": """Update the height, and return a copy. Args: height (int): New height Returns: ~ConsoleOptions: New Console options instance. """ options = self.copy() options.max_height = options.height = height return options def reset_height(self) -> "ConsoleOptions": """Return a copy of the options with height set to ``None``. Returns: ~ConsoleOptions: New console options instance. """ options = self.copy() options.height = None return options def update_dimensions(self, width: int, height: int) -> "ConsoleOptions": """Update the width and height, and return a copy. Args: width (int): New width (sets both min_width and max_width). height (int): New height. Returns: ~ConsoleOptions: New console options instance. """ options = self.copy() options.min_width = options.max_width = max(0, width) options.height = options.max_height = height return options @runtime_checkable class RichCast(Protocol): """An object that may be 'cast' to a console renderable.""" def __rich__( self, ) -> Union["ConsoleRenderable", "RichCast", str]: # pragma: no cover ... @runtime_checkable class ConsoleRenderable(Protocol): """An object that supports the console protocol.""" def __rich_console__( self, console: "Console", options: "ConsoleOptions" ) -> "RenderResult": # pragma: no cover ... # A type that may be rendered by Console. RenderableType = Union[ConsoleRenderable, RichCast, str] """A string or any object that may be rendered by Rich.""" # The result of calling a __rich_console__ method. RenderResult = Iterable[Union[RenderableType, Segment]] _null_highlighter = NullHighlighter() class CaptureError(Exception): """An error in the Capture context manager.""" class NewLine: """A renderable to generate new line(s)""" def __init__(self, count: int = 1) -> None: self.count = count def __rich_console__( self, console: "Console", options: "ConsoleOptions" ) -> Iterable[Segment]: yield Segment("\n" * self.count) class ScreenUpdate: """Render a list of lines at a given offset.""" def __init__(self, lines: List[List[Segment]], x: int, y: int) -> None: self._lines = lines self.x = x self.y = y def __rich_console__( self, console: "Console", options: ConsoleOptions ) -> RenderResult: x = self.x move_to = Control.move_to for offset, line in enumerate(self._lines, self.y): yield move_to(x, offset) yield from line class Capture: """Context manager to capture the result of printing to the console. See :meth:`~rich.console.Console.capture` for how to use. Args: console (Console): A console instance to capture output. """ def __init__(self, console: "Console") -> None: self._console = console self._result: Optional[str] = None def __enter__(self) -> "Capture": self._console.begin_capture() return self def __exit__( self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType], ) -> None: self._result = self._console.end_capture() def get(self) -> str: """Get the result of the capture.""" if self._result is None: raise CaptureError( "Capture result is not available until context manager exits." ) return self._result class ThemeContext: """A context manager to use a temporary theme. See :meth:`~rich.console.Console.use_theme` for usage.""" def __init__(self, console: "Console", theme: Theme, inherit: bool = True) -> None: self.console = console self.theme = theme self.inherit = inherit def __enter__(self) -> "ThemeContext": self.console.push_theme(self.theme) return self def __exit__( self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType], ) -> None: self.console.pop_theme() class PagerContext: """A context manager that 'pages' content. See :meth:`~rich.console.Console.pager` for usage.""" def __init__( self, console: "Console", pager: Optional[Pager] = None, styles: bool = False, links: bool = False, ) -> None: self._console = console self.pager = SystemPager() if pager is None else pager self.styles = styles self.links = links def __enter__(self) -> "PagerContext": self._console._enter_buffer() return self def __exit__( self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType], ) -> None: if exc_type is None: with self._console._lock: buffer: List[Segment] = self._console._buffer[:] del self._console._buffer[:] segments: Iterable[Segment] = buffer if not self.styles: segments = Segment.strip_styles(segments) elif not self.links: segments = Segment.strip_links(segments) content = self._console._render_buffer(segments) self.pager.show(content) self._console._exit_buffer() class ScreenContext: """A context manager that enables an alternative screen. See :meth:`~rich.console.Console.screen` for usage.""" def __init__( self, console: "Console", hide_cursor: bool, style: StyleType = "" ) -> None: self.console = console self.hide_cursor = hide_cursor self.screen = Screen(style=style) self._changed = False def update( self, *renderables: RenderableType, style: Optional[StyleType] = None ) -> None: """Update the screen. Args: renderable (RenderableType, optional): Optional renderable to replace current renderable, or None for no change. Defaults to None. style: (Style, optional): Replacement style, or None for no change. Defaults to None. """ if renderables: self.screen.renderable = ( Group(*renderables) if len(renderables) > 1 else renderables[0] ) if style is not None: self.screen.style = style self.console.print(self.screen, end="") def __enter__(self) -> "ScreenContext": self._changed = self.console.set_alt_screen(True) if self._changed and self.hide_cursor: self.console.show_cursor(False) return self def __exit__( self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType], ) -> None: if self._changed: self.console.set_alt_screen(False) if self.hide_cursor: self.console.show_cursor(True) class Group: """Takes a group of renderables and returns a renderable object that renders the group. Args: renderables (Iterable[RenderableType]): An iterable of renderable objects. fit (bool, optional): Fit dimension of group to contents, or fill available space. Defaults to True. """ def __init__(self, *renderables: "RenderableType", fit: bool = True) -> None: self._renderables = renderables self.fit = fit self._render: Optional[List[RenderableType]] = None @property def renderables(self) -> List["RenderableType"]: if self._render is None: self._render = list(self._renderables) return self._render def __rich_measure__( self, console: "Console", options: "ConsoleOptions" ) -> "Measurement": if self.fit: return measure_renderables(console, options, self.renderables) else: return Measurement(options.max_width, options.max_width) def __rich_console__( self, console: "Console", options: "ConsoleOptions" ) -> RenderResult: yield from self.renderables def group(fit: bool = True) -> Callable[..., Callable[..., Group]]: """A decorator that turns an iterable of renderables in to a group. Args: fit (bool, optional): Fit dimension of group to contents, or fill available space. Defaults to True. """ def decorator( method: Callable[..., Iterable[RenderableType]], ) -> Callable[..., Group]: """Convert a method that returns an iterable of renderables in to a Group.""" @wraps(method) def _replace(*args: Any, **kwargs: Any) -> Group: renderables = method(*args, **kwargs) return Group(*renderables, fit=fit) return _replace return decorator def _is_jupyter() -> bool: # pragma: no cover """Check if we're running in a Jupyter notebook.""" try: get_ipython # type: ignore[name-defined] except NameError: return False ipython = get_ipython() # type: ignore[name-defined] shell = ipython.__class__.__name__ if ( "google.colab" in str(ipython.__class__) or os.getenv("DATABRICKS_RUNTIME_VERSION") or shell == "ZMQInteractiveShell" ): return True # Jupyter notebook or qtconsole elif shell == "TerminalInteractiveShell": return False # Terminal running IPython else: return False # Other type (?) COLOR_SYSTEMS = { "standard": ColorSystem.STANDARD, "256": ColorSystem.EIGHT_BIT, "truecolor": ColorSystem.TRUECOLOR, "windows": ColorSystem.WINDOWS, } _COLOR_SYSTEMS_NAMES = {system: name for name, system in COLOR_SYSTEMS.items()} @dataclass class ConsoleThreadLocals(threading.local): """Thread local values for Console context.""" theme_stack: ThemeStack buffer: List[Segment] = field(default_factory=list) buffer_index: int = 0 class RenderHook(ABC): """Provides hooks in to the render process.""" @abstractmethod def process_renderables( self, renderables: List[ConsoleRenderable] ) -> List[ConsoleRenderable]: """Called with a list of objects to render. This method can return a new list of renderables, or modify and return the same list. Args: renderables (List[ConsoleRenderable]): A number of renderable objects. Returns: List[ConsoleRenderable]: A replacement list of renderables. """ _windows_console_features: Optional["WindowsConsoleFeatures"] = None def get_windows_console_features() -> "WindowsConsoleFeatures": # pragma: no cover global _windows_console_features if _windows_console_features is not None: return _windows_console_features from ._windows import get_windows_console_features _windows_console_features = get_windows_console_features() return _windows_console_features def detect_legacy_windows() -> bool: """Detect legacy Windows.""" return WINDOWS and not get_windows_console_features().vt class Console: """A high level console interface. Args: color_system (str, optional): The color system supported by your terminal, either ``"standard"``, ``"256"`` or ``"truecolor"``. Leave as ``"auto"`` to autodetect. force_terminal (Optional[bool], optional): Enable/disable terminal control codes, or None to auto-detect terminal. Defaults to None. force_jupyter (Optional[bool], optional): Enable/disable Jupyter rendering, or None to auto-detect Jupyter. Defaults to None. force_interactive (Optional[bool], optional): Enable/disable interactive mode, or None to auto detect. Defaults to None. soft_wrap (Optional[bool], optional): Set soft wrap default on print method. Defaults to False. theme (Theme, optional): An optional style theme object, or ``None`` for default theme. stderr (bool, optional): Use stderr rather than stdout if ``file`` is not specified. Defaults to False. file (IO, optional): A file object where the console should write to. Defaults to stdout. quiet (bool, Optional): Boolean to suppress all output. Defaults to False. width (int, optional): The width of the terminal. Leave as default to auto-detect width. height (int, optional): The height of the terminal. Leave as default to auto-detect height. style (StyleType, optional): Style to apply to all output, or None for no style. Defaults to None. no_color (Optional[bool], optional): Enabled no color mode, or None to auto detect. Defaults to None. tab_size (int, optional): Number of spaces used to replace a tab character. Defaults to 8. record (bool, optional): Boolean to enable recording of terminal output, required to call :meth:`export_html`, :meth:`export_svg`, and :meth:`export_text`. Defaults to False. markup (bool, optional): Boolean to enable :ref:`console_markup`. Defaults to True. emoji (bool, optional): Enable emoji code. Defaults to True. emoji_variant (str, optional): Optional emoji variant, either "text" or "emoji". Defaults to None. highlight (bool, optional): Enable automatic highlighting. Defaults to True. log_time (bool, optional): Boolean to enable logging of time by :meth:`log` methods. Defaults to True. log_path (bool, optional): Boolean to enable the logging of the caller by :meth:`log`. Defaults to True. log_time_format (Union[str, TimeFormatterCallable], optional): If ``log_time`` is enabled, either string for strftime or callable that formats the time. Defaults to "[%X] ". highlighter (HighlighterType, optional): Default highlighter. legacy_windows (bool, optional): Enable legacy Windows mode, or ``None`` to auto detect. Defaults to ``None``. safe_box (bool, optional): Restrict box options that don't render on legacy Windows. get_datetime (Callable[[], datetime], optional): Callable that gets the current time as a datetime.datetime object (used by Console.log), or None for datetime.now. get_time (Callable[[], time], optional): Callable that gets the current time in seconds, default uses time.monotonic. """ _environ: Mapping[str, str] = os.environ def __init__( self, *, color_system: Optional[ Literal["auto", "standard", "256", "truecolor", "windows"] ] = "auto", force_terminal: Optional[bool] = None, force_jupyter: Optional[bool] = None, force_interactive: Optional[bool] = None, soft_wrap: bool = False, theme: Optional[Theme] = None, stderr: bool = False, file: Optional[IO[str]] = None, quiet: bool = False, width: Optional[int] = None, height: Optional[int] = None, style: Optional[StyleType] = None, no_color: Optional[bool] = None, tab_size: int = 8, record: bool = False, markup: bool = True, emoji: bool = True, emoji_variant: Optional[EmojiVariant] = None, highlight: bool = True, log_time: bool = True, log_path: bool = True, log_time_format: Union[str, FormatTimeCallable] = "[%X]", highlighter: Optional["HighlighterType"] = ReprHighlighter(), legacy_windows: Optional[bool] = None, safe_box: bool = True, get_datetime: Optional[Callable[[], datetime]] = None, get_time: Optional[Callable[[], float]] = None, _environ: Optional[Mapping[str, str]] = None, ): # Copy of os.environ allows us to replace it for testing if _environ is not None: self._environ = _environ self.is_jupyter = _is_jupyter() if force_jupyter is None else force_jupyter if self.is_jupyter: if width is None: jupyter_columns = self._environ.get("JUPYTER_COLUMNS") if jupyter_columns is not None and jupyter_columns.isdigit(): width = int(jupyter_columns) else: width = JUPYTER_DEFAULT_COLUMNS if height is None: jupyter_lines = self._environ.get("JUPYTER_LINES") if jupyter_lines is not None and jupyter_lines.isdigit(): height = int(jupyter_lines) else: height = JUPYTER_DEFAULT_LINES self.tab_size = tab_size self.record = record self._markup = markup self._emoji = emoji self._emoji_variant: Optional[EmojiVariant] = emoji_variant self._highlight = highlight self.legacy_windows: bool = ( (detect_legacy_windows() and not self.is_jupyter) if legacy_windows is None else legacy_windows ) if width is None: columns = self._environ.get("COLUMNS") if columns is not None and columns.isdigit(): width = int(columns) - self.legacy_windows if height is None: lines = self._environ.get("LINES") if lines is not None and lines.isdigit(): height = int(lines) self.soft_wrap = soft_wrap self._width = width self._height = height self._color_system: Optional[ColorSystem] self._force_terminal = None if force_terminal is not None: self._force_terminal = force_terminal self._file = file self.quiet = quiet self.stderr = stderr if color_system is None: self._color_system = None elif color_system == "auto": self._color_system = self._detect_color_system() else: self._color_system = COLOR_SYSTEMS[color_system] self._lock = threading.RLock() self._log_render = LogRender( show_time=log_time, show_path=log_path, time_format=log_time_format, ) self.highlighter: HighlighterType = highlighter or _null_highlighter self.safe_box = safe_box self.get_datetime = get_datetime or datetime.now self.get_time = get_time or monotonic self.style = style self.no_color = ( no_color if no_color is not None else self._environ.get("NO_COLOR", "") != "" ) if force_interactive is None: tty_interactive = self._environ.get("TTY_INTERACTIVE", None) if tty_interactive is not None: if tty_interactive == "0": force_interactive = False elif tty_interactive == "1": force_interactive = True self.is_interactive = ( (self.is_terminal and not self.is_dumb_terminal) if force_interactive is None else force_interactive ) self._record_buffer_lock = threading.RLock() self._thread_locals = ConsoleThreadLocals( theme_stack=ThemeStack(themes.DEFAULT if theme is None else theme) ) self._record_buffer: List[Segment] = [] self._render_hooks: List[RenderHook] = [] self._live_stack: List[Live] = [] self._is_alt_screen = False def __repr__(self) -> str: return f"" @property def file(self) -> IO[str]: """Get the file object to write to.""" file = self._file or (sys.stderr if self.stderr else sys.stdout) file = getattr(file, "rich_proxied_file", file) if file is None: file = NULL_FILE return file @file.setter def file(self, new_file: IO[str]) -> None: """Set a new file object.""" self._file = new_file @property def _buffer(self) -> List[Segment]: """Get a thread local buffer.""" return self._thread_locals.buffer @property def _buffer_index(self) -> int: """Get a thread local buffer.""" return self._thread_locals.buffer_index @_buffer_index.setter def _buffer_index(self, value: int) -> None: self._thread_locals.buffer_index = value @property def _theme_stack(self) -> ThemeStack: """Get the thread local theme stack.""" return self._thread_locals.theme_stack def _detect_color_system(self) -> Optional[ColorSystem]: """Detect color system from env vars.""" if self.is_jupyter: return ColorSystem.TRUECOLOR if not self.is_terminal or self.is_dumb_terminal: return None if WINDOWS: # pragma: no cover if self.legacy_windows: # pragma: no cover return ColorSystem.WINDOWS windows_console_features = get_windows_console_features() return ( ColorSystem.TRUECOLOR if windows_console_features.truecolor else ColorSystem.EIGHT_BIT ) else: color_term = self._environ.get("COLORTERM", "").strip().lower() if color_term in ("truecolor", "24bit"): return ColorSystem.TRUECOLOR term = self._environ.get("TERM", "").strip().lower() _term_name, _hyphen, colors = term.rpartition("-") color_system = _TERM_COLORS.get(colors, ColorSystem.STANDARD) return color_system def _enter_buffer(self) -> None: """Enter in to a buffer context, and buffer all output.""" self._buffer_index += 1 def _exit_buffer(self) -> None: """Leave buffer context, and render content if required.""" self._buffer_index -= 1 self._check_buffer() def set_live(self, live: "Live") -> bool: """Set Live instance. Used by Live context manager (no need to call directly). Args: live (Live): Live instance using this Console. Returns: Boolean that indicates if the live is the topmost of the stack. Raises: errors.LiveError: If this Console has a Live context currently active. """ with self._lock: self._live_stack.append(live) return len(self._live_stack) == 1 def clear_live(self) -> None: """Clear the Live instance. Used by the Live context manager (no need to call directly).""" with self._lock: self._live_stack.pop() def push_render_hook(self, hook: RenderHook) -> None: """Add a new render hook to the stack. Args: hook (RenderHook): Render hook instance. """ with self._lock: self._render_hooks.append(hook) def pop_render_hook(self) -> None: """Pop the last renderhook from the stack.""" with self._lock: self._render_hooks.pop() def __enter__(self) -> "Console": """Own context manager to enter buffer context.""" self._enter_buffer() return self def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: """Exit buffer context.""" self._exit_buffer() def begin_capture(self) -> None: """Begin capturing console output. Call :meth:`end_capture` to exit capture mode and return output.""" self._enter_buffer() def end_capture(self) -> str: """End capture mode and return captured string. Returns: str: Console output. """ render_result = self._render_buffer(self._buffer) del self._buffer[:] self._exit_buffer() return render_result def push_theme(self, theme: Theme, *, inherit: bool = True) -> None: """Push a new theme on to the top of the stack, replacing the styles from the previous theme. Generally speaking, you should call :meth:`~rich.console.Console.use_theme` to get a context manager, rather than calling this method directly. Args: theme (Theme): A theme instance. inherit (bool, optional): Inherit existing styles. Defaults to True. """ self._theme_stack.push_theme(theme, inherit=inherit) def pop_theme(self) -> None: """Remove theme from top of stack, restoring previous theme.""" self._theme_stack.pop_theme() def use_theme(self, theme: Theme, *, inherit: bool = True) -> ThemeContext: """Use a different theme for the duration of the context manager. Args: theme (Theme): Theme instance to user. inherit (bool, optional): Inherit existing console styles. Defaults to True. Returns: ThemeContext: [description] """ return ThemeContext(self, theme, inherit) @property def color_system(self) -> Optional[str]: """Get color system string. Returns: Optional[str]: "standard", "256" or "truecolor". """ if self._color_system is not None: return _COLOR_SYSTEMS_NAMES[self._color_system] else: return None @property def encoding(self) -> str: """Get the encoding of the console file, e.g. ``"utf-8"``. Returns: str: A standard encoding string. """ return (getattr(self.file, "encoding", "utf-8") or "utf-8").lower() @property def is_terminal(self) -> bool: """Check if the console is writing to a terminal. Returns: bool: True if the console writing to a device capable of understanding escape sequences, otherwise False. """ # If dev has explicitly set this value, return it if self._force_terminal is not None: return self._force_terminal # Fudge for Idle if hasattr(sys.stdin, "__module__") and sys.stdin.__module__.startswith( "idlelib" ): # Return False for Idle which claims to be a tty but can't handle ansi codes return False if self.is_jupyter: # return False for Jupyter, which may have FORCE_COLOR set return False environ = self._environ tty_compatible = environ.get("TTY_COMPATIBLE", "") # 0 indicates device is not tty compatible if tty_compatible == "0": return False # 1 indicates device is tty compatible if tty_compatible == "1": return True # https://force-color.org/ force_color = environ.get("FORCE_COLOR") if force_color is not None: return force_color != "" # Any other value defaults to auto detect isatty: Optional[Callable[[], bool]] = getattr(self.file, "isatty", None) try: return False if isatty is None else isatty() except ValueError: # in some situation (at the end of a pytest run for example) isatty() can raise # ValueError: I/O operation on closed file # return False because we aren't in a terminal anymore return False @property def is_dumb_terminal(self) -> bool: """Detect dumb terminal. Returns: bool: True if writing to a dumb terminal, otherwise False. """ _term = self._environ.get("TERM", "") is_dumb = _term.lower() in ("dumb", "unknown") return self.is_terminal and is_dumb @property def options(self) -> ConsoleOptions: """Get default console options.""" size = self.size return ConsoleOptions( max_height=size.height, size=size, legacy_windows=self.legacy_windows, min_width=1, max_width=size.width, encoding=self.encoding, is_terminal=self.is_terminal, ) @property def size(self) -> ConsoleDimensions: """Get the size of the console. Returns: ConsoleDimensions: A named tuple containing the dimensions. """ if self._width is not None and self._height is not None: return ConsoleDimensions(self._width - self.legacy_windows, self._height) if self.is_dumb_terminal: return ConsoleDimensions(80, 25) width: Optional[int] = None height: Optional[int] = None streams = _STD_STREAMS_OUTPUT if WINDOWS else _STD_STREAMS for file_descriptor in streams: try: width, height = os.get_terminal_size(file_descriptor) except (AttributeError, ValueError, OSError): # Probably not a terminal pass else: break columns = self._environ.get("COLUMNS") if columns is not None and columns.isdigit(): width = int(columns) lines = self._environ.get("LINES") if lines is not None and lines.isdigit(): height = int(lines) # get_terminal_size can report 0, 0 if run from pseudo-terminal width = width or 80 height = height or 25 return ConsoleDimensions( width - self.legacy_windows if self._width is None else self._width, height if self._height is None else self._height, ) @size.setter def size(self, new_size: Tuple[int, int]) -> None: """Set a new size for the terminal. Args: new_size (Tuple[int, int]): New width and height. """ width, height = new_size self._width = width self._height = height @property def width(self) -> int: """Get the width of the console. Returns: int: The width (in characters) of the console. """ return self.size.width @width.setter def width(self, width: int) -> None: """Set width. Args: width (int): New width. """ self._width = width @property def height(self) -> int: """Get the height of the console. Returns: int: The height (in lines) of the console. """ return self.size.height @height.setter def height(self, height: int) -> None: """Set height. Args: height (int): new height. """ self._height = height def bell(self) -> None: """Play a 'bell' sound (if supported by the terminal).""" self.control(Control.bell()) def capture(self) -> Capture: """A context manager to *capture* the result of print() or log() in a string, rather than writing it to the console. Example: >>> from rich.console import Console >>> console = Console() >>> with console.capture() as capture: ... console.print("[bold magenta]Hello World[/]") >>> print(capture.get()) Returns: Capture: Context manager with disables writing to the terminal. """ capture = Capture(self) return capture def pager( self, pager: Optional[Pager] = None, styles: bool = False, links: bool = False ) -> PagerContext: """A context manager to display anything printed within a "pager". The pager application is defined by the system and will typically support at least pressing a key to scroll. Args: pager (Pager, optional): A pager object, or None to use :class:`~rich.pager.SystemPager`. Defaults to None. styles (bool, optional): Show styles in pager. Defaults to False. links (bool, optional): Show links in pager. Defaults to False. Example: >>> from rich.console import Console >>> from rich.__main__ import make_test_card >>> console = Console() >>> with console.pager(): console.print(make_test_card()) Returns: PagerContext: A context manager. """ return PagerContext(self, pager=pager, styles=styles, links=links) def line(self, count: int = 1) -> None: """Write new line(s). Args: count (int, optional): Number of new lines. Defaults to 1. """ assert count >= 0, "count must be >= 0" self.print(NewLine(count)) def clear(self, home: bool = True) -> None: """Clear the screen. Args: home (bool, optional): Also move the cursor to 'home' position. Defaults to True. """ if home: self.control(Control.clear(), Control.home()) else: self.control(Control.clear()) def status( self, status: RenderableType, *, spinner: str = "dots", spinner_style: StyleType = "status.spinner", speed: float = 1.0, refresh_per_second: float = 12.5, ) -> "Status": """Display a status and spinner. Args: status (RenderableType): A status renderable (str or Text typically). spinner (str, optional): Name of spinner animation (see python -m rich.spinner). Defaults to "dots". spinner_style (StyleType, optional): Style of spinner. Defaults to "status.spinner". speed (float, optional): Speed factor for spinner animation. Defaults to 1.0. refresh_per_second (float, optional): Number of refreshes per second. Defaults to 12.5. Returns: Status: A Status object that may be used as a context manager. """ from .status import Status status_renderable = Status( status, console=self, spinner=spinner, spinner_style=spinner_style, speed=speed, refresh_per_second=refresh_per_second, ) return status_renderable def show_cursor(self, show: bool = True) -> bool: """Show or hide the cursor. Args: show (bool, optional): Set visibility of the cursor. """ if self.is_terminal: self.control(Control.show_cursor(show)) return True return False def set_alt_screen(self, enable: bool = True) -> bool: """Enables alternative screen mode. Note, if you enable this mode, you should ensure that is disabled before the application exits. See :meth:`~rich.Console.screen` for a context manager that handles this for you. Args: enable (bool, optional): Enable (True) or disable (False) alternate screen. Defaults to True. Returns: bool: True if the control codes were written. """ changed = False if self.is_terminal and not self.legacy_windows: self.control(Control.alt_screen(enable)) changed = True self._is_alt_screen = enable return changed @property def is_alt_screen(self) -> bool: """Check if the alt screen was enabled. Returns: bool: True if the alt screen was enabled, otherwise False. """ return self._is_alt_screen def set_window_title(self, title: str) -> bool: """Set the title of the console terminal window. Warning: There is no means within Rich of "resetting" the window title to its previous value, meaning the title you set will persist even after your application exits. ``fish`` shell resets the window title before and after each command by default, negating this issue. Windows Terminal and command prompt will also reset the title for you. Most other shells and terminals, however, do not do this. Some terminals may require configuration changes before you can set the title. Some terminals may not support setting the title at all. Other software (including the terminal itself, the shell, custom prompts, plugins, etc.) may also set the terminal window title. This could result in whatever value you write using this method being overwritten. Args: title (str): The new title of the terminal window. Returns: bool: True if the control code to change the terminal title was written, otherwise False. Note that a return value of True does not guarantee that the window title has actually changed, since the feature may be unsupported/disabled in some terminals. """ if self.is_terminal: self.control(Control.title(title)) return True return False def screen( self, hide_cursor: bool = True, style: Optional[StyleType] = None ) -> "ScreenContext": """Context manager to enable and disable 'alternative screen' mode. Args: hide_cursor (bool, optional): Also hide the cursor. Defaults to False. style (Style, optional): Optional style for screen. Defaults to None. Returns: ~ScreenContext: Context which enables alternate screen on enter, and disables it on exit. """ return ScreenContext(self, hide_cursor=hide_cursor, style=style or "") def measure( self, renderable: RenderableType, *, options: Optional[ConsoleOptions] = None ) -> Measurement: """Measure a renderable. Returns a :class:`~rich.measure.Measurement` object which contains information regarding the number of characters required to print the renderable. Args: renderable (RenderableType): Any renderable or string. options (Optional[ConsoleOptions], optional): Options to use when measuring, or None to use default options. Defaults to None. Returns: Measurement: A measurement of the renderable. """ measurement = Measurement.get(self, options or self.options, renderable) return measurement def render( self, renderable: RenderableType, options: Optional[ConsoleOptions] = None ) -> Iterable[Segment]: """Render an object in to an iterable of `Segment` instances. This method contains the logic for rendering objects with the console protocol. You are unlikely to need to use it directly, unless you are extending the library. Args: renderable (RenderableType): An object supporting the console protocol, or an object that may be converted to a string. options (ConsoleOptions, optional): An options object, or None to use self.options. Defaults to None. Returns: Iterable[Segment]: An iterable of segments that may be rendered. """ _options = options or self.options if _options.max_width < 1: # No space to render anything. This prevents potential recursion errors. return render_iterable: RenderResult renderable = rich_cast(renderable) if hasattr(renderable, "__rich_console__") and not isclass(renderable): render_iterable = renderable.__rich_console__(self, _options) elif isinstance(renderable, str): text_renderable = self.render_str( renderable, highlight=_options.highlight, markup=_options.markup ) render_iterable = text_renderable.__rich_console__(self, _options) else: raise errors.NotRenderableError( f"Unable to render {renderable!r}; " "A str, Segment or object with __rich_console__ method is required" ) try: iter_render = iter(render_iterable) except TypeError: raise errors.NotRenderableError( f"object {render_iterable!r} is not renderable" ) _Segment = Segment _options = _options.reset_height() for render_output in iter_render: if isinstance(render_output, _Segment): yield render_output else: yield from self.render(render_output, _options) def render_lines( self, renderable: RenderableType, options: Optional[ConsoleOptions] = None, *, style: Optional[Style] = None, pad: bool = True, new_lines: bool = False, ) -> List[List[Segment]]: """Render objects in to a list of lines. The output of render_lines is useful when further formatting of rendered console text is required, such as the Panel class which draws a border around any renderable object. Args: renderable (RenderableType): Any object renderable in the console. options (Optional[ConsoleOptions], optional): Console options, or None to use self.options. Default to ``None``. style (Style, optional): Optional style to apply to renderables. Defaults to ``None``. pad (bool, optional): Pad lines shorter than render width. Defaults to ``True``. new_lines (bool, optional): Include "\n" characters at end of lines. Returns: List[List[Segment]]: A list of lines, where a line is a list of Segment objects. """ with self._lock: render_options = options or self.options _rendered = self.render(renderable, render_options) if style: _rendered = Segment.apply_style(_rendered, style) render_height = render_options.height if render_height is not None: render_height = max(0, render_height) lines = list( islice( Segment.split_and_crop_lines( _rendered, render_options.max_width, include_new_lines=new_lines, pad=pad, style=style, ), None, render_height, ) ) if render_options.height is not None: extra_lines = render_options.height - len(lines) if extra_lines > 0: pad_line = [ ( [ Segment(" " * render_options.max_width, style), Segment("\n"), ] if new_lines else [Segment(" " * render_options.max_width, style)] ) ] lines.extend(pad_line * extra_lines) return lines def render_str( self, text: str, *, style: Union[str, Style] = "", justify: Optional[JustifyMethod] = None, overflow: Optional[OverflowMethod] = None, emoji: Optional[bool] = None, markup: Optional[bool] = None, highlight: Optional[bool] = None, highlighter: Optional[HighlighterType] = None, ) -> "Text": """Convert a string to a Text instance. This is called automatically if you print or log a string. Args: text (str): Text to render. style (Union[str, Style], optional): Style to apply to rendered text. justify (str, optional): Justify method: "default", "left", "center", "full", or "right". Defaults to ``None``. overflow (str, optional): Overflow method: "crop", "fold", or "ellipsis". Defaults to ``None``. emoji (Optional[bool], optional): Enable emoji, or ``None`` to use Console default. markup (Optional[bool], optional): Enable markup, or ``None`` to use Console default. highlight (Optional[bool], optional): Enable highlighting, or ``None`` to use Console default. highlighter (HighlighterType, optional): Optional highlighter to apply. Returns: ConsoleRenderable: Renderable object. """ emoji_enabled = emoji or (emoji is None and self._emoji) markup_enabled = markup or (markup is None and self._markup) highlight_enabled = highlight or (highlight is None and self._highlight) if markup_enabled: rich_text = render_markup( text, style=style, emoji=emoji_enabled, emoji_variant=self._emoji_variant, ) rich_text.justify = justify rich_text.overflow = overflow else: rich_text = Text( ( _emoji_replace(text, default_variant=self._emoji_variant) if emoji_enabled else text ), justify=justify, overflow=overflow, style=style, ) _highlighter = (highlighter or self.highlighter) if highlight_enabled else None if _highlighter is not None: highlight_text = _highlighter(str(rich_text)) highlight_text.copy_styles(rich_text) return highlight_text return rich_text def get_style( self, name: Union[str, Style], *, default: Optional[Union[Style, str]] = None ) -> Style: """Get a Style instance by its theme name or parse a definition. Args: name (str): The name of a style or a style definition. Returns: Style: A Style object. Raises: MissingStyle: If no style could be parsed from name. """ if isinstance(name, Style): return name try: style = self._theme_stack.get(name) if style is None: style = Style.parse(name) return style.copy() if style.link else style except errors.StyleSyntaxError as error: if default is not None: return self.get_style(default) raise errors.MissingStyle( f"Failed to get style {name!r}; {error}" ) from None def _collect_renderables( self, objects: Iterable[Any], sep: str, end: str, *, justify: Optional[JustifyMethod] = None, emoji: Optional[bool] = None, markup: Optional[bool] = None, highlight: Optional[bool] = None, ) -> List[ConsoleRenderable]: """Combine a number of renderables and text into one renderable. Args: objects (Iterable[Any]): Anything that Rich can render. sep (str): String to write between print data. end (str): String to write at end of print data. justify (str, optional): One of "left", "right", "center", or "full". Defaults to ``None``. emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Returns: List[ConsoleRenderable]: A list of things to render. """ renderables: List[ConsoleRenderable] = [] _append = renderables.append text: List[Text] = [] append_text = text.append append = _append if justify in ("left", "center", "right"): def align_append(renderable: RenderableType) -> None: _append(Align(renderable, cast(AlignMethod, justify))) append = align_append _highlighter: HighlighterType = _null_highlighter if highlight or (highlight is None and self._highlight): _highlighter = self.highlighter def check_text() -> None: if text: sep_text = Text(sep, justify=justify, end=end) append(sep_text.join(text)) text.clear() for renderable in objects: renderable = rich_cast(renderable) if isinstance(renderable, str): append_text( self.render_str( renderable, emoji=emoji, markup=markup, highlight=highlight, highlighter=_highlighter, ) ) elif isinstance(renderable, Text): append_text(renderable) elif isinstance(renderable, ConsoleRenderable): check_text() append(renderable) elif is_expandable(renderable): check_text() append(Pretty(renderable, highlighter=_highlighter)) else: append_text(_highlighter(str(renderable))) check_text() if self.style is not None: style = self.get_style(self.style) renderables = [Styled(renderable, style) for renderable in renderables] return renderables def rule( self, title: TextType = "", *, characters: str = "─", style: Union[str, Style] = "rule.line", align: AlignMethod = "center", ) -> None: """Draw a line with optional centered title. Args: title (str, optional): Text to render over the rule. Defaults to "". characters (str, optional): Character(s) to form the line. Defaults to "─". style (str, optional): Style of line. Defaults to "rule.line". align (str, optional): How to align the title, one of "left", "center", or "right". Defaults to "center". """ from .rule import Rule rule = Rule(title=title, characters=characters, style=style, align=align) self.print(rule) def control(self, *control: Control) -> None: """Insert non-printing control codes. Args: control_codes (str): Control codes, such as those that may move the cursor. """ if not self.is_dumb_terminal: with self: self._buffer.extend(_control.segment for _control in control) def out( self, *objects: Any, sep: str = " ", end: str = "\n", style: Optional[Union[str, Style]] = None, highlight: Optional[bool] = None, ) -> None: """Output to the terminal. This is a low-level way of writing to the terminal which unlike :meth:`~rich.console.Console.print` won't pretty print, wrap text, or apply markup, but will optionally apply highlighting and a basic style. Args: sep (str, optional): String to write between print data. Defaults to " ". end (str, optional): String to write at end of print data. Defaults to "\\\\n". style (Union[str, Style], optional): A style to apply to output. Defaults to None. highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``. """ raw_output: str = sep.join(str(_object) for _object in objects) self.print( raw_output, style=style, highlight=highlight, emoji=False, markup=False, no_wrap=True, overflow="ignore", crop=False, end=end, ) def print( self, *objects: Any, sep: str = " ", end: str = "\n", style: Optional[Union[str, Style]] = None, justify: Optional[JustifyMethod] = None, overflow: Optional[OverflowMethod] = None, no_wrap: Optional[bool] = None, emoji: Optional[bool] = None, markup: Optional[bool] = None, highlight: Optional[bool] = None, width: Optional[int] = None, height: Optional[int] = None, crop: bool = True, soft_wrap: Optional[bool] = None, new_line_start: bool = False, ) -> None: """Print to the console. Args: objects (positional args): Objects to log to the terminal. sep (str, optional): String to write between print data. Defaults to " ". end (str, optional): String to write at end of print data. Defaults to "\\\\n". style (Union[str, Style], optional): A style to apply to output. Defaults to None. justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``. overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None. no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None. emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``. markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``. highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``. width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``. crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True. soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for Console default. Defaults to ``None``. new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``. """ if not objects: objects = (NewLine(),) if soft_wrap is None: soft_wrap = self.soft_wrap if soft_wrap: if no_wrap is None: no_wrap = True if overflow is None: overflow = "ignore" crop = False render_hooks = self._render_hooks[:] with self: renderables = self._collect_renderables( objects, sep, end, justify=justify, emoji=emoji, markup=markup, highlight=highlight, ) for hook in render_hooks: renderables = hook.process_renderables(renderables) render_options = self.options.update( justify=justify, overflow=overflow, width=min(width, self.width) if width is not None else NO_CHANGE, height=height, no_wrap=no_wrap, markup=markup, highlight=highlight, ) new_segments: List[Segment] = [] extend = new_segments.extend render = self.render if style is None: for renderable in renderables: extend(render(renderable, render_options)) else: for renderable in renderables: extend( Segment.apply_style( render(renderable, render_options), self.get_style(style) ) ) if new_line_start: if ( len("".join(segment.text for segment in new_segments).splitlines()) > 1 ): new_segments.insert(0, Segment.line()) if crop: buffer_extend = self._buffer.extend for line in Segment.split_and_crop_lines( new_segments, self.width, pad=False ): buffer_extend(line) else: self._buffer.extend(new_segments) def print_json( self, json: Optional[str] = None, *, data: Any = None, indent: Union[None, int, str] = 2, highlight: bool = True, skip_keys: bool = False, ensure_ascii: bool = False, check_circular: bool = True, allow_nan: bool = True, default: Optional[Callable[[Any], Any]] = None, sort_keys: bool = False, ) -> None: """Pretty prints JSON. Output will be valid JSON. Args: json (Optional[str]): A string containing JSON. data (Any): If json is not supplied, then encode this data. indent (Union[None, int, str], optional): Number of spaces to indent. Defaults to 2. highlight (bool, optional): Enable highlighting of output: Defaults to True. skip_keys (bool, optional): Skip keys not of a basic type. Defaults to False. ensure_ascii (bool, optional): Escape all non-ascii characters. Defaults to False. check_circular (bool, optional): Check for circular references. Defaults to True. allow_nan (bool, optional): Allow NaN and Infinity values. Defaults to True. default (Callable, optional): A callable that converts values that can not be encoded in to something that can be JSON encoded. Defaults to None. sort_keys (bool, optional): Sort dictionary keys. Defaults to False. """ from pip._vendor.rich.json import JSON if json is None: json_renderable = JSON.from_data( data, indent=indent, highlight=highlight, skip_keys=skip_keys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, default=default, sort_keys=sort_keys, ) else: if not isinstance(json, str): raise TypeError( f"json must be str. Did you mean print_json(data={json!r}) ?" ) json_renderable = JSON( json, indent=indent, highlight=highlight, skip_keys=skip_keys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, default=default, sort_keys=sort_keys, ) self.print(json_renderable, soft_wrap=True) def update_screen( self, renderable: RenderableType, *, region: Optional[Region] = None, options: Optional[ConsoleOptions] = None, ) -> None: """Update the screen at a given offset. Args: renderable (RenderableType): A Rich renderable. region (Region, optional): Region of screen to update, or None for entire screen. Defaults to None. x (int, optional): x offset. Defaults to 0. y (int, optional): y offset. Defaults to 0. Raises: errors.NoAltScreen: If the Console isn't in alt screen mode. """ if not self.is_alt_screen: raise errors.NoAltScreen("Alt screen must be enabled to call update_screen") render_options = options or self.options if region is None: x = y = 0 render_options = render_options.update_dimensions( render_options.max_width, render_options.height or self.height ) else: x, y, width, height = region render_options = render_options.update_dimensions(width, height) lines = self.render_lines(renderable, options=render_options) self.update_screen_lines(lines, x, y) def update_screen_lines( self, lines: List[List[Segment]], x: int = 0, y: int = 0 ) -> None: """Update lines of the screen at a given offset. Args: lines (List[List[Segment]]): Rendered lines (as produced by :meth:`~rich.Console.render_lines`). x (int, optional): x offset (column no). Defaults to 0. y (int, optional): y offset (column no). Defaults to 0. Raises: errors.NoAltScreen: If the Console isn't in alt screen mode. """ if not self.is_alt_screen: raise errors.NoAltScreen("Alt screen must be enabled to call update_screen") screen_update = ScreenUpdate(lines, x, y) segments = self.render(screen_update) self._buffer.extend(segments) self._check_buffer() def print_exception( self, *, width: Optional[int] = 100, extra_lines: int = 3, theme: Optional[str] = None, word_wrap: bool = False, show_locals: bool = False, suppress: Iterable[Union[str, ModuleType]] = (), max_frames: int = 100, ) -> None: """Prints a rich render of the last exception and traceback. Args: width (Optional[int], optional): Number of characters used to render code. Defaults to 100. extra_lines (int, optional): Additional lines of code to render. Defaults to 3. theme (str, optional): Override pygments theme used in traceback word_wrap (bool, optional): Enable word wrapping of long lines. Defaults to False. show_locals (bool, optional): Enable display of local variables. Defaults to False. suppress (Iterable[Union[str, ModuleType]]): Optional sequence of modules or paths to exclude from traceback. max_frames (int): Maximum number of frames to show in a traceback, 0 for no maximum. Defaults to 100. """ from .traceback import Traceback traceback = Traceback( width=width, extra_lines=extra_lines, theme=theme, word_wrap=word_wrap, show_locals=show_locals, suppress=suppress, max_frames=max_frames, ) self.print(traceback) @staticmethod def _caller_frame_info( offset: int, currentframe: Callable[[], Optional[FrameType]] = inspect.currentframe, ) -> Tuple[str, int, Dict[str, Any]]: """Get caller frame information. Args: offset (int): the caller offset within the current frame stack. currentframe (Callable[[], Optional[FrameType]], optional): the callable to use to retrieve the current frame. Defaults to ``inspect.currentframe``. Returns: Tuple[str, int, Dict[str, Any]]: A tuple containing the filename, the line number and the dictionary of local variables associated with the caller frame. Raises: RuntimeError: If the stack offset is invalid. """ # Ignore the frame of this local helper offset += 1 frame = currentframe() if frame is not None: # Use the faster currentframe where implemented while offset and frame is not None: frame = frame.f_back offset -= 1 assert frame is not None return frame.f_code.co_filename, frame.f_lineno, frame.f_locals else: # Fallback to the slower stack frame_info = inspect.stack()[offset] return frame_info.filename, frame_info.lineno, frame_info.frame.f_locals def log( self, *objects: Any, sep: str = " ", end: str = "\n", style: Optional[Union[str, Style]] = None, justify: Optional[JustifyMethod] = None, emoji: Optional[bool] = None, markup: Optional[bool] = None, highlight: Optional[bool] = None, log_locals: bool = False, _stack_offset: int = 1, ) -> None: """Log rich content to the terminal. Args: objects (positional args): Objects to log to the terminal. sep (str, optional): String to write between print data. Defaults to " ". end (str, optional): String to write at end of print data. Defaults to "\\\\n". style (Union[str, Style], optional): A style to apply to output. Defaults to None. justify (str, optional): One of "left", "right", "center", or "full". Defaults to ``None``. emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to None. markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to None. highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to None. log_locals (bool, optional): Boolean to enable logging of locals where ``log()`` was called. Defaults to False. _stack_offset (int, optional): Offset of caller from end of call stack. Defaults to 1. """ if not objects: objects = (NewLine(),) render_hooks = self._render_hooks[:] with self: renderables = self._collect_renderables( objects, sep, end, justify=justify, emoji=emoji, markup=markup, highlight=highlight, ) if style is not None: renderables = [Styled(renderable, style) for renderable in renderables] filename, line_no, locals = self._caller_frame_info(_stack_offset) link_path = None if filename.startswith("<") else os.path.abspath(filename) path = filename.rpartition(os.sep)[-1] if log_locals: locals_map = { key: value for key, value in locals.items() if not key.startswith("__") } renderables.append(render_scope(locals_map, title="[i]locals")) renderables = [ self._log_render( self, renderables, log_time=self.get_datetime(), path=path, line_no=line_no, link_path=link_path, ) ] for hook in render_hooks: renderables = hook.process_renderables(renderables) new_segments: List[Segment] = [] extend = new_segments.extend render = self.render render_options = self.options for renderable in renderables: extend(render(renderable, render_options)) buffer_extend = self._buffer.extend for line in Segment.split_and_crop_lines( new_segments, self.width, pad=False ): buffer_extend(line) def on_broken_pipe(self) -> None: """This function is called when a `BrokenPipeError` is raised. This can occur when piping Textual output in Linux and macOS. The default implementation is to exit the app, but you could implement this method in a subclass to change the behavior. See https://docs.python.org/3/library/signal.html#note-on-sigpipe for details. """ self.quiet = True devnull = os.open(os.devnull, os.O_WRONLY) os.dup2(devnull, sys.stdout.fileno()) raise SystemExit(1) def _check_buffer(self) -> None: """Check if the buffer may be rendered. Render it if it can (e.g. Console.quiet is False) Rendering is supported on Windows, Unix and Jupyter environments. For legacy Windows consoles, the win32 API is called directly. This method will also record what it renders if recording is enabled via Console.record. """ if self.quiet: del self._buffer[:] return try: self._write_buffer() except BrokenPipeError: self.on_broken_pipe() def _write_buffer(self) -> None: """Write the buffer to the output file.""" with self._lock: if self.record and not self._buffer_index: with self._record_buffer_lock: self._record_buffer.extend(self._buffer[:]) if self._buffer_index == 0: if self.is_jupyter: # pragma: no cover from .jupyter import display display(self._buffer, self._render_buffer(self._buffer[:])) del self._buffer[:] else: if WINDOWS: use_legacy_windows_render = False if self.legacy_windows: fileno = get_fileno(self.file) if fileno is not None: use_legacy_windows_render = ( fileno in _STD_STREAMS_OUTPUT ) if use_legacy_windows_render: from pip._vendor.rich._win32_console import LegacyWindowsTerm from pip._vendor.rich._windows_renderer import legacy_windows_render buffer = self._buffer[:] if self.no_color and self._color_system: buffer = list(Segment.remove_color(buffer)) legacy_windows_render(buffer, LegacyWindowsTerm(self.file)) else: # Either a non-std stream on legacy Windows, or modern Windows. text = self._render_buffer(self._buffer[:]) # https://bugs.python.org/issue37871 # https://github.com/python/cpython/issues/82052 # We need to avoid writing more than 32Kb in a single write, due to the above bug write = self.file.write # Worse case scenario, every character is 4 bytes of utf-8 MAX_WRITE = 32 * 1024 // 4 try: if len(text) <= MAX_WRITE: write(text) else: batch: List[str] = [] batch_append = batch.append size = 0 for line in text.splitlines(True): if size + len(line) > MAX_WRITE and batch: write("".join(batch)) batch.clear() size = 0 batch_append(line) size += len(line) if batch: write("".join(batch)) batch.clear() except UnicodeEncodeError as error: error.reason = f"{error.reason}\n*** You may need to add PYTHONIOENCODING=utf-8 to your environment ***" raise else: text = self._render_buffer(self._buffer[:]) try: self.file.write(text) except UnicodeEncodeError as error: error.reason = f"{error.reason}\n*** You may need to add PYTHONIOENCODING=utf-8 to your environment ***" raise self.file.flush() del self._buffer[:] def _render_buffer(self, buffer: Iterable[Segment]) -> str: """Render buffered output, and clear buffer.""" output: List[str] = [] append = output.append color_system = self._color_system legacy_windows = self.legacy_windows not_terminal = not self.is_terminal if self.no_color and color_system: buffer = Segment.remove_color(buffer) for text, style, control in buffer: if style: append( style.render( text, color_system=color_system, legacy_windows=legacy_windows, ) ) elif not (not_terminal and control): append(text) rendered = "".join(output) return rendered def input( self, prompt: TextType = "", *, markup: bool = True, emoji: bool = True, password: bool = False, stream: Optional[TextIO] = None, ) -> str: """Displays a prompt and waits for input from the user. The prompt may contain color / style. It works in the same way as Python's builtin :func:`input` function and provides elaborate line editing and history features if Python's builtin :mod:`readline` module is previously loaded. Args: prompt (Union[str, Text]): Text to render in the prompt. markup (bool, optional): Enable console markup (requires a str prompt). Defaults to True. emoji (bool, optional): Enable emoji (requires a str prompt). Defaults to True. password: (bool, optional): Hide typed text. Defaults to False. stream: (TextIO, optional): Optional file to read input from (rather than stdin). Defaults to None. Returns: str: Text read from stdin. """ if prompt: self.print(prompt, markup=markup, emoji=emoji, end="") if password: result = getpass("", stream=stream) else: if stream: result = stream.readline() else: result = input() return result def export_text(self, *, clear: bool = True, styles: bool = False) -> str: """Generate text from console contents (requires record=True argument in constructor). Args: clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``. styles (bool, optional): If ``True``, ansi escape codes will be included. ``False`` for plain text. Defaults to ``False``. Returns: str: String containing console contents. """ assert ( self.record ), "To export console contents set record=True in the constructor or instance" with self._record_buffer_lock: if styles: text = "".join( (style.render(text) if style else text) for text, style, _ in self._record_buffer ) else: text = "".join( segment.text for segment in self._record_buffer if not segment.control ) if clear: del self._record_buffer[:] return text def save_text(self, path: str, *, clear: bool = True, styles: bool = False) -> None: """Generate text from console and save to a given location (requires record=True argument in constructor). Args: path (str): Path to write text files. clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``. styles (bool, optional): If ``True``, ansi style codes will be included. ``False`` for plain text. Defaults to ``False``. """ text = self.export_text(clear=clear, styles=styles) with open(path, "w", encoding="utf-8") as write_file: write_file.write(text) def export_html( self, *, theme: Optional[TerminalTheme] = None, clear: bool = True, code_format: Optional[str] = None, inline_styles: bool = False, ) -> str: """Generate HTML from console contents (requires record=True argument in constructor). Args: theme (TerminalTheme, optional): TerminalTheme object containing console colors. clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``. code_format (str, optional): Format string to render HTML. In addition to '{foreground}', '{background}', and '{code}', should contain '{stylesheet}' if inline_styles is ``False``. inline_styles (bool, optional): If ``True`` styles will be inlined in to spans, which makes files larger but easier to cut and paste markup. If ``False``, styles will be embedded in a style tag. Defaults to False. Returns: str: String containing console contents as HTML. """ assert ( self.record ), "To export console contents set record=True in the constructor or instance" fragments: List[str] = [] append = fragments.append _theme = theme or DEFAULT_TERMINAL_THEME stylesheet = "" render_code_format = CONSOLE_HTML_FORMAT if code_format is None else code_format with self._record_buffer_lock: if inline_styles: for text, style, _ in Segment.filter_control( Segment.simplify(self._record_buffer) ): text = escape(text) if style: rule = style.get_html_style(_theme) if style.link: text = f'{text}' text = f'{text}' if rule else text append(text) else: styles: Dict[str, int] = {} for text, style, _ in Segment.filter_control( Segment.simplify(self._record_buffer) ): text = escape(text) if style: rule = style.get_html_style(_theme) style_number = styles.setdefault(rule, len(styles) + 1) if style.link: text = f'{text}' else: text = f'{text}' append(text) stylesheet_rules: List[str] = [] stylesheet_append = stylesheet_rules.append for style_rule, style_number in styles.items(): if style_rule: stylesheet_append(f".r{style_number} {{{style_rule}}}") stylesheet = "\n".join(stylesheet_rules) rendered_code = render_code_format.format( code="".join(fragments), stylesheet=stylesheet, foreground=_theme.foreground_color.hex, background=_theme.background_color.hex, ) if clear: del self._record_buffer[:] return rendered_code def save_html( self, path: str, *, theme: Optional[TerminalTheme] = None, clear: bool = True, code_format: str = CONSOLE_HTML_FORMAT, inline_styles: bool = False, ) -> None: """Generate HTML from console contents and write to a file (requires record=True argument in constructor). Args: path (str): Path to write html file. theme (TerminalTheme, optional): TerminalTheme object containing console colors. clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``. code_format (str, optional): Format string to render HTML. In addition to '{foreground}', '{background}', and '{code}', should contain '{stylesheet}' if inline_styles is ``False``. inline_styles (bool, optional): If ``True`` styles will be inlined in to spans, which makes files larger but easier to cut and paste markup. If ``False``, styles will be embedded in a style tag. Defaults to False. """ html = self.export_html( theme=theme, clear=clear, code_format=code_format, inline_styles=inline_styles, ) with open(path, "w", encoding="utf-8") as write_file: write_file.write(html) def export_svg( self, *, title: str = "Rich", theme: Optional[TerminalTheme] = None, clear: bool = True, code_format: str = CONSOLE_SVG_FORMAT, font_aspect_ratio: float = 0.61, unique_id: Optional[str] = None, ) -> str: """ Generate an SVG from the console contents (requires record=True in Console constructor). Args: title (str, optional): The title of the tab in the output image theme (TerminalTheme, optional): The ``TerminalTheme`` object to use to style the terminal clear (bool, optional): Clear record buffer after exporting. Defaults to ``True`` code_format (str, optional): Format string used to generate the SVG. Rich will inject a number of variables into the string in order to form the final SVG output. The default template used and the variables injected by Rich can be found by inspecting the ``console.CONSOLE_SVG_FORMAT`` variable. font_aspect_ratio (float, optional): The width to height ratio of the font used in the ``code_format`` string. Defaults to 0.61, which is the width to height ratio of Fira Code (the default font). If you aren't specifying a different font inside ``code_format``, you probably don't need this. unique_id (str, optional): unique id that is used as the prefix for various elements (CSS styles, node ids). If not set, this defaults to a computed value based on the recorded content. """ from pip._vendor.rich.cells import cell_len style_cache: Dict[Style, str] = {} def get_svg_style(style: Style) -> str: """Convert a Style to CSS rules for SVG.""" if style in style_cache: return style_cache[style] css_rules = [] color = ( _theme.foreground_color if (style.color is None or style.color.is_default) else style.color.get_truecolor(_theme) ) bgcolor = ( _theme.background_color if (style.bgcolor is None or style.bgcolor.is_default) else style.bgcolor.get_truecolor(_theme) ) if style.reverse: color, bgcolor = bgcolor, color if style.dim: color = blend_rgb(color, bgcolor, 0.4) css_rules.append(f"fill: {color.hex}") if style.bold: css_rules.append("font-weight: bold") if style.italic: css_rules.append("font-style: italic;") if style.underline: css_rules.append("text-decoration: underline;") if style.strike: css_rules.append("text-decoration: line-through;") css = ";".join(css_rules) style_cache[style] = css return css _theme = theme or SVG_EXPORT_THEME width = self.width char_height = 20 char_width = char_height * font_aspect_ratio line_height = char_height * 1.22 margin_top = 1 margin_right = 1 margin_bottom = 1 margin_left = 1 padding_top = 40 padding_right = 8 padding_bottom = 8 padding_left = 8 padding_width = padding_left + padding_right padding_height = padding_top + padding_bottom margin_width = margin_left + margin_right margin_height = margin_top + margin_bottom text_backgrounds: List[str] = [] text_group: List[str] = [] classes: Dict[str, int] = {} style_no = 1 def escape_text(text: str) -> str: """HTML escape text and replace spaces with nbsp.""" return escape(text).replace(" ", " ") def make_tag( name: str, content: Optional[str] = None, **attribs: object ) -> str: """Make a tag from name, content, and attributes.""" def stringify(value: object) -> str: if isinstance(value, (float)): return format(value, "g") return str(value) tag_attribs = " ".join( f'{k.lstrip("_").replace("_", "-")}="{stringify(v)}"' for k, v in attribs.items() ) return ( f"<{name} {tag_attribs}>{content}" if content else f"<{name} {tag_attribs}/>" ) with self._record_buffer_lock: segments = list(Segment.filter_control(self._record_buffer)) if clear: self._record_buffer.clear() if unique_id is None: unique_id = "terminal-" + str( zlib.adler32( ("".join(repr(segment) for segment in segments)).encode( "utf-8", "ignore", ) + title.encode("utf-8", "ignore") ) ) y = 0 for y, line in enumerate(Segment.split_and_crop_lines(segments, length=width)): x = 0 for text, style, _control in line: style = style or Style() rules = get_svg_style(style) if rules not in classes: classes[rules] = style_no style_no += 1 class_name = f"r{classes[rules]}" if style.reverse: has_background = True background = ( _theme.foreground_color.hex if style.color is None else style.color.get_truecolor(_theme).hex ) else: bgcolor = style.bgcolor has_background = bgcolor is not None and not bgcolor.is_default background = ( _theme.background_color.hex if style.bgcolor is None else style.bgcolor.get_truecolor(_theme).hex ) text_length = cell_len(text) if has_background: text_backgrounds.append( make_tag( "rect", fill=background, x=x * char_width, y=y * line_height + 1.5, width=char_width * text_length, height=line_height + 0.25, shape_rendering="crispEdges", ) ) if text != " " * len(text): text_group.append( make_tag( "text", escape_text(text), _class=f"{unique_id}-{class_name}", x=x * char_width, y=y * line_height + char_height, textLength=char_width * len(text), clip_path=f"url(#{unique_id}-line-{y})", ) ) x += cell_len(text) line_offsets = [line_no * line_height + 1.5 for line_no in range(y)] lines = "\n".join( f""" {make_tag("rect", x=0, y=offset, width=char_width * width, height=line_height + 0.25)} """ for line_no, offset in enumerate(line_offsets) ) styles = "\n".join( f".{unique_id}-r{rule_no} {{ {css} }}" for css, rule_no in classes.items() ) backgrounds = "".join(text_backgrounds) matrix = "".join(text_group) terminal_width = ceil(width * char_width + padding_width) terminal_height = (y + 1) * line_height + padding_height chrome = make_tag( "rect", fill=_theme.background_color.hex, stroke="rgba(255,255,255,0.35)", stroke_width="1", x=margin_left, y=margin_top, width=terminal_width, height=terminal_height, rx=8, ) title_color = _theme.foreground_color.hex if title: chrome += make_tag( "text", escape_text(title), _class=f"{unique_id}-title", fill=title_color, text_anchor="middle", x=terminal_width // 2, y=margin_top + char_height + 6, ) chrome += f""" """ svg = code_format.format( unique_id=unique_id, char_width=char_width, char_height=char_height, line_height=line_height, terminal_width=char_width * width - 1, terminal_height=(y + 1) * line_height - 1, width=terminal_width + margin_width, height=terminal_height + margin_height, terminal_x=margin_left + padding_left, terminal_y=margin_top + padding_top, styles=styles, chrome=chrome, backgrounds=backgrounds, matrix=matrix, lines=lines, ) return svg def save_svg( self, path: str, *, title: str = "Rich", theme: Optional[TerminalTheme] = None, clear: bool = True, code_format: str = CONSOLE_SVG_FORMAT, font_aspect_ratio: float = 0.61, unique_id: Optional[str] = None, ) -> None: """Generate an SVG file from the console contents (requires record=True in Console constructor). Args: path (str): The path to write the SVG to. title (str, optional): The title of the tab in the output image theme (TerminalTheme, optional): The ``TerminalTheme`` object to use to style the terminal clear (bool, optional): Clear record buffer after exporting. Defaults to ``True`` code_format (str, optional): Format string used to generate the SVG. Rich will inject a number of variables into the string in order to form the final SVG output. The default template used and the variables injected by Rich can be found by inspecting the ``console.CONSOLE_SVG_FORMAT`` variable. font_aspect_ratio (float, optional): The width to height ratio of the font used in the ``code_format`` string. Defaults to 0.61, which is the width to height ratio of Fira Code (the default font). If you aren't specifying a different font inside ``code_format``, you probably don't need this. unique_id (str, optional): unique id that is used as the prefix for various elements (CSS styles, node ids). If not set, this defaults to a computed value based on the recorded content. """ svg = self.export_svg( title=title, theme=theme, clear=clear, code_format=code_format, font_aspect_ratio=font_aspect_ratio, unique_id=unique_id, ) with open(path, "w", encoding="utf-8") as write_file: write_file.write(svg) def _svg_hash(svg_main_code: str) -> str: """Returns a unique hash for the given SVG main code. Args: svg_main_code (str): The content we're going to inject in the SVG envelope. Returns: str: a hash of the given content """ return str(zlib.adler32(svg_main_code.encode())) if __name__ == "__main__": # pragma: no cover console = Console(record=True) console.log( "JSONRPC [i]request[/i]", 5, 1.3, True, False, None, { "jsonrpc": "2.0", "method": "subtract", "params": {"minuend": 42, "subtrahend": 23}, "id": 3, }, ) console.log("Hello, World!", "{'a': 1}", repr(console)) console.print( { "name": None, "empty": [], "quiz": { "sport": { "answered": True, "q1": { "question": "Which one is correct team name in NBA?", "options": [ "New York Bulls", "Los Angeles Kings", "Golden State Warriors", "Huston Rocket", ], "answer": "Huston Rocket", }, }, "maths": { "answered": False, "q1": { "question": "5 + 7 = ?", "options": [10, 11, 12, 13], "answer": 12, }, "q2": { "question": "12 - 8 = ?", "options": [1, 2, 3, 4], "answer": 4, }, }, }, } ) ================================================ FILE: src/pip/_vendor/rich/constrain.py ================================================ from typing import Optional, TYPE_CHECKING from .jupyter import JupyterMixin from .measure import Measurement if TYPE_CHECKING: from .console import Console, ConsoleOptions, RenderableType, RenderResult class Constrain(JupyterMixin): """Constrain the width of a renderable to a given number of characters. Args: renderable (RenderableType): A renderable object. width (int, optional): The maximum width (in characters) to render. Defaults to 80. """ def __init__(self, renderable: "RenderableType", width: Optional[int] = 80) -> None: self.renderable = renderable self.width = width def __rich_console__( self, console: "Console", options: "ConsoleOptions" ) -> "RenderResult": if self.width is None: yield self.renderable else: child_options = options.update_width(min(self.width, options.max_width)) yield from console.render(self.renderable, child_options) def __rich_measure__( self, console: "Console", options: "ConsoleOptions" ) -> "Measurement": if self.width is not None: options = options.update_width(self.width) measurement = Measurement.get(console, options, self.renderable) return measurement ================================================ FILE: src/pip/_vendor/rich/containers.py ================================================ from itertools import zip_longest from typing import ( TYPE_CHECKING, Iterable, Iterator, List, Optional, TypeVar, Union, overload, ) if TYPE_CHECKING: from .console import ( Console, ConsoleOptions, JustifyMethod, OverflowMethod, RenderResult, RenderableType, ) from .text import Text from .cells import cell_len from .measure import Measurement T = TypeVar("T") class Renderables: """A list subclass which renders its contents to the console.""" def __init__( self, renderables: Optional[Iterable["RenderableType"]] = None ) -> None: self._renderables: List["RenderableType"] = ( list(renderables) if renderables is not None else [] ) def __rich_console__( self, console: "Console", options: "ConsoleOptions" ) -> "RenderResult": """Console render method to insert line-breaks.""" yield from self._renderables def __rich_measure__( self, console: "Console", options: "ConsoleOptions" ) -> "Measurement": dimensions = [ Measurement.get(console, options, renderable) for renderable in self._renderables ] if not dimensions: return Measurement(1, 1) _min = max(dimension.minimum for dimension in dimensions) _max = max(dimension.maximum for dimension in dimensions) return Measurement(_min, _max) def append(self, renderable: "RenderableType") -> None: self._renderables.append(renderable) def __iter__(self) -> Iterable["RenderableType"]: return iter(self._renderables) class Lines: """A list subclass which can render to the console.""" def __init__(self, lines: Iterable["Text"] = ()) -> None: self._lines: List["Text"] = list(lines) def __repr__(self) -> str: return f"Lines({self._lines!r})" def __iter__(self) -> Iterator["Text"]: return iter(self._lines) @overload def __getitem__(self, index: int) -> "Text": ... @overload def __getitem__(self, index: slice) -> List["Text"]: ... def __getitem__(self, index: Union[slice, int]) -> Union["Text", List["Text"]]: return self._lines[index] def __setitem__(self, index: int, value: "Text") -> "Lines": self._lines[index] = value return self def __len__(self) -> int: return self._lines.__len__() def __rich_console__( self, console: "Console", options: "ConsoleOptions" ) -> "RenderResult": """Console render method to insert line-breaks.""" yield from self._lines def append(self, line: "Text") -> None: self._lines.append(line) def extend(self, lines: Iterable["Text"]) -> None: self._lines.extend(lines) def pop(self, index: int = -1) -> "Text": return self._lines.pop(index) def justify( self, console: "Console", width: int, justify: "JustifyMethod" = "left", overflow: "OverflowMethod" = "fold", ) -> None: """Justify and overflow text to a given width. Args: console (Console): Console instance. width (int): Number of cells available per line. justify (str, optional): Default justify method for text: "left", "center", "full" or "right". Defaults to "left". overflow (str, optional): Default overflow for text: "crop", "fold", or "ellipsis". Defaults to "fold". """ from .text import Text if justify == "left": for line in self._lines: line.truncate(width, overflow=overflow, pad=True) elif justify == "center": for line in self._lines: line.rstrip() line.truncate(width, overflow=overflow) line.pad_left((width - cell_len(line.plain)) // 2) line.pad_right(width - cell_len(line.plain)) elif justify == "right": for line in self._lines: line.rstrip() line.truncate(width, overflow=overflow) line.pad_left(width - cell_len(line.plain)) elif justify == "full": for line_index, line in enumerate(self._lines): if line_index == len(self._lines) - 1: break words = line.split(" ") words_size = sum(cell_len(word.plain) for word in words) num_spaces = len(words) - 1 spaces = [1 for _ in range(num_spaces)] index = 0 if spaces: while words_size + num_spaces < width: spaces[len(spaces) - index - 1] += 1 num_spaces += 1 index = (index + 1) % len(spaces) tokens: List[Text] = [] for index, (word, next_word) in enumerate( zip_longest(words, words[1:]) ): tokens.append(word) if index < len(spaces): style = word.get_style_at_offset(console, -1) next_style = next_word.get_style_at_offset(console, 0) space_style = style if style == next_style else line.style tokens.append(Text(" " * spaces[index], style=space_style)) self[line_index] = Text("").join(tokens) ================================================ FILE: src/pip/_vendor/rich/control.py ================================================ import time from typing import TYPE_CHECKING, Callable, Dict, Iterable, List, Union, Final from .segment import ControlCode, ControlType, Segment if TYPE_CHECKING: from .console import Console, ConsoleOptions, RenderResult STRIP_CONTROL_CODES: Final = [ 7, # Bell 8, # Backspace 11, # Vertical tab 12, # Form feed 13, # Carriage return ] _CONTROL_STRIP_TRANSLATE: Final = { _codepoint: None for _codepoint in STRIP_CONTROL_CODES } CONTROL_ESCAPE: Final = { 7: "\\a", 8: "\\b", 11: "\\v", 12: "\\f", 13: "\\r", } CONTROL_CODES_FORMAT: Dict[int, Callable[..., str]] = { ControlType.BELL: lambda: "\x07", ControlType.CARRIAGE_RETURN: lambda: "\r", ControlType.HOME: lambda: "\x1b[H", ControlType.CLEAR: lambda: "\x1b[2J", ControlType.ENABLE_ALT_SCREEN: lambda: "\x1b[?1049h", ControlType.DISABLE_ALT_SCREEN: lambda: "\x1b[?1049l", ControlType.SHOW_CURSOR: lambda: "\x1b[?25h", ControlType.HIDE_CURSOR: lambda: "\x1b[?25l", ControlType.CURSOR_UP: lambda param: f"\x1b[{param}A", ControlType.CURSOR_DOWN: lambda param: f"\x1b[{param}B", ControlType.CURSOR_FORWARD: lambda param: f"\x1b[{param}C", ControlType.CURSOR_BACKWARD: lambda param: f"\x1b[{param}D", ControlType.CURSOR_MOVE_TO_COLUMN: lambda param: f"\x1b[{param+1}G", ControlType.ERASE_IN_LINE: lambda param: f"\x1b[{param}K", ControlType.CURSOR_MOVE_TO: lambda x, y: f"\x1b[{y+1};{x+1}H", ControlType.SET_WINDOW_TITLE: lambda title: f"\x1b]0;{title}\x07", } class Control: """A renderable that inserts a control code (non printable but may move cursor). Args: *codes (str): Positional arguments are either a :class:`~rich.segment.ControlType` enum or a tuple of ControlType and an integer parameter """ __slots__ = ["segment"] def __init__(self, *codes: Union[ControlType, ControlCode]) -> None: control_codes: List[ControlCode] = [ (code,) if isinstance(code, ControlType) else code for code in codes ] _format_map = CONTROL_CODES_FORMAT rendered_codes = "".join( _format_map[code](*parameters) for code, *parameters in control_codes ) self.segment = Segment(rendered_codes, None, control_codes) @classmethod def bell(cls) -> "Control": """Ring the 'bell'.""" return cls(ControlType.BELL) @classmethod def home(cls) -> "Control": """Move cursor to 'home' position.""" return cls(ControlType.HOME) @classmethod def move(cls, x: int = 0, y: int = 0) -> "Control": """Move cursor relative to current position. Args: x (int): X offset. y (int): Y offset. Returns: ~Control: Control object. """ def get_codes() -> Iterable[ControlCode]: control = ControlType if x: yield ( control.CURSOR_FORWARD if x > 0 else control.CURSOR_BACKWARD, abs(x), ) if y: yield ( control.CURSOR_DOWN if y > 0 else control.CURSOR_UP, abs(y), ) control = cls(*get_codes()) return control @classmethod def move_to_column(cls, x: int, y: int = 0) -> "Control": """Move to the given column, optionally add offset to row. Returns: x (int): absolute x (column) y (int): optional y offset (row) Returns: ~Control: Control object. """ return ( cls( (ControlType.CURSOR_MOVE_TO_COLUMN, x), ( ControlType.CURSOR_DOWN if y > 0 else ControlType.CURSOR_UP, abs(y), ), ) if y else cls((ControlType.CURSOR_MOVE_TO_COLUMN, x)) ) @classmethod def move_to(cls, x: int, y: int) -> "Control": """Move cursor to absolute position. Args: x (int): x offset (column) y (int): y offset (row) Returns: ~Control: Control object. """ return cls((ControlType.CURSOR_MOVE_TO, x, y)) @classmethod def clear(cls) -> "Control": """Clear the screen.""" return cls(ControlType.CLEAR) @classmethod def show_cursor(cls, show: bool) -> "Control": """Show or hide the cursor.""" return cls(ControlType.SHOW_CURSOR if show else ControlType.HIDE_CURSOR) @classmethod def alt_screen(cls, enable: bool) -> "Control": """Enable or disable alt screen.""" if enable: return cls(ControlType.ENABLE_ALT_SCREEN, ControlType.HOME) else: return cls(ControlType.DISABLE_ALT_SCREEN) @classmethod def title(cls, title: str) -> "Control": """Set the terminal window title Args: title (str): The new terminal window title """ return cls((ControlType.SET_WINDOW_TITLE, title)) def __str__(self) -> str: return self.segment.text def __rich_console__( self, console: "Console", options: "ConsoleOptions" ) -> "RenderResult": if self.segment.text: yield self.segment def strip_control_codes( text: str, _translate_table: Dict[int, None] = _CONTROL_STRIP_TRANSLATE ) -> str: """Remove control codes from text. Args: text (str): A string possibly contain control codes. Returns: str: String with control codes removed. """ return text.translate(_translate_table) def escape_control_codes( text: str, _translate_table: Dict[int, str] = CONTROL_ESCAPE, ) -> str: """Replace control codes with their "escaped" equivalent in the given text. (e.g. "\b" becomes "\\b") Args: text (str): A string possibly containing control codes. Returns: str: String with control codes replaced with their escaped version. """ return text.translate(_translate_table) if __name__ == "__main__": # pragma: no cover from pip._vendor.rich.console import Console console = Console() console.print("Look at the title of your terminal window ^") # console.print(Control((ControlType.SET_WINDOW_TITLE, "Hello, world!"))) for i in range(10): console.set_window_title("🚀 Loading" + "." * i) time.sleep(0.5) ================================================ FILE: src/pip/_vendor/rich/default_styles.py ================================================ from typing import Dict from .style import Style DEFAULT_STYLES: Dict[str, Style] = { "none": Style.null(), "reset": Style( color="default", bgcolor="default", dim=False, bold=False, italic=False, underline=False, blink=False, blink2=False, reverse=False, conceal=False, strike=False, ), "dim": Style(dim=True), "bright": Style(dim=False), "bold": Style(bold=True), "strong": Style(bold=True), "code": Style(reverse=True, bold=True), "italic": Style(italic=True), "emphasize": Style(italic=True), "underline": Style(underline=True), "blink": Style(blink=True), "blink2": Style(blink2=True), "reverse": Style(reverse=True), "strike": Style(strike=True), "black": Style(color="black"), "red": Style(color="red"), "green": Style(color="green"), "yellow": Style(color="yellow"), "magenta": Style(color="magenta"), "cyan": Style(color="cyan"), "white": Style(color="white"), "inspect.attr": Style(color="yellow", italic=True), "inspect.attr.dunder": Style(color="yellow", italic=True, dim=True), "inspect.callable": Style(bold=True, color="red"), "inspect.async_def": Style(italic=True, color="bright_cyan"), "inspect.def": Style(italic=True, color="bright_cyan"), "inspect.class": Style(italic=True, color="bright_cyan"), "inspect.error": Style(bold=True, color="red"), "inspect.equals": Style(), "inspect.help": Style(color="cyan"), "inspect.doc": Style(dim=True), "inspect.value.border": Style(color="green"), "live.ellipsis": Style(bold=True, color="red"), "layout.tree.row": Style(dim=False, color="red"), "layout.tree.column": Style(dim=False, color="blue"), "logging.keyword": Style(bold=True, color="yellow"), "logging.level.notset": Style(dim=True), "logging.level.debug": Style(color="green"), "logging.level.info": Style(color="blue"), "logging.level.warning": Style(color="yellow"), "logging.level.error": Style(color="red", bold=True), "logging.level.critical": Style(color="red", bold=True, reverse=True), "log.level": Style.null(), "log.time": Style(color="cyan", dim=True), "log.message": Style.null(), "log.path": Style(dim=True), "repr.ellipsis": Style(color="yellow"), "repr.indent": Style(color="green", dim=True), "repr.error": Style(color="red", bold=True), "repr.str": Style(color="green", italic=False, bold=False), "repr.brace": Style(bold=True), "repr.comma": Style(bold=True), "repr.ipv4": Style(bold=True, color="bright_green"), "repr.ipv6": Style(bold=True, color="bright_green"), "repr.eui48": Style(bold=True, color="bright_green"), "repr.eui64": Style(bold=True, color="bright_green"), "repr.tag_start": Style(bold=True), "repr.tag_name": Style(color="bright_magenta", bold=True), "repr.tag_contents": Style(color="default"), "repr.tag_end": Style(bold=True), "repr.attrib_name": Style(color="yellow", italic=False), "repr.attrib_equal": Style(bold=True), "repr.attrib_value": Style(color="magenta", italic=False), "repr.number": Style(color="cyan", bold=True, italic=False), "repr.number_complex": Style(color="cyan", bold=True, italic=False), # same "repr.bool_true": Style(color="bright_green", italic=True), "repr.bool_false": Style(color="bright_red", italic=True), "repr.none": Style(color="magenta", italic=True), "repr.url": Style(underline=True, color="bright_blue", italic=False, bold=False), "repr.uuid": Style(color="bright_yellow", bold=False), "repr.call": Style(color="magenta", bold=True), "repr.path": Style(color="magenta"), "repr.filename": Style(color="bright_magenta"), "rule.line": Style(color="bright_green"), "rule.text": Style.null(), "json.brace": Style(bold=True), "json.bool_true": Style(color="bright_green", italic=True), "json.bool_false": Style(color="bright_red", italic=True), "json.null": Style(color="magenta", italic=True), "json.number": Style(color="cyan", bold=True, italic=False), "json.str": Style(color="green", italic=False, bold=False), "json.key": Style(color="blue", bold=True), "prompt": Style.null(), "prompt.choices": Style(color="magenta", bold=True), "prompt.default": Style(color="cyan", bold=True), "prompt.invalid": Style(color="red"), "prompt.invalid.choice": Style(color="red"), "pretty": Style.null(), "scope.border": Style(color="blue"), "scope.key": Style(color="yellow", italic=True), "scope.key.special": Style(color="yellow", italic=True, dim=True), "scope.equals": Style(color="red"), "table.header": Style(bold=True), "table.footer": Style(bold=True), "table.cell": Style.null(), "table.title": Style(italic=True), "table.caption": Style(italic=True, dim=True), "traceback.error": Style(color="red", italic=True), "traceback.border.syntax_error": Style(color="bright_red"), "traceback.border": Style(color="red"), "traceback.text": Style.null(), "traceback.title": Style(color="red", bold=True), "traceback.exc_type": Style(color="bright_red", bold=True), "traceback.exc_value": Style.null(), "traceback.offset": Style(color="bright_red", bold=True), "traceback.error_range": Style(underline=True, bold=True), "traceback.note": Style(color="green", bold=True), "traceback.group.border": Style(color="magenta"), "bar.back": Style(color="grey23"), "bar.complete": Style(color="rgb(249,38,114)"), "bar.finished": Style(color="rgb(114,156,31)"), "bar.pulse": Style(color="rgb(249,38,114)"), "progress.description": Style.null(), "progress.filesize": Style(color="green"), "progress.filesize.total": Style(color="green"), "progress.download": Style(color="green"), "progress.elapsed": Style(color="yellow"), "progress.percentage": Style(color="magenta"), "progress.remaining": Style(color="cyan"), "progress.data.speed": Style(color="red"), "progress.spinner": Style(color="green"), "status.spinner": Style(color="green"), "tree": Style(), "tree.line": Style(), "markdown.paragraph": Style(), "markdown.text": Style(), "markdown.em": Style(italic=True), "markdown.emph": Style(italic=True), # For commonmark backwards compatibility "markdown.strong": Style(bold=True), "markdown.code": Style(bold=True, color="cyan", bgcolor="black"), "markdown.code_block": Style(color="cyan", bgcolor="black"), "markdown.block_quote": Style(color="magenta"), "markdown.list": Style(color="cyan"), "markdown.item": Style(), "markdown.item.bullet": Style(color="yellow", bold=True), "markdown.item.number": Style(color="yellow", bold=True), "markdown.hr": Style(color="yellow"), "markdown.h1.border": Style(), "markdown.h1": Style(bold=True), "markdown.h2": Style(bold=True, underline=True), "markdown.h3": Style(bold=True), "markdown.h4": Style(bold=True, dim=True), "markdown.h5": Style(underline=True), "markdown.h6": Style(italic=True), "markdown.h7": Style(italic=True, dim=True), "markdown.link": Style(color="bright_blue"), "markdown.link_url": Style(color="blue", underline=True), "markdown.s": Style(strike=True), "iso8601.date": Style(color="blue"), "iso8601.time": Style(color="magenta"), "iso8601.timezone": Style(color="yellow"), } if __name__ == "__main__": # pragma: no cover import argparse import io from pip._vendor.rich.console import Console from pip._vendor.rich.table import Table from pip._vendor.rich.text import Text parser = argparse.ArgumentParser() parser.add_argument("--html", action="store_true", help="Export as HTML table") args = parser.parse_args() html: bool = args.html console = Console(record=True, width=70, file=io.StringIO()) if html else Console() table = Table("Name", "Styling") for style_name, style in DEFAULT_STYLES.items(): table.add_row(Text(style_name, style=style), str(style)) console.print(table) if html: print(console.export_html(inline_styles=True)) ================================================ FILE: src/pip/_vendor/rich/diagnose.py ================================================ import os import platform from pip._vendor.rich import inspect from pip._vendor.rich.console import Console, get_windows_console_features from pip._vendor.rich.panel import Panel from pip._vendor.rich.pretty import Pretty def report() -> None: # pragma: no cover """Print a report to the terminal with debugging information""" console = Console() inspect(console) features = get_windows_console_features() inspect(features) env_names = ( "CLICOLOR", "COLORTERM", "COLUMNS", "JPY_PARENT_PID", "JUPYTER_COLUMNS", "JUPYTER_LINES", "LINES", "NO_COLOR", "TERM_PROGRAM", "TERM", "TTY_COMPATIBLE", "TTY_INTERACTIVE", "VSCODE_VERBOSE_LOGGING", ) env = {name: os.getenv(name) for name in env_names} console.print(Panel.fit((Pretty(env)), title="[b]Environment Variables")) console.print(f'platform="{platform.system()}"') if __name__ == "__main__": # pragma: no cover report() ================================================ FILE: src/pip/_vendor/rich/emoji.py ================================================ import sys from typing import TYPE_CHECKING, Optional, Union, Literal from .jupyter import JupyterMixin from .segment import Segment from .style import Style from ._emoji_codes import EMOJI from ._emoji_replace import _emoji_replace if TYPE_CHECKING: from .console import Console, ConsoleOptions, RenderResult EmojiVariant = Literal["emoji", "text"] class NoEmoji(Exception): """No emoji by that name.""" class Emoji(JupyterMixin): __slots__ = ["name", "style", "_char", "variant"] VARIANTS = {"text": "\uFE0E", "emoji": "\uFE0F"} def __init__( self, name: str, style: Union[str, Style] = "none", variant: Optional[EmojiVariant] = None, ) -> None: """A single emoji character. Args: name (str): Name of emoji. style (Union[str, Style], optional): Optional style. Defaults to None. Raises: NoEmoji: If the emoji doesn't exist. """ self.name = name self.style = style self.variant = variant try: self._char = EMOJI[name] except KeyError: raise NoEmoji(f"No emoji called {name!r}") if variant is not None: self._char += self.VARIANTS.get(variant, "") @classmethod def replace(cls, text: str) -> str: """Replace emoji markup with corresponding unicode characters. Args: text (str): A string with emojis codes, e.g. "Hello :smiley:!" Returns: str: A string with emoji codes replaces with actual emoji. """ return _emoji_replace(text) def __repr__(self) -> str: return f"" def __str__(self) -> str: return self._char def __rich_console__( self, console: "Console", options: "ConsoleOptions" ) -> "RenderResult": yield Segment(self._char, console.get_style(self.style)) if __name__ == "__main__": # pragma: no cover import sys from pip._vendor.rich.columns import Columns from pip._vendor.rich.console import Console console = Console(record=True) columns = Columns( (f":{name}: {name}" for name in sorted(EMOJI.keys()) if "\u200D" not in name), column_first=True, ) console.print(columns) if len(sys.argv) > 1: console.save_html(sys.argv[1]) ================================================ FILE: src/pip/_vendor/rich/errors.py ================================================ class ConsoleError(Exception): """An error in console operation.""" class StyleError(Exception): """An error in styles.""" class StyleSyntaxError(ConsoleError): """Style was badly formatted.""" class MissingStyle(StyleError): """No such style.""" class StyleStackError(ConsoleError): """Style stack is invalid.""" class NotRenderableError(ConsoleError): """Object is not renderable.""" class MarkupError(ConsoleError): """Markup was badly formatted.""" class LiveError(ConsoleError): """Error related to Live display.""" class NoAltScreen(ConsoleError): """Alt screen mode was required.""" ================================================ FILE: src/pip/_vendor/rich/file_proxy.py ================================================ import io from typing import IO, TYPE_CHECKING, Any, List from .ansi import AnsiDecoder from .text import Text if TYPE_CHECKING: from .console import Console class FileProxy(io.TextIOBase): """Wraps a file (e.g. sys.stdout) and redirects writes to a console.""" def __init__(self, console: "Console", file: IO[str]) -> None: self.__console = console self.__file = file self.__buffer: List[str] = [] self.__ansi_decoder = AnsiDecoder() @property def rich_proxied_file(self) -> IO[str]: """Get proxied file.""" return self.__file def __getattr__(self, name: str) -> Any: return getattr(self.__file, name) def write(self, text: str) -> int: if not isinstance(text, str): raise TypeError(f"write() argument must be str, not {type(text).__name__}") buffer = self.__buffer lines: List[str] = [] while text: line, new_line, text = text.partition("\n") if new_line: lines.append("".join(buffer) + line) buffer.clear() else: buffer.append(line) break if lines: console = self.__console with console: output = Text("\n").join( self.__ansi_decoder.decode_line(line) for line in lines ) console.print(output) return len(text) def flush(self) -> None: output = "".join(self.__buffer) if output: self.__console.print(output) del self.__buffer[:] def fileno(self) -> int: return self.__file.fileno() ================================================ FILE: src/pip/_vendor/rich/filesize.py ================================================ """Functions for reporting filesizes. Borrowed from https://github.com/PyFilesystem/pyfilesystem2 The functions declared in this module should cover the different use cases needed to generate a string representation of a file size using several different units. Since there are many standards regarding file size units, three different functions have been implemented. See Also: * `Wikipedia: Binary prefix `_ """ __all__ = ["decimal"] from typing import Iterable, List, Optional, Tuple def _to_str( size: int, suffixes: Iterable[str], base: int, *, precision: Optional[int] = 1, separator: Optional[str] = " ", ) -> str: if size == 1: return "1 byte" elif size < base: return f"{size:,} bytes" for i, suffix in enumerate(suffixes, 2): # noqa: B007 unit = base**i if size < unit: break return "{:,.{precision}f}{separator}{}".format( (base * size / unit), suffix, precision=precision, separator=separator, ) def pick_unit_and_suffix(size: int, suffixes: List[str], base: int) -> Tuple[int, str]: """Pick a suffix and base for the given size.""" for i, suffix in enumerate(suffixes): unit = base**i if size < unit * base: break return unit, suffix def decimal( size: int, *, precision: Optional[int] = 1, separator: Optional[str] = " ", ) -> str: """Convert a filesize in to a string (powers of 1000, SI prefixes). In this convention, ``1000 B = 1 kB``. This is typically the format used to advertise the storage capacity of USB flash drives and the like (*256 MB* meaning actually a storage capacity of more than *256 000 000 B*), or used by **Mac OS X** since v10.6 to report file sizes. Arguments: int (size): A file size. int (precision): The number of decimal places to include (default = 1). str (separator): The string to separate the value from the units (default = " "). Returns: `str`: A string containing a abbreviated file size and units. Example: >>> filesize.decimal(30000) '30.0 kB' >>> filesize.decimal(30000, precision=2, separator="") '30.00kB' """ return _to_str( size, ("kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"), 1000, precision=precision, separator=separator, ) ================================================ FILE: src/pip/_vendor/rich/highlighter.py ================================================ import re from abc import ABC, abstractmethod from typing import List, Union from .text import Span, Text def _combine_regex(*regexes: str) -> str: """Combine a number of regexes in to a single regex. Returns: str: New regex with all regexes ORed together. """ return "|".join(regexes) class Highlighter(ABC): """Abstract base class for highlighters.""" def __call__(self, text: Union[str, Text]) -> Text: """Highlight a str or Text instance. Args: text (Union[str, ~Text]): Text to highlight. Raises: TypeError: If not called with text or str. Returns: Text: A test instance with highlighting applied. """ if isinstance(text, str): highlight_text = Text(text) elif isinstance(text, Text): highlight_text = text.copy() else: raise TypeError(f"str or Text instance required, not {text!r}") self.highlight(highlight_text) return highlight_text @abstractmethod def highlight(self, text: Text) -> None: """Apply highlighting in place to text. Args: text (~Text): A text object highlight. """ class NullHighlighter(Highlighter): """A highlighter object that doesn't highlight. May be used to disable highlighting entirely. """ def highlight(self, text: Text) -> None: """Nothing to do""" class RegexHighlighter(Highlighter): """Applies highlighting from a list of regular expressions.""" highlights: List[str] = [] base_style: str = "" def highlight(self, text: Text) -> None: """Highlight :class:`rich.text.Text` using regular expressions. Args: text (~Text): Text to highlighted. """ highlight_regex = text.highlight_regex for re_highlight in self.highlights: highlight_regex(re_highlight, style_prefix=self.base_style) class ReprHighlighter(RegexHighlighter): """Highlights the text typically produced from ``__repr__`` methods.""" base_style = "repr." highlights = [ r"(?P<)(?P[-\w.:|]*)(?P[\w\W]*)(?P>)", r'(?P[\w_]{1,50})=(?P"?[\w_]+"?)?', r"(?P[][{}()])", _combine_regex( r"(?P[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})", r"(?P([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4})", r"(?P(?:[0-9A-Fa-f]{1,2}-){7}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{1,2}:){7}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{4}\.){3}[0-9A-Fa-f]{4})", r"(?P(?:[0-9A-Fa-f]{1,2}-){5}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{1,2}:){5}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{4}\.){2}[0-9A-Fa-f]{4})", r"(?P[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})", r"(?P[\w.]*?)\(", r"\b(?PTrue)\b|\b(?PFalse)\b|\b(?PNone)\b", r"(?P\.\.\.)", r"(?P(?(?\B(/[-\w._+]+)*\/)(?P[-\w._+]*)?", r"(?b?'''.*?(?(file|https|http|ws|wss)://[-0-9a-zA-Z$_+!`(),.?/;:&=%#~@]*)", ), ] class JSONHighlighter(RegexHighlighter): """Highlights JSON""" # Captures the start and end of JSON strings, handling escaped quotes JSON_STR = r"(?b?\".*?(?[\{\[\(\)\]\}])", r"\b(?Ptrue)\b|\b(?Pfalse)\b|\b(?Pnull)\b", r"(?P(? None: super().highlight(text) # Additional work to handle highlighting JSON keys plain = text.plain append = text.spans.append whitespace = self.JSON_WHITESPACE for match in re.finditer(self.JSON_STR, plain): start, end = match.span() cursor = end while cursor < len(plain): char = plain[cursor] cursor += 1 if char == ":": append(Span(start, end, "json.key")) elif char in whitespace: continue break class ISO8601Highlighter(RegexHighlighter): """Highlights the ISO8601 date time strings. Regex reference: https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch04s07.html """ base_style = "iso8601." highlights = [ # # Dates # # Calendar month (e.g. 2008-08). The hyphen is required r"^(?P[0-9]{4})-(?P1[0-2]|0[1-9])$", # Calendar date w/o hyphens (e.g. 20080830) r"^(?P(?P[0-9]{4})(?P1[0-2]|0[1-9])(?P3[01]|0[1-9]|[12][0-9]))$", # Ordinal date (e.g. 2008-243). The hyphen is optional r"^(?P(?P[0-9]{4})-?(?P36[0-6]|3[0-5][0-9]|[12][0-9]{2}|0[1-9][0-9]|00[1-9]))$", # # Weeks # # Week of the year (e.g., 2008-W35). The hyphen is optional r"^(?P(?P[0-9]{4})-?W(?P5[0-3]|[1-4][0-9]|0[1-9]))$", # Week date (e.g., 2008-W35-6). The hyphens are optional r"^(?P(?P[0-9]{4})-?W(?P5[0-3]|[1-4][0-9]|0[1-9])-?(?P[1-7]))$", # # Times # # Hours and minutes (e.g., 17:21). The colon is optional r"^(?P

' : '\U0001d4ab', '\\' : '\U0001d4ac', '\\' : '\U0000211b', '\\' : '\U0001d4ae', '\\' : '\U0001d4af', '\\' : '\U0001d4b0', '\\' : '\U0001d4b1', '\\' : '\U0001d4b2', '\\' : '\U0001d4b3', '\\' : '\U0001d4b4', '\\' : '\U0001d4b5', '\\' : '\U0001d5ba', '\\' : '\U0001d5bb', '\\' : '\U0001d5bc', '\\' : '\U0001d5bd', '\\' : '\U0001d5be', '\\' : '\U0001d5bf', '\\' : '\U0001d5c0', '\\' : '\U0001d5c1', '\\' : '\U0001d5c2', '\\' : '\U0001d5c3', '\\' : '\U0001d5c4', '\\' : '\U0001d5c5', '\\' : '\U0001d5c6', '\\' : '\U0001d5c7', '\\' : '\U0001d5c8', '\\