+
    QV-jIª  ã                   óª  a € RY tj0 t R t^ RI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Ht ^ RIHt ^ RIHt ^ RIHt ^ RIHtHt ^ RIH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$H%t%H&t& ^RIH't' ^RI(H)t) ^RI*H+t+ ]'PX                  ! ]-4      t.]! RR7       ! R R4      4       t/]P`                  ! R4      t1]P`                  ! R4      t2R R lt3Rt4Rt5Rt6]P`                  ! R]Pn                  R7      t8]P`                  ! R]Pn                  R7      t9]P`                  ! R4      t:]P`                  ! R4      t;0 RZmt<R R lt=R  R! lt>R" R# lt?R$ R% lt@R& R' ltAR( R) ltBR* R+ ltC]. ]Pˆ                  3,          tE]. ]PŒ                  3,          tG]P�                  ! 4       tI]BsJ] ^ k ]CsK] ^k RsL] ^k R, R- ltMR. R/ ltNR0 R1 ltOR2 R3 ltPR4 R5 ltQ]P¤                  ! ]Q4       ]S! ]R64      '       d   ]P¨                  ! ]QR77       ]Pª                  ]P¬                  3tW] ^k R[tX] ^k R8^R9^R:^R;]WR<]XR=R>/R? R@ lltYR8^R9^R:^R;]WR<]X/RA RB lltZ]R8^R9^R:^R;]WR<]X/RC RD ll4       t[RER>/RF RG llt\RH RI lt]R\RJ RK llt^]_! 4       t`RL RM lta]! RN]#RO7      tbRP RQ ltcR]tdRR RS lteRT RU ltf]P`                  ! RV]PÎ                  4      thRW RX ltiR# )^z>Contains utilities to handle HTTP requests in huggingface_hub.N)ÚCallableÚ	GeneratorÚMapping)Úcontextmanager)Ú	dataclass)Úquote)ÚAnyÚTypeVar)Úurlparse)ÚOfflineModeIsEnabled)Ú	constants)ÚBadRequestErrorÚBucketNotFoundErrorÚDisabledRepoErrorÚGatedRepoErrorÚHfHubHTTPErrorÚRemoteEntryNotFoundErrorÚRepositoryNotFoundErrorÚRevisionNotFoundError)Úlogging)ÚSliceFileObj)ÚHTTP_METHOD_TT)Úfrozenc                   ó8   a € ] tR t^6t o RtRtRtV 3R ltRtV t	R# )ÚRateLimitInfoaß  
Parsed rate limit information from HTTP response headers.

Attributes:
    resource_type (`str`): The type of resource being rate limited.
    remaining (`int`): The number of requests remaining in the current window.
    reset_in_seconds (`int`): The number of seconds until the rate limit resets.
    limit (`int`, *optional*): The maximum number of requests allowed in the current window.
    window_seconds (`int`, *optional*): The number of seconds in the current window.

Nc                ór   <€ V ^8„  d   Qh/ S[ ;R&   S[;R&   S[;R&   S[R,          ;R&   S[R,          ;R&   # )é   Úresource_typeÚ	remainingÚreset_in_secondsNÚlimitÚwindow_seconds©ÚstrÚint)ÚformatÚ__classdict__s   "€Úl/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/huggingface_hub/utils/_http.pyÚ__annotate__ÚRateLimitInfo.__annotate__6   sM   ø‡ ‚ ñ Ññ ñ �Nñ ñ  Ññ! ñ" ��:Ññ# ñ$ ˜$•JÑ%ò% ó    © )
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r    r!   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)r&   s   @r'   r   r   6   s   ø‡ € ñ
ð €EØ!%€N÷% ƒ r*   r   zL\"(?P<resource_type>\w+)\"\s*;\s*r\s*=\s*(?P<r>\d+)\s*;\s*t\s*=\s*(?P<t>\d+)z'q\s*=\s*(?P<q>\d+).*?w\s*=\s*(?P<w>\d+)c                ó`   € V ^8„  d   QhR\         \        \        3,          R\        R,          /# )r   ÚheadersÚreturnN)r   r#   r   )r%   s   "r'   r(   r(   R   s(   € ÷ 8ñ 8¤W¬S´#¨XÕ%6ð 8¼=È4Õ;Oñ 8r*   c                ó6  € RpRpV  F5  pVP                  4       pVR8X  d   W,          pK$  VR8X  g   K-  W,          pK7  	  V'       g   R# \        P                  V4      pV'       g   R# VP                  R4      p\	        VP                  R4      4      p\	        VP                  R4      4      pRp	Rp
V'       dR   \
        P                  V4      pV'       d5   \	        VP                  R4      4      p	\	        VP                  R4      4      p
\        VVVV	V
R	7      # )
aê  Parse rate limit information from HTTP response headers.

Follows IETF draft: https://www.ietf.org/archive/id/draft-ietf-httpapi-ratelimit-headers-09.html
Only a subset is implemented.

Example:
```python
>>> from huggingface_hub.utils import parse_ratelimit_headers
>>> headers = {
...     "ratelimit": '"api";r=0;t=55',
...     "ratelimit-policy": '"fixed window";"api";q=500;w=300',
... }
>>> info = parse_ratelimit_headers(headers)
>>> info.remaining
0
>>> info.reset_in_seconds
55
```
NÚ	ratelimitzratelimit-policyr   ÚrÚtÚqÚw)r   r   r   r    r!   )ÚlowerÚ_RATELIMIT_REGEXÚsearchÚgroupr$   Ú_RATELIMIT_POLICY_REGEXr   )r5   r8   ÚpolicyÚkeyÚ	lower_keyÚmatchr   r   r   r    r!   Úpolicy_matchs   &           r'   Úparse_ratelimit_headersrG   R   sû   € ð* !€IØ€FÛˆØ—I‘I“Kˆ	Ø˜Ô#Ø�ŠIØÐ,Ö,Ø•\ŠFñ ÷ Ùä×#Ñ# IÓ.€EßÙà—K‘K Ó0€MÜ�E—K‘K Ó$Ó%€IÜ˜5Ÿ;™; sÓ+Ó,Ðà€EØ!%€NçÜ.×5Ñ5°fÓ=ˆßÜ˜×*Ñ*¨3Ó/Ó0ˆEÜ  ×!3Ñ!3°CÓ!8Ó9ˆNäØ#ØØ)ØØ%ôð r*   zx-request-idzX-Amzn-Trace-Idzx-amz-cf-ida  
        # staging or production endpoint
        ^https://[^/]+
        (
            # on /api/repo_type/repo_id
            /api/(models|datasets|spaces)/(.+)
            |
            # or /repo_id/resolve/revision/...
            /(.+)/resolve/(.+)
        )
    )Úflagszz
        # staging or production endpoint
        ^https?://[^/]+
        # on /api/buckets/...
        /api/buckets/
    zA^https?://[^/]+/api/(models|datasets|spaces)/([^/]+)(?:/([^/]+))?z)^https?://[^/]+/api/buckets/([^/]+/[^/]+)c                ón   € V ^8„  d   QhR\         R\        \         R,          \         R,          3,          /# ©r   Úurlr6   N)r#   Útuple)r%   s   "r'   r(   r(   ·   s,   € ÷ ñ ¤3ð ¬5´°tµ¼SÀ4½ZÐ1GÕ+Hñ r*   c                ó"  € \         P                  V 4      pV'       g   R# \        P                  P	                  VP                  ^4      4      pVP                  ^4      VP                  ^4      rCV'       d   V\        9  d   V RV 2pW%3# TpW%3# )a  Extract (repo_type, repo_id) from an API URL.

