ó
    Ñ]j�  ã                   ó:   • 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       ÚX/home/mande/repo/quber/.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   € à�E—N‘NÑ%Ð%7¸×8KÑ8KÑ7NÐOð 	ð	6ØŸ:™: c›?ˆLö Ü  Ó.Ð.ð øô ó 	6Ü  Ó.°AÐ5ûð	6ús    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 ™G¨5�Ñ1Ø—w’w Ð/¨Ñ/Ð/r   )r   r   r   r   )r   r   r   r#   s   ` ` r   Ú__get__Ú_AvailableIfDescriptor.__get__'   sT   ù€ Ø‰?ð �K‰K˜ 5ˆKÑ)Ü˜TŸW™W cÓ*ˆCð ˆ
ô �4—7‘7‹^õ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   