zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
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
U
H=®dsOã@sÀddlZddlZddlmZddlmZmZddlmZddl    m
Z
ddl m Z m Z ddlmZmZddlmZmZdd    lmZdd
lmZdd lmZmZdd lmZdd lmZddlm Z m!Z!er:ddl"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(ddl    m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddlm0Z0ddl1m2Z2e(dZ3e 4e5¡Z6dd„Z7dd„Z8dd„Z9Gdd„de ƒZ:Gd d!„d!e:ƒZ;Gd"d#„d#e:ƒZ<Gd$d%„d%e ƒZ=Gd&d'„d'e ƒZ>Gd(d)„d)e ƒZ?dS)*éN)Úsuppress)ÚInvalidSpecifierÚ SpecifierSet)Úcanonicalize_name)ÚVersion)Ú    HashErrorÚMetadataInconsistent)ÚHTTPRangeRequestUnsupportedÚdist_from_wheel_url)Úinstall_req_from_editableÚinstall_req_from_line)ÚInstallRequirement)Ú
indent_log)Údist_is_editableÚnormalize_version_info)Úget_requires_python)ÚMYPY_CHECK_RUNNINGé)Ú    CandidateÚ format_name)ÚAnyÚ    FrozenSetÚIterableÚOptionalÚTupleÚUnion)Ú _BaseVersion)Ú Distribution)ÚAbstractDistribution)ÚLink)Ú Requirement)ÚFactory)ÚAlreadyInstalledCandidateÚEditableCandidateÚ LinkCandidatec Csh|jrtdƒ‚|jr t|jƒ}n|j}t||j|j|j|j    |j
t |j |j |jdd}|j|_||_|S)Nztemplate is editable©Úinstall_optionsÚglobal_optionsÚhashes©Ú user_suppliedÚ
comes_fromÚ
use_pep517ÚisolatedÚ
constraintÚoptions)ÚeditableÚAssertionErrorÚreqÚstrÚurlr r*r+r,r-r.Údictr&r'Ú hash_optionsÚ original_linkÚlink)r8ÚtemplateÚlineÚireq©r<úeD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\pip/_internal/resolution/resolvelib/candidates.pyÚmake_install_req_from_link0s( ýù r>c Cs@|jstdƒ‚t|j|j|j|j|j|jt    |j
|j |j ddS)Nztemplate not editabler%r)) r0r1r r4r*r+r,r-r.r5r&r'r6)r8r9r<r<r=Úmake_install_req_from_editableIsýùr?c Cs|t|jƒ}|jrt|jƒ}n&|jr4d ||jj¡}nd ||j¡}t||j    |j
|j |j |j t|j|j|jdd}||_|S)Nz{} @ {}z{}=={}r%r))rÚ project_namer2r3r8Úformatr4Úparsed_versionr r*r+r,r-r.r5r&r'r6Ú satisfied_by)Údistr9r@r:r;r<r<r=Úmake_install_req_from_dist[s*
 ýù rEc@s®eZdZdZdZd&dd„Zdd„Zdd    „Zd
d „Zd d „Z    e
dd„ƒZ e
dd„ƒZ e
dd„ƒZ dd„Zdd„Zdd„Zdd„Zdd„Ze
dd„ƒZd d!„Zd"d#„Zd$d%„ZdS)'Ú"_InstallRequirementBackedCandidatea÷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).
    FNcCs4||_||_||_||_||_||_d|_d|_dS©NF)Ú_linkÚ _source_linkÚ_factoryÚ_ireqÚ_nameÚ_versionÚ_distÚ    _prepared)Úselfr8Ú source_linkr;ÚfactoryÚnameÚversionr<r<r=Ú__init__†s