Returns canonical repo_type values: "model", "dataset", "space" (or None).

Examples:
    >>> _parse_repo_info_from_url("https://huggingface.co/api/models/user/repo")
    ("model", "user/repo")
    >>> _parse_repo_info_from_url("https://huggingface.co/api/datasets/user/repo/resolve/main/data.csv")
    ("dataset", "user/repo")
    >>> _parse_repo_info_from_url("https://huggingface.co/api/models/bert-base-cased/resolve/main/config.json")
    ("model", "bert-base-cased")
Ú/©NN)Ú_REPO_ID_FROM_URL_REGEXr?   r   ÚREPO_TYPES_MAPPINGÚgetr@   Ú_REPO_URL_SUBPATHS)rK   rE   Ú	repo_typeÚfirstÚsecondÚrepo_ids   &     r'   Ú_parse_repo_info_from_urlrX   ·   sˆ   € ô $×*Ñ*¨3Ó/€EßØÐÜ×,Ñ,×0Ñ0°·±¸Q³Ó@€IØ—K‘K “N E§K¡K°£Nˆ6ß�&Ô 2Ô2Ø�G˜1˜V˜HÐ%ˆð ÐÐð ˆØÐÐr*   c                ó>   € V ^8„  d   QhR\         R\         R,          /# rJ   ©r#   )r%   s   "r'   r(   r(   Ð   s   € ÷ -ñ -¤3ð -¬3°­:ñ -r*   c                ób   € \         P                  V 4      pV'       d   VP                  ^4      # R# )z9Extract bucket_id (namespace/name) from a bucket API URL.N)Ú_BUCKET_ID_FROM_URL_REGEXr?   r@   )rK   rE   s   & r'   Ú_parse_bucket_id_from_urlr]   Ð   s'   € ä%×,Ñ,¨SÓ1€Eß"ˆ5�;‰;�q‹>Ð,¨Ð,r*   c                ó<   € V ^8„  d   QhR\         P                  RR/# ©r   Úrequestr6   N©ÚhttpxÚRequest)r%   s   "r'   r(   r(   Ö   s   € ÷ ñ ¤5§=¡=ð °Tñ r*   c           	     ó|  € \         P                  ! 4       '       d   \        RV P                   R24      h\        V P
                  9  dW   V P
                  P                  \        4      ;'       g    \        \        P                  ! 4       4      V P
                  \        &   V P
                  P                  \        4      p\        P                  RVV P                  V P                  V P
                  P                  R4      RJ4       \         P                  '       d    \        P                  R\        V 4      4       V# )zÝ
Event hook that will be used to make HTTP requests to the Hugging Face Hub.

What it does:
- Block requests if offline mode is enabled
- Add a request ID to the request headers
- Log the request if debug mode is enabled
zCannot reach za: offline mode is enabled. To disable it, please unset the `HF_HUB_OFFLINE` environment variable.z%Request %s: %s %s (authenticated: %s)ÚauthorizationNzSend: %s)r   Úis_offline_moder   rK   ÚX_AMZN_TRACE_IDr5   rR   ÚX_REQUEST_IDr#   ÚuuidÚuuid4ÚloggerÚdebugÚmethodÚHF_DEBUGÚ_curlify)r`   Ú
request_ids   & r'   Úhf_request_event_hookrq   Ö   sî   € ô × Ò ×"Ò"Ü"Ø˜GŸK™K˜=ð  )Jð  Kó
ð 	
ô
 ˜gŸo™oÔ-Ø+2¯?©?×+>Ñ+>¼|Ó+L×+aÐ+aÔPSÔTX×T^ÒT^ÓT`ÓPaˆ�‰œÑ(Ø—‘×$Ñ$¤_Ó5€Jô ‡L�LØ/ØØ�‰Ø�‰Ø�‰×Ñ˜OÓ,°DÐ8ôô ××ÐÜ�‰�Z¤¨'Ó!2Ô3àÐr*   c                ó<   € V ^8„  d   QhR\         P                  RR/# r_   ra   )r%   s   "r'   r(   r(   ÷   s   € ÷ *ñ *¬u¯}©}ð *Àñ *r*   c              ƒ  ó    "  € \        V 4      # 5i)z+
Async version of `hf_request_event_hook`.
)rq   )r`   s   &r'   Úasync_hf_request_event_hookrt   ÷   s   é € ô ! Ó)Ð)ùs   ‚c                ó<   € V ^8„  d   QhR\         P                  RR/# ©r   Úresponser6   N©rb   ÚResponse)r%   s   "r'   r(   r(   þ   s   € ÷ 'ñ '´·±ð 'ÀDñ 'r*   c              ƒ   óþ   "  € V P                   R 8¼  dT   RV P                  9   dA    \        V P                  R,          4      pTR8  d   T P	                  4       G Rj  x€L
  R# R# R# R#   \         d     R# i ; i L5i)é�  zContent-lengthNi@B )Ústatus_coder5   r$   Ú
ValueErrorÚaread)rw   Úlengths   & r'   Úasync_hf_response_event_hookr€   þ   s€   é € Ø×Ñ˜sÔ"ð ˜x×/Ñ/Ô/ðÜ˜X×-Ñ-Ð.>Õ?Ó@�ð ˜	Ô!Ø—n‘nÓ&×&Ò&ñ "ñ 0ñ #øô ô Úðúñ 'ùs4   ‚#A=¦A) ÁA=ÁA;ÁA=Á)A8Á4A=Á7A8Á8A=c                ó8   € V ^8„  d   QhR\         P                  /# ©r   r6   ©rb   ÚClient)r%   s   "r'   r(   r(     s   € ÷ ñ ¤§¡ñ r*   c                 óB   € \         P                  ! R\        ./RRR7      # )zI
Factory function to create a `httpx.Client` with the default transport.
r`   TN©Úevent_hooksÚfollow_redirectsÚtimeout)rb   r„   rq   r+   r*   r'   Údefault_client_factoryrŠ     s'   € ô �<Š<ØÔ!6Ð 7Ð8ØØôð r*   c                ó8   € V ^8„  d   QhR\         P                  /# r‚   ©rb   ÚAsyncClient)r%   s   "r'   r(   r(     s   € ÷ ñ ¤e×&7Ñ&7ñ r*   c                 óP   € \         P                  ! R\        .R\        ./RRR7      # )zN
Factory function to create a `httpx.AsyncClient` with the default transport.
r`   rw   TNr†   )rb   r�   rt   r€   r+   r*   r'   Údefault_async_client_factoryr�     s1   € ô ×ÒØÔ!<Ð =¸zÔLhÐKiÐjØØôð r*   c                ó(   € V ^8„  d   QhR\         RR/# )r   Úclient_factoryr6   N)ÚCLIENT_FACTORY_T)r%   s   "r'   r(   r(   +  s   € ÷ 0ñ 0Ô'7ð 0¸Dñ 0r*   c                ót   € \         ;_uu_ 4        \        4        V sRRR4       R#   + '       g   i     R# ; i)a  
Set the HTTP client factory to be used by `huggingface_hub`.

The client factory is a method that returns a `httpx.Client` object. On the first call to [`get_session`] the client factory
will be used to create a new `httpx.Client` object that will be shared between all calls made by `huggingface_hub`.

This can be useful if you are running your scripts in a specific environment requiring custom configuration (e.g. custom proxy or certifications).

Use [`get_session`] to get a correctly configured `httpx.Client`.
N)Ú_CLIENT_LOCKÚclose_sessionÚ_GLOBAL_CLIENT_FACTORY)r‘   s   &r'   Úset_client_factoryr—   +  s    € ÷ 
ŽÜŒØ!/Ð÷ 
��Šús   �&¦7	c                ó(   € V ^8„  d   QhR\         RR/# )r   Úasync_client_factoryr6   N)ÚASYNC_CLIENT_FACTORY_T)r%   s   "r'   r(   r(   <  s   € ÷ 8ñ 8Ô3Ið 8Èdñ 8r*   c                ó
   € V s R# )a‹  
Set the HTTP async client factory to be used by `huggingface_hub`.

The async client factory is a method that returns a `httpx.AsyncClient` object.
This can be useful if you are running your scripts in a specific environment requiring custom configuration (e.g. custom proxy or certifications).
Use [`get_async_client`] to get a correctly configured `httpx.AsyncClient`.

<Tip warning={true}>

Contrary to the `httpx.Client` that is shared between all calls made by `huggingface_hub`, the `httpx.AsyncClient` is not shared.
It is recommended to use an async context manager to ensure the client is properly closed when the context is exited.

</Tip>
N©Ú_GLOBAL_ASYNC_CLIENT_FACTORY)r™   s   &r'   Úset_async_client_factoryrž   <  s
   € ð  $8Ò r*   c                ó8   € V ^8„  d   QhR\         P                  /# r‚   rƒ   )r%   s   "r'   r(   r(   O  s   € ÷ ñ ”U—\‘\ñ r*   c                 óœ   € \         f(   \        ;_uu_ 4        \        4       s RRR4       \         # \         #   + '       g   i     \         # ; i)zö
Get a `httpx.Client` object, using the transport factory from the user.

This client is shared between all calls made by `huggingface_hub`. Therefore you should not close it manually.

Use [`set_client_factory`] to customize the `httpx.Client`.
N)Ú_GLOBAL_CLIENTr”   r–   r+   r*   r'   Úget_sessionr¢   O  s5   € ô ÒßŽ\Ü3Ó5ˆN÷ äÐŒ>Ð÷ Ž\äÐús	   —6¶A	c                ó8   € V ^8„  d   QhR\         P                  /# r‚   rŒ   )r%   s   "r'   r(   r(   ^  s   € ÷ *ñ *œ5×,Ñ,ñ *r*   c                 ó   € \        4       # )a°  
Return a `httpx.AsyncClient` object, using the transport factory from the user.

Use [`set_async_client_factory`] to customize the `httpx.AsyncClient`.

<Tip warning={true}>

Contrary to the `httpx.Client` that is shared between all calls made by `huggingface_hub`, the `httpx.AsyncClient` is not shared.
It is recommended to use an async context manager to ensure the client is properly closed when the context is exited.

</Tip>
rœ   r+   r*   r'   Úget_async_sessionr¥   ^  s   € ô (Ó)Ð)r*   c                ó   € V ^8„  d   QhRR/# )r   r6   Nr+   )r%   s   "r'   r(   r(   n  s   € ÷ 9ñ 9�tñ 9r*   c                 ó¦   € \         p Rs V e    V P                  4        R# R#   \         d$   p\        P	                  RT 24        Rp?R# Rp?ii ; i)zÊ
Close the global `httpx.Client` used by `huggingface_hub`.

If a Client is closed, it will be recreated on the next call to [`get_session`].

Can be useful if e.g. an SSL certificate has been updated.
NzError closing client: )r¡   ÚcloseÚ	Exceptionrk   Úwarning)ÚclientÚes     r'   r•   r•   n  sT   € ô €Fð €Nð Òð	9Ø�L‰LŽNñ øô ô 	9Ü�N‰NÐ3°A°3Ð7×8Ò8ûð	9ús   Ž" ¢A­AÁAÚregister_at_fork)Úafter_in_childÚmax_retriesÚbase_wait_timeÚmax_wait_timeÚretry_on_exceptionsÚretry_on_status_codesÚstreamFc                ó@  € V ^8„  d   QhR\         R\        R\        R\        R\        R\        \
        ,          \        \        \
        ,          R3,          ,          R\        \        \        R3,          ,          R	\        R
\        \        P                  RR3,          /	# )r   rm   rK   r¯   r°   r±   r²   .r³   r´   r6   N)r   r#   r$   ÚfloatÚtyper©   rL   Úboolr   rb   ry   )r%   s   "r'   r(   r(   �  s¡   € ÷ ^8ñ ^8Üð^8ä	ð^8ô ð	^8ô
 ð^8ô ð^8ô œi�¬5´´iµÀ#Ð1EÕ+FÕFð^8ô ¤¤s¨C x¥Õ0ð^8ô ð^8ô Œu�~‰~˜t TÐ)Õ*ñ^8r*   c          	   +  óˆ  a aaaaa"  € \        V\        4      '       d   V3p\        S\        4      '       d   S3o^ oTp	RoRp
RV9   dE   \        VR,          \        P                  \
        34      '       d   VR,          P                  4       p
\        4       p S^,          oRo V
e   VR,          P                  V
4       R VV VVVV3R llpV'       dG   VP                  ! RRS RS/VB ;_uu_ 4       pV! V4      '       g   Vx €  RRR4       R#  RRR4       M+VP                  ! RRS RS/VB pV! V4      '       g   Vx € R#  Se3   \!        S4      ^,           p\        P                  R
V RS RS R24       M!T	p\        P                  RV RS RS R24       \"        P$                  ! V4       \'        WI^,          4      p	EK2    + '       g   i     L’; i  T d\   p\        P                  RT RS  R	S 24       \        T\        P                  4      '       d   \        4        SS8”  d   Th Rp?LòRp?ii ; i5i)zfInternal implementation of HTTP backoff logic shared between `http_backoff` and `http_stream_backoff`.NÚdatac                óD   € V ^8„  d   QhR\         P                  R\        /# )r   rw   r6   )rb   ry   r¸   )r%   s   "r'   r(   Ú(_http_backoff_base.<locals>.__annotate__¶  s   € ÷ ñ ¬¯©ð ¼4ñ r*   c                ó  <€ V P                   S9  d   R# \        P                  RV P                    RS RS 24       SS8”  d   \        V 4       R# V P                   R8X  d&   \	        V P
                  4      pVe   VP                  oR# )zNHandle response and return True if should retry, False if should return/yield.FzHTTP Error z thrown while requesting Ú é­  T)r|   rk   rª   Úhf_raise_for_statusrG   r5   r   )rw   Úratelimit_infor¯   rm   Únb_triesÚratelimit_resetr³   rK   s   & €€€€€€r'   Ú_should_retryÚ)_http_backoff_base.<locals>._should_retry¶  sŽ   ø€ ð ×'Ñ'Ð/DÔDÙ ô —‘ ¨X×-AÑ-AÐ,BÐB[Ð\bÐ[cÐcdÐehÐdiÐjÔkØ˜kÔ)Ü'¨Ô1ñ !ð ×'Ñ'¨3Ô.Ü%<¸X×=MÑ=MÓ%N�NØ%Ò1Ø*8×*IÑ*I˜ár*   rm   rK   Ú'z' thrown while requesting r¾   zRate limited. Waiting zs before retry [Retry rN   z].zRetrying in z	s [Retry r+   )Ú
isinstancer·   r$   ÚioÚIOBaser   Útellr¢   Úseekr´   r`   rk   rª   rb   ÚConnectErrorr•   r¶   ÚtimeÚsleepÚmin)rm   rK   r¯   r°   r±   r²   r³   r´   ÚkwargsÚ
sleep_timeÚio_obj_initial_posr«   rÄ   rw   ÚerrÚactual_sleeprÂ   rÃ   s   ffd$$$d$,       @@r'   Ú_http_backoff_baserÕ   �  s*  ýé € ô Ð%¤t×,Ò,Ø2Ð4ÐäÐ'¬×-Ò-Ø!6Ð 8Ðà€HØ€JØ"&€Oð
 ÐØ�ÔœJ v¨f¥~¼¿	¹	Ä<Ð7P×QÒQØ# F�^×0Ñ0Ó2Ðä‹]€FØ
Ø�A�ˆØˆð0	ð "Ò-Ø�v•×#Ñ#Ð$6Ô7÷õ ÷. Ø—]’]ÑD¨&ÐD°cÐD¸V×DÒDÈÙ(¨×2Ò2Ø&šØ÷ EÑDØ2÷ EÐDð
 "Ÿ>š>ÑK°ÐK¸SÐKÀFÑK�Ù$ X×.Ò.Ø"’NÙð /ð Ò&Ü  Ó1°AÕ5ˆLÜ�N‰NÐ3°L°>ÐAWÐX`ÐWaÐabÐcnÐboÐoqÐrÕsà%ˆLÜ�N‰N˜\¨,¨°yÀÀ
È!ÈKÈ=ÐXZÐ[Ô\ä�
Š
�<Ô ô ˜°Q­Ó7‹
÷; E×Dûð #ô 	Ü�N‰N˜Q˜s˜eÐ#=¸f¸XÀQÀsÀeÐLÔMä˜#œu×1Ñ1×2Ò2Ü”à˜+Ô%Ø�	ô &ûð	üsz   ˆBIÂ%1G ÃG Ã5G
Ä	G ÄIÄG ÄIÄ#G ÅG ÅBIÇ
G	ÇG ÇIÇG ÇH?Ç$AH:È5IÈ:H?È?Ic                ó  € V ^8„  d   QhR\         R\        R\        R\        R\        R\        \
        ,          \        \        \
        ,          R3,          ,          R\        \        \        R3,          ,          R	\        P                  /# )
r   rm   rK   r¯   r°   r±   r²   .r³   r6   )	r   r#   r$   r¶   r·   r©   rL   rb   ry   )r%   s   "r'   r(   r(   î  sŠ   € ÷ Mñ MÜðMä	ðMô ð	Mô
 ðMô ðMô œi�¬5´´iµÀ#Ð1EÕ+FÕFðMô ¤¤s¨C x¥Õ0ðMô ‡^�^ñMr*   c               óJ   € \        \        R
RV RVRVRVRVRVRVRR	/VB 4      # )ax
  Wrapper around httpx to retry calls on an endpoint, with exponential backoff.

Endpoint call is retried on exceptions (ex: connection timeout, proxy error,...)
and/or on specific status codes (ex: service unavailable). If the call failed more
than `max_retries`, the exception is thrown or `raise_for_status` is called on the
response object.

Re-implement mechanisms from the `backoff` library to avoid adding an external
dependencies to `hugging_face_hub`. See https://github.com/litl/backoff.

Args:
    method (`Literal["GET", "OPTIONS", "HEAD", "POST", "PUT", "PATCH", "DELETE"]`):
        HTTP method to perform.
    url (`str`):
        The URL of the resource to fetch.
    max_retries (`int`, *optional*, defaults to `5`):
        Maximum number of retries, defaults to 5 (no retries).
    base_wait_time (`float`, *optional*, defaults to `1`):
        Duration (in seconds) to wait before retrying the first time.
        Wait time between retries then grows exponentially, capped by
        `max_wait_time`.
    max_wait_time (`float`, *optional*, defaults to `8`):
        Maximum duration (in seconds) to wait before retrying.
    retry_on_exceptions (`type[Exception]` or `tuple[type[Exception]]`, *optional*):
        Define which exceptions must be caught to retry the request. Can be a single type or a tuple of types.
        By default, retry on `httpx.TimeoutException` and `httpx.NetworkError`.
    retry_on_status_codes (`int` or `tuple[int]`, *optional*, defaults to `(429, 500, 502, 503, 504)`):
        Define on which status codes the request must be retried. By default, retries
        on rate limit (429) and server errors (5xx).
    **kwargs (`dict`, *optional*):
        kwargs to pass to `httpx.request`.

Example:
```
>>> from huggingface_hub.utils import http_backoff

# Same usage as "httpx.request".
>>> response = http_backoff("GET", "https://www.google.com")
>>> response.raise_for_status()

# If you expect a Gateway Timeout from time to time
>>> http_backoff("PUT", upload_url, data=data, retry_on_status_codes=504)
>>> response.raise_for_status()
```

> [!WARNING]
> When using `requests` it is possible to stream data by passing an iterator to the
> `data` argument. On http backoff this is a problem as the iterator is not reset
> after a failed call. This issue is mitigated for file objects or any IO streams
> by saving the initial position of the cursor (with `data.tell()`) and resetting the
> cursor between each call (with `data.seek()`). For arbitrary iterators, http backoff
> will fail. If this is a hard constraint for you, please let us know by opening an
> issue on [Github](https://github.com/huggingface/huggingface_hub).
rm   rK   r¯   r°   r±   r²   r³   r´   Fr+   )ÚnextrÕ   ©rm   rK   r¯   r°   r±   r²   r³   rÐ   s   &&$$$$$,r'   Úhttp_backoffrÚ   î  sp   € ôB Üñ 
	
Øð
	
àð
	
ð $ð
	
ð *ð	
	
ð
 (ð
	
ð !4ð
	
ð #8ð
	
ð ð
	
ð ñ
	
óð r*   c                ó4  € V ^8„  d   QhR\         R\        R\        R\        R\        R\        \
        ,          \        \        \
        ,          R3,          ,          R\        \        \        R3,          ,          R	\        \        P                  R
R
3,          /# )r   rm   rK   r¯   r°   r±   r²   .r³   r6   N)
r   r#   r$   r¶   r·   r©   rL   r   rb   ry   )r%   s   "r'   r(   r(   ?  s–   € ÷ Oñ OÜðOä	ðOô ð	Oô
 ðOô ðOô œi�¬5´´iµÀ#Ð1EÕ+FÕFðOô ¤¤s¨C x¥Õ0ðOô Œu�~‰~˜t TÐ)Õ*ñOr*   c             +  óX   "  € \        RRV RVRVRVRVRVRVRR	/VB  R
j  x€L
  R
#  L5i)aÎ
  Wrapper around httpx to retry calls on an endpoint, with exponential backoff.

Endpoint call is retried on exceptions (ex: connection timeout, proxy error,...)
and/or on specific status codes (ex: service unavailable). If the call failed more
than `max_retries`, the exception is thrown or `raise_for_status` is called on the
response object.

Re-implement mechanisms from the `backoff` library to avoid adding an external
dependencies to `hugging_face_hub`. See https://github.com/litl/backoff.

Args:
    method (`Literal["GET", "OPTIONS", "HEAD", "POST", "PUT", "PATCH", "DELETE"]`):
        HTTP method to perform.
    url (`str`):
        The URL of the resource to fetch.
    max_retries (`int`, *optional*, defaults to `5`):
        Maximum number of retries, defaults to 5 (no retries).
    base_wait_time (`float`, *optional*, defaults to `1`):
        Duration (in seconds) to wait before retrying the first time.
        Wait time between retries then grows exponentially, capped by
        `max_wait_time`.
    max_wait_time (`float`, *optional*, defaults to `8`):
        Maximum duration (in seconds) to wait before retrying.
    retry_on_exceptions (`type[Exception]` or `tuple[type[Exception]]`, *optional*):
        Define which exceptions must be caught to retry the request. Can be a single type or a tuple of types.
        By default, retry on `httpx.TimeoutException` and `httpx.NetworkError`.
    retry_on_status_codes (`int` or `tuple[int]`, *optional*, defaults to `(429, 500, 502, 503, 504)`):
        Define on which status codes the request must be retried. By default, retries
        on rate limit (429) and server errors (5xx).
    **kwargs (`dict`, *optional*):
        kwargs to pass to `httpx.request`.

Example:
```
>>> from huggingface_hub.utils import http_stream_backoff

# Same usage as "httpx.stream".
>>> with http_stream_backoff("GET", "https://www.google.com") as response:
...     for chunk in response.iter_bytes():
...         print(chunk)

# If you expect a Gateway Timeout from time to time
>>> with http_stream_backoff("PUT", upload_url, data=data, retry_on_status_codes=504) as response:
...     response.raise_for_status()
```

<Tip warning={true}>

When using `httpx` it is possible to stream data by passing an iterator to the
`data` argument. On http backoff this is a problem as the iterator is not reset
after a failed call. This issue is mitigated for file objects or any IO streams
by saving the initial position of the cursor (with `data.tell()`) and resetting the
cursor between each call (with `data.seek()`). For arbitrary iterators, http backoff
will fail. If this is a hard constraint for you, please let us know by opening an
issue on [Github](https://github.com/huggingface/huggingface_hub).

</Tip>
rm   rK   r¯   r°   r±   r²   r³   r´   TNr+   )rÕ   rÙ   s   &&$$$$$,r'   Úhttp_stream_backoffrÝ   >  sp   é € ôL "ñ 
Øð
àð
ð  ð
ð &ð	
ð
 $ð
ð 0ð
ð 4ð
ð ð
ð ñ
÷ 
ô 
ùs   ‚*¡(¢*Úretry_on_errorsc                ó\   € V ^8„  d   QhR\         R\        R\        R\        P                  /# )r   rm   rK   rÞ   r6   )r   r#   r¸   rb   ry   )r%   s   "r'   r(   r(   ‘  s0   € ÷ 0ñ 0Üð0Ü #ð0Ü9=ð0ä
‡^�^ñ0r*   c               ój  € V'       d   / MRRRR/p \        RRV RV/VBRR/BVB p\        V4       RVP                  u;8:  d   R8:  dh   M  V# \        VP                  R	,          4      pVP
                  R
8X  d6   \        V4      P                  VP                  R7      P                  4       pK¡   V# )a  Perform an HTTP request with backoff and follow relative redirects only.

Used to fetch HEAD /resolve on repo or bucket files.

This is useful to follow a redirection to a renamed repository without following redirection to a CDN.

A backoff mechanism retries the HTTP call on errors (429, 5xx, timeout, network errors).

Args:
    method (`str`):
        HTTP method, such as 'GET' or 'HEAD'.
    url (`str`):
        The URL of the resource to fetch.
    retry_on_errors (`bool`, *optional*, defaults to `False`):
        Whether to retry on errors. If False, no retry is performed (fast fallback to local cache).
        If True, uses default retry behavior (429, 5xx, timeout, network errors).
    **httpx_kwargs (`dict`, *optional*):
        Params to pass to `httpx.request`.
r²   r³   rm   rK   rˆ   Fi,  i�  ÚLocationÚ )Úpathr+   )	rÚ   rÀ   r|   r
   r5   ÚnetlocÚ_replacerã   Úgeturl)rm   rK   rÞ   Úhttpx_kwargsÚno_retry_kwargsrw   Úparsed_targets   &&$,   r'   Ú-_httpx_follow_relative_redirects_with_backoffrê   ‘  sÚ   € ÷0 ‰Ð$9¸2Ð?VÐXZÐ#[ð ð Üñ 
Øð
àð
ð ñ
ð #ñ	
ð
 ñ
ˆô 	˜HÔ%ð �(×&Ñ&Ö-¨#Ö-ð 	à€Oô % X×%5Ñ%5°jÕ%AÓBˆMØ×#Ñ# rÔ)ä˜s“m×,Ñ,°-×2DÑ2DÐ,ÓE×LÑLÓN�Ùð 	à€Or*   c                óJ   € V ^8„  d   QhR\         R\         R,          R\         /# )r   rK   ÚendpointNr6   rZ   )r%   s   "r'   r(   r(   Ä  s%   € ÷ 
ñ 
¤ð 
¬s°T­zð 
¼cñ 
r*   c                ó"  € V'       d   VP                  R4      M\        P                  pV\        P                  \        P                  39  dA   V P                  \        P                  V4      p V P                  \        P                  V4      p V # )zœReplace the default endpoint in a URL by a custom one.

This is useful when using a proxy and the Hugging Face Hub returns a URL with the default endpoint.
rN   )Úrstripr   ÚENDPOINTÚ_HF_DEFAULT_ENDPOINTÚ_HF_DEFAULT_STAGING_ENDPOINTÚreplace)rK   rì   s   &&r'   Úfix_hf_endpoint_in_urlró   Ä  sf   € ÷
 (0ˆx�‰˜sÔ#´Y×5GÑ5G€Hàœ	×6Ñ6¼	×8^Ñ8^Ð_Ô_Ø�k‰kœ)×8Ñ8¸(ÓCˆØ�k‰kœ)×@Ñ@À(ÓKˆØ€Jr*   c                óV   € V ^8„  d   QhR\         P                  R\        R,          RR/# )r   rw   Úendpoint_nameNr6   )rb   ry   r#   )r%   s   "r'   r(   r(   Ñ  s/   € ÷ \?ñ \?¤%§.¡.ð \?ÄÀtÅð \?ÐW[ñ \?r*   c           	     ó6
  €  \        V 4        V P	                  4        R#   \         d    \        P                  RRR7        L7i ; i  \
        P                   Ed»   pT P                  ^d,          ^8X  d    Rp?R# T P                  P                  R4      pT P                  P                  R4      pT P                  e8   T P                  P                  e    \        T P                  P                  4      MRpT'       d   \        T4      MR6w  rgTR8X  d?   T P                   R2R	,           R
T P                   R2,           p\        \        Y€YgR7      ThTR8X  d?   T P                   R2R	,           RT P                   R2,           p\        \         Y€YgR7      ThTR8X  d?   T P                   R2R	,           RT P                   R2,           p\        \"        Y€YgR7      ThTR8X  dK   T P                   R2R	,           RT P                   R2,           R,           R,           p\        \$        Y€4      ThTR8X  dq   Tem   \&        P)                  T4      eV   T P                   R2R	,           RT P                   R2,           R,           R,           p\        \*        Y€\-        T4      R7      ThTR8X  g4   T P                  R8X  do   TR8w  dh   Ted   \.        P)                  T4      eM   T P                   R2R	,           RT P                   R2,           R,           R,           p\        \0        Y€YgR7      ThT P                  R8X  d   Te   RT R 2MR!p\        \2        Y€4      ThT P                  R"8X  dA   R	T P                   R#T R2R$T P                   R2,           R%,           p\        \4        Y€4      ThT P                  R&8X  dÑ   \7        T P                  4      p	T	e—   R'T	P8                   R(2pTR)T	P:                   R*2,          pT	P<                  eA   T	P>                  e3   TR+T	P@                   R,T	P<                   R-T	P>                   R.2,          pM	TR,          pTR/T P                   R2,          pMR0T P                   R2p\        \4        Y€4      ThT P                  R18X  d[   T P                  P                  P                  R24      p
T R3T
 R4T P                  P                  R54       R2p\        \4        Y€4      Th\        \4        \        T4      T 4      ThRp?ii ; i)7ad  
Internal version of `response.raise_for_status()` that will refine a potential HTTPError.
Raised exception will be an instance of [`~errors.HfHubHTTPError`].

This helper is meant to be the unique method to raise_for_status when making a call to the Hugging Face Hub.

Args:
    response (`Response`):
        Response from the server.
    endpoint_name (`str`, *optional*):
        Name of the endpoint that has been called. If provided, the error message will be more complete.

> [!WARNING]
> Raises when the request has failed:
>
>     - [`~utils.RepositoryNotFoundError`]
>         If the repository to download from cannot be found. This may be because it
>         doesn't exist, because `repo_type` is not set correctly, or because the repo
>         is `private` and you do not have access.
>     - [`~utils.GatedRepoError`]
>         If the repository exists but is gated and the user is not on the authorized
>         list.
>     - [`~utils.RevisionNotFoundError`]
>         If the repository exists but the revision couldn't be found.
>     - [`~utils.EntryNotFoundError`]
>         If the repository exists but the entry (e.g. the requested file) couldn't be
>         find.
>     - [`~utils.BadRequestError`]
>         If request failed with a HTTP 400 BadRequest error.
>     - [`~utils.HfHubHTTPError`]
>         If request failed for a reason not listed above.
zFailed to parse warning headersT)Úexc_infoNzX-Error-CodeúX-Error-MessageÚRevisionNotFoundz Client Error.ú

