+
    WGjD                       R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
H
t
 ^ RIHt ^ RIHtHtHtHtHtHt ^ RIt^ RIHtHtHt ^ RIHt ^ RIHt ^ R	IH t  ^ R
I!H"t"H#t#H$t$H%t%H&t&H't'H(t( ^ RI)H*t* ^ RI+H,t, ^ RI-H.t. ^ RI/H0t0H1t1H2t2 ^ RI3H4t4 ]'       d   ^ RIH5t5 ^ RI/H6t6H7t7  ! R R]54      t8M]9t8R R lt: ! R R]4      t; ! R R4      t<R# )z'The main class for the unearth package.)annotationsN)datetime)TemporaryDirectory)TYPE_CHECKINGAny	GeneratorIterable
NamedTupleSequence)BuildTagcanonicalize_nameparse_wheel_filename)parse)MultiDomainBasicAuth)collect_links_from_location)	EvaluatorFormatControlPackageTargetPythonevaluate_packageis_equality_specifiervalidate_hashes)Fetcher)
PyPIClient)Link)noop_download_reporternoop_unpack_reporterunpack_link)LazySequence)	TypedDict)DownloadReporterUnpackReporterc                  ,    ] tR t^*t$ R]R&   R]R&   RtR# )Sourcestrurltype N)__name__
__module____qualname____firstlineno____annotations____static_attributes__r'       .lib/python3.14/site-packages/unearth/finder.pyr#   r#   *   s    	r.   r#   c                    V ^8  d   QhRRRR/# )   sessionr   returnNoner'   )formats   "r/   __annotate__r6   2   s     
 
3 
4 
r.   c                     ^ RI Hp \        Y4      '       d    \        P
                  ! R\        ^R7       R# R#   \         d     R# i ; i)    )SessionNzThe legacy requests.Session is used, which is deprecated and will be removed in the next release. Please use `httpx.Client` instead. )
stacklevel)requestsr9   ModuleNotFoundError
isinstancewarningswarnDeprecationWarning)r2   r9   s   & r/   _check_legacy_sessionrA   2   sG    $ '##2		
 $  s   : A	A	c                  :    ] tR t^At$ RtR]R&   R]R&   R]R&   RtR# )		BestMatchzThe best match for a package.zPackage | NonebestSequence[Package]
applicable
candidatesr'   N)r(   r)   r*   r+   __doc__r,   r-   r'   r.   r/   rC   rC   A   s    ' !!!!r.   rC   c                  L   ] tR t^LtRtR2RR3RR3RR3RRRRR	R3R
R3RR3RRR^ RR/R R lllt]R R l4       tR R ltR R lt	R4R R llt
R R ltR R ltR R ltR2R R  lltR! R" ltR# R$ ltR4R% R& lltR5R' R( lltR2R) R* lltR6R+ R, lltR6R- R. lltRR]]3R/ R0 lltR1tR# )7PackageFindera  The main class for the unearth package.

Args:
    session: The session to use for the finder.
        If not provided, a temporary session will be created.
    index_urls: The index URLs to search for packages.
    find_links: The links to search for packages.
    trusted_hosts:: The trusted hosts.
    target_python: The links must match
        the target Python
    ignore_compatibility: Whether to ignore the compatibility check
    no_binary: The names of the packages to disallow wheels
    only_binary: The names of the packages to disallow non-wheels
    prefer_binary: The names of the packages to prefer binary
        distributions even if newer sdist pacakges exist.
    respect_source_order: If True, packages from the source coming earlier
        are more preferred, even if they have lower versions.
    verbosity: The verbosity level.
    exclude_newer_than: A datetime that when provided, excludes any version
        newer than it.
N
index_urls
find_linkstrusted_hoststarget_pythonignore_compatibilityF	no_binaryonly_binaryprefer_binaryrespect_source_order	verbosityexclude_newer_thanc               L    V ^8  d   QhRRRRRRRRRRR	R
RRRRRRRR
RRRRRR/# )r1   r2   zFetcher | NonerK   zIterable[str]rL   rM   rN   zTargetPython | NonerO   boolrP   rQ   rR   rS   rT   intrU   zdatetime | Noner3   r4   r'   )r5   s   "r/   r6   PackageFinder.__annotate__c   s     '
 '
