+
    –°³j^»  ã                   óö  a€ Rl tz0 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 ^ RIHt ^ RIHtHt ^ R	IHt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+H,t, ^RI!H-t- ^RI.H/t/ ^RI0H1t1H2t2 ]-Pf                  ! ]44      t5]! RR7       ! R R4      4       t6]Pn                  ! R4      t8]Pn                  ! R4      t9R R lt:R R lt;Rt<Rt=Rt>]Pn                  ! R]P~                  R7      t@]Pn                  ! R]P~                  R7      tA]Pn                  ! R 4      tB]Pn                  ! R!4      tC]Pn                  ! R"4      tD0 RmmtER# R$ ltFR% R& ltGR' R( ltH]! R)R*R+7      tI] ^ k R, R- ltJR. R/ ltKR0 R1 ltLR2 R3 ltMR4 R5 ltNR6 R7 ltO]. ]P                   3,          tQ]. ]P¤                  3,          tS]P¨                  ! 4       tU]NsV] ^k ]OsW] ^k RsX] ^k R8 R9 ltYR: R; ltZR< R= lt[R> R? lt\R@ RA lt]]P¼                  ! ]]4       ]_! ]RB4      '       d   ]PÀ                  ! ]]RC7       ]PÂ                  ]PÄ                  ]PÆ                  3td] ^k Rnte] ^k RD^RE^RF^RG]dRH]eRIR*/RJ RK lltfRD^RE^RF^RG]dRH]e/RL RM lltg]RD^RE^RF^RG]dRH]e/RN RO ll4       th^tiRPR*/RQ RR lltjRS RT ltkRU RV ltlRoRW RX lltm]n! 4       toRY RZ ltp]! R[](R\7      tqR] R^ ltrRpts]s U Uu. uF:  p ]Po                  R_V  R`24      Ra3]Po                  RbV  Rc24      Rd33 F  pVNK  	  K<  	  upp ttRe Rf ltuRg Rh ltv]Pn                  ! Ri]Pî                  4      txRj Rk ltyR# u upp i )qz>Contains utilities to handle HTTP requests in huggingface_hub.N)ÚCallableÚ	GeneratorÚMapping)Úcontextmanager)Ú