z+_InstallRequirementBackedCandidate.__init__cCsdj|jjt|jƒdS)Nz{class_name}({link!r}))Ú
class_namer8)rAÚ    __class__Ú__name__r3rH©rPr<r<r=Ú__repr__™sþz+_InstallRequirementBackedCandidate.__repr__cCst|j|jfƒS©N)ÚhashrWrHrYr<r<r=Ú__hash__ sz+_InstallRequirementBackedCandidate.__hash__cCst||jƒr|j|jkSdSrG)Ú
isinstancerWrH©rPÚotherr<r<r=Ú__eq__¤s  z)_InstallRequirementBackedCandidate.__eq__cCs | |¡ Sr[©rar_r<r<r=Ú__ne__«sz)_InstallRequirementBackedCandidate.__ne__cCs|jSr[)rIrYr<r<r=rQ¯sz._InstallRequirementBackedCandidate.source_linkcCs|jdkrt|jjƒ|_|jS)ú:The normalised name of the project the candidate refers toN)rLrrDr@rYr<r<r=rS´s
z'_InstallRequirementBackedCandidate.namecCs|jdkr|jj|_|jSr[)rMrDrBrYr<r<r=rT¼s
 
z*_InstallRequirementBackedCandidate.versioncCs$d |j|j|jjr|jjn|j¡S)Nz{} {} (from {}))rArSrTrHÚis_fileÚ    file_pathrYr<r<r=Úformat_for_errorÃs
ýz3_InstallRequirementBackedCandidate.format_for_errorcCs tdƒ‚dS)NzOverride in subclass)ÚNotImplementedErrorrYr<r<r=Ú_prepare_abstract_distributionËszA_InstallRequirementBackedCandidate._prepare_abstract_distributioncCsb|j}t|jƒ}|jdk    r4|j|kr4t|jd|jƒ‚|j}|jdk    r^|j|kr^t|jd|jƒ‚dS)z:Check for consistency of project name and version of dist.NrSrT)    rNrr@rLrrKrBrMrT)rPrDrSrTr<r<r=Ú_check_metadata_consistencyÏs
z>_InstallRequirementBackedCandidate._check_metadata_consistencyc
Csr|jr
dSz | ¡}Wn,tk
rB}z|j|_‚W5d}~XYnX| ¡|_|jdk    s`tdƒ‚| ¡d|_dS)NzDistribution already installedT)    rOrirrKr2Úget_pkg_resources_distributionrNr1rj)rPÚ abstract_distÚer<r<r=Ú_prepareÜs 
z+_InstallRequirementBackedCandidate._preparec
CsÖ|jj}|jj}|jjo |jj }|rÀ|rÀ|jsÀ|jdk    s>t‚t     
d|j j pP|j ¡t ƒ`ttƒLt     
d|j|j¡|jj dd¡d}|jj}t|j||ƒ|_| ¡W5QRXW5QRX|jdkrÒ| ¡dS)z-Fetch metadata, using lazy wheel if possible.Nz Collecting %sz+Obtaining dependency information from %s %sú#rr)rJÚpreparerÚuse_lazy_wheelrHÚis_wheelreÚrequire_hashesrLr1ÚloggerÚinforKr2rrr    rMr4ÚsplitÚ
downloaderÚ_sessionr
rNrjrn)rPrprqZ remote_wheelr4Úsessionr<r<r=Ú_fetch_metadataës$þ
z2_InstallRequirementBackedCandidate._fetch_metadatacCs|jdkr| ¡|jSr[)rNrzrYr<r<r=rDs
z'_InstallRequirementBackedCandidate.distc
Cs`t|jƒ}|dkrdSz t|ƒ}Wn8tk
rZ}zt d|j|¡WY¢dSd}~XYnX|S)Nz-Package %r has an invalid Requires-Python: %s)rrDrrrtÚwarningrS)rPÚrequires_pythonÚspecrmr<r<r=Ú_get_requires_python_specifiers
 ÿzA_InstallRequirementBackedCandidate._get_requires_python_specifierccsL|sdS|j ¡D]}|j t|ƒ|j¡Vq|j | ¡¡}|rH|VdSr[)rDÚrequiresrJÚmake_requirement_from_specr3rKZ make_requires_python_requirementr~)rPÚ with_requiresÚrZ
python_depr<r<r=Úiter_dependenciessÿz4_InstallRequirementBackedCandidate.iter_dependenciescCs| ¡|jSr[)rnrKrYr<r<r=Úget_install_requirement"sz:_InstallRequirementBackedCandidate.get_install_requirement)NN)rXÚ
__module__Ú __qualname__Ú__doc__Ú is_installedrUrZr]rarcÚpropertyrQrSrTrgrirjrnrzrDr~rƒr„r<r<r<r=rFus2ù
 
 
 
 
 rFcs*eZdZdZd‡fdd„    Zdd„Z‡ZS)r$FNc    sv|}| ||¡}|dk    r,t d|j¡|j}t||ƒ}|dk    rV|jrV|j|jkrVd|_tt    |ƒj
||||||ddS)NzUsing cached wheel link: %sT©r8rQr;rRrSrT) Zget_wheel_cache_entryrtÚdebugr8r>Ú
persistentr7Úoriginal_link_is_in_wheel_cacheÚsuperr$rU)    rPr8r9rRrSrTrQÚ cache_entryr;©rWr<r=rU+s(     
ÿ
þ
úzLinkCandidate.__init__cCs|jjj|jddS)NT)Úparallel_builds)rJrpÚprepare_linked_requirementrKrYr<r<r=riIsÿz,LinkCandidate._prepare_abstract_distribution)NN©rXr…r†Ú is_editablerUriÚ __classcell__r<r<rr=r$(s
úr$cs*eZdZdZd‡fdd„    Zdd„Z‡ZS)r#TNcs&tt|ƒj||t||ƒ|||ddS)NrŠ)rŽr#rUr?)rPr8r9rRrSrTrr<r=rUSs    
úzEditableCandidate.__init__cCs|jj |j¡Sr[)rJrpÚprepare_editable_requirementrKrYr<r<r=riesz0EditableCandidate._prepare_abstract_distribution)NNr“r<r<rr=r#Ps
úr#c@sxeZdZdZdZdd„Zdd„Zdd„Zd    d
„Zd d „Z    e
d d„ƒZ e
dd„ƒZ e
dd„ƒZ dd„Zdd„Zdd„ZdS)r"TNcCs0||_t||ƒ|_||_d}|j |j|¡dS)Nzalready satisfied)rDrErKrJrpÚprepare_installed_requirement)rPrDr9rRÚ skip_reasonr<r<r=rUns
 z"AlreadyInstalledCandidate.__init__cCsdj|jj|jdS)Nz{class_name}({distribution!r}))rVÚ distribution)rArWrXrDrYr<r<r=rZ€sþz"AlreadyInstalledCandidate.__repr__cCst|j|j|jfƒSr[)r\rWrSrTrYr<r<r=r]‡sz"AlreadyInstalledCandidate.__hash__cCs(t||jƒr$|j|jko"|j|jkSdSrG)r^rWrSrTr_r<r<r=ra‹s z AlreadyInstalledCandidate.__eq__cCs | |¡ Sr[rbr_r<r<r=rc’sz AlreadyInstalledCandidate.__ne__cCs t|jjƒSr[)rrDr@rYr<r<r=rS–szAlreadyInstalledCandidate.namecCs|jjSr[)rDrBrYr<r<r=rT›sz!AlreadyInstalledCandidate.versioncCs
t|jƒSr[)rrDrYr<r<r=r” sz%AlreadyInstalledCandidate.is_editablecCsd |j|j¡S)Nz{} {} (Installed))rArSrTrYr<r<r=rg¥sz*AlreadyInstalledCandidate.format_for_errorccs2|sdS|j ¡D]}|j t|ƒ|j¡VqdSr[)rDrrJr€r3rK)rPrr‚r<r<r=rƒ©sz+AlreadyInstalledCandidate.iter_dependenciescCsdSr[r<rYr<r<r=r„°sz1AlreadyInstalledCandidate.get_install_requirement)rXr…r†rˆrQrUrZr]rarcr‰rSrTr”rgrƒr„r<r<r<r=r"js 
 
 
r"c@sŒeZdZdZdd„Zdd„Zdd„Zdd    „Zd
d „Ze    d d „ƒZ
e    dd„ƒZ dd„Z e    dd„ƒZ e    dd„ƒZe    dd„ƒZdd„Zdd„ZdS)ÚExtrasCandidateaí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.
    cCs||_||_dSr[)ÚbaseÚextras)rPr›rœr<r<r=rUÍszExtrasCandidate.__init__cCsdj|jj|j|jdS)Nz.{class_name}(base={base!r}, extras={extras!r}))rVr›rœ)rArWrXr›rœrYr<r<r=rZÖs
ýzExtrasCandidate.__repr__cCst|j|jfƒSr[)r\r›rœrYr<r<r=r]ÞszExtrasCandidate.__hash__cCs(t||jƒr$|j|jko"|j|jkSdSrG)r^rWr›rœr_r<r<r=raâs zExtrasCandidate.__eq__cCs | |¡ Sr[rbr_r<r<r=rcészExtrasCandidate.__ne__cCst|jj|jƒS)rd)rr›rSrœrYr<r<r=rSíszExtrasCandidate.namecCs|jjSr[)r›rTrYr<r<r=rTószExtrasCandidate.versioncCsd |j ¡d t|jƒ¡¡S)Nz{} [{}]z, )rAr›rgÚjoinÚsortedrœrYr<r<r=rgøsþz ExtrasCandidate.format_for_errorcCs|jjSr[)r›rˆrYr<r<r=rˆÿszExtrasCandidate.is_installedcCs|jjSr[)r›r”rYr<r<r=r”szExtrasCandidate.is_editablecCs|jjSr[)r›rQrYr<r<r=rQ    szExtrasCandidate.source_linkccsž|jj}| |j¡V|sdS|j |jjj¡}|j |jjj¡}t|ƒD]}t     d|jj
|j |¡qJ|jj  |¡D]$}|  t|ƒ|jj|¡}|rt|VqtdS)Nz%%s %s does not provide the extra '%s')r›rJZmake_requirement_from_candidaterœÚ intersectionrDÚ
differenceržrtr{rSrTrr€r3rK)rPrrRZ valid_extrasZinvalid_extrasÚextrar‚Ú requirementr<r<r=rƒs* üÿz!ExtrasCandidate.iter_dependenciescCsdSr[r<rYr<r<r=r„+sz'ExtrasCandidate.get_install_requirementN)rXr…r†r‡rUrZr]rarcr‰rSrTrgrˆr”rQrƒr„r<r<r<r=ršµs&    
 
 
 
 
ršc@sLeZdZdZdZdd„Zedd„ƒZedd„ƒZd    d
„Z    d d „Z
d d„Z dS)ÚRequiresPythonCandidateFNcCs>|dk    rt|ƒ}ntjdd…}td dd„|Dƒ¡ƒ|_dS)NéÚ.css|]}t|ƒVqdSr[)r3)Ú.0Úcr<r<r=Ú    <genexpr>=sz3RequiresPythonCandidate.__init__.<locals>.<genexpr>)rÚsysÚ version_inforrrM)rPÚpy_version_inforªr<r<r=rU7s
z RequiresPythonCandidate.__init__cCsdS)Nz<Python from Requires-Python>r<rYr<r<r=rSCszRequiresPythonCandidate.namecCs|jSr[)rMrYr<r<r=rTIszRequiresPythonCandidate.versioncCs d |j¡S)Nz    Python {})rArTrYr<r<r=rgNsz(RequiresPythonCandidate.format_for_errorcCsdS)Nr<r<)rPrr<r<r=rƒRsz)RequiresPythonCandidate.iter_dependenciescCsdSr[r<rYr<r<r=r„Vsz/RequiresPythonCandidate.get_install_requirement) rXr…r†rˆrQrUr‰rSrTrgrƒr„r<r<r<r=r£3s 
 
r£)@Úloggingr©Úpip._vendor.contextlib2rZ pip._vendor.packaging.specifiersrrZpip._vendor.packaging.utilsrÚpip._vendor.packaging.versionrÚpip._internal.exceptionsrrZ pip._internal.network.lazy_wheelr    r
Úpip._internal.req.constructorsr r Zpip._internal.req.req_installr Úpip._internal.utils.loggingrÚpip._internal.utils.miscrrÚpip._internal.utils.packagingrÚpip._internal.utils.typingrr›rrÚtypingrrrrrrrZpip._vendor.pkg_resourcesrÚpip._internal.distributionsrÚpip._internal.models.linkrr rRr!Z BaseCandidateÚ    getLoggerrXrtr>r?rErFr$r#r"ršr£r<r<r<r=Ú<module>sH              ÿ
4(K~