+
    4j,                       R t ^ RIHt ^ RIt^ RIt^ RIHt ^ RIHtH	t	 ^ RI
Ht ^RIHt ^RIHt ]'       d#   ^ RIHtHt ^ R	I
Ht ^ R
IHt ^RIHtHt ^RIHt . ROt ! R R]	4      t]! RRR7       ! R R4      4       t ! R R4      tR# )a  Routing across an ordered list of named indexes for nab-index.

Each index in the list is named and addressable; the order alone is
semantically significant (no "primary vs extras" split).  Per package,
the router walks the list left-to-right and stops at the first index
whose listing for the package is non-empty (presence-based first-index,
matching uv's ``--index-strategy first-index``).  An index that raises
:class:`~nab_index.cache.OfflineError` (offline mode, cold cache) is
skipped so later indexes are still consulted.  If no index then serves
a listing, that error is re-raised, since an empty result would read as
an absent package.

Per-package overrides route a package to a *named* index regardless
of order; when an override matches, *only* that index is consulted
(strict pin), matching uv's ``[tool.uv.sources]`` semantics.

Marker evaluation for overrides happens upstream; this layer just sees
a ``canonical_package_name -> index_name`` mapping that has already
been resolved against the active environment.
)annotationsN)	dataclass)TYPE_CHECKINGProtocol)canonicalize_name)OfflineError)SimpleSerialization)MappingSequence)NormalizedName)Self)	SdistFile	WheelFile)RangeMetadataResultIndexClientIndexConfigMultiIndexClientc                  ~    ] tR t^2tRtR R ltR R ltRR R lltRR	 R
 lltRR R llt	RR R llt
R R ltRtR# )r   zStructural protocol satisfied by Simple-API clients.

The concrete implementations are
:class:`~nab_index.cached_client.CachedAsyncSimpleClient` and
:class:`~nab_index.local_index.LocalIndexClient`; tests can also
supply a duck-typed stand-in.
c                    V ^8  d   QhRRRR/#    packagestrreturnzlist[WheelFile | SdistFile] )formats   "g/home/user/pdf2html-billing-ledger-validate/.venv/lib/python3.14/site-packages/nab_index/multi_index.py__annotate__IndexClient.__annotate__;   s      s /J     c                   "   R# 5i)z#Return the listing for ``package``.Nr   selfr   s   &&r   	get_filesIndexClient.get_files;           c                    V ^8  d   QhRRRR/# r   r   r   r   boolr   )r   s   "r   r   r   ?   s      c d r   c                    R# )zBWhether a listing for ``package`` held only files nab cannot read.Nr   r!   s   &&r   served_unreadable_only"IndexClient.served_unreadable_only?   s    r   Nc          
     ,    V ^8  d   QhRRRRRRRRRR/# r   r   r   versionmetadata_urlmetadata_hashztuple[str, str] | Noner   r   )r   s   "r   r   r   C   s<        	
 . 
r   c                   "   R# 5i)z%Return the metadata text for a wheel.Nr   r"   r   r/   r0   r1   s   &&&&&r   get_metadata_textIndexClient.get_metadata_textC   
      	r&   c          
     ,    V ^8  d   QhRRRRRRRRRR/# 	r   r   r   r/   	sdist_urlsdist_hashestuple[tuple[str, str], ...]r   ztuple[str | None, str | None]r   )r   s   "r   r   r   M   s<        	
 2 
'r   c                   "   R# 5i)z9Return ``(pkg_info_text, pyproject_text)`` for the sdist.Nr   r"   r   r/   r9   r:   s   &&&&&r   get_sdist_filesIndexClient.get_sdist_filesM   r6   r&   c          
     ,    V ^8  d   QhRRRRRRRRRR/# 	r   r   r   r/   r9   r:   r;   r   bytesr   )r   s   "r   r   r   W   s<        	
 2 
