+
    –°³jÃ0  ã                   ó4  a € R, t-0 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
 ^ RIHt ^ RIt^RIHt ^RIHtHtHt ]P&                  ! R4      t^<tR	t/ t] ^ k ]P0                  ! 4       t/ t] ^k R
 R lt ! R R]]
4      t]! RR7       ! R R4      4       t]! RR7       ! R R4      4       tR-R R llt R R lt!]R R l4       t"]R R l4       t#R R lt$R R lt%R  R! lt&]R"RR#R/R$ R% ll4       t' ! R& R'4      t(](! 4       t)R( t*R) R* lt+R+ t,R# ).é    N)ÚMapping)Ú	dataclass)ÚEnum)ÚAny)Ú	constants)Úhf_raise_for_statusÚhttp_backoffÚvalidate_hf_hub_argsz^[0-9a-fA-F]{64}$iè  c                ó0   € V ^8„  d   QhR\         R\        /# )é   Úxet_hashÚreturn)ÚstrÚbool)Úformats   "Ú[/home/luca/screen-checking/.venv/lib/python3.14/site-packages/huggingface_hub/utils/_xet.pyÚ__annotate__r      s   € ÷ 5ñ 5¤ð 5¬ñ 5ó    c                ó>   € \        \        P                  V 4      4      # )zLReturn whether `xet_hash` looks like a real Xet content hash (64 hex chars).)r   Ú_REGEX_XET_HASHÚ	fullmatch)r   s   &r   Úis_valid_xet_hashr      s   € ä”×)Ñ)¨(Ó3Ó4Ð4r   c                   ó   € ] tR t^tRtRtRtR# )ÚXetTokenTypeÚreadÚwrite© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__ÚREADÚWRITEÚ__static_attributes__r   r   r   r   r      s   † Ø€DØ„Er   r   T)Úfrozenc                   ó,   a € ] tR t^#t o V 3R ltRtV tR# )ÚXetFileDatac                ó2   <€ V ^8„  d   Qh/ S[ ;R&   S[ ;R&   # )r   Ú	file_hashÚrefresh_route)r   )r   Ú__classdict__s   "€r   r   ÚXetFileData.__annotate__#   s   ø‡ ‚ á�Nñ ñ Ñò r   r   N©r   r   r    r!   Ú__annotate_func__r$   Ú__classdictcell__©r+   s   @r   r'   r'   #   ó   ø‡ ‡ „ r   r'   c                   ó,   a € ] tR t^)t o V 3R ltRtV tR# )ÚXetConnectionInfoc                ó>   <€ V ^8„  d   Qh/ S[ ;R&   S[;R&   S[ ;R&   # )r   Úaccess_tokenÚexpiration_unix_epochÚendpoint)r   Úint)r   r+   s   "€r   r   ÚXetConnectionInfo.__annotate__)   s)   ø‡ ‚ áÑñ ñ Ññ ñ �Mò	 r   r   Nr-   r0   s   @r   r3   r3   )   r1   r   r3   c                ól   € V ^8„  d   QhR\         P                  R\        R,          R\        R,          /# )r   Úresponser7   Nr   )ÚhttpxÚResponser   r'   )r   s   "r   r   r   0   s1   € ÷  ñ  ´·±ð  Ì#ÐPTÍ*ð  Ô`kÐnrÕ`rñ  r   c                óV  € V f   R#  V P                   \        P                  ,          p\        P                  V P                  9   d*   V P                  \        P                  ,          R,          pM"V P                   \        P
                  ,          p Ve   TM\        P                  pVP                  \        P                  4      '       d?   VP                  \        P                  P                  R4      VP                  R4      4      p\        VVR7      #   \         d     R# i ; i)a2  
Parse XET file metadata from an HTTP response.

This function extracts XET file metadata from the HTTP headers or HTTP links
of a given response object. If the required metadata is not found, it returns `None`.

Args:
    response (`httpx.Response`):
        The HTTP response object containing headers dict and links dict to extract the XET metadata from.
Returns:
    `Optional[XetFileData]`:
        An instance of `XetFileData` containing the file hash and refresh route if the metadata
        is found. Returns `None` if the required metadata is missing.