zRevision Not Found for url: Ú.)rT   rW   ÚEntryNotFoundzEntry Not Found for url: Ú	GatedRepoz!Cannot access gated repo for url z$Access to this resource is disabled.z!Cannot access repository for url Ú
ÚRepoNotFoundzBucket Not Found for url: zG
Please make sure you specified the correct bucket id (namespace/name).zg
If the bucket is private, make sure you are authenticated and your token has the required permissions.)Ú	bucket_idi‘  z+Invalid credentials in Authorization headerzRepository Not Found for url: zÈ
Please make sure you specified the correct `repo_id` and `repo_type`.
If you are trying to access a private or gated repo, make sure you are authenticated and your token has the required permissions.zQ
For more details, see https://huggingface.co/docs/huggingface_hub/authenticationr{   z

Bad request for z
 endpoint:z

Bad request:i“  z Forbidden: z
Cannot access content at: z2
Make sure your token has the correct permissions.r¿   z0

429 Too Many Requests: you have reached your 'z' rate limit.z
Retry after z secondsú (rN   z requests remaining in current z
s window).z
Url: z!

429 Too Many Requests for url: i   ÚRangez. Requested range: z. Content-Range: zContent-RangerO   )!Ú_warn_on_warning_headersr©   rk   rl   Úraise_for_statusrb   ÚHTTPStatusErrorr|   r5   rR   r`   rK   r#   rX   Ú_formatr   r   r   r   ÚBUCKET_API_REGEXr?   r   r]   ÚREPO_API_REGEXr   r   r   rG   r   r   r    r!   r   )rw   rõ   r¬   Ú
error_codeÚerror_messageÚrequest_urlrT   rW   ÚmessagerÁ   Úrange_headers   &&         r'   rÀ   rÀ   Ñ  sn  € ðBGÜ  Ô*ð
u?Ø×!Ñ!Ö#øô ô Gä�‰Ð6ÀˆÖFðGûô × Ñ õ s?Ø×Ñ 3Õ&¨!Ô+Ýà×%Ñ%×)Ñ)¨.Ó9ˆ
Ø ×(Ñ(×,Ñ,Ð->Ó?ˆð *2×)9Ñ)9Ò)EÈ(×JZÑJZ×J^ÑJ^ÒJjŒC�× Ñ ×$Ñ$Ô%Ðptð 	÷ HSÔ6°{ÔCÐXdÑˆ	àÐ+Ô+Ø!×-Ñ-Ð.¨nÐ=ÀÕFÐKgÐhp×htÑhtÐguÐuvÐIwÕwˆGÜÔ/°ÈiÔiÐopÐpà˜?Ô*Ø!×-Ñ-Ð.¨nÐ=ÀÕFÐKdÐem×eqÑeqÐdrÐrsÐItÕtˆGÜÔ2°GÐQZÔlÐrsÐsà˜;Ô&à×'Ñ'Ð(¨Ð7¸&Õ@ÐEfÐgo×gsÑgsÐftÐtuÐCvÕvð ô œ.¨'ÀyÔbÐhiÐiàÐDÔDà×'Ñ'Ð(¨Ð7Øõà5°h·l±l°^À1ÐEõFð õð 9õ	9ð ô Ô+¨WÓ?ÀQÐFð ˜.Ô(ØÒ'Ü ×'Ñ'¨Ó4Ò@ð ×'Ñ'Ð(¨Ð7Øõà.¨x¯|©|¨n¸AÐ>õ?ð ]õ]ð }õ	}ð ô Ü# WÔB[Ð\gÓBhôàðð ˜>Ô)Ø× Ñ  CÔ'ØÐ!NÔNØÒ'Ü×%Ñ% kÓ2Ò>ð ×'Ñ'Ð(¨Ð7Øõà2°8·<±<°.ÀÐBõCð`õ`ð gõgð ô Ô1°7ÐPYÔkÐqrÐrà×!Ñ! SÔ(àDQÒD]Ð& } o°ZÑ@Ðcuð ô œ/¨7Ó=À1ÐDà×!Ñ! SÔ(à�x×+Ñ+Ð,¨L¸¸ÀqÐIØ0°·±°¸aÐ@õAàGõHð ô
 œ.¨'Ó<À!ÐCà×!Ñ! SÔ(Ü4°X×5EÑ5EÓFˆNØÒ)àHÈ×IeÑIeÐHfÐfsÐtð ð ˜^¨N×,KÑ,KÐ+LÈHÐUÕU�Ø!×'Ñ'Ò3¸×8UÑ8UÒ8aØØ˜^×5Ñ5Ð6°a¸×8LÑ8LÐ7Mð N'Ø'5×'DÑ'DÐ&EÀZðQõ‘Gð
 ˜s•N�GØ˜W X§\¡\ N°!Ð4Õ4‘à?ÀÇÁ¸~ÈQÐO�Üœ.¨'Ó<À!ÐCà×!Ñ! SÔ(Ø#×+Ñ+×3Ñ3×7Ñ7¸Ó@ˆLØ˜Ð.¨|¨nÐ<MÈh×N^ÑN^×NbÑNbÐcrÓNsÐMtÐtuÐvˆGÜœ.¨'Ó<À!ÐCô ”n¤c¨!£f¨hÓ7¸QÐ>ûðgs?ús4   ‚  ŽA  "AÁAÁTÁTÁ<BTÄPTÔTc                ó<   € V ^8„  d   QhR\         P                  RR/# rv   rx   )r%   s   "r'   r(   r(   s  s   € ÷ (ñ (¤u§~¡~ð (¸$ñ (r*   c                óN  € V P                   P                  R4      pV Fƒ  pRV9   d   VP                  R^4      MRV3w  r4VP                  4       pV\        9  g   K?  VP                  4       pV'       g   KY  \        P                  V4       \        P                  V4       K…  	  R# )a}  
Emit warnings if warning headers are present in the HTTP response.

Expected header format: 'X-HF-Warning: topic; message'

Only the first warning for each topic will be shown. Topic is optional and can be empty. Note that several warning
headers can be present in a single response.

Args:
    response (`httpx.Response`):
        The HTTP response to check for warning headers.
zX-HF-WarningÚ;râ   N)r5   Úget_listÚsplitÚstripÚ_WARNED_TOPICSÚaddrk   rª   )rw   Úserver_warningsÚserver_warningÚtopicr  s   &    r'   r  r  s  s…   € ð ×&Ñ&×/Ñ/°Ó?€OÛ)ˆØ9<ÀÔ9N˜×-Ñ-¨c°1Ô5ÐUWÐYgÐTh‰ˆØ—‘“ˆØœÖ&Ø—m‘m“oˆGß‰wÜ×"Ñ" 5Ô)Ü—‘˜wÖ'ó *r*   Ú_HfHubHTTPErrorT)Úboundc          
      ó~   € V ^8„  d   QhR\         \        ,          R\        R\        P                  R\
        R\        /# )r   Ú
error_typeÚcustom_messagerw   Úattrsr6   )r·   r  r#   rb   ry   r   )r%   s   "r'   r(   r(   Ž  sE   € ÷ fñ fÜÔ%Õ&ðfÜ8;ðfÜGLÇ~Á~ðfÜ`cðfäñfr*   c                 óz  € . pVP                   P                  R 4      pVe   VP                  V4         VP                  4       pTP                  R4      pTP                  R4      pTeV   \        T\        4      '       d   TP                  T4       MBTe   TP                  T RT 24       M'TP                  T4       MTe   TP                  T4       TP                  R4      p	T	e+   T	 F$  pRT9   g   K  TP                  TR,          4       K&  	  T Uu. uF=  p\        T4      P                  4       '       g   K$  \        T4      P                  4       NK?  	  pp\        \         P#                  T4      4      pR
P%                  T4      pTpT'       dL   TP                  4       TP                  4       9  d)   RT9   d   TR
T,           ,          pMTRT,           ,          pRpRp\&        R3\(        R3\*        R33 F?  w  ppTP                   P                  T4      pT'       g   K+  \        T4      pRT RT R2p M	  T'       d[   TP                  4       TP                  4       9  d8   R
T9   d)   TP-                  R
4      pTRT T,           TTR ,           pMYß,          pT ! TP                  4       Y,;'       g    RR7      pTP/                  4        F  w  pp\1        TTT4       K  	  T#   \        P
                   d;     TP                  4        TP                  4       p ELà  \         d    / p  ELñi ; ii ; i  \        P                   dc    TP                   P                  RR4      p
TP                  '       d1   R	T
P                  4       9  d   TP                  TP                  4        EL i ; iu upi )rø   NÚerrorÚerror_descriptionú: Úerrorsr  zContent-Typerâ   Úhtmlrþ   rú   z
Request IDzAmzn Trace IDz	Amz CF IDr  Ú))rw   Úserver_message)r5   rR   ÚappendÚjsonrb   ÚResponseNotReadÚreadÚRuntimeErrorrÇ   ÚlistÚextendÚJSONDecodeErrorÚtextr=   r#   r  ÚdictÚfromkeysÚjoinrh   rg   ÚX_AMZ_CF_IDÚindexÚitemsÚsetattr)r  r  rw   r  Úserver_errorsÚfrom_headersrº   r   r!  r#  Úcontent_typeÚliner&  Úfinal_error_messagerp   Úrequest_id_messageÚheaderÚlabelÚvalueÚnewline_indexrÓ   ÚkÚvs   &&&,                   r'   r  r  Ž  su  € ð €Mð ×#Ñ#×'Ñ'Ð(9Ó:€LØÒØ×Ñ˜\Ô*ð+0ð	Ø—=‘=“?ˆDð —‘˜Ó!ˆØ ŸH™HÐ%8Ó9ÐØÒÜ˜%¤×&Ò&à×$Ñ$ UÕ+Ø"Ò.à×$Ñ$¨ w¨bÐ1BÐ0CÐ%DÕEð ×$Ñ$ UÕ+ØÒ*à× Ñ Ð!2Ô3à—‘˜(Ó#ˆØÒã�Ø Ö%Ø!×(Ñ(¨¨yÕ)9Ö:ñ  ñ 4AÓV±=¨4ÄCÈÃIÇOÁO×DUÔ&”S˜“Y—_‘_Ö&±=€MÐVô œŸ™ }Ó5Ó6€Mð —Y‘Y˜}Ó-€Nð )Ðß˜.×.Ñ.Ó0¸×8LÑ8LÓ8NÔNØ�^Ô#Ø 4¨.Õ#8Õ8Ñà 6¨NÕ#:Õ:Ðð €JØÐä	�|Ð$Ü	˜/Ð*Ü	�kÐ"ó‰ˆ�ð
 × Ñ ×$Ñ$ VÓ,ˆß‰5Ü˜U›ˆJØ#% e W¨B¨u¨g°QÐ!7ÐÙñ÷ �j×&Ñ&Ó(Ð0C×0IÑ0IÓ0KÔKØÐ&Ô&Ø/×5Ñ5°dÓ;ˆMà# N ]Ð3Ð6HÕHÐK^Ð_lÐ_mÐKnÕnñ  ð  Õ5Ðñ Ð(×.Ñ.Ó0¸8×TjÐTjÐfjÔ
