
    -i                     :    S SK JrJr  S SKJr   " S S5      rS rg)    )update_wrapperwraps)
MethodTypec                   .    \ rS rSrSrS rS rSS jrSrg)	_AvailableIfDescriptor   a^  Implements a conditional property using the descriptor protocol.

Using this class to create a decorator will raise an ``AttributeError``
if check(self) returns a falsey value. Note that if check raises an error
this will also result in hasattr returning false.

See https://docs.python.org/3/howto/descriptor.html for an explanation of
descriptors.
c                 >    Xl         X l        X0l        [        X5        g N)fncheckattribute_namer   )selfr   r   r   s       N/var/www/html/venv/lib/python3.13/site-packages/sklearn/utils/_available_if.py__init___AvailableIfDescriptor.__init__   s    
, 	t     c                     SUR                   < SU R                  < 3n U R                  U5      nU(       d  [	        U5      eg ! [         a  n[	        U5      UeS nAff = f)NzThis z has no attribute )__name__r   r   	ExceptionAttributeError)r   objownerattr_err_msgcheck_resultes         r   _check_AvailableIfDescriptor._check   sj    ENN%%78K8K7NO 		6::c?L  ..   	6 .A5	6s   A 
AAANc                    ^ ^ Ub(  T R                  UTS9  [        T R                  U5      nU$ [        T R                  5      UU 4S j5       nU$ )Nr   c                  N   > TR                  U S   TS9  TR                  " U 0 UD6$ )Nr   r   )r   r   )argskwargsr   r   s     r   out+_AvailableIfDescriptor.__get__.<locals>.out1   s+    DG51ww///r   )r   r   r   r   )r   r   r   r#   s   ` ` r   __get___AvailableIfDescriptor.__get__'   sT    ? KK5K)TWWc*C 
 477^0 0 
r   )r   r   r   r
   )	r   
__module____qualname____firstlineno____doc__r   r   r%   __static_attributes__ r   r   r   r      s    !
/r   r   c                    ^  U 4S j$ )a  An attribute that is available only if check returns a truthy value.

Parameters
----------
check : callable
    When passed the object with the decorated method, this should return
    a truthy value if the attribute is available, and either return False
    or raise an AttributeError if not available.

Returns
-------
callable
    Callable makes the decorated method available if `check` returns
    a truthy value, otherwise the decorated method is unavailable.

Examples
--------
>>> from sklearn.utils.metaestimators import available_if
>>> class HelloIfEven:
...    def __init__(self, x):
...        self.x = x
...
...    def _x_is_even(self):
...        return self.x % 2 == 0
...
...    @available_if(_x_is_even)
...    def say_hello(self):
...        print("Hello")
...
>>> obj = HelloIfEven(1)
>>> hasattr(obj, "say_hello")
False
>>> obj.x = 2
>>> hasattr(obj, "say_hello")
True
>>> obj.say_hello()
Hello
c                 .   > [        U TU R                  S9$ )N)r   )r   r   )r   r   s    r   <lambda>available_if.<locals>.<lambda>`   s    ,Rr{{Sr   r,   )r   s   `r   available_ifr1   9   s    N TSr   N)	functoolsr   r   typesr   r   r1   r,   r   r   <module>r4      s    , . .b'Tr   