
    Ug                     B    d dl Z d dlZdgZ G d d          Zd Zd ZdS )    N
deprecatedc                   2    e Zd ZdZd	dZd Zd Zd Zd ZdS )
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                     || _         d S )N)extra)selfr   s     X/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/sklearn/utils/deprecation.py__init__zdeprecated.__init__"   s    


    c                     t          |t                    r|                     |          S t          |t                    r|                     |          S |                     |          S )zPCall method

        Parameters
        ----------
        obj : object
        )
isinstancetype_decorate_classproperty_decorate_property_decorate_fun)r   objs     r	   __call__zdeprecated.__call__%   sf     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                              |           S  | g|R i |S N)category)warningswarnFutureWarningobject__new__)clsargskwargsmsgnews      r	   wrappedz+deprecated._decorate_class.<locals>.wrappedA   sW    M#6666fn$$~~c***3s,T,,,V,,,r   r   )__name__r   r   deprecated_original)r   r   r$   r"   r#   s      @@r	   r   zdeprecated._decorate_class:   sn    &5: 	'6DJ&&Ck	- 	- 	- 	- 	- 	- $&)#
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-    M#66663''''r   )r%   r   	functoolswraps__wrapped__)r   r)   r$   r"   s    ` @r	   r   zdeprecated._decorate_funN   so     *CL8: 	'6DJ&&C				( 	( 	( 	( 	( 
		( "r   c                 |    | j         t          t          j        j                  fd                        }|S )Nc                  T    t          j        t                      j        | i |S r   )r   r   r   fget)r    r!   r"   props     r	   r$   z.deprecated._decorate_property.<locals>.wrappedc   s1     M#666649d-f---r   )r   r   r*   r+   r/   )r   r0   r$   r"   s    ` @r	   r   zdeprecated._decorate_property`   sQ    j			#	#	. 	. 	. 	. 	. 
$	# 
	. r   N)r   )	r%   
__module____qualname____doc__r
   r   r   r   r    r   r	   r   r      sn         4   + + +*  (  $	 	 	 	 	r   c                 r    t          | dg           }|g }dd                    d |D                       v }|S )z>Helper to check if func is wrapped by our deprecated decorator__closure__Nr   r   c                 P    g | ]#}t          |j        t                    |j        $S r4   )r   cell_contentsstr).0cs     r	   
<listcomp>z"_is_deprecated.<locals>.<listcomp>r   s+    OOOQj#.N.NOOOOr   )getattrjoin)funcclosuresis_deprecateds      r	   _is_deprecatedrB   l   sQ    t]B//H BGGOO(OOO% % M r   c                     | |t          d          | |t          d          |t          j        dt                     |S | S )zKHelper to deprecate the `Xt` argument in favor of `X` in inverse_transform.Nz%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_transformrG   x   s]    }?@@@yRZBCCC	~I	
 	
 	
 	Hr   )r*   r   __all__r   rB   rG   r4   r   r	   <module>rI      sz        .b b b b b b b bJ      r   