ó
    qyüi_  ã                   ó¾   • S SK r S SKrS SKJr  S SKrSSKJr  SSKJrJ	r	J
r
  \	" 5       (       a  S SKr " S S\5      r     SS	\S
\S\S-  S\S\S\S\S-  4S jjrg)é    N)Úwrapsé   )Ú__version__é   )ÚExplicitEnumÚis_torch_availableÚis_torchdynamo_compilingc                   ó$   • \ rS rSrSrSrSrSrSrg)ÚActioné   ÚnoneÚnotifyÚnotify_alwaysÚraise© N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__ÚNONEÚNOTIFYÚNOTIFY_ALWAYSÚRAISEÚ__static_attributes__r   ó    Ú[/home/mande/repo/quber/.venv/lib/python3.13/site-packages/transformers/utils/deprecation.pyr   r      s   † Ø€DØ€FØ#€MØƒEr   r   Úold_nameÚversionÚnew_nameÚ warn_if_greater_or_equal_versionÚ!raise_if_greater_or_equal_versionÚraise_if_both_namesÚadditional_messagec                 óà   ^ ^^^^^^
^• [         R                  R                  U5      n[         R                  R                  [        5      nX‡:¬  m
T
(       a  SU 3mOSU 3mUU
UU UUUU4S jn	U	$ )a«
  
Function or method decorator to notify users about deprecated keyword arguments, replacing them with a new name if specified.
Note that is decorator is `torch.compile`-safe, i.e. it will not cause graph breaks (but no warning will be displayed if compiling).

This decorator allows you to:
- Notify users when a keyword argument is deprecated.
- Automatically replace deprecated keyword arguments with new ones.
- Raise an error if deprecated arguments are used, depending on the specified conditions.

By default, the decorator notifies the user about the deprecated argument while the `transformers.__version__` < specified `version`
in the decorator. To keep notifications with any version `warn_if_greater_or_equal_version=True` can be set.

Parameters:
    old_name (`str`):
        Name of the deprecated keyword argument.
    version (`str`):
        The version in which the keyword argument was (or will be) deprecated.
    new_name (`Optional[str]`, *optional*):
        The new name for the deprecated keyword argument. If specified, the deprecated keyword argument will be replaced with this new name.
    warn_if_greater_or_equal_version (`bool`, *optional*, defaults to `False`):
        Whether to show warning if current `transformers` version is greater or equal to the deprecated version.
    raise_if_greater_or_equal_version (`bool`, *optional*, defaults to `False`):
        Whether to raise `ValueError` if current `transformers` version is greater or equal to the deprecated version.
    raise_if_both_names (`bool`, *optional*, defaults to `False`):
        Whether to raise `ValueError` if both deprecated and new keyword arguments are set.
    additional_message (`Optional[str]`, *optional*):
        An additional message to append to the default deprecation message.

Raises:
    ValueError:
        If raise_if_greater_or_equal_version is True and the current version is greater than or equal to the deprecated version, or if raise_if_both_names is True and both old and new keyword arguments are provided.

Returns:
    Callable:
        A wrapped function that handles the deprecated keyword arguments according to the specified parameters.

Example usage with renaming argument:

    ```python
    @deprecate_kwarg("reduce_labels", new_name="do_reduce_labels", version="6.0.0")
    def my_function(do_reduce_labels):
        print(do_reduce_labels)

    my_function(reduce_labels=True)  # Will show a deprecation warning and use do_reduce_labels=True
    ```

Example usage without renaming argument:

    ```python
    @deprecate_kwarg("max_size", version="6.0.0")
    def my_function(max_size):
        print(max_size)

    my_function(max_size=1333)  # Will show a deprecation warning
    ```

z"and removed starting from version zand will be removed in version c                 óÐ   >^ ^^• [         R                  " T 5      n[        UR                  R	                  5       5      nSU;   mSU;   m[        T 5      UU UUUUU	U
UUU4S j5       nU$ )NÚselfÚclsc                  ó  >• TR                   nT	(       a  U S   R                  R                    SU 3nOT(       a  U S   R                    SU 3n[        R                  nS nTU;   a]  T
U;   aW  T(       a  [        R                  O[        R
                  nST ST
 SU ST
 SUT
    ST SUT    S	3nUR                  T5        OeTU;   a=  T
b:  T
U;  a4  [        R                  nS
T ST SU ST
 S3	nUR                  T5      UT
'   O"TU;   a  [        R                  nS
T ST SU S	3nUb
  Tb  U ST 3nT(       aW  T(       a%  U[        R                  :w  a  [        R                  nO+T(       d$  U[        R                  :X  a  [        R                  nU[        R                  :X  a  [        U5      eU[        R                  [        R
                  4;   a)  [        5       (       d  [        R                  " U[        SS9  T" U 0 UD6$ )Nr   Ú.zBoth `z` and `z` are set for `z
`. Using `Ú=z` and ignoring deprecated `z`.Ú`z` is deprecated z for `z`. Use `z
` instead.Ú r   )Ú
stacklevel)r   Ú	__class__r   r   r   r   Úpopr   Ú
ValueErrorr	   ÚwarningsÚwarnÚFutureWarning)ÚargsÚkwargsÚ	func_nameÚminimum_actionÚmessager#   ÚfuncÚis_class_methodÚis_greater_or_equal_versionÚis_instance_methodr   r   r"   r!   Úversion_messager    s        €€€€€€€€€€€r   Úwrapped_funcÚ6deprecate_kwarg.<locals>.wrapper.<locals>.wrapped_funcw   s:  ø€ ð Ÿ™ˆIÞ!Ø# A™w×0Ñ0×9Ñ9Ð:¸!¸I¸;ÐG‘	Þ Ø# A™w×/Ñ/Ð0°°)°Ð=�	ä#Ÿ[™[ˆNØˆGð ˜6Ó! h°&Ó&8Þ1D¤§¢Ì&×J^ÑJ^�Ø" 8 *¨G°H°:¸_ÈYÈKÐWaÐbjÐakÐklÐmsÐt|Ñm}Ðl~ð  Zð  [cð  Zdð  deð  flð  muñ  fvð  ewð  wyð  z�Ø—
‘
˜8Õ$ð ˜VÓ#¨Ñ(<ÀÐQWÓAWÜ!'§¡�Ø˜h˜ZÐ'7¸Ð7HÈÈyÈkÐYaÐbjÐakÐkuÐv�Ø#)§:¡:¨hÓ#7��xÒ ð ˜VÓ#Ü!'§¡�Ø˜h˜ZÐ'7¸Ð7HÈÈyÈkÐY[Ð\�àÑ"Ð'9Ñ'EØ$˜I QÐ'9Ð&:Ð;�ö +ö 5¸Ì6Ï;É;Ó9VÜ%+§\¡\‘Nö :¸nÔPV×P]ÑP]Ó>]Ü%+§[¡[�Nð ¤§¡Ó-Ü  Ó)Ð)à¤F§M¡M´6×3GÑ3GÐ#HÓHÔQi×QkÑQkä—’˜g¤}ÀÒCá˜Ð( Ñ(Ð(r   )ÚinspectÚ	signatureÚsetÚ
parametersÚkeysr   )r9   ÚsigÚfunction_named_argsr>   r:   r<   r#   r;   r   r   r"   r!   r=   r    s   `   @@€€€€€€€€r   ÚwrapperÚ deprecate_kwarg.<locals>.wrapperp   sf   û€ ä×Ò Ó%ˆÜ! #§.¡.×"5Ñ"5Ó"7Ó8ÐØ#Ð':Ñ:ÐØÐ#6Ñ6ˆä	ˆt‹÷3	)ö 3	)ó 
ð3	)ðj Ðr   )Ú	packagingr   Úparser   )r   r   r   r    r!   r"   r#   Údeprecated_versionÚcurrent_versionrG   r;   r=   s   ` `````   @@r   Údeprecate_kwargrM   $   si   ÿ€ ôF #×*Ñ*×0Ñ0°Ó9ÐÜ×'Ñ'×-Ñ-¬kÓ:€OØ"1Ñ"GÐæ"Ø>¸w¸iÐH‰à;¸G¸9ÐEˆ÷=ô =ð~ €Nr   )NFFFN)r@   r1   Ú	functoolsr   Úpackaging.versionrI   Ú r   r   r   r	   Útorchr   ÚstrÚboolrM   r   r   r   Ú<module>rT      sž   ðó Û Ý ã å ß HÑ Hñ ×ÑÛôˆ\ô ð  Ø-2Ø.3Ø %Ø%)ñKØðKàðKð �D‰jðKð '+ð	Kð
 (,ðKð ðKð ˜d™
öKr   