k€CØ—‘–‰ˆˆ1Ü��Q˜Öñ à€Jøôo ×$Ñ$ô 
	ð	Ø—‘”Ø—}‘}““øÜô ð ”ðúð	
	ûôF ×Ñô 0à×'Ñ'×+Ñ+¨N¸BÓ?ˆØ�=�=ˆ=˜V¨<×+=Ñ+=Ó+?Ô?Ø× Ñ  §¡Ô/úð	0üò Wsg   µK, ÁB.L> Ã8L> Ä!N8Ä>N8Ë,L;Ì L%Ì"L> Ì%L7Ì2L;Ì3L> Ì6L7Ì7L;Ì;L> Ì>AN5Î0N5Î4N5c                ó0   € V ^8„  d   QhR\         R\         /# )r   Úbodyr6   rZ   )r%   s   "r'   r(   r(   û  s   € ÷ ñ ¤ð ¬ñ r*   c                óX   € \          F  p\        P                  ! RV R2RV 4      p K!  	  V # )z?Redact OAuth credential values from a JSON request body string.z("z"\s*:\s*")[^"]*(")z\1<REDACTED>\2)Ú_SENSITIVE_BODY_KEYSÚreÚsub)rD  rC   s   & r'   Ú_redact_sensitive_bodyrI  û  s.   € ç#ˆÜ�vŠv˜˜C˜5Ð 2Ð3Ð5FÈÓMŠñ $à€Kr*   c                óD   € V ^8„  d   QhR\         P                  R\        /# )r   r`   r6   )rb   rc   r#   )r%   s   "r'   r(   r(     s   € ÷ ' ñ ' ”e—m‘mð ' ¬ñ ' r*   c                ó  € RRV P                   3.p\        V P                  P                  4       4       F-  w  r#VP	                  4       R8X  d   RpVRV RV 23.,          pK/  	  Rp V P
                  eE   V P
                  P                  RRR	7      p\        V4      R
