
    {Kg                     :    d dl Z d dlZdgZ G d d      Zd Zd Zy)    N
deprecatedc                   0    e Zd ZdZddZd Zd Zd Zd Zy)	r   a  Decorator to mark a function or class as deprecated.

    Issue a warning when the function is called/the class is instantiated and
    adds a warning to the docstring.

    The optional extra argument will be appended to the deprecation message
    and the docstring. Note: to use this with the default value for extra, put
    in an empty of parentheses:

    Examples
    --------
    >>> from sklearn.utils import deprecated
    >>> deprecated()
    <sklearn.utils.deprecation.deprecated object at ...>
    >>> @deprecated()
    ... def some_function(): pass

    Parameters
    ----------
    extra : str, default=''
          To be added to the deprecation messages.
    c                     || _         y )N)extra)selfr   s     ]/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/sklearn/utils/deprecation.py__init__zdeprecated.__init__"   s	    
    c                     t        |t              r| j                  |      S t        |t              r| j	                  |      S | j                  |      S )zPCall method

        Parameters
        ----------
        obj : object
        )
isinstancetype_decorate_classproperty_decorate_property_decorate_fun)r   objs     r   __call__zdeprecated.__call__%   sM     c4 '',,X& **3//%%c**r
   c                     d|j                   z  | j                  rd| j                  z  z  |j                  fd}||_        d|_         |_        |S )NzClass %s is deprecated; %sc                     t        j                  t               t        j                  u rt        j	                  |       S  | g|i |S N)category)warningswarnFutureWarningobject__new__)clsargskwargsmsgnews      r   wrappedz+deprecated._decorate_class.<locals>.wrappedA   sA    MM#6fnn$~~c**s,T,V,,r
   r   )__name__r   r   deprecated_original)r   r   r#   r!   r"   s      @@r   r   zdeprecated._decorate_class:   sW    &5::6DJJ&&Ckk	- $&)#
r
   c                     dj                   z  | j                  rd| j                  z  z  t        j                        fd       }|_        |S )zDecorate function funzFunction %s is deprecatedr   c                  J    t        j                  t                | i |S r   )r   r   r   )r   r    funr!   s     r   r#   z)deprecated._decorate_fun.<locals>.wrappedU   s!    MM#6'''r
   )r$   r   	functoolswraps__wrapped__)r   r(   r#   r!   s    ` @r   r   zdeprecated._decorate_funN   sW     *CLL8::6DJJ&&C			( 
	( "r
   c                     | j                   t        t        j                  j                        fd              }|S )Nc                  ^    t        j                  t                j                  | i |S r   )r   r   r   fget)r   r    r!   props     r   r#   z.deprecated._decorate_property.<locals>.wrappedc   s)     MM#6499d-f--r
   )r   r   r)   r*   r.   )r   r/   r#   r!   s    ` @r   r   zdeprecated._decorate_property`   s:    jj			#	. 
$ 
	. r
   N) )	r$   
__module____qualname____doc__r	   r   r   r   r    r
   r   r   r      s     4+*($	r
   c           
          t        | dg       }|g }ddj                  |D cg c])  }t        |j                  t              s|j                  + c}      v }|S c c}w )z>Helper to check if func is wrapped by our deprecated decorator__closure__r   r0   )getattrjoinr   cell_contentsstr)funcclosurescis_deprecateds       r   _is_deprecatedr?   l   sa    t]B/H BGG"*O(Qj#.N(O% M  	Ps   A
A
c                 ~    | |t        d      | |t        d      |t        j                  dt               |S | S )zKHelper to deprecate the `Xt` argument in favor of `X` in inverse_transform.z%Cannot use both X and Xt. Use X only.z(Missing required positional argument: X.z;Xt was renamed X in version 1.5 and will be removed in 1.7.)	TypeErrorr   r   r   )XXts     r   "_deprecate_Xt_in_inverse_transformrD   x   sO    }?@@yRZBCC	~I	
 	Hr
   )r)   r   __all__r   r?   rD   r4   r
   r   <module>rF      s)     .b bJr
   