+
    QV-j&4  ã                   ó–  a € R# t 0 t R t^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
Ht ^ RIHt ^ RIHt ^ RIHt ^RIHt / t] ^ k  ! R R	4      tR$R
 R lltR$R R lltR R lt ! R R]4      t]P5                  ]P6                  ! 4       4        ! R R4      t]
R R l4       tRR/R R lltRRR^ RRRRRRRRR R/R! R" lltR# )%u	  Utility helpers to handle progress bars in `huggingface_hub`.

Example:
    1. Use `huggingface_hub.utils.tqdm` as you would use `tqdm.tqdm` or `tqdm.auto.tqdm`.
    2. To disable progress bars, either use `disable_progress_bars()` helper or set the
       environment variable `HF_HUB_DISABLE_PROGRESS_BARS` to 1.
    3. To re-enable progress bars, use `enable_progress_bars()`.
    4. To check whether progress bars are disabled, use `are_progress_bars_disabled()`.

NOTE: Environment variable `HF_HUB_DISABLE_PROGRESS_BARS` has the priority.

Example:
    ```py
    >>> from huggingface_hub.utils import are_progress_bars_disabled, disable_progress_bars, enable_progress_bars, tqdm

    # Disable progress bars globally
    >>> disable_progress_bars()

    # Use as normal `tqdm`
    >>> for _ in tqdm(range(5)):
    ...    pass

    # Still not showing progress bars, as `disable=False` is overwritten to `True`.
    >>> for _ in tqdm(range(5), disable=False):
    ...    pass

    >>> are_progress_bars_disabled()
    True

    # Re-enable progress bars globally
    >>> enable_progress_bars()

    # Progress bar will be shown !
    >>> for _ in tqdm(range(5)):
    ...   pass
    100%|â–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆ| 5/5 [00:00<00:00, 117817.53it/s]
    ```

Group-based control:
    ```python
    # Disable progress bars for a specific group
    >>> disable_progress_bars("peft.foo")

    # Check state of different groups
    >>> assert not are_progress_bars_disabled("peft"))
    >>> assert not are_progress_bars_disabled("peft.something")
    >>> assert are_progress_bars_disabled("peft.foo"))
    >>> assert are_progress_bars_disabled("peft.foo.bar"))

    # Enable progress bars for a subgroup
    >>> enable_progress_bars("peft.foo.bar")

    # Check if enabling a subgroup affects the parent group
    >>> assert are_progress_bars_disabled("peft.foo"))
    >>> assert not are_progress_bars_disabled("peft.foo.bar"))

    # No progress bar for `name="peft.foo"`
    >>> for _ in tqdm(range(5), name="peft.foo"):
    ...     pass

    # Progress bar will be shown for `name="peft.foo.bar"`
    >>> for _ in tqdm(range(5), name="peft.foo.bar"):
    ...     pass
    100%|â–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆ| 5/5 [00:00<00:00, 117817.53it/s]

    ```
N)ÚIterator)ÚcontextmanagerÚnullcontext)ÚPath)ÚContextManager)Útqdm)ÚHF_HUB_DISABLE_PROGRESS_BARSc                   ó^   a € ] tR t^lt o RtR
V 3R lR lltV 3R lR ltV 3R lR ltR	tV t	R# )Údisable_progress_barsaê  
Disable progress bars either globally or for a specified group.

This function updates the state of progress bars based on a group name.
If no group name is provided, all progress bars are disabled. The operation
respects the `HF_HUB_DISABLE_PROGRESS_BARS` environment variable's setting.

Works as both a regular call and a context manager:
    disable_progress_bars()           # disables until enable_progress_bars()
    with disable_progress_bars():     # disables for the block, re-enables on exit
        ...

Args:
    name (`str`, *optional*):
        The name of the group for which to disable the progress bars. If None,
        progress bars are disabled globally.

Raises:
    Warning: If the environment variable precludes changes.