NÚurlÚ/)r)   r*   )Úheadersr   ÚHUGGINGFACE_HEADER_X_XET_HASHÚ$HUGGINGFACE_HEADER_LINK_XET_AUTH_KEYÚlinksÚ&HUGGINGFACE_HEADER_X_XET_REFRESH_ROUTEÚKeyErrorÚENDPOINTÚ
startswithÚHUGGINGFACE_CO_URL_HOMEÚreplaceÚrstripr'   )r;   r7   r)   r*   s   &&  r   Ú!parse_xet_file_data_from_responserL   0   sí   € ð ÒÙðØ×$Ñ$¤Y×%LÑ%LÕMˆ	ä×9Ñ9¸X¿^¹^ÔKØ$ŸN™N¬9×+YÑ+YÕZÐ[`Õa‰Mà$×,Ñ,¬Y×-]Ñ-]Õ^‰Mð $Ò/‰x´Y×5GÑ5G€HØ×Ñ¤	× AÑ A×BÒBØ%×-Ñ-¬i×.OÑ.O×.VÑ.VÐWZÓ.[Ð]e×]lÑ]lÐmpÓ]qÓrˆÜØØ#ôð øô ô Úðús   ˆA(D Á1!D ÄD(Ä'D(c                ó`   € V ^8„  d   QhR\         \        \        3,          R\        R,          /# )r   rA   r   N)r   r   r3   )r   s   "r   r   r   S   s*   € ÷ ñ ´G¼CÄ¸HÕ4Eð ÔJ[Ð^bÕJbñ r   c                óö   €  V \         P                  ,          pV \         P                  ,          p\        V \         P                  ,          4      p\        TTTR7      #   \
        \        \        3 d     R# i ; i)a`  
Parse XET connection info from the HTTP headers or return None if not found.
Args:
    headers (`dict`):
       HTTP headers to extract the XET metadata from.
Returns:
    `XetConnectionInfo` or `None`:
        The information needed to connect to the XET storage service.
        Returns `None` if the headers do not contain the XET connection info.
N)r7   r5   r6   )	r   Ú!HUGGINGFACE_HEADER_X_XET_ENDPOINTÚ%HUGGINGFACE_HEADER_X_XET_ACCESS_TOKENr8   Ú#HUGGINGFACE_HEADER_X_XET_EXPIRATIONrF   Ú
ValueErrorÚ	TypeErrorr3   )rA   r7   r5   r6   s   &   r   Ú&parse_xet_connection_info_from_headersrT   S   sp   € ðØœ9×FÑFÕGˆØœy×NÑNÕOˆÜ # G¬I×,YÑ,YÕ$ZÓ [Ðô ØØ!Ø3ôð øô ”j¤)Ð,ô Úðús   ‚AA ÁA8Á7A8c                ó^   € V ^8„  d   QhR\         R\        \        \        3,          R\        /# )r   Ú	file_datarA   r   )r'   Údictr   r3   )r   s   "r   r   r   m   s5   € ÷ Qñ QäðQô ”#”s�(�^ðQô ñ	Qr   c                ó`   € V P                   f   \        R4      h\        V P                   V4      # )aÝ  
Utilizes the information in the parsed metadata to request the Hub xet connection information.
This includes the access token, expiration, and XET service URL.
Args:
    file_data: (`XetFileData`):
        The file data needed to refresh the xet connection information.
    headers (`dict[str, str]`):
        Headers to use for the request, including authorization headers and user agent.
Returns:
    `XetConnectionInfo`:
        The connection information needed to make the request to the xet storage service.
Raises:
    [`~utils.HfHubHTTPError`]
        If the Hub API returned an error.
    [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
        If the Hub API response is improperly formatted.
z>The provided xet metadata does not contain a refresh endpoint.)r*   rR   Ú#_fetch_xet_connection_info_with_url)rV   rA   s   $$r   Úrefresh_xet_connection_inforZ   l   s/   € ð. ×ÑÒ&ÜÐYÓZÐZÜ.¨y×/FÑ/FÈÓPÐPr   c                ó^   € V ^8„  d   QhR\         R\        \         \         3,          R\        /# ©r   r?   rA   r   )r   rW   r3   )r   s   "r   r   r   ‰   s.   € ÷ ;ñ ;Ü	ð;ä”#”s�(�^ð;ô ñ;r   c                óF  € \        W4      p\        P                  V4      pVe   \        V4      '       g   V# \	        V4      ;_uu_ 4        \        P                  V4      pVe   \        V4      '       g   VuuRRR4       # \        RWR7      p\        V4       \        VP                  4      pVf   \        R4      h\        ;_uu_ 4        \        \        P                  4       4       F.  w  rg\        V4      '       g   K  \        P                  VR4       K0  	  \        \        4      \        8¼  d,   \        P                  \!        \#        \        4      4      4       V\        V&   RRR4       VuuRRR4       #   + '       g   i     L; i  + '       g   i     R# ; i)aØ  
Requests the xet connection info from the supplied URL. This includes the
access token, expiration time, and endpoint to use for the xet storage service.