8”  d   VR,           R2p\        V4      pTe   TRTP                  RR4      3.,          pTRT P                  3.,          p. pT F]  w  r#T'       d$   TP                  \        \        T4      4      4       T'       g   K:  TP                  \        \        T4      4      4       K_  	  RP!                  T4      #   \        P                   d    Rp LÅi ; i)zÎConvert a `httpx.Request` into a curl command (str).

Used for debug purposes only.

Implementation vendored from https://github.com/ofw/curlify/blob/master/curlify.py.
MIT License Copyright (c) 2016 Egor.
Nz-Xre   z<TOKEN>z-Hr"  zutf-8Úignore)r#  iè  :Niè  Nz ... [truncated]z<streaming body>z-drþ   râ   r¾   )ÚcurlN)rm   Úsortedr5   r5  r=   ÚcontentÚdecodeÚlenrI  rb   ÚRequestNotReadrò   rK   r'  r   r#   r2  )r`   ÚpartsrA  rB  rD  Ú
flat_partss   &     r'   ro   ro     sl  € ð 	Ø	ˆw�~‰~Ðð$€Eô
 �w—‘×,Ñ,Ó.Ö/‰ˆØ�7‰7‹9˜Ô'ØˆAØ�4˜A˜3˜b  ˜Ð%Ð&Õ&Šñ 0ð
 €Dð"Ø�?‰?Ò&Ø—?‘?×)Ñ)¨'¸(Ð)ÓCˆDÜ�4‹y˜4ÔØ˜u�+˜Ð&6Ð7�Ü)¨$Ó/ˆDð ÒØ�4˜Ÿ™ d¨BÓ/Ð0Ð1Õ1ˆà	ˆt�W—[‘[Ð!Ð"Õ"€Eà€JÛ‰ˆßØ×Ñœe¤C¨£F›mÔ,ß‰1Ø×Ñœe¤C¨£F›mÖ,ñ	 ð �8‰8�JÓÐøô ×Ñô "Ø!Šð"ús   Á(AE& Å&F Å?F z%^\s*bytes\s*=\s*(\d*)\s*-\s*(\d*)\s*$c                óX   € V ^8„  d   QhR\         R,          R\        R\         R,          /# )r   Úoriginal_rangeNÚresume_sizer6   r"   )r%   s   "r'   r(   r(   0  s*   € ÷ "!ñ "!¬¨t­ð "!Ä#ð "!Ì#ÐPTÍ*ñ "!r*   c                ó  € V '       g   RV R2# RV 9   d   \        RV : R24      h\        P                  V 4      pV'       g   \        RV : R24      hVP	                  4       w  r4V'       gI   V'       g   \        RV : R24      h\        V4      V,
          pRV 2pV^ 8:  d   \        R	V: R24      hV# \        V4      pW1,           pV'       d,   \        V4      pRV RV 2pWt8”  d   \        R	V: R24      hV# RV R2# )