Nc                ó2   <€ V ^8„  d   QhRS[ R,          RR/# ©é   ÚnameNÚreturn©Ústr)ÚformatÚ__classdict__s   "€Úk/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/huggingface_hub/utils/tqdm.pyÚ__annotate__Ú"disable_progress_bars.__annotate__‚   s   ø€ ÷ .ñ .™S 4�Zð .°4ñ .ó    c                óp  € Wn         \        R J d    \        P                  ! R4       R V n        R# \        V4      '       * V n        Vf    \        P                  4        R \        R&   R# \         Uu. uF   q"P                  V R24      '       g   K  VNK"  	  ppV F
  p\        V K  	  R \        V&   R# u upi )FzlCannot disable progress bars: environment variable `HF_HUB_DISABLE_PROGRESS_BARS=0` is set and has priority.NÚ_globalÚ.)	r   r   ÚwarningsÚwarnÚ_should_reenableÚare_progress_bars_disabledÚprogress_bar_statesÚclearÚ
startswith)Úselfr   ÚkeyÚkeys_to_removes   &&  r   Ú__init__Údisable_progress_bars.__init__‚   s¥   € ØŒ	ä'¨5Ó0Ü�MŠMØ~ôð %*ˆDÔ!Ùä$>¸tÓ$DÔ DˆÔØŠ<Ü×%Ñ%Ô'Ø-2Ô 	Ó*å-@Ó_Ñ-@ cÇNÁNÐVZÐU[Ð[\ÐS]×D^Ÿc˜cÑ-@ˆNÐ_Û%�Ü'¨Ò,ñ &à(-Ô Ó%ùò `s   Á0B3ÂB3c                ó   <€ V ^8„  d   QhRR/# )r   r   r
   © )r   r   s   "€r   r   r   –   s   ø€ ÷ ñ Ð2ñ r   c                ó   € V # ©Nr(   ©r"   s   &r   Ú	__enter__Údisable_progress_bars.__enter__–   ó   € Øˆr   c                ó   <€ V ^8„  d   QhRR/# )r   r   Nr(   )r   r   s   "€r   r   r   ™   s   ø€ ÷ ,ñ , ñ ,r   c                óX   € V P                   '       d   \        V P                  4       R # R # r*   )r   Úenable_progress_barsr   )r"   Úexcs   &*r   Ú__exit__Údisable_progress_bars.__exit__™   s   € Ø× × Ð Ü  §¡Ö+ñ !r   )r   r   r*   )
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r%   r,   r3   Ú__static_attributes__Ú__classdictcell__©r   s   @r   r
   r
   l   s(   ø‡ € ñ÷*.ò .÷(ð ÷,ö ,r   r
   c                ó6   € V ^8„  d   QhR\         R,          RR/# r   r   )r   s   "r   r   r   ž   s   € ÷ )ñ )œs T�zð )°Tñ )r   c                ó,  € \         RJ d   \        P                  ! R4       R# V f    \        P	                  4        R\        R&   R# \         Uu. uF   qP                  V  R24      '       g   K  VNK"  	  ppV F
  p\        V K  	  R\        V &   R# u upi )aç  
Enable progress bars either globally or for a specified group.

This function sets the progress bars to enabled for the specified group or globally
if no group is specified. The operation is subject to the `HF_HUB_DISABLE_PROGRESS_BARS`
environment setting.

Args:
    name (`str`, *optional*):
        The name of the group for which to enable the progress bars. If None,
        progress bars are enabled globally.

Raises:
    Warning: If the environment variable precludes changes.
TzkCannot enable progress bars: environment variable `HF_HUB_DISABLE_PROGRESS_BARS=1` is set and has priority.Nr   r   )r   r   r   r   r    r!   )r   r#   r$   s   &  r   r1   r1   ž   s‰   € ô  $ tÓ+Ü�ŠØyô	
ñ 	à‚|Ü×!Ñ!Ô#Ø)-Ô˜IÓ&å)<Ó[Ñ)< #ÇÁÐRVÐQWÐWXÈz×@ZŸ#˜#Ñ)<ˆÐ[Û!ˆCÜ# CÒ(ñ "à$(Ô˜DÓ!ùò \s   ÁBÁ.Bc                ó>   € V ^8„  d   QhR\         R,          R\        /# r   )r   Úbool)r   s   "r   r   r   ¾   s   € ÷ 8ñ 8¤S¨4¥Zð 8¼4ñ 8r   c                ó"  € \         RJ d   R# V f   \        P                  RR4      '       * # V '       dC   V \        9   d   \        V ,          '       * # RP                  V P	                  R4      RR 4      p KJ  \        P                  RR4      '       * # )a¾  
Check if progress bars are disabled globally or for a specific group.