ContextVar)Ú	dataclass©Úwraps)Úquote)ÚAnyÚTypeVar)ÚurljoinÚurlparse)ÚOfflineModeIsEnabled)Ú	constants)	ÚBadRequestErrorÚBucketNotFoundErrorÚDisabledRepoErrorÚGatedRepoErrorÚHfHubHTTPErrorÚJobNotFoundErrorÚRemoteEntryNotFoundErrorÚRepositoryNotFoundErrorÚRevisionNotFoundError)Úlogging)ÚSliceFileObj)ÚHTTP_METHOD_TÚ	CallableTT)Úfrozenc                   ó8   a € ] tR t^9t 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   "€Ú\/home/luca/screen-checking/.venv/lib/python3.14/site-packages/huggingface_hub/utils/_http.pyÚ__annotate__ÚRateLimitInfo.__annotate__9   sM   ø‡ ‚ ñ Ññ ñ �Nñ ñ  Ññ! ñ" ��:Ññ# ñ$ ˜$•JÑ%ò% ó    © )
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r&   r'   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)r,   s   @r-   r    r    9   s   ø‡ € ñ
ð €EØ!%€N÷% ƒ r0   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.   U   s(   € ÷ 8ñ 8¤W¬S´#¨XÕ%6ð 8¼=È4Õ;Oñ 8r0   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    )r<   r?   ÚpolicyÚkeyÚ	lower_keyÚmatchr#   r$   r%   r&   r'   Úpolicy_matchs   &           r-   Úparse_ratelimit_headersrN   U   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äØ#ØØ)ØØ%ôð r0   c                ó`   € V ^8„  d   QhR\         \        \        3,          R\        R,          /# r;   )r   r)   r*   )r+   s   "r-   r.   r.   �   s'   € ÷ ñ ¤¬¬S¨Õ 1ð ´c¸Dµjñ r0   c                óÜ   € RpV  F"  pVP                  4       R8X  g   K  W,          p M	  Vf   R# VP                  4       pV'       g   R# VP                  4       '       d   \        V4      # R# )aK  Parse the standard `Retry-After` HTTP header into a number of seconds to wait.

The `Retry-After` header can be either a non-negative number of seconds (delay-seconds)
or an HTTP-date after which to retry. We handle only the delay-seconds case.

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Retry-After.
Nzretry-after)rD   ÚstripÚisdigitr*   )r<   ÚvaluerJ   s   &  r-   Ú_parse_retry_afterrT   �   s^   € ð €EÛˆØ�9‰9‹;˜-Ö'Ø•LˆEÙñ ð
 ‚}ÙØ�K‰K‹M€EßÙà‡}�}‡‚Ü�5‹zÐÙr0   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/
    z:^https?://[^/]+/api/(?:scheduled-jobs|jobs)/[^/]+/([^/?]+)zA^https?://[^/]+/api/(models|datasets|spaces)/([^/]+)(?:/([^/]+))?z)^https?://[^/]+/api/buckets/([^/]+/[^/]+)c                ón   € V ^8„  d   QhR\         R\        \         R,          \         R,          3,          /# ©r"   Úurlr=   N)r)   Útuple)r+   s   "r-   r.   r.   ×   s,   € ÷ ñ ¤3ð ¬5´°tµ¼SÀ4½ZÐ1GÕ+Hñ r0   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_REGEXrF   r   ÚREPO_TYPES_MAPPINGÚgetrG   Ú_REPO_URL_SUBPATHS)rX   rL   Ú	repo_typeÚfirstÚsecondÚrepo_ids   &     r-   Ú_parse_repo_info_from_urlre   ×   sˆ   € ô $×*Ñ*¨3Ó/€EßØÐÜ×,Ñ,×0Ñ0°·±¸Q³Ó@€IØ—K‘K “N E§K¡K°£Nˆ6ß�&Ô 2Ô2Ø�G˜1˜V˜HÐ%ˆð ÐÐð ˆØÐÐr0   c                ó>   € V ^8„  d   QhR\         R\         R,          /# rW   ©r)   )r+   s   "r-   r.   r.   ð   s   € ÷ -ñ -¤3ð -¬3°­:ñ -r0   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_REGEXrF   rG   ©rX   rL   s   & r-   Ú_parse_bucket_id_from_urlrk   ð   s'   € ä%×,Ñ,¨SÓ1€Eß"ˆ5�;‰;�q‹>Ð,¨Ð,r0   c                ó>   € V ^8„  d   QhR\         R\         R,          /# rW   rg   )r+   s   "r-   r.   r.   ö   s   € ÷ -ñ -¤ð -¬¨d­
ñ -r0   c                ób   € \         P                  V 4      pV'       d   VP                  ^4      # R# )z>Extract the job_id from a (scheduled) job API URL, if present.N)Ú_JOB_ID_FROM_URL_REGEXrF   rG   rj   s   & r-   Ú_parse_job_id_from_urlro   ö   s'   € ä"×)Ñ)¨#Ó.€Eß"ˆ5�;‰;�q‹>Ð,¨Ð,r0   Ú_IS_DOWNLOAD_CALLF)Údefaultc                ó0   € V ^8„  d   QhR\         R\         /# )r"   Úfnr=   )r   )r+   s   "r-   r.   r.   ÿ   s   € ÷ ñ œið ¬Iñ r0   c                ó0   a € \        S 4      V 3R l4       pV# )a  Decorator to tag all HTTP calls made by `fn` with the `X-HF-Download-Counter` header.