r   c                   "   R# 5i)z#Return the raw sdist archive bytes.Nr   r=   s   &&&&&r   get_sdist_archiveIndexClient.get_sdist_archiveW   r6   r&   c               0    V ^8  d   QhRRRRRRRRRRR	R
/# r   r   r   r/   	wheel_urlcanonical_namer   wheel_hashesr;   r   r   r   )r   s   "r   r   r   a   sF     	 		 	 		
 '	 2	 
	r   c                   "   R# 5i)z<Recover a sidecar-less wheel's METADATA by HTTP range reads.Nr   r"   r   r/   rH   rI   rJ   s   &&&&&&r   get_range_metadataIndexClient.get_range_metadataa   s
      	r&   c                   V ^8  d   QhRR/# r   r   Noner   )r   s   "r   r   r   l   s      d r   c                   "   R# 5i)zClose any underlying transport.Nr   r"   s   &r   acloseIndexClient.aclosel   r%   r&   r   Nr   )__name__
__module____qualname____firstlineno____doc__r#   r+   r4   r>   rD   rM   rT   __static_attributes__r   r   r   r   r   2   s/    	 r   T)frozenslotsc                  R    ] tR t^qt$ RtR]R&   R]R&   ]P                  tR]R&   Rt	R# )	r   ar  Declares one index in the ordered list of indexes.

``name`` is the index identifier used by overrides and lockfile
output.  ``url`` is the Simple API root (HTTPS or ``file://``).
Order is significant: callers walk the list left-to-right and
presence-based first-index applies.  ``serialization`` pins which
Simple-API serialization this index is asked for and read as.
r   nameurlr   serializationr   N)
rX   rY   rZ   r[   r\   __annotations__r   	NEGOTIATErc   r]   r   r   r   r   r   q   s$     I	H)<)F)FM&Fr   c                      ] tR t^tRtR R ltR R ltR R ltR R	 ltR
 R lt	R R lt
R R ltR"R R lltR#R R lltR#R R lltR#R R lltR R ltR R ltR R ltR R  ltR!tR# )$r   aa  Routes Simple API calls across an ordered list of named indexes.

``clients_by_name`` maps each index name to its client (HTTPS via
:class:`CachedAsyncSimpleClient` or ``file://`` via
:class:`LocalIndexClient`).  ``order`` is the ordered list of
index names; the router walks it left-to-right when no override
applies.  ``override_map`` is keyed by canonical (PEP 503)
package name and maps to the chosen index name.

All client instances are owned by the router and closed by
:meth:`aclose`.  When the same client appears multiple times in
``clients_by_name`` (e.g. an alias), :meth:`aclose` closes it
once.
c               (    V ^8  d   QhRRRRRRRR/# )	r   clients_by_namezMapping[str, IndexClient]orderzSequence[str]override_mapzMapping[str, str]r   rQ   r   )r   s   "r   r   MultiIndexClient.__annotate__   s2      ,  ,2 ,  , (	 ,
 
 ,r   c                $   V'       g   Rp\        V4      hV Uu. uF  qUV9  g   K  VNK  	  ppV'       d   RV 2p\        V4      hVP                  4        UUu. uF  w  rxW9  g   K  Wx3NK  	  p	ppV	'       d   RV	 2p\        V4      h\        V4      V n        \	        V4      V n        VP                  4        U
Uu/ uF  w  r\        V
4      VbK  	  upp
V n        / V n        \        P                  ! 4       V n        R# u upi u uppi u upp
i )z9Wire the router.  See module docstring for routing rules.z*order must contain at least one index namez&order references unknown index names: z&override targets unknown index names: N)
ValueErroritemsdict_clientslist_order_normalise_name_override_map_route_cache	threadingLock_route_lock)r"   rh   ri   rj   msgnmissing_orderpkgidxbad_overridesra   
index_names   &&&&        r   __init__MultiIndexClient.__init__   s    >CS/!$)FEqo-EEF:=/JCS/! )..0
0) SJ0 	 

 :=/JCS/!_-5k %1$6$6$8
$8  D!:-$8
 -/$>>++ G