z:
Adjust HTTP Range header to account for resume position.
zbytes=Ú-Ú,zMultiple ranges detected - z, not supported yet.zInvalid range format - rû   zbytes=-zEmpty new range - )r}   ÚRANGE_REGEXrE   r+  Úgroupsr$   )rV  rW  rE   ÚstartÚendÚ
new_suffixÚ	new_rangeÚ	new_starts   &&      r'   Ú_adjust_range_headerrb  0  s!  € ÷ Ø˜�} AÐ&Ð&à
ˆnÔÜÐ6°~Ñ6HÐH\Ð]Ó^Ð^ä×Ñ˜nÓ-€EßÜÐ4°^Ñ4FÀaÐHÓIÐIØ—‘“�J€EçßÜÐ!8¸Ñ8JÈ!ÐLÓMÐMä˜“X Õ+ˆ
Ø˜j˜\Ð*ˆ	Ø˜Œ?ÜÐ!3°I±=ÀÐBÓCÐCØÐä�‹J€EØÕ#€Iß
Ü�#‹hˆØ˜Y˜K q¨¨Ð.ˆ	ØŒ?ÜÐ!3°I±=ÀÐBÓCÐCØÐà�I�;˜aÐ Ð r*   c                óL  € V ^8„  d   Qh/ ^ \         9   d
   \        ;R&   ^\         9   d
   \        ;R&   ^\         9   d   \        P                  R,          ;R&   ^\         9   d"   \
        \        \        ,          R3,          ;R&   ^\         9   d   \
        \        R3,          ;R&   # )r   r–   r�   Nr¡   .Ú_DEFAULT_RETRY_ON_EXCEPTIONSÚ_DEFAULT_RETRY_ON_STATUS_CODES)	Ú__conditional_annotations__r’   rš   rb   r„   rL   r·   r©   r$   )r%   s   "r'   r(   r(      s–   € × DÑ D÷p BÒ AÔ(Ñ Añq E÷r TÒ SÔ4Ñ Sñs E÷t +Ò *”—‘˜tÕ#Ñ *ñu E÷v iÒ hœe¤D¬¥O°SÐ$8Õ9Ñ hñw E÷x LÒ K¤¤c¨3 h¥Ñ Kòy Er*   >	   ÚrawÚblobÚrefsÚtreeÚcommitÚresolveÚrevisionÚsettingsÚdiscussions)r¿   iô  iö  i÷  iø  )N)Úsubject_tokenÚaccess_tokenÚrefresh_tokenÚclient_secret)krf  r0   ÚatexitrÈ   r(  ÚosrG  Ú	threadingrÍ   ri   Úcollections.abcr   r   r   Ú
