관리-도구
편집 파일: found_candidates.cpython-312.pyc
� G��eI � � � d Z ddlZddlmZ ddlmZmZmZmZm Z m Z mZ ddlm Z ddlmZ ee eg e e f f Zeree ZneZdee d ee fd �Zdedee d ee fd�Zdedee d ee fd �Z G d� de� Zy)a� 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. � N)�Sequence)� TYPE_CHECKING�Any�Callable�Iterator�Optional�Set�Tuple)�_BaseVersion� )� Candidate�infos�returnc # �| K � t � }| D ]) \ }}||v r� |� }|��|�� |j |� �+ y�w)z�Iterator for ``FoundCandidates``. This iterator is used when the package is not already installed. Candidates from index come later in their normal ordering. N)�set�add)r �versions_found�version�func� candidates ��/builddir/build/BUILDROOT/alt-python312-pip-23.3.1-1.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py�_iter_builtr % sP � �� � ),��N�� $� ����n�$���F� ���������7�#�$�s �:<� installedc # � K � | �� | j h}|D ]) \ }}||v r� |� }|��|�� |j |� �+ y�w)aK 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. N)r r �r r r r r r s r �_iter_built_with_prependedr 6 s\ � �� � �O�)2�):�):�(;�N�� $� ����n�$���F� ���������7�#�$�s �AAc # � K � t � }|D ]W \ }}||v r�| j |k\ r| �� |j | j � |� }|��C|�� |j |� �Y | j |vr| �� yy�w)a� 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. N)r r r r s r �_iter_built_with_insertedr L s� � �� � ),��N�� $� ����n�$������'��O����y�0�0�1��F� ���������7�#�$� ����.��� /�s �A;A=c � � e Zd ZdZdeg ee f dee de de e fd�Zde de fd �Zdee fd �Zdefd�Z ej$ d� � de fd�� Zy)�FoundCandidatesac 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. � get_infosr �prefers_installed�incompatible_idsc �<