Applied on `hf_hub_download`, `snapshot_download`, etc. so that every call they make through [`get_session`]
is flagged as part of a download, no matter how deep in the call stack it happens.
c                  óž   <€ \         P                  R 4      p S! V / VB \         P                  V4       #   \         P                  T4       i ; i)T)rp   ÚsetÚreset)ÚargsÚkwargsÚtokenrs   s   *, €r-   Ú_innerÚ%flag_as_download_call.<locals>._inner  sC   ø€ ä!×%Ñ% dÓ+ˆð	+Ù�tÐ&˜vÑ&ä×#Ñ# EÕ*øÔ×#Ñ# EÕ*ús	   ˜5 µAr   )rs   r{   s   f r-   Úflag_as_download_callr}   ÿ   s"   ø€ ô ˆ2ƒYô+ó ð+ð €Mr0   c                ó<   € V ^8„  d   QhR\         P                  RR/# ©r"   Úrequestr=   N©ÚhttpxÚRequest)r+   s   "r-   r.   r.     s   € ÷ "ñ "¤5§=¡=ð "°Tñ "r0   c           	     óê  € \         P                  ! 4       '       d   \        RV P                   R24      h\        P                  4       '       d   RV P                  \         P                  &   \        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# )a  
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
- Flag the request as part of a download, if applicable
- 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.Ú1z%Request %s: %s %s (authenticated: %s)ÚauthorizationNzSend: %s)r   Úis_offline_moder   rX   rp   r_   r<   ÚX_HF_DOWNLOAD_COUNTERÚX_AMZN_TRACE_IDÚX_REQUEST_IDr)   ÚuuidÚuuid4ÚloggerÚdebugÚmethodÚHF_DEBUGÚ_curlify)r€   Ú
request_ids   & r-   Úhf_request_event_hookr“     s  € ô × Ò ×"Ò"Ü"Ø˜GŸK™K˜=ð  )Jð  Kó
ð 	
ô ×Ñ×ÒØ;>ˆ�‰œ	×7Ñ7Ñ8ô ˜gŸo™oÔ-Ø+2¯?©?×+>Ñ+>¼|Ó+L×+aÐ+aÔPSÔTX×T^ÒT^ÓT`ÓPaˆ�‰œÑ(Ø—‘×$Ñ$¤_Ó5€Jô ‡L�LØ/ØØ�‰Ø�‰Ø�‰×Ñ˜OÓ,°DÐ8ôô ××ÐÜ�‰�Z¤¨'Ó!2Ô3àÐr0   c                ó<   € V ^8„  d   QhR\         P                  RR/# r   r�   )r+   s   "r-   r.   r.   6  s   € ÷ *ñ *¬u¯}©}ð *Àñ *r0   c              ƒ  ó    "  € \        V 4      # 5i)z+
Async version of `hf_request_event_hook`.
)r“   )r€   s   &r-   Úasync_hf_request_event_hookr–   6  s   é € ô ! Ó)Ð)ùs   ‚c                ó<   € V ^8„  d   QhR\         P                  RR/# ©r"   Úresponser=   N©r‚   ÚResponse)r+   s   "r-   r.   r.   =  s   € ÷ 'ñ '´·±ð 'ÀDñ 'r0   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_coder<   r*   Ú
ValueErrorÚaread)r™   Ú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"   r=   ©r‚   ÚClient)r+   s   "r-   r.   r.   K  s   € ÷ ñ ¤§¡ñ r0   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)r‚   r¦   r“   r1   r0   r-   Údefault_client_factoryr¬   K  s'   € ô �<Š<ØÔ!6Ð 7Ð8ØØôð r0   c                ó8   € V ^8„  d   QhR\         P                  /# r¤   ©r‚   ÚAsyncClient)r+   s   "r-   r.   r.   V  s   € ÷ ñ ¤e×&7Ñ&7ñ r0   c                 óP   € \         P                  ! R\        .R\        ./RRR7      # )zN
Factory function to create a `httpx.AsyncClient` with the default transport.
r€   r™   TNr¨   )r‚   r¯   r–   r¢   r1   r0   r-   Údefault_async_client_factoryr±   V  s1   € ô ×ÒØÔ!<Ð =¸zÔLhÐKiÐjØØôð r0   c                ó(   € V ^8„  d   QhR\         RR/# )r"   Úclient_factoryr=   N)ÚCLIENT_FACTORY_T)r+   s   "r-   r.   r.   j  s   € ÷ 0ñ 0Ô'7ð 0¸Dñ 0r0   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¹   j  s    € ÷ 
ŽÜŒØ!/Ð÷ 
��Šús   �&¦7	c                ó(   € V ^8„  d   QhR\         RR/# )r"   Úasync_client_factoryr=   N)ÚASYNC_CLIENT_FACTORY_T)r+   s   "r-   r.   r.   {  s   € ÷ 8ñ 8Ô3Ið 8Èdñ 8r0   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`.