contextlibr   Údataclassesr   Úshlexr   Útypingr   r	   Úurllib.parser
   rb   Úhuggingface_hub.errorsr   râ   r   r#  r   r   r   r   r   r   r   r   r   Ú_lfsr   Ú_typingr   Ú
get_loggerr,   rk   r   Úcompiler>   rA   rG   rh   rg   r3  ÚVERBOSEr  r  rP   r\   rS   rX   r]   rq   rt   r€   rŠ   r�   r„   r’   r�   rš   ÚLockr”   r–   r�   r¡   r—   rž   r¢   r¥   r•   ÚregisterÚhasattrr­   ÚTimeoutExceptionÚNetworkErrorrd  re  rÕ   rÚ   rÝ   rê   ró   rÀ   Úsetr  r  r  r  rF  rI  ro   Ú
IGNORECASEr[  rb  r(   )rf  s   @r'   Ú<module>rŠ     sZ  øðö Eã Û 	Û Û 	Û 	Û Û Û ß 8Ñ 8Ý %Ý !Ý ß Ý !ã å 7å ÷	÷ 	ó 	õ Ý Ý "ð 
×	Ò	˜HÓ	%€ñ �$Ô÷&ð &ó ð&ð, —:’:ÐmÓnÐ àŸ*š*Ð%OÓPÐ õ8ðz €Ø#€Ø€à—’ð
ð �*‰*ô€ð —:’:ðð �*‰*ôÐ ð Ÿ*š*Ð%iÓjÐ ð ŸJšJÐ'SÓTÐ ò qÐ õõ2-õõB*õ'õõð ˜B §¡Ð,Õ-Ð Ø! " e×&7Ñ&7Ð"7Õ8Ð à�~Š~Ó€Ø+AÐ Ó AØ7SÐ Ó SØ&*€Ó *õ0õ"8õ&õ*õ 9ð, ‡‚�Ô Ù
ˆ2Ð!×"Ò"Ø×Ò }Õ5ð >C×=SÑ=SÐUZ×UgÑUgÐ<hÐ Ó hØ2KÐ Ó Kð^8ð ð	^8ð
 ð^8ð ð^8ð Jfð^8ð 4Rð^8ð ÷^8ðBMð ð	Mð
 ðMð ðMð JfðMð 4R÷Mð` ðOð ð	Oð
 ðOð ðOð JfðOð 4RöOó ðOðd0Ø@E÷0õf
÷\?ñ~ “€õ(ñ0 Ð-°^ÔDÐ õfðT [Ð õõ' ðV �jŠjÐAÀ2Ç=Á=ÓQ€÷"!r*   