'
 "	'

 "'
 %'
 +'
 #'
 !'
 #'
 %'
 #'
 '
 ,'
 
'
r.   c               	   . V n         V F  pV P                  V4       K  	  V F  pV P                  V4       K  	  V P                   '       g   V P                  R 4       T;'       g    \        4       V n        W`n        V Uu0 uF  p\        V4      kK  	  upV n        V Uu0 uF  p\        V4      kK  	  upV n        V	 Uu0 uF  p\        V4      kK  	  upV n	        W@n
        \        V4       Wn        Wn        Wn        Wn        / V n        \#        V P                  P%                  4       4       UUu/ uF	  w  ppVVbK  	  uppV n        R# u upi u upi u upi u uppi )zhttps://pypi.org/simple/N)sourcesadd_index_urladd_find_linksr   rN   rO   r   rP   rQ   rR   rM   rA   _sessionrS   rT   rU   headers	enumeratesupported_tags_tag_priorities)selfr2   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   r%   nameitags   &&$$$$$$$$$$$    r/   __init__PackageFinder.__init__c   s:     &(Cs# C$  |||9:*<<ln$8!>GHid+D1iH@KL-d3LBOP-$/5-P*g&$8!""4') "+4+=+=+L+L+N!O 
!Ovq#CF!O 
 ILP 
s   E"EE4Ec                   V ^8  d   QhRR/# )r1   r3   r   r'   )r5   s   "r/   r6   rY      s     	 	 	r.   c                	<   V P                   f   V P                   Uu. uF  qR,          R8X  g   K  VR,          NK  	  pp\        V P                  R7      p\	        VR7      Vn        \        P                  ! VP                  4       W0n         V P                   # u upi )Nr&   indexr%   )rM   )rK   )	r^   r[   r   rM   r   authatexitregisterclose)rc   sourcerK   r2   s   &   r/   r2   PackageFinder.session   s    == ,0LL,8&6Ng<UuL   !t/A/ABG/:FGLOOGMM*#M}}s
   BBc                    V ^8  d   QhRRRR/# r1   r%   r$   r3   r4   r'   )r5   s   "r/   r6   rY      s     ; ; ; ;r.   c                D    V P                   P                  RVRR/4       R# )zYAdd an index URL to the finder search scope.

Args:
    url (str): The index URL to add.
r%   r&   rk   Nr[   appendrc   r%   s   &&r/   r\   PackageFinder.add_index_url   s     	UC9:r.   c                    V ^8  d   QhRRRR/# rs   r'   )r5   s   "r/   r6   rY      s     @ @# @$ @r.   c                D    V P                   P                  RVRR/4       R# )zbAdd a find links URL to the finder search scope.

Args:
    url (str): The find links URL to add.
r%   r&   rL   Nru   rw   s   &&r/   r]   PackageFinder.add_find_links   s     	UC>?r.   c               $    V ^8  d   QhRRRRRR/# )r1   package_namer$   allow_yankedrW   r3   r   r'   )r5   s   "r/   r6   rY      s$     
 

/3
	
r.   c           	         \        V P                  V P                  R7      p\        VV P                  V P
                  VVV P                  R7      # )zBuild an evaluator for the given package name.

Args:
    package_name : The desired package name
    allow_yanked: Whether to allow yanked candidates.

Returns:
    Evaluator: The evaluator for the given package name
)rP   rQ   )r}   rN   rO   r~   format_controlrU   )r   rP   rQ   r   rN   rO   rU   )rc   r}   r~   r   s   &&& r/   build_evaluatorPackageFinder.build_evaluator   sP     'nn$2B2B
 %,,!%!:!:%)#66
 	
r.   c               $    V ^8  d   QhRRRRRR/# )r1   	index_urlr$   r}   r3   r   r'   )r5   s   "r/   r6   rY      s!     * * *3 *4 *r.   c                	r    \         P                  ! V\        V4      4      R ,           pV P                  V4      # )/)	posixpathjoinr   _build_find_link)rc   r   r}   r%   s   &&& r/   _build_index_page_link$PackageFinder._build_index_page_link   s.    nnY(9,(GH3N$$S))r.   c                    V ^8  d   QhRRRR/# )r1   	find_linkr$   r3   r   r'   )r5   s   "r/   r6   rY      s     Q Q# Q$ Qr.   c                	    \         P                  P                  V4      '       d4   \        P                  ! \         P                  P                  V4      4      # R V9   d   \        V4      # \        RV 24      h)z://z(Invalid find link or non-existing path: )ospathexistsr   	from_pathabspath
ValueError)rc   r   s   &&r/   r   PackageFinder._build_find_link   sV    77>>)$$>>"''//)"<==i	?"CI;OPPr.   c               $    V ^8  d   QhRRRRRR/# )r1   linkszIterable[Link]	evaluatorr   r3   Iterable[Package]r'   )r5   s   "r/   r6   rY      s)     A A#A09A	Ar.   c                	B    \        R \        VP                  V4      4      # N)filtermapevaluate_link)rc   r   r   s   &&&r/   _evaluate_linksPackageFinder._evaluate_links   s     dC	 7 7?@@r.   c               (    V ^8  d   QhRRRRRRRR/# )r1   packagesr   requirement"packaging.requirements.Requirementallow_prereleasesbool | Noner3   r'   )r5   s   "r/   r6   rY      s2      # 8 '	
 
r.   c                	&   \         P                  ! \        VVR 7      p\        P                  ! V4      w  rV\        P                  ! \        WE4      4      w  rx\        VR4      f-   Vf)   \         P                  ! \        VRR 7      p\        WF4      pV# ))r   r   NT)	functoolspartialr   	itertoolsteer   next)	rc   r   r   r   r   
first_itersecond_itercheckits	   &&&&     r/   _evaluate_packages PackageFinder._evaluate_packages   s     %%#/
	
 #,--"9
MM&"?@	t$):)B!)) '"&I
 	/B	r.   c               $    V ^8  d   QhRRRRRR/# )r1   r   r   hasheszdict[str, list[str]]r3   r'   )r5   s   "r/   r6   rY      s$     + +)+3G+	+r.   c                	d    \         P                  ! \        W P                  R 7      p\	        W14      # ))r   r2   )r   r   r   r2   r   )rc   r   r   r   s   &&& r/   _evaluate_hashesPackageFinder._evaluate_hashes   s*     %%FLL
	 i**r.   c                    V ^8  d   QhRRRR/# )r1   packager   r3   tupler'   )r5   s   "r/   r6   rY      s     
 
 
U 
r.   c                  a a VP                   p\        S P                  4      ^,           oRpRpVP                  '       do   \	        VP
                  4      Ev rSp\        VV 3R lV 4       S^,
          R7      o\        VP                  4      S P                  9   g   RS P                  9   d   Rp\        VP                  4      ) \        V4      VP                  e   \        VP                  4      M^ S) V3# )zGThe key for sort, package with the largest value is the most preferred.Fc              3  j   <"   T F(  pSP                   P                  VS^,
          4      x  K*  	  R# 5i)   N)rb   get).0rf   prirc   s   & r/   	<genexpr>*PackageFinder._sort_key.<locals>.<genexpr>   s+     M9C%%))#sQw779s   03)defaultz:all:Tr'   )linklenrb   is_wheelr   filenameminr   rd   rR   rX   	is_yankedversionparse_version)rc   r   r   	build_tagrR   _	file_tagsr   s   f&     @r/   	_sort_keyPackageFinder._sort_key   s    ||$&&'!+ 	===';DMM'J$Q9M9MaC
 "',,/43E3EEd000 $   .5oo.IM'//*qD
 	
r.   c               $    V ^8  d   QhRRRRRR/# )r1   r}   r$   r~   rW   r3   r   r'   )r5   s   "r/   r6   rY   	  s)     (F (F(F/3(F	(Fr.   c                   a aa S P                  SV4      oR VVV 3R llp\        P                  P                  \	        VS P
                  4      4      pS P                  '       d   V# \        VS P                  RR7      # )zFind all packages with the given name.

Args:
    package_name: The desired package name
    allow_yanked: Whether to allow yanked candidates.

Returns:
    The packages with the given name, sorted by best match.
c                    V ^8  d   QhRRRR/# )r1   rp   r#   r3   r   r'   )r5   s   "r/   r6   2PackageFinder._find_packages.<locals>.__annotate__  s     	 	F 	/@ 	r.   c           	       < V R ,          R8X  dM   SP                  V R,          S4      pSP                  \        SP                  VSP                  R7      S4      pMKSP                  V R,          4      pSP                  \        SP                  VRSP                  R7      S4      pSP                  '       d   \        VSP                  RR7      # V# )r&   rk   r%   )r_   T)expandr_   keyreverse)	r   r   r   r2   r_   r   rS   sortedr   )rp   r   resultr   r}   rc   s   &  r/   find_one_source5PackageFinder._find_packages.<locals>.find_one_source  s    f~(226%=,O--/dDLL 	 ,,VE];--/d4 	 (((f$..$GGMr.   Tr   )	r   r   chainfrom_iterabler   r[   rS   r   r   )rc   r}   r~   r   all_packagesr   s   ff&  @r/   _find_packagesPackageFinder._find_packages	  sg     ((|D		 	, !44S$,,5WX$$$lEEr.   c               (    V ^8  d   QhRRRRRRRR/# )	r1   r}   r$   r~   rW   r   dict[str, list[str]] | Noner3   rE   r'   )r5   s   "r/   r6   rY   3  s2     
 

 
 ,	

 

r.   c                l    \        T P                  V P                  W4      T;'       g    / R7      4      # )a?  Find all packages with the given package name, best match first.

Args:
    package_name (str): The desired package name
    allow_yanked (bool): Whether to allow yanked candidates.
    hashes (dict[str, list[str]]|None): The hashes to filter on.

Returns:
    Sequence[Package]: The packages list sorted by best match
r   )r   r   r   )rc   r}   r~   r   s   &&&&r/   find_all_packagesPackageFinder.find_all_packages3  s;      !!##L?RT " 
 	
r.   c               $    V ^8  d   QhRRRRRR/# )r1   r   r   r~   r   r3   zGenerator[Package, None, None]r'   )r5   s   "r/   r6   rY   I  s-     
K 
K7
K "
K 
(	
Kr.   c              #  	  "   Vf   \        VP                  4      pVP                  '       d0   \        VP                  R \        VP                  4      R7      x  R # V P                  VP                  V4       R j  xL
  R #  L5i)N)r   )r   	specifierr%   r   rd   r   r   )rc   r   r~   s   &&&r/   _find_packages_from_requirement-PackageFinder._find_packages_from_requirementI  s`     
 01F1FGL???+**DtKOO7LMM**;+;+;\JJJs   +BAB<B=Bc          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r1   r   (packaging.requirements.Requirement | strr~   r   r   r   r   r3   rE   r'   )r5   s   "r/   r6   rY   U  s<      
  
= 
 " 
 '	 

 , 
 
 
r.   c           
         \        V\        4      '       d    \        P                  P	                  V4      p\        T P                  V P                  V P                  W4      VV4      T;'       g    / R7      4      # )a  Find all packages matching the given requirement, best match first.

Args:
    requirement: A packaging.requirements.Requirement
        instance or a string to construct it.
    allow_yanked (bool|None): Whether to allow yanked candidates,
        or None to infer from the specifier.
    allow_prereleases (bool|None): Whether to allow prereleases,
        or None to infer from the specifier.
    hashes (dict[str, list[str]]|None): The hashes to filter on.

Returns:
    Sequence[Package]: The packages sorted by best match
r   )	r=   r$   	packagingrequirementsRequirementr   r   r   r   )rc   r   r~   r   r   s   &&&&&r/   find_matchesPackageFinder.find_matchesU  st    * k3''#00<<[IK!!''88S%
 || " 	
 		
