hyb
2025-11-07 cadac0a99d87c53805a07f3b4ca7fd11e524fe4a
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
Ë
ñúh9?ãó²—dZddlmZddlZddlZddlZddlZddlZddl    Z    ddl
Z
ddl Z ddl Z ddlmZmZmZddlmZddlmZddlmZddlmZmZmZdd    lmZdd
lmZdd l m!Z!m"Z"dd l#m$Z$dd l%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4m5Z5m6Z6e    jne8«Z9ee:e:fZ;d2d„Z<Gd„de=«Z>d3d„Z?Gd„de=«Z@d4d„ZAd5d„ZBd6d„ZCGd„d «ZDGd!„d"e«ZEd7d#„ZFeFd8d%„«ZGed&¬'«Gd(„d$««ZHGd)„d*e«ZI    d9                            d:d+„ZJ    d;                    d<d,„ZKd=d-„ZLGd.„d/e«ZMGd0„d1«ZNy)>zO
The main purpose of this module is to expose LinkCollector.collect_sources().
é)Ú annotationsN)ÚIterableÚMutableMappingÚSequence)Ú    dataclass)Ú
HTMLParser)ÚValues)ÚCallableÚ
NamedTupleÚProtocol)Úrequests)ÚResponse)Ú
RetryErrorÚSSLError)ÚNetworkConnectionError)ÚLink)Ú SearchScope)Ú
PipSession)Úraise_for_status)Úis_archive_file©Úredact_auth_from_url)Úvcsé)ÚCandidatesFromPageÚ
LinkSourceÚ build_sourcecó–—tjD]6}|j«j|«sŒ#|t    |«dvsŒ4|cSy)zgLook for VCS schemes in the URL.
 
    Returns the matched VCS scheme, or None if there's no match.
    z+:N)rÚschemesÚlowerÚ
startswithÚlen)ÚurlÚschemes  úPH:\Change_password\venv_build\Lib\site-packages\pip/_internal/index/collector.pyÚ_match_vcs_schemer&.sE€ô
—+‘+òˆØ 9‰9‹;× !Ñ ! &Õ )¨c´#°f³+Ñ.>À$Ò.FØŠMðð óc󠇗eZdZdˆfd„ ZˆxZS)Ú_NotAPIContentcóB•—t‰|||«||_||_y©N)ÚsuperÚ__init__Ú content_typeÚ request_desc)Úselfr.r/Ú    __class__s   €r%r-z_NotAPIContent.__init__:s"ø€Ü ‰Ñ˜ |Ô4Ø(ˆÔØ(ˆÕr')r.Ústrr/r2ÚreturnÚNone)Ú__name__Ú
__module__Ú __qualname__r-Ú __classcell__©r1s@r%r)r)9s ø„÷)ñ)r'r)có¾—|jjdd«}|j«}|jd«ryt    ||j
j «‚)z°
    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ÚUnknown)z    text/htmlz#application/vnd.pypi.simple.v1+htmlú#application/vnd.pypi.simple.v1+jsonN)ÚheadersÚgetr r!r)ÚrequestÚmethod)Úresponser.Úcontent_type_ls   r%Ú_ensure_api_headerrD@s[€ð×#Ñ#×'Ñ'¨¸    ÓB€Là!×'Ñ'Ó)€NØ× Ñ ð    
ôð    ä
˜ x×'7Ñ'7×'>Ñ'>Ó
?Ð?r'có —eZdZy)Ú_NotHTTPN)r5r6r7©r'r%rFrFVs„Ør'rFcó¼—tjj|«\}}}}}|dvr
t«‚|j    |d¬«}t |«t |«y)zõ
    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.
    >ÚhttpÚhttpsT)Úallow_redirectsN)ÚurllibÚparseÚurlsplitrFÚheadrrD)r#Úsessionr$ÚnetlocÚpathÚqueryÚfragmentÚresps        r%Ú_ensure_api_responserVZsV€ô-3¯L©L×,AÑ,AÀ#Ó,FÑ)€FˆFD˜% Ø Ð&Ñ&Ü‹jÐà <‰<˜¨Tˆ<Ó 2€DܐTÔätÕr'cóˆ—tt|«j«r t||¬«tj dt |««|j|djgd¢«ddœ¬«}t|«t|«tj dt |«|jjd    d