This function returns whether progress bars are disabled for a given group or globally.
It checks the `HF_HUB_DISABLE_PROGRESS_BARS` environment variable first, then the programmatic
settings.

Args:
    name (`str`, *optional*):
        The group name to check; if None, checks the global setting.

Returns:
    `bool`: True if progress bars are disabled, False otherwise.
TNr   r   éÿÿÿÿ)r   r   ÚgetÚjoinÚsplit)r   s   &r   r   r   ¾   sw   € ô $ tÓ+Ùà‚|Ü&×*Ñ*¨9°dÓ;Ô;Ð;ç
ØÔ&Ô&Ü*¨4Õ0Ô0Ð0Ø�x‰x˜Ÿ
™
 3›¨¨Ð,Ó-Šä"×&Ñ& y°$Ó7Ô7Ð7r   c                ó>   € V ^8„  d   QhR\         R\        R,          /# )r   Ú	log_levelr   N)Úintr@   )r   s   "r   r   r   Û   s   € ÷ 
ñ 
¤ð 
¬¨t­ñ 
r   c                ón   € V \         P                  8X  d   R# \        P                  ! R4      R8X  d   R# R# )zá
Determine if tqdm progress bars should be disabled based on logging level and environment settings.

see https://github.com/huggingface/huggingface_hub/pull/2000 and https://github.com/huggingface/huggingface_hub/pull/2698.
TÚTQDM_POSITIONz-1FN)ÚloggingÚNOTSETÚosÚgetenv)rG   s   &r   Úis_tqdm_disabledrO   Û   s*   € ð ”G—N‘NÔ"ÙÜ	‡y‚y�Ó! TÔ)ÙÙr   c                   óN   a a€ ] tR t^èt oRtV 3R ltV3R lV 3R lltRtVtV ;t	# )r   zŸ
Class to override `disable` argument in case progress bars are globally disabled.