r.   c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r1   r   r   r~   r   r   r   r   r3   rC   r'   )r5   s   "r/   r6   rY   w  sC     !H !H=!H "!H '	!H
 ,!H 
!Hr.   c           	        \        V\        4      '       d    \        P                  P	                  V4      pV P                  W4      p\        P                  ! V4      w  rg\        V4      p\        T P                  V P                  WqV4      T;'       g    / R7      4      p	\        \        V	4      R4      p
\        WV4      # )a  Find the best match for the given requirement.

Args:
    requirement: A packaging.requirements.Requirement
        instance or a string to construct it.
    allow_yanked (bool|None): Whether to allow yanked candidates,
        or None to infer from the specifier.
    allow_prereleases (bool|None): Whether to allow prereleases,
        or None to infer from the specifier.
    hashes (dict[str, list[str]]|None): The hashes to filter on.

Returns:
    BestMatch: The best match
r   N)r=   r$   r   r   r   r   r   r   r   r   r   r   iterrC   )rc   r   r~   r   r   r   r   r   rG   applicable_candidates
best_matchs   &&&&&      r/   find_best_matchPackageFinder.find_best_matchw  s    * k3''#00<<[IK77R"+--"9
!*-
 ,!!''BST|| " !
 $45t<
JGGr.   c               4    V ^8  d   QhRRRRRRRRR	R
RRRR/# )r1   r   r   locationzstr | pathlib.Pathdownload_dirzstr | pathlib.Path | Noner   r   download_reporterr    unpack_reporterr!   r3   zpathlib.Pathr'   )r5   s   "r/   r6   rY     sY     4O 4O4O %4O 0	4O
 ,4O ,4O (4O 
4Or.   c                   ^ RI pVf   VP                  pVP                  4       ;_uu_ 4       pVf   VP                  \	        RR7      4      p\        V P                  V\        P                  ! V4      \        P                  ! V4      VV P                  VVR7      p	RRR4       VP                  '       d   X	P                  VP                  4      # X	#   + '       g   i     L?; i)a  Download and unpack the package at the given link.

