HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/pip/_vendor/resolvelib/__pycache__/resolvers.cpython-37.pyc
B

L��gP�@sddlZddlZddlZddlmZddlmZmZmZe�	dddg�Z
Gdd	�d	e�ZGd
d�de�Z
Gdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Ze�	dd�ZGdd�de�Zdd�Ze�	dd�Zdd�ZGd d!�d!e�ZdS)"�N�)�AbstractResolver)�
DirectedGraph�IteratorMapping�build_iter_view�RequirementInformation�requirement�parentc@seZdZdZdS)�ResolverExceptionz�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.
    N)�__name__�
__module__�__qualname__�__doc__�rr�D/tmp/pip-unpacked-wheel-hv55ucu3/pip/_vendor/resolvelib/resolvers.pyr

sr
cs$eZdZ�fdd�Zdd�Z�ZS)�RequirementsConflictedcstt|��|�||_dS)N)�superr�__init__�	criterion)�selfr)�	__class__rrrszRequirementsConflicted.__init__cCs d�d�dd�|j��D���S)NzRequirements conflict: {}z, css|]}t|�VqdS)N)�repr)�.0�rrrr�	<genexpr>sz1RequirementsConflicted.__str__.<locals>.<genexpr>)�format�joinr�iter_requirement)rrrr�__str__szRequirementsConflicted.__str__)rrr
rr�
__classcell__rr)rrrsrcs$eZdZ�fdd�Zdd�Z�ZS)�InconsistentCandidatecs"tt|��||�||_||_dS)N)rr r�	candidater)rr!r)rrrr!szInconsistentCandidate.__init__cCs$d�|jd�dd�|j��D���S)Nz+Provided candidate {!r} does not satisfy {}z, css|]}t|�VqdS)N)r)rrrrrr)sz0InconsistentCandidate.__str__.<locals>.<genexpr>)rr!rrr)rrrrr&szInconsistentCandidate.__str__)rrr
rrrrr)rrr  sr c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�	CriterionaQRepresentation 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.
    cCs||_||_||_dS)N)�
candidates�information�incompatibilities)rr#r$r%rrrrAszCriterion.__init__cCs d�dd�|jD��}d�|�S)Nz, css|]\}}d�||�VqdS)z({!r}, via={!r})N)r)r�reqr	rrrrHsz%Criterion.__repr__.<locals>.<genexpr>z
Criterion({}))rr$r)r�requirementsrrr�__repr__FszCriterion.__repr__cCsdd�|jD�S)Ncss|]}|jVqdS)N)r)r�irrrrNsz-Criterion.iter_requirement.<locals>.<genexpr>)r$)rrrrrMszCriterion.iter_requirementcCsdd�|jD�S)Ncss|]}|jVqdS)N)r	)rr)rrrrQsz(Criterion.iter_parent.<locals>.<genexpr>)r$)rrrr�iter_parentPszCriterion.iter_parentN)rrr
rrr(rr*rrrrr"-s
r"c@seZdZdS)�ResolutionErrorN)rrr
rrrrr+Tsr+cseZdZ�fdd�Z�ZS)�ResolutionImpossiblecstt|��|�||_dS)N)rr,r�causes)rr-)rrrrYszResolutionImpossible.__init__)rrr
rrrr)rrr,Xsr,cseZdZ�fdd�Z�ZS)�ResolutionTooDeepcstt|��|�||_dS)N)rr.r�round_count)rr/)rrrr`szResolutionTooDeep.__init__)rrr
rrrr)rrr._sr.�Statez!mapping criteria backtrack_causesc@sleZdZdZdd�Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�
Resolutionz�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.
    cCs||_||_g|_dS)N)�_p�_r�_states)r�provider�reporterrrrrpszResolution.__init__cCs,y
|jdStk
r&td��YnXdS)N����state)r4�
IndexError�AttributeError)rrrrr8us
zResolution.statecCs>|jd}t|j��|j��|jdd�d�}|j�|�dS)z�Push a new state into history.

        This new state will be used to hold resolution results of the next
        coming round.
        r7N)�mapping�criteria�backtrack_causes)r4r0r;�copyr<r=�append)r�baser8rrr�_push_new_state|s
zResolution._push_new_statec	Cs�|jj||d�|jj|d�}|�|�}|r8t|j�}ng}|jj|t|t	�
d�||gi�t|t	�d�||i�d�}|r�t|j�}|�
t||��nt||�g}tt|�||d�}|js�t|��|||<dS)N)rr	)Zrequirement_or_candidaterr%)�
identifierr'r%)r#r$r%)r3Zadding_requirementr2�identify�get�listr%�find_matchesr�operator�methodcaller�
attrgetterr$r?rr"rr#r)	rr<rr	rBrr%�matchesr$rrr�_add_to_criteria�s6


zResolution._add_to_criteriacsH�sdSx:|��D].\}}t|j��fdd�|jD�|j�||<qWdS)aWRemove 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.
        Ncs,g|]$}|jdks$�j�|j��kr|�qS)N)r	r2rC)rr$)�parentsrrr�
<listcomp>�s
z@Resolution._remove_information_from_criteria.<locals>.<listcomp>)�itemsr"r#r$r%)rr<rL�keyrr)rLrr�!_remove_information_from_criteria�s	z,Resolution._remove_information_from_criteriac	Cs>|jj||jjt|jjt�d��t|jjt�d��|jjd�S)Nr#r$)rBZresolutionsr#r$r=)	r2Zget_preferencer8r;rr<rGrIr=)r�namerrr�_get_preference�s

zResolution._get_preferencecsBy�jj|�Wntk
r$dSXt��fdd�|��D��S)NFc3s|]}�jj|�d�VqdS))rr!N)r2�is_satisfied_by)rr)�current_pinrrrr�sz8Resolution._is_current_pin_satisfying.<locals>.<genexpr>)r8r;�KeyError�allr)rrQrr)rTrr�_is_current_pin_satisfying�sz%Resolution._is_current_pin_satisfyingcCs8|jj��}x&|jj|d�D]}|j|||d�qW|S)N)r!)r	)r8r<r>r2�get_dependenciesrK)rr!r<rrrr�_get_updated_criteria�sz Resolution._get_updated_criteriacs��jj|}g}x�|jD]��y����}Wn@tk
rj}z"�j�|j��|�|j�wWdd}~XYnXt	��fdd�|�
�D��}|s�t�|���jj�d��jj�
|��jj�|d���jj|<gSW|S)Nc3s|]}�jj|�d�VqdS))rr!N)r2rS)rr)r!rrrr�sz7Resolution._attempt_to_pin_criterion.<locals>.<genexpr>)r!)r8r<r#rYrr3Zrejecting_candidaterr?rVrr Zpinning�updater;�pop)rrQrr-r<�eZ	satisfiedr)r!rr�_attempt_to_pin_criterion�s(
z$Resolution._attempt_to_pin_criterionc	st�dd�|D�dd�|D��}�fdd�|D�}x�t�j�dk�r�jd=d}xl|s�y�j��}|j��\}}Wn ttfk
r�t	|��YnX�fd	d��j
�|�D�}|�|�}qRWd
d�|j
��D����||gf���fdd
�}	���|	�}
|
r4dSq4WdS)a2Perform 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.
        css|]}|jdk	r|jVqdS)N)r	)r�crrrr.sz'Resolution._backjump.<locals>.<genexpr>css|]}|jVqdS)N)r)rr^rrrr/scsh|]}�j�|��qSr)r2rC)rr)rrr�	<setcomp>1sz'Resolution._backjump.<locals>.<setcomp>�r7Fcsh|]}�j�|��qSr)r2rC)r�d)rrrr_?scSsg|]\}}|t|j�f�qSr)rEr%)r�k�vrrrrMHsz(Resolution._backjump.<locals>.<listcomp>c	s�x��D]�\}}|sqy�jj|}Wntk
r:wYnX�jj|t�jjt�d��t�jjt�d�||i�d�}t	|�}|s�dS|�
|j�t|t
|j�|d��jj|<qWdS)Nrr%)rBr'r%F)r#r$r%T)r8r<rUr2rFrrGrHrIr�extendr%r"rEr$)rbr%rrJr#)�incompatibilities_from_brokenrrr�_patch_criteriaQs2
z-Resolution._backjump.<locals>._patch_criteriaT)�	itertools�chain�lenr4r[r;�popitemr9rUr,r2rX�
isdisjointr<rNr?rA)rr-Zincompatible_reqsZincompatible_depsZincompatible_stateZbroken_staterQr!Zcurrent_dependenciesrf�successr)rerr�	_backjumps4

zResolution._backjumpcs��jrtd���j��tt��igd�g�_xT|D]L}y�j�jj	|dd�Wq4t
k
r~}zt|jj
��Wdd}~XYq4Xq4W����xt|�D�]}�jj|d��fdd��jj	��D�}|s�jj�jd��jSt�jj	���t|��t|�jd�}��|�}|�r`d	d�|D�}	�jj|	d
���|	�}
|	�jjdd�<|
�s�t�jj��n4��fdd��jj	��D�}���jj	|�����jj|�jd
�q�Wt|��dS)Nzalready resolved)r;r<r=)r	)�indexcs g|]\}}��||�s|�qSr)rW)rrOr)rrrrM�sz&Resolution.resolve.<locals>.<listcomp>)r8)rOcSsg|]}|jD]}|�qqSr)r$)rr^r)rrrrM�s)r-cs(h|] \}}|�kr��||�s|�qSr)rW)rrOr)�satisfied_namesrrrr_�sz%Resolution.resolve.<locals>.<setcomp>)rnr8)r4�RuntimeErrorr3Zstartingr0�collections�OrderedDictrKr8r<rr,rr$rA�rangeZstarting_roundrNZending�set�keys�minrRr]Zresolving_conflictsrmr=rPZending_roundr.)rr'�
max_roundsrr\Zround_indexZunsatisfied_namesrQZfailure_causesr-rlZnewly_unsatisfied_namesr)rorr�resolve}sL

