1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
U
I=®dª:ã@søddlZddlmZddlmZddlmZe dddg¡ZGd    d
„d
e    ƒZ
Gd d „d e
ƒZ Gd d„de
ƒZ Gdd„de ƒZGdd„de
ƒZGdd„deƒZGdd„deƒZe dd¡ZGdd„de ƒZdd„Ze dd¡Zdd „ZGd!d"„d"eƒZdS)#éNé)Úcollections_abc)ÚAbstractResolver)Ú DirectedGraphÚ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úWD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\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: {}ú, css|]}t|ƒVqdSr©Úrepr©Ú.0ÚrrrrÚ    <genexpr>sz1RequirementsConflicted.__str__.<locals>.<genexpr>)ÚformatÚjoinrÚiter_requirement©rrrrÚ__str__sÿzRequirementsConflicted.__str__©r
r r rr#Ú __classcell__rrrrrs rcs$eZdZ‡fdd„Zdd„Z‡ZS)ÚInconsistentCandidatecs"tt|ƒ ||¡||_||_dSr)rr&rÚ    candidater)rr'rrrrr!szInconsistentCandidate.__init__cCs$d |jd dd„|j ¡Dƒ¡¡S)Nz+Provided candidate {!r} does not satisfy {}rcss|]}t|ƒVqdSrrrrrrr)sz0InconsistentCandidate.__str__.<locals>.<genexpr>)rr'r rr!r"rrrr#&sþzInconsistentCandidate.__str__r$rrrrr& s r&c@sLeZdZdZdd„Zdd„Zedd„ƒZdd    „Zd
d „Z    d d „Z
dd„Z dS)Ú    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||_||_||_dSr©Ú
candidatesÚ informationÚincompatibilities)rr*r+r,rrrrAszCriterion.__init__cCs d dd„|jDƒ¡}d |¡S)Nrcss|]\}}d ||¡VqdS)z({!r}, via={!r})N)r)rÚreqrrrrrGsÿz%Criterion.__repr__.<locals>.<genexpr>z Criterion({}))r r+r)rÚ requirementsrrrÚ__repr__Fs
þzCriterion.__repr__cCsF| |g¡}t|tjƒs t|ƒ}||t||ƒggd}|sBt|ƒ‚|S)z.Build an instance from a requirement.
        r))Ú find_matchesÚ
isinstancerÚSequenceÚlistrr)ÚclsÚproviderrrr*rrrrÚfrom_requirementMs  
ýzCriterion.from_requirementcCsdd„|jDƒS)Ncss|] }|jVqdSr)r©rÚirrrr^sz-Criterion.iter_requirement.<locals>.<genexpr>©r+r"rrrr!]szCriterion.iter_requirementcCsdd„|jDƒS)Ncss|] }|jVqdSr©rr7rrrrasz(Criterion.iter_parent.<locals>.<genexpr>r9r"rrrÚ iter_parent`szCriterion.iter_parentcCsht|jƒ}| t||ƒ¡| dd„|Dƒ¡}t|tjƒsBt|ƒ}t|ƒ||t|j    ƒƒ}|sdt
|ƒ‚|S)z>Build a new instance from this and a new requirement.
        cSsg|] \}}|‘qSrr)rrÚ_rrrÚ
<listcomp>hsz)Criterion.merged_with.<locals>.<listcomp>) r3r+Úappendrr0r1rr2Útyper,r)rr5rrÚinfosr*rrrrÚ merged_withcs
 zCriterion.merged_withcsJt|jƒ}| ˆ¡‡fdd„|jDƒ}|s0dSt|ƒ|t|jƒ|ƒ}|S)zœBuild a new instance from this, but excluding specified candidate.
 
        Returns the new instance, or None if we still have no valid candidates.
        csg|]}|ˆkr|‘qSrr)rÚc©r'rrr=wsz)Criterion.excluded_of.<locals>.<listcomp>N)r3r,r>r*r?r+)rr'Z    incompatsr*rrrCrÚ excluded_ofps
 
zCriterion.excluded_ofN) r
r r r rr/Ú classmethodr6r!r;rArDrrrrr(-s
 r(c@s eZdZdS)ÚResolutionErrorN)r
r r rrrrrF~srFcseZdZ‡fdd„Z‡ZS)ÚResolutionImpossiblecstt|ƒ |¡||_dSr)rrGrÚcauses)rrHrrrrƒszResolutionImpossible.__init__©r
r r rr%rrrrrG‚srGcseZdZ‡fdd„Z‡ZS)ÚResolutionTooDeepcstt|ƒ |¡||_dSr)rrJrÚ round_count)rrKrrrrŠszResolutionTooDeep.__init__rIrrrrrJ‰srJÚStatezmapping criteriac@sdeZdZdZdd„Zedd„ƒZdd„Zdd    „Zd
d „Z    d d „Z
dd„Z dd„Z dd„Z dd„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|_dSr)Ú_pÚ_rÚ_states)rr5ÚreporterrrrršszResolution.__init__cCs.z |jdWStk
r(tdƒ‚YnXdS)NéÿÿÿÿÚstate)rPÚ
IndexErrorÚAttributeErrorr"rrrrSŸs zResolution.statecCs\z|jd}Wn$tk
r2tt ¡id}YnXt|j ¡|j ¡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.
        rR)ÚmappingÚcriteriaN)    rPrTrLÚ collectionsÚ OrderedDictrVÚcopyrWr>)rÚbaserSrrrÚ_push_new_state¦sÿzResolution._push_new_statecCsh|j ||¡|j |¡}z|jj|}Wn$tk
rNt |j||¡}YnX|     |j||¡}||fSr)
rOZadding_requirementrNZidentifyrSrWÚKeyErrorr(r6rA)rrrÚnameÚcritrrrÚ_merge_into_criterion¶s z Resolution._merge_into_criterioncCsF|\}}z|jj|}Wntk
r0d}YnX|j ||j|j¡Sr)rSrVr]rNZget_preferencer*r+)rÚitemr^rZpinnedrrrÚ_get_criterion_item_preferenceÁs
ÿz)Resolution._get_criterion_item_preferencecsDzˆjj|‰Wntk
r&YdSXt‡‡fdd„| ¡DƒƒS)NFc3s|]}ˆj |ˆ¡VqdSr©rNZis_satisfied_byr©Z current_pinrrrrÐsÿz8Resolution._is_current_pin_satisfying.<locals>.<genexpr>)rSrVr]Úallr!)rr^rrrdrÚ_is_current_pin_satisfyingËsþz%Resolution._is_current_pin_satisfyingcCs4i}|j |¡D]}|j||d\}}|||<q|S)Nr:)rNZget_dependenciesr`)rr'rWrr^r_rrrÚ_get_criteria_to_updateÕs
 