If the link is a remote link, it will be downloaded to the ``download_dir``.
Then, if the link is a wheel, the path of wheel file will be returned,
otherwise it will be unpacked to the destination. Specially, if the link refers
to a local directory, the path will be returned directly, otherwise the unpacked
source path will be returned. And if the link has a subdirectory fragment, the
subdirectory will be returned.

Args:
    link (Link): The link to download
    location: The destination directory
    download_dir: The directory to download to, or None to use a
        temporary directory created by unearth.
    hashes (dict[str, list[str]]|None): The optional hash dict for validation.
    download_reporter (DownloadReporter): The download reporter for progress
        reporting. By default, it does nothing.
    unpack_reporter (UnpackReporter): The unpack reporter for progress
        reporting. By default, it does nothing.

Returns:
    The path to the installable file or directory.
Nzunearth-download-)prefix)rT   r   r  )
contextlibhash_option	ExitStackenter_contextr   r   r2   pathlibPathrT   subdirectoryjoinpath)
rc   r   r   r   r   r   r  r  stackfiles
   &&&&&&&   r/   download_and_unpack!PackageFinder.download_and_unpack  s    @ 	>%%F!!##u#$22&.AB  \*X&.."3 /	D $ 483D3D3Dt}}T../N$N $#s   A/CC#	)r^   rb   rU   r_   rO   rP   rQ   rR   rS   r[   rN   rM   rT   r   r'   )F)FN)NNN)r(   r)   r*   r+   rH   rg   propertyr2   r\   r]   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r-   r'   r.   r/   rJ   rJ   L   s    ,'
 %'	'

 %''
 (*'
 .2'
 &+'
 $&'
 &('
 (*'
 &+'
 '
 /3'
 '
R 	 	;@
0*QA
.+
4(FT
,
K 
D!HN 37.2.D*>4O 4Or.   rJ   )=rH   
__future__r   rm   r   r   r   r  r   r>   r   tempfiler   typingr   r   r   r   r	   r
   packaging.requirementsr   packaging.utilsr   r   r   packaging.versionr   r   unearth.authr   unearth.collectorr   unearth.evaluatorr   r   r   r   r   r   r   unearth.fetchersr   unearth.fetchers.syncr   unearth.linkr   unearth.preparerr   r   r   unearth.utilsr   r   r    r!   r#   dictrA   rC   rJ   r'   r.   r/   <module>r      s    - "    	     ' P P  M M 4 - 9   % ,  V V & A 
 F
"
 "BO BOr.   