"


zResolution.resolveN)rrr
rr�propertyr8rArKrPrRrWrYr]rmrxrrrrr1is'
%or1c	Cs�||krdS||krdSxn||��D]^}y|t|�}Wntk
rPw&YnX||krh|�|�dSt||||�r&|�|�dSq&WdS)NTF)r*�idrU�add�_has_route_to_root)r<rO�all_keys�	connected�p�pkeyrrrr|�s 

r|�Resultzmapping graph criteriac
s�|j}dd�|��D�}d|td�<t�}|�d�dh�x�|j��D]�\}}t|j||��s`qF||krr|�|�xV|��D]J}y|t|�}Wntk
r�w|YnX||kr�|�|�|�	||�q|WqFWt
�fdd�|��D�||jd�S)NcSsi|]\}}|t|��qSr)rz)rrbrcrrr�
<dictcomp>�sz!_build_result.<locals>.<dictcomp>csi|]\}}|�kr||�qSrr)rrbrc)r~rrr��s)r;�graphr<)r;rNrzrr{r<r|r*rU�connectr�)r8r;r}r�rOrrr�r)r~r�
_build_result�s.


r�c@seZdZdZeZddd�ZdS)�Resolverz3The thing that performs the actual resolution work.�dcCs$t|j|j�}|j||d�}t|�S)aTake 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.
        )rw)r1r5r6rxr�)rr'rw�
resolutionr8rrrrxszResolver.resolveN)r�)rrr
rr
Zbase_exceptionrxrrrrr�sr�)rqrgrGZ	providersr�structsrrr�
namedtupler�	Exceptionr
rr �objectr"r+r,r.r0r1r|r�r�r�rrrr�<module>s*
'e