««|S) aYAccess 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.
    ©rPzGetting page %sz, )r=z*application/vnd.pypi.simple.v1+html; q=0.1ztext/html; q=0.01z    max-age=0)ÚAcceptz Cache-Control)r>zFetched page %s as %sr;r<) rrÚfilenamerVÚloggerÚdebugrr?ÚjoinrrDr>)r#rPrUs   r%Ú_get_simple_responser^ls¬€ô”t˜C“y×)Ñ)Ô*ܘS¨'Õ2ä
‡LLÐ"Ô$8¸Ó$=Ô>à ;‰;Ø à—i‘iòóð()ñ+
ð ó €Dô4TÔôtÔä
‡LLØÜ˜SÓ!Ø  ‰ ×ј¨Ó3ôð €Kr'có˜—|rHd|vrDtjj«}|d|d<|jd«}|r t    |«Sy)z=Determine if we have any encoding information in our headers.r;z content-typeÚcharsetN)ÚemailÚmessageÚMessageÚ    get_paramr2)r>Úmr`s   r%Ú_get_encoding_from_headersrf«sK€á> WÑ,Ü M‰M× !Ñ !Ó #ˆØ# NÑ3ˆˆ.ÑØ—+‘+˜iÓ(ˆÙ ܐw“<Ð Ø r'có$—eZdZdd„Zdd„Zdd„Zy)ÚCacheablePageContentcó.—|jsJ‚||_yr+)Úcache_link_parsingÚpage©r0rks  r%r-zCacheablePageContent.__init__·s€Ø×&Ò&Ð&Ð&؈    r'cóŠ—t|t|««xr-|jj|jjk(Sr+)Ú
isinstanceÚtyperkr#)r0Úothers  r%Ú__eq__zCacheablePageContent.__eq__»s-€Ü˜%¤ d£Ó,ÒP°·±·±À%Ç*Á*Ç.Á.Ñ1PÐPr'có@—t|jj«Sr+)Úhashrkr#©r0s r%Ú__hash__zCacheablePageContent.__hash__¾s€ÜD—I‘I—M‘MÓ"Ð"r'N)rkÚ IndexContentr3r4)rpÚobjectr3Úbool)r3Úint)r5r6r7r-rqrurGr'r%rhrh¶s„óóQô#r'rhcó—eZdZdd„Zy)Ú
ParseLinkscó—yr+rGrls  r%Ú__call__zParseLinks.__call__Ãsr'N©rkrvr3zIterable[Link])r5r6r7r}rGr'r%r{r{Âs„ÜAr'r{cóz‡‡—tjdˆfd„ «Štj‰«dˆˆfd„ «}|S)zÚ
    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`.
    có:•—t‰|j««Sr+)Úlistrk)Úcacheable_pageÚfns €r%Úwrapperz*with_cached_index_content.<locals>.wrapperÍsø€ä‘B~×*Ñ*Ó+Ó,Ð,r'có`•—|jr‰t|««St‰|««Sr+)rjrhr)rkrƒr„s €€r%Úwrapper_wrapperz2with_cached_index_content.<locals>.wrapper_wrapperÑs+ø€à × "Ò "ÙÔ/°Ó5Ó6Ð 6Ü‘Bt“H‹~Ðr')r‚rhr3ú
