
    ,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 erd dlmZ  e	d	      Z ed
      Z e	d      ZdZddZddZddZ	 d	 	 	 	 	 ddZ	 d	 	 	 	 	 ddZy)    )annotations)CallableN)Any)TYPE_CHECKING)TypeVar)ExperimentalWarning)	ParamSpecFTFPCTz

.. note::
    Added in v{ver} as an experimental feature. The interface may change in newer versions
    without prior notice. See https://github.com/optuna/optuna/releases/tag/v{ver}.
c                @    t        j                  d|  dt               y )NzArgument ``zF`` is an experimental feature. The interface can change in the future.)warningswarnr   )option_names    M/var/www/html/planif/env/lib/python3.12/site-packages/optuna/_experimental.pywarn_experimental_argumentr      s"    MM
k] #3 	3    c                    t        | t              rt        | j                  d            dk7  rt	        dj                  |             y )N.   zKInvalid version specification. Must follow `x.y.z` format but `{}` is given)
isinstancestrlensplit
ValueErrorformat)versions    r   _validate_versionr   &   sE    gs#s7==+='>!'CY``
 	
 (Dr   c                6    d| v r| j                  d      d   S dS )N
 )r   )	docstrings    r   _get_docstring_indentr$   /   s"    (,	(99??4 $ArAr   c                .     t                d fd}|S )zDecorate function as experimental.

    Args:
        version: The first version that supports the target feature.
        name: The name of the feature. Defaults to the function name. Optional.
    c                8     j                   d _         t        j                        }t         j                         } j                   j	                         t        j                  ||      z   |z    _         t        j                         d fd       }|S )Nr"   verc                     t        j                  dj                  nj                        t        d        | i |S NzP{} is experimental (supported from v{}). The interface can change in the future.   )
stacklevel)r   r   r   __name__r   )argskwargsfuncnamer   s     r   wrapperz5experimental_func.<locals>.decorator.<locals>.wrapperH   sH    MM::@& ,D$--; $ (((r   )r.   r   r/   r   returnr
   )	__doc___EXPERIMENTAL_NOTE_TEMPLATEr   r$   striptextwrapindent	functoolswraps)r0   noter8   r2   r1   r   s   `   r   	decoratorz$experimental_func.<locals>.decorator@   s    <<DL*11g1>&t||4||))+hoodF.KKfT		
	) 

	) r   )r0   Callable[FP, FT]r3   r=   r   r   r1   r<   s   `` r   experimental_funcr@   3   s     g. r   c                .     t                d fd}|S )zDecorate class as experimental.

    Args:
        version: The first version that supports the target feature.
        name: The name of the feature. Defaults to the class name. Optional.
    c                "    dfd} ||       S )Nc                   t        | d      t        | d      t        j                        dfd       }t        | d|       | j                  d| _        t
        j                        }t        | j                        }| j                  j                         t        j                  ||      z   |z   | _        | S )zDecorates a class as experimental.

            This decorator is supposed to be applied to the experimental class.
            __init__r-   c                ~    t        j                  dj                  n      t        d        | g|i | y r*   )r   r   r   r   )selfr.   r/   _original_init_original_namer1   r   s      r   wrapped_initzLexperimental_class.<locals>.decorator.<locals>.wrapper.<locals>.wrapped_initp   sF    >>Df $ 0ng? (  t5d5f5r   r"   r'   )rF   r   r.   r   r/   r   r3   None)getattrr9   r:   setattrr4   r5   r   r$   r6   r7   r8   )clsrI   r;   r8   rG   rH   r1   r   s       @@r   r2   z6experimental_class.<locals>.decorator.<locals>.wrapperh   s    
 %S*5N$S*5N__^,
6 -
6 C\2{{" .55'5BD*3;;7F++++-f0MMPVVCKJr   rM   r   r3   r    )rM   r2   r1   r   s     r   r<   z%experimental_class.<locals>.decoratorg   s    	@ s|r   rN   r>   r?   s   `` r   experimental_classrP   Z   s     g!F r   )r   r   r3   rJ   )r   r   r3   rJ   )r#   r   r3   r   )N)r   r   r1   
str | Noner3   z.Callable[[Callable[FP, FT]], Callable[FP, FT]])r   r   r1   rQ   r3   zCallable[[CT], CT])
__future__r   collections.abcr   r9   r7   typingr   r   r   r   optuna.exceptionsr   typing_extensionsr	   r
   r   r   r5   r   r   r$   r@   rP   rO   r   r   <module>rW      s    " $        1 +	B	4B	B 
B $$
$ 4$R 00
0 0r   