> [!WARNING]
> 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.
N©Ú_GLOBAL_ASYNC_CLIENT_FACTORY)r»   s   &r-   Úset_async_client_factoryrÀ   {  s
   € ð $8Ò r0   c                ó8   € V ^8„  d   QhR\         P                  /# r¤   r¥   )r+   s   "r-   r.   r.   ‹  s   € ÷ ñ ”U—\‘\ñ r0   c                 ó¬   € \         f0   \        ;_uu_ 4        \         f   \        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¸   r1   r0   r-   Úget_sessionrÄ   ‹  s?   € ô ÒßŽ\ÜÒ%Ü!7Ó!9�÷ ô ÐŒ>Ð÷ Ž\ô Ðús	   —>¾A	c                ó8   € V ^8„  d   QhR\         P                  /# r¤   r®   )r+   s   "r-   r.   r.   ›  s   € ÷ 
*ñ 
*œ5×,Ñ,ñ 
*r0   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`.

> [!WARNING]
> 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.
r¾   r1   r0   r-   Úget_async_sessionrÇ   ›  s   € ô (Ó)Ð)r0   c                ó   € V ^8„  d   QhRR/# )r"   r=   Nr1   )r+   s   "r-   r.   r.   ¨  s   € ÷ 9ñ 9�tñ 9r0   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Ú	Exceptionr�   Úwarning)ÚclientÚes     r-   r·   r·   ¨  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Ústreamc                ó@  € V ^8„  d   QhR\         R\        R\        R\        R\        R\        \
        ,          \        \        \
        ,          R3,          ,          R\        \        \        R3,          ,          R	\        R
\        \        P                  RR3,          /	# )r"   r�   rX   rÑ   rÒ   rÓ   rÔ   .rÕ   rÖ   r=   N)r   r)   r*   ÚfloatÚtyperË   rY   Úboolr   r‚   r›   )r+   s   "r-   r.   r.   Ë  s¡   € ÷ d8ñ d8Üðd8ä	ðd8ô ð	d8ô
 ðd8ô ðd8ô œi�¬5´´iµÀ#Ð1EÕ+FÕFðd8ô ¤¤s¨C x¥Õ0ðd8ô ðd8ô Œu�~‰~˜t TÐ)Õ*ñd8r0   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
 S^,          oRo\        4       p 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K<    + '       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"   r™   r=   )r‚   r›   rÚ   )r+   s   "r-   r.   Ú(_http_backoff_base.<locals>.__annotate__ö  s   € ÷ ñ ¬¯©ð ¼4ñ r0   c                ón  <€ 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  d9   \	        V P
                  4      ;pe    VP                  ^ 8X  d   VP                  oR# \        V P
                  4      ;pe   VoR# )zNHandle response and return True if should retry, False if should return/yield.FzHTTP Error z thrown while requesting Ú é­  T)	rž   r�   rÌ   Úhf_raise_for_statusrN   r<   r$   r%   rT   )	r™   Úratelimit_infoÚretry_afterrÑ   r�   Únb_triesÚratelimit_resetrÕ   rX   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ñ !ð ×(Ñ(¨CÔ/Ü+BÀ8×CSÑCSÓ+TÐT˜ÒaØ&×0Ñ0°AÔ5à&4×&EÑ&E�Oñ ô &8¸×8HÑ8HÓ%IÐI�kÒVØ&1�Oár0   r�   rX   Ú'z' thrown while requesting rà   zRate limited. Waiting zs before retry [Retry r[   z].zRetrying in z	s [Retry r1   )Ú
isinstancerÙ   r*   ÚioÚIOBaser   ÚtellrÄ   ÚseekrÖ   r€   r�   rÌ   r‚   ÚConnectErrorr·   rØ   ÚtimeÚsleepÚmin)r�   rX   rÑ   rÒ   rÓ   rÔ   rÕ   rÖ   ry   Ú
sleep_timeÚio_obj_initial_posrÍ   rç   r™   Ú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Ðà
Ø�A�ˆØˆô “ˆð4	ð "Ò-Ø�v•×#Ñ#Ð$6Ô7÷õ ÷6 Ø—]’]Ñ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"   r�   rX   rÑ   rÒ   rÓ   rÔ   .rÕ   r=   )	r   r)   r*   rØ   rÙ   rË   rY   r‚   r›   )r+   s   "r-   r.   r.   2  sŠ   € ÷ Mñ MÜðMä	ðMô ð	Mô
 ðMô ðMô œi�¬5´´iµÀ#Ð1EÕ+FÕFðMô ¤¤s¨C x¥Õ0ðMô ‡^�^ñMr0   c               óJ   € \        \        R
RV RVRVRVRVRVRVRR	/VB 4      # )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. Set to `0` to disable 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`, `httpx.NetworkError` and `httpx.RemoteProtocolError`.
    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).