s   DD
D)D>Dc                   V ^8  d   QhRR/# rP   r   )r   s   "r   r   rk      s     
 
d 
r   c                0  "   \        4       p. pV P                  P                  4        F@  p\        V4      V9   d   K  VP	                  \        V4      4       VP                  V4       KB  	  \        P                  ! R V 4       RR/ G Rj  xL
  R#  L5i)z&Close every owned client exactly once.c              3  @   "   T F  qP                  4       x  K  	  R # 5irV   rT   ).0cs   & r   	<genexpr>*MultiIndexClient.aclose.<locals>.<genexpr>   s     )&Qhhjj&s   return_exceptionsTN)setrp   valuesidaddappendasynciogather)r"   seenuniqueclients   &   r   rT   MultiIndexClient.aclose   s{     $&mm**,F&zT!HHRZ MM&!	 -
 nn)&)
"
 	
 	
s   BBBBc                   V ^8  d   QhRR/# )r   r   r   r   )r   s   "r   r   rk      s      $ r   c                   "   V # 5i)zReturn self.r   rS   s   &r   
__aenter__MultiIndexClient.__aenter__   s
     r&   c                    V ^8  d   QhRRRR/# )r   argsobjectr   rQ   r   )r   s   "r   r   rk      s      V  r   c                B   "   V P                  4       G Rj  xL
  R#  L5i)zClose all clients on exit.Nr   )r"   r   s   &*r   	__aexit__MultiIndexClient.__aexit__   s     kkms   c                    V ^8  d   QhRRRR/# r   r   r   r   z
str | Noner   )r   s   "r   r   rk      s     @ @s @z @r   c                	J    V P                   P                  \        V4      4      # rV   )rt   getrs   r!   s   &&r   _override_index MultiIndexClient._override_index   s    !!%%og&>??r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   rk      s     & &s &/J &r   c                  "   V P                  V4      pVe@   V P                  V,          pVP                  V4      G Rj  xL
 pV P                  W4       V# V P	                  V4      pVe+   V P                  V,          P                  V4      G Rj  xL
 # RpV P
                   FM  pV P                  V,          p VP                  V4      G Rj  xL
 pT'       g   K:  T P                  Y4       Tu # 	  V P                  WP
                  ^ ,          4       Ve   Vh. #  L L LS  \         d   pTp Rp?K  Rp?ii ; i5i)a%  Return the chosen index's listing for ``package``.

See module docstring for routing.  The chosen index name is
cached so subsequent metadata / sdist calls hit the same
client.  Raises :class:`~nab_index.cache.OfflineError` when no
index served a listing and at least one was skipped offline.
N)r   rp   r#   _record_route_cached_route_namerr   r   )	r"   r   overrider   filescachedskipped_offliner   excs	   &&       r   r#   MultiIndexClient.get_files   s'     ''0]]8,F **733Ew1L((1v.88AAA/3++J]]:.F$..w77 u""77 & 	7KKN3&!!	7 4 B 8 "%sf   =E D AE D!(E ;D%D#D%E AE !E #D%%D=0D82E 8D==E c                    V ^8  d   QhRRRR/# r(   r   )r   s   "r   r   rk      s     	
 	
c 	
d 	
r   c                   a \         ;QJ d7    V3R lV P                  P                  4        4       F  '       g   K   R# 	  R# ! V3R lV P                  P                  4        4       4      # )zWhether any walked index listed ``package`` in unreadable formats.

An empty walk routes ``package`` to the first index, which need not
be the one that served the unreadable page, so every client is asked
rather than the routed one.
c              3  D   <"   T F  qP                  S4      x  K  	  R # 5irV   )r+   )r   r   r   s   & r   r   :MultiIndexClient.served_unreadable_only.<locals>.<genexpr>   s!      
AWv))'22AWs    TF)anyrp   r   r!   s   &fr   r+   'MultiIndexClient.served_unreadable_only   sZ     s 
AEAUAUAW
ss 	
s 	
s 
AEAUAUAW
 
 	
r   Nc          
     ,    V ^8  d   QhRRRRRRRRRR/# r.   r   )r   s   "r   r   rk      s<     

 



 

 	


 .

 