Taken from https://github.com/tqdm/tqdm/issues/619#issuecomment-619639324.
c                óx   <€ VP                  R R4      p\        V4      '       d   RVR&   \        SV `  ! V/ VB  R# )r   NTÚdisable)Úpopr   Úsuperr%   )r"   ÚargsÚkwargsr   Ú	__class__s   &*, €r   r%   Útqdm.__init__ï   s:   ø€ Ø�z‰z˜& $Ó'ˆÜ% d×+Ò+Ø $ˆF�9ÑÜ‰Ò˜$Ð) &Ô)r   c                ó$   <€ V ^8„  d   QhRS[ RR/# )r   Úattrr   Nr   )r   r   s   "€r   r   Útqdm.__annotate__õ   s   ø€ ÷ ñ ¡ð ¨ñ r   c                ó\   <€  \         SV `  V4       R#   \         d    TR8w  d   h  R# i ; i)zBFix for https://github.com/huggingface/huggingface_hub/issues/1603Ú_lockN)rT   Ú__delattr__ÚAttributeError)r"   rZ   rW   s   &&€r   r^   Útqdm.__delattr__õ   s3   ø€ ð	Ü‰GÑ Ö%øÜô 	Ø�wŒØò ð	ús   ƒ ”+ª+r(   )
r5   r6   r7   r8   r9   r%   r^   r:   r;   Ú__classcell__)rW   r   s   @@r   r   r   è   s   ù‡ € ñõ*÷÷ ó r   r   c                   óL   a € ] tR tRt o RtR tR tR tR
V 3R lR lltRt	V t
R	# )Úsilent_tqdmi  z#Fake tqdm object that does nothing.c                ó   € R # r*   r(   )r"   rU   rV   s   &*,r   r%   Úsilent_tqdm.__init__  ó   € Ùr   c                ó   € V # r*   r(   r+   s   &r   r,   Úsilent_tqdm.__enter__  r.   r   c                ó   € R # r*   r(   )r"   Úexc_typeÚ	exc_valueÚ	tracebacks   &&&&r   r3   Úsilent_tqdm.__exit__  rf   r   c                óB   <€ V ^8„  d   QhRS[ S[,          R,          RR/# )r   ÚnNr   )rH   Úfloat)r   r   s   "€r   r   Úsilent_tqdm.__annotate__  s$   ø€ ÷ ñ ™™e� dÕ*ð °4ñ r   c                ó   € R # r*   r(   )r"   ro   s   &&r   ÚupdateÚsilent_tqdm.update  rf   r   r(   N)é   )r5   r6   r7   r8   r9   r%   r,   r3   rs   r:   r;   r<   s   @r   rc   rc     s&   ø‡ € Ù-òòò÷÷ ð r   rc   c                óp   € V ^8„  d   QhR\         \        ,          R\        \        P                  ,          /# )r   Úpathr   )r   r   r   ÚioÚBufferedReader)r   s   "r   r   r     s)   € ÷ *ñ *œ4¤#�:ð *¬(´2×3DÑ3DÕ*Eñ *r   c           
   #  óŒ  aa"  € \        V \        4      '       d   \        V 4      p V P                  R4      ;_uu_ 4       pV P	                  4       P
                  p\        RRV^ V P                  R7      oVP                  oRR VV3R lllpW1n        Vx € SP                  4        RRR4       R#   + '       g   i     R# ; i5i)	u  
Open a file as binary and wrap the `read` method to display a progress bar when it's streamed.

First implemented in `transformers` in 2019 but removed when switched to git-lfs. Used in `huggingface_hub` to show
progress bar when uploading an LFS file to the Hub. See github.com/huggingface/transformers/pull/2078#discussion_r354739608
for implementation details.

Note: currently implementation handles only files stored on disk as it is the most common use case. Could be
      extended to stream any `BinaryIO` object but we might have to debug some corner cases.