r�   rX   rÑ   rÒ   rÓ   rÔ   rÕ   rÖ   Fr1   )Únextr÷   ©r�   rX   rÑ   rÒ   rÓ   rÔ   rÕ   ry   s   &&$$$$$,r-   Úhttp_backoffrü   2  sp   € ôB Üñ 
	
Øð
	
àð
	
ð $ð
	
ð *ð	
	
ð
 (ð
	
ð !4ð
	
ð #8ð
	
ð ð
	
ð ñ
	
óð r0   c                ó4  € V ^8„  d   QhR\         R\        R\        R\        R\        R\        \
        ,          \        \        \
        ,          R3,          ,          R\        \        \        R3,          ,          R	\        \        P                  R
R
3,          /# )r"   r�   rX   rÑ   rÒ   rÓ   rÔ   .rÕ   r=   N)
r   r)   r*   rØ   rÙ   rË   rY   r   r‚   r›   )r+   s   "r-   r.   r.   ƒ  s–   € ÷ Lñ LÜðLä	ðLô ð	Lô
 ðLô ðLô œi�¬5´´iµÀ#Ð1EÕ+FÕFðLô ¤¤s¨C x¥Õ0ðLô Œu�~‰~˜t TÐ)Õ*ñLr0   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. Set to `0` to disable 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`, `httpx.NetworkError` and `httpx.RemoteProtocolError`.
    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()
```

> [!WARNING]
> 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).
r�   rX   rÑ   rÒ   rÓ   rÔ   rÕ   rÖ   TNr1   )r÷   rû   s   &&$$$$$,r-   Úhttp_stream_backoffrÿ   ‚  sp   é € ôF "ñ 
Øð
àð
ð  ð
ð &ð	
ð
 $ð
ð 0ð
ð 4ð
ð ð
ð ñ
÷ 
ô 
ùs   ‚*¡(¢*Úretry_on_errorsc                ó\   € V ^8„  d   QhR\         R\        R\        R\        P                  /# )r"   r�   rX   r   r=   )r   r)   rÚ   r‚   r›   )r+   s   "r-   r.   r.   Õ  s6   € ÷ 1bñ 1bÜð1bÜ #ð1bÜ9=ð1bä
‡^�^ñ1br0   c               ób  € V'       d   / MRRRR/p\        \        4       Fl  p\        RRV RV/VBRR/BVB p\        V4       VP                  '       g   Vu # \        WP                  R,          4      p\        W4      '       g   Vu # TpKn  	  \        P                  ! R\         R	V R
24      h)a‡  Perform an HTTP request with backoff, following redirects that stay on the Hub.

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

Redirects to the same host or another Hub host are followed. Redirects to any other host (CDN, storage
bucket) are not: the file metadata is on the redirect response itself and the auth header must not leave the Hub.

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Õ   r�   rX   rª   FÚLocationz	Exceeded z redirects while resolving 'z'.r1   )
ÚrangeÚ_MAX_REDIRECTSrü   râ   Úhas_redirect_locationr   r<   Ú_is_same_or_hub_hostr‚   ÚTooManyRedirects)r�   rX   r   Úhttpx_kwargsÚno_retry_kwargsÚ_r™   Útargets   &&$,    r-   Ú(_httpx_follow_hub_redirects_with_backoffr  Õ  sÓ   € ÷2 ‰Ð$9¸2Ð?VÐXZÐ#[ð ô ”>Ö"ˆÜñ 
Øð
àð
ð ñ
ð #ñ	
ð
 ñ
ˆô 	˜HÔ%à×-×-Ð-ØŠOä˜×.Ñ.¨zÕ:Ó;ˆÜ# C×0Ò0ð ŠOàŠñ' #ô* ×
 Ò
  9¬^Ð,<Ð<XÐY\ÐX]Ð]_Ð!`Ó