r   c                `   "   V P                  V4      P                  WW44      G Rj  xL
 #  L5izCForward to the routed client; presupposes ``get_files`` was called.N)_client_forr4   r3   s   &&&&&r   r4   "MultiIndexClient.get_metadata_text   s4      %%g.@@l
 
 	
 
   %.,.c          
     ,    V ^8  d   QhRRRRRRRRRR/# r8   r   )r   s   "r   r   rk     s<     

 



 

 	


 2

 
'

r   c                `   "   V P                  V4      P                  WW44      G Rj  xL
 #  L5ir   )r   r>   r=   s   &&&&&r   r>    MultiIndexClient.get_sdist_files  s4      %%g.>>i
 
 	
 
r   c          
     ,    V ^8  d   QhRRRRRRRRRR/# rA   r   )r   s   "r   r   rk     s<     

 



 

 	


 2

 


r   c                `   "   V P                  V4      P                  WW44      G Rj  xL
 #  L5ir   )r   rD   r=   s   &&&&&r   rD   "MultiIndexClient.get_sdist_archive  s4      %%g.@@i
 
 	
 
r   c               0    V ^8  d   QhRRRRRRRRRRR	R
/# rG   r   )r   s   "r   r   rk   #  sF     
 

 
 	

 '
 2
 

r   c                b   "   V P                  V4      P                  WW4V4      G Rj  xL
 #  L5ir   )r   rM   rL   s   &&&&&&r   rM   #MultiIndexClient.get_range_metadata#  s6      %%g.AAi
 
 	
 
s   &/-/c                    V ^8  d   QhRRRR/# )r   r   r   r   r   r   )r   s   "r   r   rk   0  s     - -3 -; -r   c                	    V P                  V4      pVe   V P                  V,          # V P                  V P                  ^ ,          ,          # rV   )r   rp   rr   )r"   r   r   s   && r   r   MultiIndexClient._client_for0  s>    ((1==((}}T[[^,,r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   rk   6  s     4 4# 4* 4r   c                	    \        V4      pV P                  ;_uu_ 4        V P                  P                  V4      uuR R R 4       #   + '       g   i     R # ; irV   )rs   rx   ru   r   )r"   r   	canonicals   && r   r   #MultiIndexClient._cached_route_name6  s;    #G,	$$((3 s   AA	c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   rk   ;  s     0 0 0 0r   c                $    V P                  V4      # )a  Return the index name that served ``package``, or ``None``.

``None`` indicates the router has not seen the package yet:
no listing call has resolved its location.  Callers must
treat the return value as best-effort and fall back to a
configured default when ``None`` comes back.
)r   r!   s   &&r   	route_forMultiIndexClient.route_for;  s     &&w//r   c               $    V ^8  d   QhRRRRRR/# )r   r   r   r   r   rQ   r   )r   s   "r   r   rk   E  s!     6 6S 6c 6d 6r   c                	    \        V4      pV P                  ;_uu_ 4        W P                  V&   R R R 4       R #   + '       g   i     R # ; irV   )rs   rx   ru   )r"   r   r   r   s   &&& r   r   MultiIndexClient._record_routeE  s5    #G,	+5i( s	   9A
	)rp   rr   rt   ru   rx   rV   rW   )rX   rY   rZ   r[   r\   r   rT   r   r   r   r#   r+   r4   r>   rD   rM   r   r   r   r   r]   r   r   r   r   r      sZ     ,D
@&P	







-4
06 6r   )r   r   r   ) r\   
__future__r   r   rv   dataclassesr   typingr   r   packaging.utilsr   rs   cacher   rc   r   collections.abcr	   r
   r   typing_extensionsr   r   r   r   
lazy_wheelr   __all__r   r   r   r   r   r   <module>r      sy   * #   ! * @  .1.&,/<( <~ $d#G G $GG6 G6r   