Result is cached to avoid redundant requests.

Args:
    url: (`str`):
        The access token endpoint URL.
    headers (`dict[str, str]`):
        Headers to use for the request, including authorization headers and user agent.
Returns:
    `XetConnectionInfo`:
        The connection information needed to make the request to the xet storage service.
Raises:
    [`~utils.HfHubHTTPError`]
        If the Hub API returned an error.
    [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
        If the Hub API response is improperly formatted.
NÚGET)rA   z6Xet headers have not been correctly set by the server.)Ú
_cache_keyÚXET_CONNECTION_INFO_CACHEÚgetÚ_is_expiredÚ	_key_lockr	   r   rT   rA   rR   Ú_XET_CONNECTION_INFO_LOCKÚlistÚitemsÚpopÚlenÚXET_CONNECTION_INFO_CACHE_SIZEÚnextÚiter)r?   rA   Ú	cache_keyÚcached_infoÚrespÚmetadataÚkÚvs   &&      r   rY   rY   ˆ   s<  € ô4 ˜3Ó(€IÜ+×/Ñ/°	Ó:€KØÒÜ˜;×'Ò'ØÐô 
�9×	Õ	Ü/×3Ñ3°IÓ>ˆØÒ"¬;°{×+CÒ+CØ÷ 
Ò	ô ˜E 3Ô8ˆÜ˜DÔ!ä9¸$¿,¹,ÓGˆØÒÜÐUÓVÐVç&Ö&äÔ6×<Ñ<Ó>Ö?‘�Ü˜q—>”>Ü-×1Ñ1°!°TÖ:ñ @ô
 Ô,Ó-Ô1OÔOÜ)×-Ñ-¬d´4Ô8QÓ3RÓ.SÔTð 4<Ô% iÑ0÷ 'ð ÷5 
Ò	÷ '×&ú÷ 
×	Ð	ús2   Á,FÂA
FÃ1E<	ÄA&E<	Å(	FÅ<FÆFÆF 	c                ó^   € V ^8„  d   QhR\         R\        \         \         3,          R\         /# r\   )r   rW   )r   s   "r   r   r   Ç   s)   € ÷ "ñ "”Cð "¤$¤s¬C x¥.ð "´Sñ "r   c                ó¤   € VP                  4        UUu/ uF  w  r#VP                  4       VbK  	  pppVP                  RR4      pV  RV 2# u uppi )z;Return a unique cache key for the given request parameters.ÚauthorizationÚ Ú|)rf   Úlowerra   )r?   rA   rp   rq   Úlower_headersÚauth_headers   &&    r   r_   r_   Ç   sP   € à.5¯m©m¬oÔ>©o¡d a�Q—W‘W“Y ’\©o€MÑ>Ø×#Ñ# O°RÓ8€KØˆU�!�K�=Ð!Ð!ùó ?s   ”Ac                óD   € V ^8„  d   QhR\         R\        P                  /# )r   rl   r   )r   Ú	threadingÚLock)r   s   "r   r   r   Î   s"   € ÷ Vñ Vœð V¤§¡ñ Vr   c                ó®   € \         ;_uu_ 4        \        P                  V \        P                  ! 4       4      uuRRR4       #   + '       g   i     R# ; i)zNReturn the lock guarding token fetches for `cache_key`, creating it if needed.N)rd   Ú_XET_CONNECTION_INFO_KEY_LOCKSÚ
setdefaultr{   r|   )rl   s   &r   rc   rc   Î   s.   € ç	"Ö	"Ü-×8Ñ8¸ÄIÇNÂNÓDTÓU÷ 
#×	"×	"Ó	"ús   �)AÁA	c                ó0   € V ^8„  d   QhR\         R\        /# )r   Úconnection_infor   )r3   r   )r   s   "r   r   r   Ô   s   € ÷ iñ iÔ!2ð i´tñ ir   c                ón   € V P                   \        \        P                  ! 4       4      \        ,           8*  # )z2Check if the given XET connection info is expired.)r6   r8   ÚtimeÚ!XET_CONNECTION_INFO_SAFETY_PERIOD)r�   s   &r   rb   rb   Ô   s$   € à×0Ñ0´C¼¿	º	»Ó4DÔGhÕ4hÑhÐhr   Úrevisionr7   c                ó|   € V ^8„  d   QhR\         R\        R\        R\        R,          R\        R,          R\        /# )r   Ú
token_typeÚrepo_idÚ	repo_typer…   Nr7   r   )r   r   )r   s   "r   r   r   Ú   sN   € ÷ !ñ !äð!ô ð!ô ð	!ô
 �D�jð!ô �D�jð!ô 	ñ!r   c                ó�   € Ve   TM\         P                  pV RV RV RV P                   R2pVR8w  g   Ve   VRV 2,          pV# )a—  
