+
    2j^                    >   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Ht ^ RIHt ^ RIHt ^ RIHt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 ^RI H!t!H"t"H#t#H$t$H%t%H&t& ^RI'H(t( ]'       d   ^ RIH)t) ^ RI*H+t+ ^RI,H-t- . RAOt. ! R R]/4      t0 ! R R](4      t1 ! R R]14      t2 ! R R]14      t3 ! R R]14      t4R R lt5R R lt6R R  lt7R! R" lt8]9! ]Pt                  ]Pv                  ]Px                  ]Pz                  04      t>]9! 0 RBm4      t?R# R$ lt@R% R& ltAR' R( ltB]P                  ! R)]P                  4      tER* R+ ltFR, R- ltGR. R/ ltHR0 R1 ltIR2 R3 ltJR4 R5 ltKR6 R7 ltLR8 R9 ltMR: R; ltNR< R= ltOR> R? ltP ! R@ R4      tQR# )Ca  Local file:// index support for nab-index.

Two flavours, both keyed off a ``file://`` URL pointing at a directory:

* PEP 503 directory: ``<root>/<package>/index.html`` HTML listings,
  same anchor-tag shape that pip and uv recognise. Synthesised
  :class:`~nab_index.client.WheelFile` /
  :class:`~nab_index.client.SdistFile` records mirror what an HTTPS
  Simple API returns.
* Flat wheelhouse: a directory containing ``.whl`` and ``.tar.gz``
  files at the top level (pip's ``--find-links ./wheels`` shape).
  On-disk filenames are parsed for ``(name, version)`` and every
  distribution for a package is returned by ``get_files``.  ``.zip``
  sdists are ignored, matching the remote-index behaviour.

Reads run synchronously off the filesystem; the filesystem is the
cache. The async surface is a thin shim over the sync helpers so the
multi-index router can treat local and remote indexes uniformly.
)annotationsN)BytesParserParser)Path)TYPE_CHECKING)unquoteurljoinurlparseurlsplit)url2pathname)canonicalize_name)parse_sdist_filename)hash_fragmentmetadata_declaration	read_page)	SdistFile	WheelFile_extract_sdist_files_parse_sdist_filename_parse_wheel_filenameis_readable_filename)IndexAccessError)NormalizedName)Self)RangeMetadataResultLocalIndexClientLocalIndexErrorMalformedLocalListingErrorNonLocalArtifactErrorUnreadableLocalIndexErrorUnsupportedWheelErrorc                      ] tR t^FtRtRtR# )r    zA local wheel's ``.dist-info`` contradicts its own filename.

Raised when a wheel carries more than one top-level ``.dist-info``
directory, or a single one whose name does not canonicalise to the
distribution named by the wheel's filename.
 N__name__
__module____qualname____firstlineno____doc____static_attributes__r"       `/home/user/billing-ledger-validation/.venv/lib/python3.14/site-packages/nab_index/local_index.pyr    r    F       r*   c                      ] tR t^OtRtRtR# )r   zA ``file://`` index could not produce a listing or serve an artifact.

Raising, rather than returning an empty listing, keeps an index that
failed from reading as an absent package.
r"   Nr#   r"   r*   r+   r   r   O   s    r*   c                      ] tR t^WtRtRtR# )r   a  A path under a ``file://`` index could not be read.

Distinct from :class:`MalformedLocalListingError` because the content was
never seen: a wheelhouse the process cannot list, or an ``index.html`` it
cannot stat or open, is a permission or mount fault rather than a bad
listing.
r"   Nr#   r"   r*   r+   r   r   W   s    r*   c                      ] tR t^atRtRtR# )r   zHA ``file://`` index's ``index.html`` or metadata sidecar does not parse.r"   Nr#   r"   r*   r+   r   r   a   s    Rr*   c                      ] tR t^etRtRtR# )r   zA ``file://`` index advertised an artifact URL a local client cannot serve.

A :pep:`503` repository page may link to absolute ``http(s)`` artifact
URLs, so the listing is legal, but a filesystem-backed index cannot fetch
a remote artifact.
r"   Nr#   r"   r*   r+   r   r   e   r,   r*   c                    V ^8  d   QhRRRR/# )   urlstrreturnboolr"   )formats   "r+   __annotate__r8   n   s     	 	S 	T 	r*   c                X     \        V 4      P                  R8H  #   \         d     R# i ; i)zReturn True when ``url`` is a ``file:`` URL in either RFC 8089 spelling.