list[Link])rkrvr3r‡)Ú    functoolsÚcacheÚwraps)rƒr†r„s` @r%Úwith_cached_index_contentr‹Æs@ù€ô‡__ô-óð-ô‡__RÓõóðð
Ðr'rvc#óTK—|jj«}|jd«r^tj|j
«}|j dg«D])}tj||j«}|€Œ&|–—Œ+yt|j«}|jxsd}|j|j
j|««|j}|jxs|}|jD]!}    tj |    ||¬«}|€Œ|–—Œ#y­w)z\
    Parse a Simple API's Index Content, and yield its anchor elements as Link objects.
    r=ÚfilesNzutf-8)Úpage_urlÚbase_url)r.r r!ÚjsonÚloadsÚcontentr?rÚ    from_jsonr#ÚHTMLLinkParserÚencodingÚfeedÚdecoderÚanchorsÚ from_element)
rkrCÚdataÚfileÚlinkÚparserr•r#rÚanchors
          r%Ú parse_linksrŸÚsÿèø€ð ×&Ñ&×,Ñ,Ó.€NØ× Ñ Ð!FÔG܏z‰z˜$Ÿ,™,Ó'ˆØ—H‘H˜W bÓ)ò    ˆDÜ—>‘> $¨¯©Ó1ˆD؈|ØØ‹Jð        ð
    ä ˜DŸH™HÓ %€F؏}‰}Ò' €HØ
‡KK— ‘ ×#Ñ# HÓ-Ô.à
(‰(€C؏‰Ò% #€HØ—.‘.òˆÜ× Ñ  °#ÀÔIˆØ ˆ<Ø Ø‹
ñ    ùs‚D&D(T)ÚfrozencóP—eZdZUdZded<ded<ded<ded<d    Zd
ed <dd „Zy )rvaŒ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.
    Úbytesr’r2r.ú
str | Noner•r#Trxrjcó,—t|j«Sr+)rr#rts r%Ú__str__zIndexContent.__str__s€Ü# D§H¡HÓ-Ð-r'N)r3r2)r5r6r7Ú__doc__Ú__annotations__rjr¥rGr'r%rvrv÷s/…ñðƒNØÓØÓØ     ƒHØ#ИÓ#ô.r'có4‡—eZdZdZdˆfd„ Zdd„Zdd„ZˆxZS)r”zf
    HTMLParser that keeps the first base HREF and a list of all anchor
    elements' attributes.
    cóP•—t‰|d¬«||_d|_g|_y)NT)Úconvert_charrefs)r,r-r#rr˜)r0r#r1s  €r%r-zHTMLLinkParser.__init__s(ø€Ü ‰Ñ¨$ÐÔ/àˆŒØ$(ˆŒ Ø46ˆ r'có²—|dk(r(|j€|j|«}|||_yy|dk(r%|jjt    |««yy)NÚbaseÚa)rÚget_hrefr˜ÚappendÚdict)r0ÚtagÚattrsÚhrefs    r%Úhandle_starttagzHTMLLinkParser.handle_starttagsT€Ø &Š=˜TŸ]™]Ð2Ø—=‘= Ó'ˆDØÐØ $• ð à CŠZØ L‰L× Ñ ¤ U£ Õ ,ðr'có*—|D]\}}|dk(sŒ |cSy)Nr³rG)r0r²ÚnameÚvalues    r%r®zHTMLLinkParser.get_href!s&€Ø ò    ‰KˆD%ؐv‹~Ø’ ð    ðr')r#r2r3r4)r±r2r²úlist[tuple[str, str | None]]r3r4)r²r¸r3r£)r5r6r7r¦r-r´r®r8r9s@r%r”r” sø„ñõ
7ó-÷r'r”có<—|€tj}|d||«y)Nz%Could not fetch URL %s: %s - skipping)r[r\)rœÚreasonÚmeths   r%Ú_handle_get_simple_failr¼(s€ð
 €|܏|‰|ˆÙР   0°$¸Õ?r'cóŽ—t|j«}t|j|jd||j|¬«S)Nr;)r•r#rj)rfr>rvr’r#)rBrjr•s   r%Ú_make_index_contentr¾2sE€ô*¨(×*:Ñ*:Ó;€HÜ Ø×ÑØ×јÑ(ØØ L‰LØ-ô  ðr'có€—|jjdd«d}t|«}|rtj    d||«yt
j j|«\}}}}}}|dk(rˆtjjt
jj|««rL|jd«s|dz }t
j j|d«}tjd|«    t!||¬    «}t#||j$¬
«S#t&$rtj    d |«Yyt($r6}tj    d ||j*|j,«Yd}~yd}~wt.$r}t1||«Yd}~yd}~wt2$r}t1||«Yd}~yd}~wt4$r6}d }    |    t7|«z }    t1||    tj8¬«Yd}~yd}~wt:j<$r}t1|d|›«Yd}~yd}~wt:j>$rt1|d«YywxYw)Nú#rrzICannot look at %s URL %s because it does not support lookup as web pages.r›ú/z
index.htmlz# file: URL is directory, getting %srX)rjz`Skipping page %s because it looks like an archive, and cannot be checked by a HTTP HEAD request.zº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/htmlz4There was a problem confirming the ssl certificate: )r»zconnection error: z    timed out) r#Úsplitr&r[ÚwarningrLrMÚurlparseÚosrRÚisdirr@Ú url2pathnameÚendswithÚurljoinr\r^r¾rjrFr)r/r.rr¼rrr2Úinfor ÚConnectionErrorÚTimeout)
rœrPr#Ú
vcs_schemer$Ú_rRrUÚexcrºs
          r%Ú_get_index_contentrÐ?s€Ø
