
    fTh                         S SK r S SKrS SKJ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\\   4S jjrg)    N)wraps)Optional   )__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       V/var/www/auris/envauris/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_func6deprecate_kwarg.<locals>.wrapper.<locals>.wrapped_funcx   s:    I!#Aw0099:!I;G	 #Aw//0)=	#[[NG 6!h&&81D&J^J^"8*GH:_YKWabjakklmst|m}l~  Z  [c  Zd  de  fl  mu  fv  ew  wy  z

8$ V#(<QWAW!'hZ'77HykYabjakkuv#)::h#7x  V#!'hZ'77HykY[\"'9'E$IQ'9&:; + 56;;9V%+\\N :nPVP]P]>]%+[[N - ))FMM63G3G#HHQiQkQkg}C(((r   )inspect	signatureset
parameterskeysr   )r:   sigfunction_named_argsr?   r;   r=   r$   r<   r    r   r#   r"   r>   r!   s   `   @@r   wrapper deprecate_kwarg.<locals>.wrapperq   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_versionrH   r<   r>   s   ` `````   @@r   deprecate_kwargrN   %   si    F #**009''--k:O"1"G">wiH;G9E= =~ Nr   )NFFFN)rA   r2   	functoolsr   typingr   packaging.versionrJ    r   r   r	   r
   torchr   strboolrN   r   r   r   <module>rV      s          H H \  #-2.3 %(,KKK smK '+	K
 (,K K !Kr   