aÐar0   c                ó<   € V ^8„  d   QhR\         R\         R\        /# )r"   rX   r  r=   )r)   rÚ   )r+   s   "r-   r.   r.   	  s&   € ÷ jñ jœcð j¬3ð j´4ñ jr0   c                óò   € \        V4      P                  ;'       g    RP                  4       pT\        V 4      P                  ;'       g    RP                  4       8H  ;'       g    V\        P                  9   # )zMWhether `target` is served by the same host as `url`, or by a known Hub host.Ú )r   ÚhostnamerD   r   ÚHF_URL_HOSTS)rX   r  Útarget_hosts   && r-   r  r  	  s]   € ä˜FÓ#×,Ñ,×2Ð2°×9Ñ9Ó;€KØœ8 C›=×1Ñ1×7Ð7°R×>Ñ>Ó@Ñ@×iÐiÀKÔS\×SiÑSiÑDiÐir0   c                óJ   € V ^8„  d   QhR\         R\         R,          R\         /# )r"   rX   ÚendpointNr=   rg   )r+   s   "r-   r.   r.     s%   € ÷ 
ñ 
¤ð 
¬s°T­zð 
¼cñ 
r0   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.
r[   )Úrstripr   ÚENDPOINTÚ_HF_DEFAULT_ENDPOINTÚ_HF_DEFAULT_STAGING_ENDPOINTÚreplace)rX   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ˆØ€Jr0   c                óV   € V ^8„  d   QhR\         P                  R\        R,          RR/# )r"   r™   Úendpoint_nameNr=   )r‚   r›   r)   )r+   s   "r-   r.   r.     s/   € ÷ j?ñ j?¤%§.¡.ð j?ÄÀtÅð j?ÐW[ñ j?r0   c           	     ó*  €  \        V 4        V P	                  4        R#   \         d    \        P                  RRR7        L7i ; i  \
        P                   Ed5   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R:w  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 P                  R8X  dY   TeU   \/        T4      ;p	eF   T P                   R2R	,           RT P                   R2,           R,           p\        \0        Y€T	R7      ThTR8X  g4   T P                  R8X  do   TR8w  dh   Ted   \2        P)                  T4      eM   T P                   R2R	,           RT P                   R2,           R ,           R!,           p\        \4        Y€YgR7      ThT P                  R"8X  d   Te   R#T R$2MR%p\        \6        Y€4      ThT P                  R&8X  dA   R	T P                   R'T R2R(T P                   R2,           R),           p\        \8        Y€4      ThT P                  R*8X  dâ   \;        T P                  4      p