(‰(.‰.˜˜aÓ
  Ñ
#€Cô# 3Ó'€JÙ܏‰Ø WØ Ø ô    
ð
ô &Ÿ|™|×4Ñ4°SÓ9Ñ€FˆAˆtQ˜˜1Ø ÒœBŸG™GŸM™M¬&¯.©.×*EÑ*EÀdÓ*KÔLð|‰|˜CÔ Ø 3‰JˆCô
l‰l×"Ñ" 3¨ Ó5ˆÜ ‰ Ð:¸CÔ@ðUÜ# C°Ô9ˆô:# 4¸D×<SÑ<SÔTÐTøô9 ò
܏‰ð 1à õ    
ð8 ô/ ò
܏‰ð Að Ø × Ñ Ø × Ñ ÷     
ð    
ð, ûô "ò+Ü  c×*Ð*ð ûô ò+Ü  c×*Ð*ð ûô ò@ØGˆØ”#c“(шܠ f´6·;±;×?Ñ?ð ûô × #Ñ #òBÜ Ð(:¸3¸%Ð&@×AÐAð
ûô     × Ñ ò3Ü  kÕ2ð ð    3úsTÃ9 DÄH=Ä>H=Å,E7Å7 H=Æ FÆ H=Æ  F1Æ1 H=Æ=,G.Ç.H=ÈHÈ"H=È<H=có"—eZdZUded<ded<y)ÚCollectedSourceszSequence[LinkSource | None]Ú
find_linksÚ
index_urlsN)r5r6r7r§rGr'r%rÒrÒ|s…Ø+Ó+Ø+Ô+r'rÒcóv—eZdZdZ                        dd„Ze    d                                d
d„«Zed d„«Zd d„Z                            d d„Z
y)Ú LinkCollectorzµ
    Responsible for collecting Link objects from all configured locations,
    making network requests as needed.
 
    The class's main method is its collect_sources() method.
    có —||_||_yr+)Ú search_scoperP)r0rPrØs   r%r-zLinkCollector.__init__‰s€ð
)ˆÔ؈ r'có0—|jg|jz}|jr0|s.tj    ddj d„|D«««g}|j xsg}tj|||j¬«}t||¬«}|S)zÆ
        :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.
        zIgnoring indexes: %sú,c3ó2K—|]}t|«–—Œy­wr+r)Ú.0r#s  r%ú    <genexpr>z'LinkCollector.create.<locals>.<genexpr>¡sèø€ÒI°sÔ-¨c×2ÑIùs‚)rÓrÔÚno_index)rPrØ)
Ú    index_urlÚextra_index_urlsrÞr[r\r]rÓrÚcreaterÖ)ÚclsrPÚoptionsÚsuppress_no_indexrÔrÓrØÚlink_collectors        r%rázLinkCollector.create‘sœ€ð×'Ñ'Ð(¨7×+CÑ+CÑCˆ
Ø × Ò Ñ$5Ü L‰LØ&Ø—‘ÑI¸jÔIÓIô ðˆJð×'Ñ'Ò-¨2ˆ
ä"×)Ñ)Ø!Ø!Ø×%Ñ%ô
ˆ ô
'ØØ%ô
ˆðÐr'có.—|jjSr+)rØrÓrts r%rÓzLinkCollector.find_links³s€à× Ñ ×+Ñ+Ð+r'có0—t||j¬«S)z>
        Fetch an HTML page containing package links.
        rX)rÐrP)r0Úlocations  r%Úfetch_responsezLinkCollector.fetch_response·s€ô" (°D·L±LÔAÐAr'c󂇇‡—tjˆˆˆfd„‰jj‰«D««j    «}tjˆˆˆfd„‰j