Build the URL used to fetch or refresh a Xet access token for a given repo.
Args:
    token_type (`XetTokenType`):
        Type of the token to request: `"read"` or `"write"`.
    repo_id (`str`):
        A namespace (user or an organization) and a repo name separated by a `/`.
    repo_type (`str`):
        Type of the repo (e.g. `"model"`, `"dataset"`, `"space"`, `"bucket"`).
    revision (`str`, `optional`):
        The revision of the repo to get the token for.
    endpoint (`str`, `optional`):
        The endpoint to use for the request. Defaults to the Hub endpoint.
Returns:
    `str`:
        The fully-qualified URL of the token refresh endpoint.
z/api/zs/z/xet-z-tokenÚbucketr@   )r   rG   Úvalue)r‡   rˆ   r‰   r…   r7   r?   s   $$$$$ r   Úxet_connection_info_refresh_urlr�   Ù   s_   € ð4 $Ò/‰x´Y×5GÑ5G€HØˆJ�e˜I˜; b¨¨	°°z×7GÑ7GÐ6HÈÐ
O€CØ�HÔ Ò 4ð
 	��8�*ˆ~ÕˆØ€Jr   c                   óB   a € ] tR t^þt o RtV 3R lR ltR tR tRtV t	R# )ÚXetSessionHoldera'  Holds an optional XetSession; supports safe re-creation after sigint_abort or fork.

Thread-safe: a ``threading.Lock`` guards all state mutations, which matters
for free-threaded Python (3.14t) where multiple threads can race on ``get()``
or ``sigint_abort()`` without the GIL serialising them.
c                ó   <€ V ^8„  d   QhRR/# )r   r   Nr   )r   r+   s   "€r   r   ÚXetSessionHolder.__annotate__  s   ø€ ÷ -ñ -˜$ñ -r   c                óV   € \         P                  ! 4       V n        R V n        R V n        R # ©N)r{   r|   Ú_lockÚ_sessionÚ_session_pid©Úselfs   &r   Ú__init__ÚXetSessionHolder.__init__  s   € Ü—^’^Ó%ˆŒ
Ø!ˆŒØ(,ˆÖr   c                óB  € V P                   ;_uu_ 4        \        P                  ! 4       pV P                  e   V P                  V8w  d   RV n        V P                  f   ^ RIHp V! 4       V n        Wn        V P                  uuRRR4       #   + '       g   i     R# ; i)zøReturn the current session, creating one if needed.

Fork-safe: if the current process PID differs from the PID that created
the session (i.e. we are in a forked child), the old session is discarded
and a fresh session is created for this process.
N)Ú
XetSession)r”   ÚosÚgetpidr•   r–   Úhf_xetrœ   )r˜   Úcurrent_pidrœ   s   &  r   ra   ÚXetSessionHolder.get  sg   € ð �Z�Z‹ZÜŸ)š)›+ˆKà�}‰}Ò(¨T×->Ñ->À+Ô-Mð !%�”à�}‰}Ò$Ý-á *£�”Ø$/Ô!à—=‘=÷ �Z�Z‹Zús   •A-BÂB	c                óø   € V P                   ;_uu_ 4        V P                  e*    V P                  P                  4        RV n        RV n        RRR4       R#   \         d     L%i ; i  + '       g   i     R# ; i)zMAbort the current session and clear it so the next get() creates a fresh one.N)r”   r•   Úsigint_abortÚ	Exceptionr–   r—   s   &r   r£   ÚXetSessionHolder.sigint_abort#  s`   € à�Z�Z‹ZØ�}‰}Ò(ðØ—M‘M×.Ñ.Ô0ð !%�”Ø$(�Ô!÷ ‰Zøô !ô Ùðú÷	 �ZˆZús-   •A(¥A¿A(ÁA%Á"A(Á$A%Á%A(Á(A9	)r”   r•   r–   N)
r   r   r    r!   Ú__doc__r™   ra   r£   r$   r/   r0   s   @r   r�   r�   þ   s#   ø‡ € ñ÷-ð -ò
!÷0	)ð 	)r   r�   c                 ó*   € \         P                  4       # )a  Return the global :class:`hf_xet.XetSession`, creating it on first call.