An authority :func:`urlsplit` cannot parse, such as an unterminated IPv6
bracket, is not one.
fileF)r
   scheme
ValueError)r3   s   &r+   is_file_urlr=   n   s.    }##v-- s    ))c                    V ^8  d   QhRRRR/# r2   r3   r4   r5   r   r"   )r7   s   "r+   r8   r8   z   s        r*   c                t   \        V 4      pVP                  R8w  d   RV : 2p\        V4      hVP                  pV'       d   VR8X  d   RpM0\        P
                  R8X  d   RV,           pMRV : 2p\        V4      h\        W1P                  ,           4      pRV9   d   R	V : 2p\        V4      h\        V4      # )
a  Resolve a ``file://`` URL to an absolute filesystem path.

Uses :func:`urllib.request.url2pathname` so Windows-style drive
paths (``file:///C:/...``) and percent-encoded characters round-trip
cleanly across platforms. An empty or ``localhost`` authority (RFC
8089) means the local machine; any other host becomes a UNC share on
Windows and is rejected elsewhere.  :mod:`pathlib` accepts a decoded
null character, which names no file on any platform, so it raises
:class:`ValueError` here instead.
r:   zexpected file:// URL, got 	localhost win32z\\z9non-local file:// URL is not supported on this platform:  z;file:// URL decodes to a path containing a null character: )	r	   r;   r<   netlocsysplatformr   pathr   )r3   parsedmsgrE   rH   s   &    r+   parse_file_urlrK   z   s     c]F}}*3'2o]]FV{*		 &I#Qo,-D~KC7So:r*   c                    V ^8  d   QhRRRR/# r?   r"   )r7   s   "r+   r8   r8      s     2 2c 2d 2r*   c                d     \        V 4      #   \         d   pRT : 2p\        T4      ThRp?ii ; i)zResolve a served-artifact URL to a local path.

:func:`parse_file_url` raises :class:`ValueError` for an ``http(s)`` or
non-local ``file://`` URL; re-raise it as :class:`NonLocalArtifactError` so
the fetch fails through the index-error path.
z*local file:// index cannot serve artifact N)rK   r<   r   )r3   excrJ   s   &  r+   _resolve_served_pathrO      s;    2c"" 2:3'B#C(c12s   
 /*/c               $    V ^8  d   QhRRRRRR/# )r2   rH   r   kindr4   r5   bytesr"   )r7   s   "r+   r8   r8      s!     6 6T 6 6 6r*   c                x     V P                  4       #   \         d   pRT RT  RT 2p\        T4      ThRp?ii ; i)zRead a served local artifact's bytes, mapping a read failure.

A missing or unreadable file raises :class:`UnreadableLocalIndexError` so
the fetch fails through the index-error path, matching a remote index's
404 rather than a raw :class:`OSError`.
zcannot read local  : N)
read_bytesOSErrorr   )rH   rQ   rN   rJ   s   &&  r+   _read_served_bytesrX      sI    6   6"4&$r#7',#56s    949c                    V ^8  d   QhRRRR/# )r2   rH   r   r5   z
int | Noner"   )r7   s   "r+   r8   r8      s      T j r*   c                     V P                  4       P                  #   \         d8   pTP                  \        9   g   \        TRR4      \        9   d    Rp?R# h Rp?ii ; i)aW  Return ``path``'s ``st_mode``, or ``None`` when nothing is there.

Only an error meaning the path is absent gives ``None``, so a broken entry
skips instead of failing the listing it sits in. Anything else raises: from
Python 3.14 ``Path.exists`` and ``Path.is_file`` swallow every
:class:`OSError`, so an unreadable path would read as absent.
winerrorN)statst_moderW   errno_ABSENT_ERRNOSgetattr_ABSENT_WINERRORS)rH   rN   s   & r+   
_stat_moderb      sM    yy{""" II'sJ-1BBs    A+AAAc                    V ^8  d   QhRRRR/# r2   rH   r   r5   r6   r"   )r7   s   "r+   r8   r8      s     3 34 3D 3r*   c                \    \        V 4      pVRJ;'       d    \        P                  ! V4      # )z4Return whether ``path`` is an existing regular file.N)rb   r\   S_ISREGrH   modes   & r+   _is_fileri      (    dDt22T 22r*   c                    V ^8  d   QhRRRR/# rd   r"   )r7   s   "r+   r8   r8      s     3 3$ 34 3r*   c                \    \        V 4      pVRJ;'       d    \        P                  ! V4      # )z1Return whether ``path`` is an existing directory.N)rb   r\   S_ISDIRrg   s   & r+   _is_dirrn      rj   r*   z\.(whl|tar\.gz)$c               $    V ^8  d   QhRRRRRR/# )r2   package_dirr   	canonicalr4   r5   (tuple[list[WheelFile | SdistFile], bool]r"   )r7   s   "r+   r8   r8      s&     < <<< .<r*   c                   V R,          p\        V4      '       g   . R3#  VP                  RR7      p\	        T4      w  rgT P                  4       R,          P                  4       pTe    \        Y4      p. p	Rp
T F  pTP                  '       d   K  \        TP                  T4      w  rrTf   K6  \        T4      '       g   Rp
KK  \        TTTTP                  TT\        TP                   4      RJR	7      pTf   K  T	P#                  T4       K  	  Y3#   \         d   pT RT 2p\        T4      ThRp?ii ; i  \         d   pT RT 2p\        T4      ThRp?ii ; i)
zParse ``<package>/index.html`` and return file records.

The second element says the page linked a file in a format nab does
not read, which tells a page of ``.zip`` sdists from an empty one.

index.htmlFutf-8)encoding is not valid UTF-8: Nz! has an unparseable <base href>: Thas_metadata)ri   	read_textUnicodeDecodeErrorr   r   resolveas_urir   r<   yanked_resolve_local_linkhrefr   _make_recordrequires_pythonr   metadataappend)rp   rq   
index_htmltextrN   rJ   anchors	base_hrefbase_urlfiles
unreadableanchorfilenamefile_url
local_pathhashesrecords   &&               r+   _scan_pep503_directoryr      s    |+JJ5y7##W#5
 #4G##%4<<>H
	;x3H
 *,EJ===1DKK2
.J #H--J""-foo>dJ
 LL 1 2 [  71#7(-367  	;L A#GC,S1s:	;s/   D )D: D7D22D7:EEEc               $    V ^8  d   QhRRRRRR/# )r2   r   r4   r   r5   z@tuple[str | None, str, Path | None, tuple[tuple[str, str], ...]]r"   )r7   s   "r+   r8   r8     s'     )* )*
)*)* F)*r*   c                   V P                  R4      w  r#p\        V4      p \        W4      p\        V4      pTP
                  R9   d<   \        TP                  P                  R^4      R,          4      ;'       g    RpYRT3#  \        T4      p	T	P                  YiT3#   \         d
    RTRT3u # i ; i  \         d
    RTRT3u # i ; i)a  Resolve an anchor href to ``(filename, url, local_path, hashes)``.

``base_url`` is the page's ``<base href>`` when it carries one, else the
``index.html`` URL.  An href is a URL reference, so only its path
component names the artefact, and the target may sit outside the package
directory: the standard mirror layout links to a shared
``../../packages/`` tree.

The href's hash fragment is surfaced as the file record's ``hashes``
tuple so the lockfile writer has something to round-trip.

``local_path`` is the artefact's on-disk path when the href names
a local file, and ``None`` for an ``http``/``https`` href.  It is
carried so downstream code never has to reverse the ``file:`` URL.
#N/>   httphttps)	partitionr   r   r	   r<   r;   r   rH   rsplitrK   name)
r   r   href_no_frag_fragmentr   r3   rI   r   rH   s
   &&        r+   r   r     s    & !%s 3LX8$F
2h-# }}))6;;--c15b9:BBdtV,,)c" IIs&))  2lD&112  )c4(()s#   B B5 B21B25C	C	c               $    V ^8  d   QhRRRRRR/# )r2   rootr   packager4   r5   rr   r"   )r7   s   "r+   r8   r8   K  s&     # #
## .#r*   c                   \        V4      p. pRp\        V P                  4       4       F  p\        V4      '       g   K  \        P                  VP                  4      f#   T;'       g    \        VP                  V4      pKY  \        WR4      p\        VP                  VP                  4       VVRVRR7      pVf   K  VP                  V4       K  	  W43# )a  Find all dists for ``package`` in a flat directory of files.

Entries are sorted because the listing order breaks ties between dists at
one version, and ``iterdir`` order comes from the filesystem.

The second element says the directory holds a ``.zip`` sdist for
``package``, a format nab does not read.  One directory serves every
package, so a file that does not name ``package`` says nothing about it.
Frx   r"   )
_canonicalsortediterdirri   
_FLAT_EXTSsearchr   _is_zip_sdist_flat_requires_pythonr   r}   r   )r   r   rq   r   r   entryr   r   s   &&      r+   _scan_flat_wheelhouser   K  s     7#I)+EJ'UZZ(0#KK}UZZ'KJ/AJJLLN
 LL # ($ r*   c               $    V ^8  d   QhRRRRRR/# )r2   r   r4   rq   r5   r6   r"   )r7   s   "r+   r8   r8   q  s!     	 	C 	C 	D 	r*   c                |    V P                  R4      '       g   R#  \        V 4      w  r#W!8H  #   \         d     R# i ; i)zDWhether ``filename`` is a ``.zip`` sdist belonging to ``canonical``.z.zipF)endswithr   r<   )r   rq   r   r   s   &&  r+   r   r   q  sF    V$$&x0   s   , ;;c               $    V ^8  d   QhRRRRRR/# )r2   r   r   rq   r4   r5   
str | Noner"   )r7   s   "r+   r8   r8   }  s!     
 
 
# 
* 
r*   c                    \        V P                  4      pVe   V^ ,          V8w  d   R# \        W4      # \        V P                  4      pVe   V^ ,          V8X  d   \	        V 4      # R# )zGRead a flat-wheelhouse dist's ``Requires-Python``; not in the filename.N)r   r   _read_wheel_requires_pythonr   _read_sdist_requires_python)r   rq   wheelsdists   &&  r+   r   r   }  s]    !%**-E8y *5<<!%**-EU1X2*511r*   c                    V ^8  d   QhRRRR/# )r2   
sdist_pathr   r5   r   r"   )r7   s   "r+   r8   r8     s     5 5D 5Z 5r*   c                     V P                  4       p\        T4      w  r#Tf   R# \        4       P	                  TRR7      P                  R4      p\        T\        4      '       d   T# R#   \         d     R# i ; i)zAReturn ``Requires-Python`` from an sdist's PKG-INFO, or ``None``.NTheadersonlyRequires-Python)rV   rW   r   r   parsestrget
isinstancer4   )r   datapkg_infor   values   &    r+   r   r     sz    $$& 't,KHHhD9==>OPEuc**544  s   A) )A87A8c               $    V ^8  d   QhRRRRRR/# )r2   
wheel_pathr   expectedr4   r5   r   r"   )r7   s   "r+   r8   r8     s!     5 5D 5C 5J 5r*   c                    \         P                  ! V 4      ;_uu_ 4       p\        VP                  4       V4      pVf    RRR4       R# VP	                  V4      pRRR4       \        4       P                  XRR7      P                  R4      p\!        T\"        4      '       d   T# R#   + '       g   i     LT; i  \         P
                  \        \        \        P                  \        P                  \        3 d     R# i ; i)z@Return ``Requires-Python`` from a wheel's METADATA, or ``None``.NTr   r   )zipfileZipFilewheel_metadata_membernamelistread
BadZipFilerW   r    zliberrorlzma	LZMAErrorRuntimeErrorr   
parsebytesr   r   r4   )r   r   archivememberrawr   s   &&    r+   r   r     s    __Z((G*7+;+;+=xHF~ )( ,,v&C	 ) M$$Sd$;??@QREuc**544! )( 	

  s;   B:  B' B: 
B'B: 'B7	2B: 7B: :AD Dc               8    V ^8  d   QhRRRRRRRRRR	R
RRRRR/# )r2   r   r4   r   r   zPath | Noner   r   r   tuple[tuple[str, str], ...]r   ry   r6   r5   zWheelFile | SdistFile | Noner"   )r7   s   "r+   r8   r8     sX     - --- -  	-
 (- - - "-r*   c                   \        V 4      pVe    Vw  rW8w  d   R# \        V VV	VVRVVR7      # \        V 4      pVe   Vw  rW8w  d   R# \        V VV	VRVVR7      # R# )zBuild a file record, or ``None`` for unusable filenames.

Files whose parsed canonical name does not match ``expected`` are
dropped; see :func:`nab_index.client._parse_files` for the
phantom-version failure this prevents.
N)r   r3   versionr   ry   upload_timer   r   )r   r3   r   r   r   r   r   )r   r   r   r   )
r   r   r   r   r   r   ry   rI   parsed_namer   s
   &&&&&&$   r+   r   r     s      #8,F%"+%!	
 		
 #8,F%"+!
 	
 r*   c                    V ^8  d   QhRRRR/# )r2   r   r   r5   r   r"   )r7   s   "r+   r8   r8     s      D Z r*   c                "   \        V P                  4      pVf   R#  \        P                  ! V 4      ;_uu_ 4       p\	        VP                  4       V^ ,          4      pVf    RRR4       R# VP                  V4      P                  R4      uuRRR4       #   + '       g   i     R# ; i  \         d   pRT  RT 2p\        T4      ThRp?i\        P                  \        \        P                  \        P                  \         3 d     R# i ; i)ap  Return a wheel's ``<name>-<version>.dist-info/METADATA`` text.

The ``.dist-info`` directory must name the wheel's own distribution
(taken from its filename); a wheel with several top-level ``.dist-info``
directories, or one naming a different distribution, raises
:class:`UnsupportedWheelError` rather than reading another package's
metadata.  Returns ``None`` when the archive cannot be parsed, its name is
not a wheel filename, or it carries no METADATA member.  A wheel that
cannot be opened raises :class:`UnreadableLocalIndexError` instead, so a
permission or mount fault is not read as a wheel that declares nothing.
Nru   zcannot read local wheel rU   )r   r   r   r   r   r   r   decoderW   r   r   r{   r   r   r   r   r   )r   rI   zfr   rN   rJ   s   &     r+   read_wheel_metadatar     s     #:??3F~__Z((B*2;;=&)DF~ )( 776?))'2	 )(((
  6(Bse<',#5

  sL   B* 'B"B* ,B
B* B'	!B* 'B* *D5C		?D	DDc               $    V ^8  d   QhRRRRRR/# )r2   namesz	list[str]r   r4   r5   r   r"   )r7   s   "r+   r8   r8     s!     $/ $/ $/c $/j $/r*   c           
        \        R V  4        UUUu0 uF+  w  r#pV'       g   K  VP                  R4      '       g   K)  VkK-  	  uppp4      pV'       g   R# \        V4      ^8  d&   RP                  V4      pRV: RV 2p\	        V4      hV^ ,          p\        V4      V8w  d   RV: RV: R2p\	        V4      hV R	2p	W9   d   V	# R# u upppi )
a  Return ``expected``'s own top-level ``*.dist-info/METADATA`` member.

``expected`` is the wheel's canonical name.  Both the local wheel reader
and the HTTP range reader select the METADATA member through this one
helper, so the two paths agree on what counts as a wheel's own metadata.
Returns ``None`` when no top-level ``.dist-info`` holds a METADATA file.
Raises
:class:`UnsupportedWheelError` when the wheel carries several top-level
``.dist-info`` directories, or a single one whose name does not
canonicalise to ``expected``.
c              3  B   "   T F  qP                  R 4      x  K  	  R# 5i)r   N)r   ).0r   s   & r+   	<genexpr>(wheel_metadata_member.<locals>.<genexpr>  s      G!4!4s   
.dist-infoNz, z
wheel for z& has multiple .dist-info directories: z carries .dist-info directory z for a different distributionz	/METADATA)r   r   lenjoinr    _dist_info_name)
r   r   headsepr   	info_dirsjoinedrJ   info_dirr   s
   &&        r+   r   r     s      !H G	
 G1 }}\2 D G	
I 
9~9%8,&LVHU#C((|Hx H,$B8, O+ , 	 $C((z#F_6.$./	
s   C
C
C
c                    V ^8  d   QhRRRR/# )r2   r   r4   r5   r"   )r7   s   "r+   r8   r8   (  s     . .c .c .r*   c                h    V P                  R4      p\        VP                  R^4      ^ ,          4      # )zFReturn the canonical distribution name from a ``.dist-info`` dir name.r   -)removesuffixr   r   )r   stems   & r+   r   r   (  s-      .Ddkk#q)!,--r*   c                      ] tR tR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 R lltRR R lltRR R lltRR R lltRtR# )r   i.  aG  File-system-backed index client.

Speaks the same surface as :class:`CachedAsyncSimpleClient` so the
multi-index router can use it without branches.  Each ``get_files``
call auto-detects layout: PEP 503 if ``<root>/<package>/index.html``
exists, flat wheelhouse otherwise.  Mixed roots work; the choice is
re-made per package.
c                    V ^8  d   QhRRRR/# )r2   	index_urlr4   r5   Noner"   )r7   s   "r+   r8   LocalIndexClient.__annotate__8  s     0 0# 0$ 0r*   c                `    \        V4      P                  4       V n        \        4       V n        R# )zxHold the resolved root path for ``index_url``.

A ``file:`` URL may be cwd-relative; artefact URLs have to be absolute.
N)rK   r|   _rootset_unreadable_only)selfr   s   &&r+   __init__LocalIndexClient.__init__8  s#    
 $I.668
*-%r*   c                   V ^8  d   QhRR/# )r2   r5   r   r"   )r7   s   "r+   r8   r   @  s     ) )d )r*   c                   "   R# 5i)zNo-op; nothing to release.Nr"   r   s   &r+   acloseLocalIndexClient.aclose@          c                   V ^8  d   QhRR/# )r2   r5   r   r"   )r7   s   "r+   r8   r   C  s      $ r*   c                   "   V # 5i)zReturn self for ``async with``.r"   r  s   &r+   
__aenter__LocalIndexClient.__aenter__C  s
     r  c                    V ^8  d   QhRRRR/# )r2   argsobjectr5   r   r"   )r7   s   "r+   r8   r   G  s      V  r*   c                   "   R# 5i)zNo-op exit.Nr"   )r   r  s   &*r+   	__aexit__LocalIndexClient.__aexit__G  r  r  c                    V ^8  d   QhRRRR/# )r2   r   r4   r5   zlist[WheelFile | SdistFile]r"   )r7   s   "r+   r8   r   J  s      s /J r*   c                  "   \        V4      pV P                  V,          p \        VR,          4      '       d   \        W24      w  rEM8\	        V P                  4      '       g   . RrTM\        V P                  V4      w  rE V'       g$   V'       d   V P                  P                  V4       V#   \         d$   pRT P                   RT 2p\        T4      ThRp?ii ; i5i)a.  Return all distribution files known for ``package``.

An index directory or listing the process cannot read raises
:class:`UnreadableLocalIndexError` so the listing fails through the
index-error path rather than raising a raw :class:`OSError` or
returning an empty list that reads as "package absent".
rt   Fzcannot read local index rU   N)
r   r   ri   r   rn   r   rW   r   r   add)r   r   rq   rp   r   r   rN   rJ   s   &&      r+   	get_filesLocalIndexClient.get_filesJ  s      w'	jj9,		:l233$:;$R!zTZZ(($&z$9$**g$N!z
 !!%%g.  	:,TZZL3%@C+C0c9	:sL   C%B- CB- &C'B- ?CCC-C8CCCc                    V ^8  d   QhRRRR/# )r2   r   r4   r5   r6   r"   )r7   s   "r+   r8   r   d  s     0 0c 0d 0r*   c                    WP                   9   # )zBWhether a listing for ``package`` held only files nab cannot read.)r   )r   r   s   &&r+   served_unreadable_only'LocalIndexClient.served_unreadable_onlyd  s    ////r*   Nc          
     ,    V ^8  d   QhRRRRRRRRRR/# )r2   r   r4   r   metadata_urlmetadata_hashztuple[str, str] | Noner5   r"   )r7   s   "r+   r8   r   h  s<     ; ;; ; 	;
 .; 
;r*   c                   "   \        V4      p\        VR4      p VP                  R4      #   \         d   pT RT 2p\	        T4      ThRp?ii ; i5i)a  Return PEP 658 metadata text for a wheel sitting on disk.

The on-disk sidecar is trusted, so ``metadata_hash`` is accepted only
to match the remote client signature and is not verified.  A missing
or unreadable sidecar raises :class:`UnreadableLocalIndexError` and a
non-UTF-8 one :class:`MalformedLocalListingError`, so no raw
:class:`OSError` or :class:`UnicodeDecodeError` escapes.
zmetadata sidecarru   rw   N)rO   rX   r   r{   r   )	r   r   r   r  r  rH   r   rN   rJ   s	   &&&&&    r+   get_metadata_text"LocalIndexClient.get_metadata_texth  s_      $L1!$(:;	;;;w''! 	;F/u5C,S1s:	;s$   A, AAA

AAc          
     ,    V ^8  d   QhRRRRRRRRRR/# )	r2   r   r4   r   	sdist_urlsdist_hashesr   r5   ztuple[str | None, str | None]r"   )r7   s   "r+   r8   r     sC     G GG G 	G
 2G 
'Gr*   c                J   "   \        V4      p\        \        VR4      4      # 5i)zReturn ``(pkg_info, pyproject_toml)`` extracted from the sdist.

On-disk archives are trusted, so ``sdist_hashes`` matches the remote
client signature but is not verified.
r   )rO   r   rX   r   r   r   r#  r$  rH   s   &&&&& r+   get_sdist_files LocalIndexClient.get_sdist_files  s$      $I.#$6tW$EFFs   !#c          
     ,    V ^8  d   QhRRRRRRRRRR/# )	r2   r   r4   r   r#  r$  r   r5   rR   r"   )r7   s   "r+   r8   r     s<     1 11 1 	1
 21 
1r*   c                8   "   \        V4      p\        VR4      # 5i)zReturn the raw bytes of an sdist archive sitting on disk.

On-disk archives are trusted, so ``sdist_hashes`` matches the remote
client signature but is not verified.
r   )rO   rX   r&  s   &&&&& r+   get_sdist_archive"LocalIndexClient.get_sdist_archive  s      $I.!$00s   c               0    V ^8  d   QhRRRRRRRRRRR	R
/# )r2   r   r4   r   	wheel_urlcanonical_namer   wheel_hashesr   r5   r   r"   )r7   s   "r+   r8   r     sN     C CC C 	C
 'C 2C 
Cr*   c                @   "   ^RI HpHp V! RVP                  4      # 5i)zReturn the no-source result.

A local wheel is read through the resolver's ``local_path`` branch, not
over HTTP, so there is no range read to perform here.
)r   RangeOutcomeN)
lazy_wheelr   r2  UNSUPPORTED)r   r   r   r.  r/  r0  r   r2  s   &&&&&&  r+   get_range_metadata#LocalIndexClient.get_range_metadata  s      	B"4)A)ABBs   )r   r   )N)r"   )r$   r%   r&   r'   r(   r   r  r  r  r  r  r   r'  r+  r5  r)   r"   r*   r+   r   r   .  sA    0)40;.G1C Cr*   )
r   r   r   r   r   r    r=   rK   r   r   >      {     )Rr(   
__future__r   r^   r   rer\   rF   r   r   email.parserr   r   pathlibr   typingr   urllib.parser   r   r	   r
   urllib.requestr   packaging.utilsr   r   r   _pep503r   r   r   clientr   r   r   r   r   r   errorsr   r   typing_extensionsr   r3  r   __all__	Exceptionr    r   r   r   r   r=   rK   rO   rX   	frozensetENOENTENOTDIREBADFELOOPr_   ra   rb   ri   rn   compile
IGNORECASEr   r   r   r   r   r   r   r   r   r   r   r   r   r"   r*   r+   <module>rO     s[  ( #   	  
   ,    = = ' ; 0 C C  %.&/I &  S SO 	B26 ELL%--ekkRS o. &33 ZZ+R]];
<~)*X#L	
55,-`D$/N.@C @Cr*   