D««j    «}t jtj«rwtj||«Dcgc]}||jd|j›‘Œ!}}t|«›d‰›dg|z}t jdj|««t!t#|«t#|«¬«Scc}w)Nc    3óh•K—|])}t|‰‰jjdd‰¬«–—Œ+y­w)F©Úcandidates_from_pageÚpage_validatorÚ
expand_dirrjÚ project_nameN©rrPÚis_secure_origin©rÜÚlocrírðr0s  €€€r%rÝz0LinkCollector.collect_sources.<locals>.<genexpr>ÃsAøèø€ò
4
ðô ØØ%9Ø#Ÿ|™|×<Ñ<Ø Ø#(Ø)÷  ð ñ
4
ùóƒ/2c    3óh•K—|])}t|‰‰jjdd‰¬«–—Œ+y­w)TrìNrñrós  €€€r%rÝz0LinkCollector.collect_sources.<locals>.<genexpr>ÎsAøèø€ò
5
ðô ØØ%9Ø#Ÿ|™|×<Ñ<ØØ#'Ø)÷  ð ñ
5
ùrõz* z' location(s) to search for versions of ú:ú
)rÓrÔ)Ú collectionsÚ OrderedDictrØÚget_index_urls_locationsÚvaluesrÓr[Ú isEnabledForÚloggingÚDEBUGÚ    itertoolsÚchainrœr"r\r]rÒr)r0rðríÚindex_url_sourcesÚfind_links_sourcesÚsÚliness```    r%Úcollect_sourceszLinkCollector.collect_sources½s2ú€ô (×3Ñ3õ
4
ð×(Ñ(×AÑAÀ,ÓOô
4
ó
 
÷ ‰&‹(ð    ô)×4Ñ4õ
5
ð—‘ô
5
ó
 
÷ ‰&‹(ð    ô × Ñ œwŸ}™}Ô -ô#Ÿ™Ð);Ð=NÓOöàØ= Q§V¡VÐ%7ðQ—V‘VH’ ðˆEðô u“:,ð#Ø#/ .°ð3ððñˆEô L‰L˜Ÿ™ 5Ó)Ô *äÜÐ.Ó/ÜÐ-Ó.ô
ð    
ùòsÂ>$D<N)rPrrØrr3r4)F)rPrrãr    rärxr3rÖ)r3z    list[str])rèrr3úIndexContent | None)rðr2rírr3rÒ) r5r6r7r¦r-Ú classmethodráÚpropertyrÓrérrGr'r%rÖrցs£„ñðàðð"ðð
ó    ðð
#(ð    àðððð ð    ð
 
ò óððBò,óð,óBð ,
àð,
ð1ð,
ð
ô    ,
r'rÖ)r#r2r3r£)rBrr3r4)r#r2rPrr3r4)r#r2rPrr3r)r>ÚResponseHeadersr3r£)rƒr{r3r{r~r+)rœrrºzstr | Exceptionr»zCallable[..., None] | Noner3r4)T)rBrrjrxr3rv)rœrrPrr3r)Or¦Ú
__future__rrùÚ email.messagerarˆrrrþrÅÚ urllib.parserLÚurllib.requestÚcollections.abcrrrÚ dataclassesrÚ html.parserrÚoptparser    Útypingr
r r Ú pip._vendorr Úpip._vendor.requestsrÚpip._vendor.requests.exceptionsrrÚpip._internal.exceptionsrÚpip._internal.models.linkrÚ!pip._internal.models.search_scoperÚpip._internal.network.sessionrÚpip._internal.network.utilsrÚpip._internal.utils.filetypesrÚpip._internal.utils.miscrÚpip._internal.vcsrÚsourcesrrrÚ    getLoggerr5r[r2r
r&Ú    Exceptionr)rDrFrVr^rfrhr{r‹rŸrvr”r¼r¾rÐrÒrÖrGr'r%ú<module>r"sðñõ#ãÛÛÛÛ ÛÛ    ÛÛß>Ñ>Ý!Ý"Ý÷ñõ !Ý)ß@å;Ý*Ý9Ý4Ý8Ý9Ý9Ý!çAÑAà    ˆ×    Ñ    ˜8Ó    $€à   c Ñ*€óô)Yô)ó@ô,    ˆyô    óó$<ó~÷    #ñ    #ôBôBóð(òóðñ8 $Ô÷.ð.óð.ô(Zôð>(,ð@Ø
ð@à ð@ð %ð@ð
ó    @ð48ð
Øð
Ø,0ð
àó
ó:ôz,zô,÷
h
òh
r'