Example:
```py
>>> with tqdm_stream_file("config.json") as f:
>>>     httpx.put(url, data=f)
config.json: 100%|â–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆ| 8.19k/8.19k [00:02<00:00, 3.72kB/s]
```
ÚrbÚBT)ÚunitÚ
unit_scaleÚtotalÚinitialÚdescc                ó>   € V ^8„  d   QhR\         R,          R\        /# )r   ÚsizeNr   )rH   Úbytes)r   s   "r   r   Ú&tqdm_stream_file.<locals>.__annotate__7  s   € ÷ 	ñ 	œc D�jð 	´%ñ 	r   c                 óL   <€ S! V 4      pSP                  \        V4      4       V# r*   )rs   Úlen)rƒ   ÚdataÚf_readÚpbars   & €€r   Ú_inner_readÚ%tqdm_stream_file.<locals>._inner_read7  s!   ø€ Ù˜$“<ˆDØ�K‰Kœ˜D›	Ô"ØˆKr   N)rB   )
Ú
isinstancer   r   ÚopenÚstatÚst_sizer   r   ÚreadÚclose)rw   ÚfÚ
total_sizer‹   r‰   rŠ   s   &   @@r   Útqdm_stream_filer•     s�   ùé € ô& �$œ×ÒÜ�D‹zˆà	�‰�4�Œ˜AØ—Y‘Y“[×(Ñ(ˆ
ÜØØØØØ—‘ô
ˆð —‘ˆ÷	ó 	ð
 ŒàŠà�
‰
Œ÷+ 
��Šüs   „;C¿A'B0Â&
CÂ0C	Â;	Cr   c                ól   € V ^8„  d   QhR\         \        ,          R\        R\        R,          R\        /# )r   ÚclsrG   r   Nr   )ÚtypeÚold_tqdmrH   r   )r   s   "r   r   r   C  s1   € ÷ 5ñ 5¤¤h¥ð 5¼Cð 5ÄsÈTÅzð 5Ôgoñ 5r   c                ó˜   € \        V \        4      '       d   \        V \        4      '       g	   V ! R/ VB # \	        V4      pV ! RRVRV/VB # )a§  Create a progress bar.

For our `tqdm` subclass (or subclasses of it): respects all disable signals
(`HF_HUB_DISABLE_PROGRESS_BARS`, `disable_progress_bars()`, log level) and uses
`disable=None` for TTY auto-detection (see https://github.com/huggingface/huggingface_hub/pull/2000),
unless `TQDM_POSITION=-1` forces bars on (https://github.com/huggingface/huggingface_hub/pull/2698).

For other classes: does not inject `disable` or `name`. the custom class is fully
responsible for its own behavior. Vanilla tqdm defaults to `disable=False` (bar shows).
Omits `name` which vanilla tqdm rejects with `TqdmKeyError`. See https://github.com/huggingface/huggingface_hub/issues/4050.
rR   r   r(   )r�   r˜   Ú
issubclassr   rO   )r—   rG   r   rV   rR   s   $$$, r   Ú_create_progress_barrœ   C  sM   € ô �sœD×!Ò!¤j°´d×&;Ò&;Ù‰}�V‰}Ðô ˜yÓ)€GÙÑ4�wÐ4 TÐ4¨VÑ4Ð4r   r   r€   r}   r|   r~   TÚ
tqdm_classÚ	_tqdm_barc                óô   € V ^8„  d   QhR\         R\        R\        R,          R\        R\         R\        R\         R,          R	\        \        ,          R,          R
\
        R,          R\        \
        ,          /
# )r   r�   rG   r   Nr€   r}   r~   r   r�   rž   r   )r   rH   r@   r˜   r™   r   r   )r   s   "r   r   r   Y  sˆ   € ÷ ñ ä
ðô ðô ��:ð	ô
 ðô ðô ðô ��*ðô ”X• Õ%ðô �d�{ðô ”DÕñr   c        	         ób   € Ve   \        V4      # \        T;'       g    \        VVVVVVV R7      # )N)r—   rG   r   r}   r~   r   r€   r�   )r   rœ   r   )	r�   rG   r   r€   r}   r~   r   r�   rž   s	   $$$$$$$$$r   Ú_get_progress_bar_contextr¡   Y  sD   € ð ÒÜ˜9Ó%Ð%ô
  Ø×Ðœ$ØØØØØØØô	ð 	r   c                ób   € V ^8„  d   Qh/ ^ \         9   d   \        \        \        3,          ;R&   # )r   r   )Ú__conditional_annotations__Údictr   r@   )r   s   "r   r   r      s+   € ÷ Bñ B÷v *Ò )”Tœ#œt˜)•_Ñ )òwBr   r*   )!r£   r9   rx   rK   rM   Ú	threadingr   Úcollections.abcr   Ú
contextlibr   r   Úpathlibr   Útypingr   Ú	tqdm.autor   r™   Ú	constantsr   r   r
   r1   r   rO   Úset_lockÚRLockrc   r•   rœ   r¡   r   )r£   s   @r   Ú<module>r®      só   øðöBóH 
Û Û 	Û Û Ý $ß 2Ý Ý !å &å 4ð (*Ð Ó )÷/,ñ /,÷d)÷@8õ:
ôˆ8ô ð4 ‡�ˆi�oŠoÓÔ  ÷ñ ð  ô*ó ð*ðZ5ÐTX÷ 5ð,ð ð	ð
 ðð ðð ðð ðð )-ðð "÷ñ r   