z"Resolution._get_criteria_to_updatec sÀg}|jD]°‰zˆ ˆ¡}Wn6tk
rR}z| |j¡WY¢q
W5d}~XYnXt‡‡fdd„| ¡Dƒƒ}|s~tˆ|ƒ‚ˆj     ˆ¡ˆj
j   |d¡ˆˆj
j |<ˆj
j  |¡gS|S)Nc3s|]}ˆj |ˆ¡VqdSrrcr©r'rrrrésÿz7Resolution._attempt_to_pin_criterion.<locals>.<genexpr>)r*rgrr>rrer!r&rOZpinningrSrVÚpoprWÚupdate)rr^rrHrWÚeZ    satisfiedrrhrÚ_attempt_to_pin_criterionÜs$
 þ
  z$Resolution._attempt_to_pin_criterioncCs˜|jd=t|jƒdkr”|j ¡}z|j ¡\}}Wntk
rJYqYnX|j |¡| ¡|j    j
|  |¡}|dkr„|jd=q||j    j
|<dSdS)NrRéTF) rPÚlenrirVÚpopitemr]rOZ backtrackingr\rSrWrD)rZ
prev_stater^r'rrrrÚ
_backtrackýs 
 
  zResolution._backtrackc sBˆjrtdƒ‚ˆ ¡|D]V}zˆj|dd\}}Wn.tk
rb}zt|jjƒ‚W5d}~XYnX|ˆjj    |<qˆj
  ¡t |ƒD]°}ˆj
  |¡ˆ ¡ˆj}‡fdd„ˆjj     ¡Dƒ}    |    sވjd=ˆj
 |¡ˆjSt|    ˆjd\}}
ˆ ||
¡} | r&ˆ ¡} | s&dd„| Dƒ} t| ƒ‚ˆj
 ||¡q„t|ƒ‚dS)Nzalready resolvedr:csg|]}ˆj|Žs|‘qSr)rf)rrar"rrr=3s
þz&Resolution.resolve.<locals>.<listcomp>rR)ÚkeycSsg|]}|jD]}|‘qqSrr9)rr_r8rrrr=Js)rPÚ RuntimeErrorr\r`rrGrr+rSrWrOZstartingÚrangeZstarting_roundÚitemsZendingÚminrbrlrpZ ending_roundrJ)rr.Ú
max_roundsrr^r_rkZ round_indexÚcurrZunsatisfied_criterion_itemsrZfailure_causesÚresultrHrr"rÚresolvesF
 
 
þ 
þ
 ÿzResolution.resolveN)r
r r r rÚpropertyrSr\r`rbrfrgrlrpryrrrrrM“s
 
 
!"rMc    CsŽ||kr dS||krdS|| ¡D]d}z|t|ƒ}Wntk
rPYq$YnX||krj| |¡dSt||||ƒr$| |¡dSq$dS)NTF)r;Úidr]ÚaddÚ_has_route_to_root)rWrqÚall_keysÚ    connectedÚpÚpkeyrrrr}Ts 
 
 
r}ÚResultzmapping graph criteriac
sê|j}dd„| ¡Dƒ}d|tdƒ<tƒ}| d¡dh‰|j ¡D]‚\}}t|j||ˆƒs^qD||krp| |¡| ¡D]L}z|t|ƒ}Wntk
r¤YqxYnX||kr¸| |¡|     ||¡qxqDt
‡fdd„| ¡Dƒ||jdS)NcSsi|]\}}t|ƒ|“qSr)r{©rÚkÚvrrrÚ
<dictcomp>lsz!_build_result.<locals>.<dictcomp>csi|]\}}|ˆkr||“qSrrrƒ©rrrr†‚s)rVÚgraphrW) rVrtr{rr|rWr}r;r]Úconnectr‚)rSrVr~rˆrqrr€rrr‡rÚ _build_resultjs0 
 
 
 
ýrŠc@seZdZdZeZddd„ZdS)ÚResolverz8The 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.
        )rv)rMr5rQryrŠ)rr.rvÚ
resolutionrSrrrryŽszResolver.resolveN)rŒ)r
r r r r    Zbase_exceptionryrrrrr‹ˆsr‹)rXÚcompatrZ    providersrÚstructsrÚ
namedtuplerÚ    Exceptionr    rr&Úobjectr(rFrGrJrLrMr}r‚rŠr‹rrrrÚ<module>s*   ÿ  Q B