The session is shared across all calls within a process, just as the HTTP
client returned by :func:`~huggingface_hub.utils._http.get_session` is shared.
It is created lazily and is fork-safe and thread-safe.
)Ú_GLOBAL_XET_HOLDERra   r   r   r   Úget_xet_sessionr©   2  s   € ô ×!Ñ!Ó#Ð#r   c                ót   € V ^8„  d   QhR\         \        \        3,          R\         \        \        3,          /# )r   rA   r   )rW   r   )r   s   "r   r   r   <  s.   € ÷ \ñ \¤d¬3´¨8¥nð \¼¼cÄ3¸h½ñ \r   c                ó„   € V P                  4        UUu/ uF  w  rVP                  4       R8w  g   K  WbK   	  upp# u uppi )zÓReturn a copy of headers with the authorization header removed.

Xet storage requests use a short-lived xet access token for auth, so the
Hub authorization header must not be forwarded to xet storage endpoints.
rt   )rf   rw   )rA   ÚkeyrŒ   s   &  r   Úxet_headers_without_authr­   <  s5   € ð *1¯©¬Ô[©™:˜3¸C¿I¹I»KÈ?Ñ<ZŒJˆCŠJ©Ò[Ð[ùÓ[s   ”<²<c                 ó.   € \         P                  4        R# )zÃAbort the global xet session after a KeyboardInterrupt.

Cancels any in-flight Rust operation and clears the session so the next
call to :func:`get_xet_session` starts fresh (notebook-friendly).
N)r¨   r£   r   r   r   Úabort_xet_sessionr¯   E  s   € ô ×#Ñ#Ö%r   c                ó¸   € V ^8„  d   Qh/ ^ \         9   d   \        \        R3,          ;R&   ^\         9   d%   \        \        \        P                  3,          ;R&   # )r   r3   r`   r~   )Ú__conditional_annotations__rW   r   r{   r|   )r   s   "r   r   r      sC   € ‡	�	÷& ?Ò >œ4¤Ð%8Ð 8Õ9Ñ >ñ' 
÷* ?Ò >¤¤S¬)¯.©.Ð%8Õ 9Ñ >ò+ 
r   r“   ).r±   r�   Úrer{   rƒ   Úcollections.abcr   Údataclassesr   Úenumr   Útypingr   r<   ru   r   r   r	   r
   Úcompiler   r„   ri   r`   r|   rd   r~   r   r   r   r'   r3   rL   rT   rZ   rY   r_   rc   rb   r�   r�   r¨   r©   r­   r¯   r   )r±   s   @r   Ú<module>r¸      sM  øðß 	€	Û 	Û Û Ý #Ý !Ý Ý ã å ß EÑ Eð —*’*Ð1Ó2€à$&Ð !Ø!&Ð Ø<>Ð Ó >Ø%ŸNšNÓ,Ð Ø<>Ð Ó >õ5ô
�3˜ô ñ
 �$Ô÷ð ó ðñ
 �$Ô÷ð ó ð÷ õFð2 ôQó ðQð6 ô;ó ð;õ|"õVõið
 ð!ð
  ð!ð  ö!ó ð!÷H.)ñ .)ñb &Ó'Ð ò$õ\ô&r   