
    ,YHh*                       d dl mZ d dlmZ d dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dl
Z
d dlmZ d dlmZ d d	lmZ erd d
lmZ  e	d      Z ed      Z e	d      ZdZdZddZddZ	 	 d	 	 	 	 	 	 	 	 	 ddZ	 	 d	 	 	 	 	 	 	 	 	 ddZy)    )annotations)CallableN)Any)TYPE_CHECKING)TypeVar)version)_get_docstring_indent)_validate_version)	ParamSpecFTFPCTa  

.. warning::
    Deprecated in v{d_ver}. This feature will be removed in the future. The removal of this
    feature is currently scheduled for v{r_ver}, but this schedule is subject to change.
    See https://github.com/optuna/optuna/releases/tag/v{d_ver}.
z{name} has been deprecated in v{d_ver}. This feature will be removed in v{r_ver}. See https://github.com/optuna/optuna/releases/tag/v{d_ver}.c                    t        j                  |       t        j                  |      kD  rt        dj                  | |            y )NzInvalid version relationship. The deprecated version must be smaller than the removed version, but (deprecated version, removed version) = ({}, {}) are specified.)r   parse
ValueErrorformat)old_versionnew_versions     K/var/www/html/planif/env/lib/python3.12/site-packages/optuna/_deprecated.py_validate_two_versionr   )   s?    }}[!GMM+$>>[9
 	
 ?    c                V    dt        j                  | j                         d      z   dz   S )Nz

z    
)textwrapindentstrip)texts    r   _format_textr   2   s#    HOODJJL&99D@@r   c                d     t                t               t                d fd}|S )a5  Decorate function as deprecated.

    Args:
        deprecated_version:
            The version in which the target feature is deprecated.
        removed_version:
            The version in which the target feature will be removed.
        name:
            The name of the feature. Defaults to the function name. Optional.
        text:
            The additional text for the deprecation note. The default note is build using specified
            ``deprecated_version`` and ``removed_version``. If you want to provide additional
            information, please specify this argument yourself.

            .. note::
                The default deprecation note is as follows: "Deprecated in v{d_ver}. This feature
                will be removed in the future. The removal of this feature is currently scheduled
                for v{r_ver}, but this schedule is subject to change. See
                https://github.com/optuna/optuna/releases/tag/v{d_ver}."

            .. note::
                The specified text is concatenated after the default deprecation note.
    c                ^     j                   d _         t        j                        }|t              z  }t	         j                         } j                   j                         t        j                  ||      z   |z    _         t        j                         d fd       }|S )N d_verr_verc                     t         j                  nj                        }|dz   z  }t        j                  |t
        d        | i |S )zDecorates a function as deprecated.

            This decorator is supposed to be applied to the deprecated function.
            namer#   r$       
stacklevel)_DEPRECATION_WARNING_TEMPLATEr   __name__warningswarnFutureWarning)argskwargsmessagedeprecated_versionfuncr'   removed_versionr   s      r   wrapperz3deprecated_func.<locals>.decorator.<locals>.wrapperb   sd     4::".dDMM(% ; G
 3:%MM'=Q?(((r   )r1   r   r2   r   returnz'FT')
__doc___DEPRECATION_NOTE_TEMPLATEr   r   r	   r   r   r   	functoolswraps)r5   noter   r7   r4   r'   r6   r   s   `   r   	decoratorz"deprecated_func.<locals>.decoratorX   s    <<DL)007IQ`0aL&&D&t||4||))+hoodF.KKfT			) 	) 
	)" r   )r5   'Callable[FP, FT]'r8   r?   r
   r   r4   r6   r'   r   r>   s   ```` r   deprecated_funcrB   6   s3    < ()o&,o> < r   c                d     t                t               t                d fd}|S )a/  Decorate class as deprecated.

    Args:
        deprecated_version:
            The version in which the target feature is deprecated.
        removed_version:
            The version in which the target feature will be removed.
        name:
            The name of the feature. Defaults to the class name. Optional.
        text:
            The additional text for the deprecation note. The default note is build using specified
            ``deprecated_version`` and ``removed_version``. If you want to provide additional
            information, please specify this argument yourself.

            .. note::
                The default deprecation note is as follows: "Deprecated in v{d_ver}. This feature
                will be removed in the future. The removal of this feature is currently scheduled
                for v{r_ver}, but this schedule is subject to change. See
                https://github.com/optuna/optuna/releases/tag/v{d_ver}."

            .. note::
                The specified text is concatenated after the default deprecation note.
    c                &    dfd} ||       S )Nc                   t        | d      t        | d      t        j                        d	fd       }t        | d|       | j                  d| _        t
        j                        }	|t        	      z  }t        | j                        }| j                  j                         t        j                  ||      z   |z   | _        | S )z|Decorates a class as deprecated.

            This decorator is supposed to be applied to the deprecated class.
            __init__r-   c                    t         j                  n      }	|d	z   z  }t        j                  |t        d        | g|i | y )Nr&   r(   r)   r*   )r,   r   r.   r/   r0   )
selfr1   r2   r3   _original_init_original_namer4   r'   r6   r   s
       r   wrapped_initzJdeprecated_class.<locals>.decorator.<locals>.wrapper.<locals>.wrapped_init   sg    7>>"&"2$,) ? 
 #sTz)G!  t5d5f5r   r!   r"   )rH   r   r1   r   r2   r   r8   None)getattrr;   r<   setattrr9   r:   r   r   r	   r   r   r   )
clsrK   r=   r   rI   rJ   r4   r'   r6   r   s
       @@r   r7   z4deprecated_class.<locals>.decorator.<locals>.wrapper   s    
 %S*5N$S*5N__^,6 6 -6  C\2{{" -44( 5 D T***3;;7F++++-f0MMPVVCKJr   rO   'CT'r8   rQ    )rO   r7   r4   r'   r6   r   s     r   r>   z#deprecated_class.<locals>.decorator   s    &	 &	P s|r   rP   r@   rA   s   ```` r   deprecated_classrS   y   s4    < ()o&,o>) )V r   )r   strr   rT   r8   rL   )r   rT   r8   rT   )NN)
r4   rT   r6   rT   r'   
str | Noner   rU   r8   z0'Callable[[Callable[FP, FT]], Callable[FP, FT]]')
r4   rT   r6   rT   r'   rU   r   rU   r8   z'Callable[[CT], CT]')
__future__r   collections.abcr   r;   r   typingr   r   r   r.   	packagingr   optuna._experimentalr	   r
   typing_extensionsr   r   r   r   r:   r,   r   r   rB   rS   rR   r   r   <module>r\      s    " $         6 2 +	B	4B	B B 
A 	@@@ @ 	@
 6@L 	MMM M 	M
 Mr   