T
e¨   T
P<                  ^ 8X  d—   R+T
P>                   R,2pTR-T
P@                   R.2,          pT
PB                  eA   T
PD                  e3   TR/T
P<                   R0T
PB                   R1T
PD                   R22,          pM	TR,          pTR3T P                   R2,          pMR4T P                   R2p\        \8        Y€4      ThT P                  R58X  d[   T P                  P                  P                  R64      pT R7T R8T P                  P                  R94       R2p\        \8        Y€4      Th\        \8        \        T4      T 4      ThRp?ii ; i);ad  
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: Ú.)ra   rd   Ú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Job Not Found for url: zA
Please make sure you specified the correct job ID and namespace.)Újob_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ú (r[   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-Ranger\   )#Ú_warn_on_warning_headersrË   r�   rŽ   Úraise_for_statusr‚   ÚHTTPStatusErrorrž   r<   r_   r€   rX   r)   re   Ú_formatr   r   r   r   ÚBUCKET_API_REGEXrF   r   rk   ro   r   ÚREPO_API_REGEXr   r   r   rN   r$   r#   r%   r&   r'   )r™   r  rÎ   Ú
error_codeÚerror_messageÚrequest_urlra   rd   Úmessager*  rã   Úrange_headers   &&          r-   râ   râ     sõ  € ðBGÜ  Ô*ð
C?Ø×!Ñ!Ö#øô ô Gä�‰Ð6ÀˆÖFðGûô × Ñ õ A?Ø×Ñ 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Ô'ØÒ'Ü1°+Ó>Ð>�ÒKð ×'Ñ'Ð(¨Ð7Øõà+¨H¯L©L¨>¸Ð;õ<ð WõWð ô Ô*¨GÀfÔMÐSTÐTà˜>Ô)Ø× Ñ  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àÒ)¨n×.FÑ.FÈ!Ô.Kà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Ð>ûðCA?ús4   ‚  ŽA  "AÁAÁVÁVÁ<BVÄRVÖVc                ó<   € V ^8„  d   QhR\         P                  RR/# r˜   rš   )r+   s   "r-   r.   r.   Ì  s   € ÷ (ñ (¤u§~¡~ð (¸$ñ (r0   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)r<   Úget_listÚsplitrQ   Ú_WARNED_TOPICSÚaddr�   rÌ   )r™   Úserver_warningsÚserver_warningÚtopicr6  s   &    r-   r-  r-  Ì  s…   € ð ×&Ñ&×/Ñ/°Ó?€OÛ)ˆØ9<ÀÔ9N˜×-Ñ-¨c°1Ô5ÐUWÐYgÐTh‰ˆØ—‘“ˆØœÖ&Ø—m‘m“oˆGß‰wÜ×"Ñ" 5Ô)Ü—‘˜wÖ'ó *r0   Ú_HfHubHTTPErrorT)Úboundc          
      ó~   € V ^8„  d   QhR\         \        ,          R\        R\        P                  R\
        R\        /# )r"   Ú
error_typeÚcustom_messager™   Úattrsr=   )rÙ   rB  r)   r‚   r›   r   )r+   s   "r-   r.   r.   ç  sE   € ÷ fñ fÜÔ%Õ&ðfÜ8;ðfÜGLÇ~Á~ðfÜ`cðfäñfr0   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ú: Úerrorsr6  zContent-Typer  Úhtmlr'  r#  z
Request IDzAmzn Trace IDz	Amz CF IDr+  Ú))r™   Úserver_message)r<   r_   ÚappendÚjsonr‚   ÚResponseNotReadÚreadÚRuntimeErrorrê   ÚlistÚextendÚJSONDecodeErrorÚtextrD   r)   rQ   ÚdictÚfromkeysÚjoinrŠ   r‰   ÚX_AMZ_CF_IDÚindexÚitemsÚsetattr)rE  rF  r™   rG  Úserver_errorsÚfrom_headersrÜ   rI  rJ  rL  Úcontent_typeÚlinerO  Úfinal_error_messager’   Úrequest_id_messageÚheaderÚlabelrS   Únewline_indexrõ   ÚkÚvs   &&&,                   r-   r0  r0  ç  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z("z"\s*:\s*")[^"]*(")z\1<REDACTED>\2z(^|&)(z=)[^&]*z\1\2<REDACTED>c                ó0   € V ^8„  d   QhR\         R\         /# )r"   Úbodyr=   rg   )r+   s   "r-   r.   r.   \  s   € ÷ ñ ¤ð ¬ñ r0   c                óF   € \          F  w  rVP                  W 4      p K  	  V # )zRRedact OAuth credential values from a JSON or form-urlencoded request body string.)Ú_SENSITIVE_BODY_PATTERNSÚsub)rl  ÚpatternÚreplacements   &  r-   Ú_redact_sensitive_bodyrr  \  s"   € ç 8ÑˆØ�{‰{˜;Ó-Šñ !9à€Kr0   c                óD   € V ^8„  d   QhR\         P                  R\        /# )r"   r€   r=   )r‚   rƒ   r)   )r+   s   "r-   r.   r.   c  s   € ÷ ' ñ ' ”e—m‘mð ' ¬ñ ' r0   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-Xr†   z<TOKEN>z-HrK  zutf-8Úignore)rL  iè  :Niè  Nz ... [truncated]z<streaming body>z-dr'  r  rà   )ÚcurlN)r�   Úsortedr<   r^  rD   ÚcontentÚdecodeÚlenrr  r‚   ÚRequestNotReadr  rX   rP  r
   r)   r[  )r€   Úpartsri  rj  rl  Ú
flat_partss   &     r-   r‘   r‘   c  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_sizer=   r(   )r+   s   "r-   r.   r.   ‘  s*   € ÷ "!ñ "!¬¨t­ð "!Ä#ð "!Ì#ÐPTÍ*ñ "!r0   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_REGEXrL   rT  Úgroupsr*   )r  r€  rL   ÚstartÚendÚ
new_suffixÚ	new_rangeÚ	new_starts   &&      r-   Ú_adjust_range_headerr‹  ‘  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Ð Ð r0   c                óŠ  € V ^8„  d   Qh/ ^ \         9   d   \        \        ,          ;R&   ^\         9   d
   \        ;R&   ^\         9   d
   \        ;R&   ^\         9   d   \
        P                  R,          ;R&   ^\         9   d"   \        \        \        ,          R3,          ;R&   ^\         9   d   \        \        R3,          ;R&   # )	r"   rp   r¸   r¿   NrÃ   .Ú_DEFAULT_RETRY_ON_EXCEPTIONSÚ_DEFAULT_RETRY_ON_STATUS_CODES)Ú__conditional_annotations__r   rÚ   r´   r¼   r‚   r¦   rY   rÙ   rË   r*   )r+   s   "r-   r.   r.      s´   € × DÑ D÷\ UÒ T”:œdÕ#Ñ Tñ] E÷n
 BÒ AÔ(Ñ Año
 E÷p
 TÒ SÔ4Ñ Sñq
 E÷r
 +Ò *”—‘˜tÕ#Ñ *ñs
 E÷jò œe¤D¬¥O°SÐ$8Õ9ñ ñk E÷t QÒ P¤¤c¨3 h¥Ñ Pòu Er0   >	   ÚrawÚblobÚrefsÚtreeÚcommitÚresolveÚrevisionÚsettingsÚdiscussions)i˜  rá   iô  iö  i÷  iø  )N)Úsubject_tokenÚaccess_tokenÚrefresh_tokenÚclient_secretÚdevice_code){r�  r6   Úatexitrë   rQ  ÚosÚreÚ	threadingrð   r‹   Úcollections.abcr   r   r   Ú
contextlibr   Úcontextvarsr   Údataclassesr   Ú	functoolsr	   Úshlexr
   Útypingr   r   Úurllib.parser   r   r‚   Úhuggingface_hub.errorsr   r  r   rL  r   r   r   r   r   r   r   r   r   r   Ú_lfsr   Ú_typingr   r   Ú
get_loggerr2   r�   r    ÚcompilerE   rH   rN   rT   rŠ   r‰   r\  ÚVERBOSEr2  r1  rn   r]   ri   r`   re   rk   ro   rp   r}   r“   r–   r¢   r¬   r±   r¦   r´   r¯   r¼   ÚLockr¶   r¸   r¿   rÃ   r¹   rÀ   rÄ   rÇ   r·   ÚregisterÚhasattrrÏ   ÚTimeoutExceptionÚNetworkErrorÚRemoteProtocolErrorr�  rŽ  r÷   rü   rÿ   r  r  r  r  râ   rv   r=  r-  rB  r0  Ú_SENSITIVE_BODY_KEYSrn  rr  r‘   Ú
IGNORECASEr„  r‹  r.   )rJ   rp  r�  s   00@r-   Ú<module>r¸     s   øðö Eã Û 	Û Û 	Û 	Û Û Û ß 8Ñ 8Ý %Ý "Ý !Ý Ý ß ß *ã å 7å ÷
÷ 
õ 
õ Ý ß -ð 
×	Ò	˜HÓ	%€ñ �$Ô÷&ð &ó ð&ð, —:’:ÐmÓnÐ àŸ*š*Ð%OÓPÐ õ8õvð6 €Ø#€Ø€à—’ð
ð �*‰*ô€ð —:’:ðð �*‰*ôÐ ð ŸšÐ$aÓbÐ ð Ÿ*š*Ð%iÓjÐ ð ŸJšJÐ'SÓTÐ ò qÐ õõ2-õ-ñ '1Ð1DÈeÔ&TÐ Ó Tõõ$"õJ*õ'õõð ˜B §¡Ð,Õ-Ð Ø! " e×&7Ñ&7Ð"7Õ8Ð à�~Š~Ó€Ø+AÐ Ó AØ7SÐ Ó SØ&*€Ó *õ0õ"8õ õ 
*õ9ð, ‡‚�Ô Ù
ˆ2Ð!×"Ò"Ø×Ò }Õ5ð 
×ÑØ	×ÑØ	×Ñð=Ð ó ð
 3QÐ Ó Pðd8ð ð	d8ð
 ðd8ð ðd8ð Jfðd8ð 4Rðd8ð ÷d8ðNMð ð	Mð
 ðMð ðMð JfðMð 4R÷Mð` ðLð ð	Lð
 ðLð ðLð JfðLð 4RöLó ðLð^ €ð1bØ@E÷1bõhjõ
÷j?ñZ “€õ(ñ0 Ð-°^ÔDÐ õfðT jÐ ñ $ôá#ˆà	�‰�r˜#˜Ð0Ð1Ó	2Ð4EÐFØ	�‰�v˜c˜U 'Ð*Ó	+Ð->Ð?óˆó ññ Ù#òÐ õõ' ðV �jŠjÐAÀ2Ç=Á=ÓQ€÷"!ùós   Ì A M5