Ë
    ý�Djã  ã                   ó>   — d dl mZ d dlmZ dgZ G d„ de«      Zd„ Zy)é    )Ú
attrgetter)Úupdate_wrapperÚif_has_delegatec                   ó   — e Zd ZdZd„ Zdd„Zy)Ú_IffHasDelegateas  Implements a conditional property using the descriptor protocol.
    Using this class to create a decorator will raise an ``AttributeError``
    if none of the delegates (specified in ``delegate_names``) is an attribute
    of the base object or the first found delegate does not have an attribute
    ``attribute_name``.

    This allows ducktyping of the decorated method based on
    ``delegate.attribute_name``. Here ``delegate`` is the first item in
    ``delegate_names`` for which ``hasattr(object, delegate) is True``.

    See https://docs.python.org/3/howto/descriptor.html for an explanation of
    descriptors.
    c                 ó8   — || _         || _        t        | |«       y ©N)ÚfnÚdelegate_namesr   )Úselfr
   r   s      úaC:\Crop_Prediction\Backend\crop-ai-system\venv\Lib\site-packages\pmdarima/utils/metaestimators.pyÚ__init__z_IffHasDelegate.__init__   s   € ØˆŒØ,ˆÔô 	�t˜RÕ ó    Nc                 óè   ‡ ‡— ‰�B‰ j                   D ]  }	  t        |«      ‰«        n  t        ‰ j                   d   «      ‰«       ˆˆ fd„}t        |‰ j                  «       |S # t        $ r Y Œ_w xY w)Néÿÿÿÿc                  ó0   •—  ‰j                   ‰g| ¢­i |¤ŽS r	   )r
   )ÚargsÚkwargsÚobjr   s     €€r   ú<lambda>z)_IffHasDelegate.__get__.<locals>.<lambda>5   s   ø€  w t§w¡w¨sÐ'D°TÒ'D¸VÑ'D€ r   )r   r   ÚAttributeErrorr   r
   )r   r   ÚtypeÚdelegate_nameÚouts   ``   r   Ú__get__z_IffHasDelegate.__get__%   sƒ   ù€ àˆ?ð "&×!4Ñ!4ò 9�ðØ-”J˜}Ó-¨cÔ2ñ ð9ð 4”
˜4×.Ñ.¨rÑ2Ó3°CÔ8ô Eˆä�s˜DŸG™GÔ$Øˆ
øô &ò Ùðús   •A%Á%	A1Á0A1r	   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   © r   r   r   r      s   „ ñò!ôr   r   c                 ój   ‡ — t        ‰ t        «      rt        ‰ «      Š t        ‰ t        «      s‰ fŠ ˆ fd„S )a™  Wrap a delegated instance attribute function.

    Creates a decorator for methods that are delegated in the presence of a
    results wrapper. This enables duck-typing by ``hasattr`` returning True
    according to the sub-estimator.

    This function was adapted from scikit-learn, which defines
    ``if_delegate_has_method``, but operates differently by injecting methods
    not based on method presence, but by delegate presence.

    Examples
    --------
    >>> from pmdarima.utils.metaestimators import if_has_delegate
    >>>
    >>> class A(object):
    ...     @if_has_delegate('d')
    ...     def func(self):
    ...         return True
    >>>
    >>> a = A()
    >>> # the delegate does not exist yet
    >>> assert not hasattr(a, 'func')
    >>> # inject the attribute
    >>> a.d = None
    >>> assert hasattr(a, 'func') and a.func()

    Parameters
    ----------
    delegate : string, list of strings or tuple of strings
        Name of the sub-estimator that can be accessed as an attribute of the
        base object. If a list or a tuple of names are provided, the first
        sub-estimator that is an attribute of the base object will be used.
    c                 ó   •— t        | ‰«      S r	   )r   )r
   Údelegates    €r   r   z!if_has_delegate.<locals>.<lambda>b   s   ø€ ”o b¨(Ó3€ r   )Ú
isinstanceÚlistÚtuple)r#   s   `r   r   r   ;   s0   ø€ ôD �(œDÔ!Ü˜“?ˆÜ�h¤Ô&Ø�;ˆã3Ð3r   N)Úoperatorr   Ú	functoolsr   Ú__all__Úobjectr   r   r    r   r   ú<module>r+      s+   ðõ  Ý $ð ð€ô
(�fô (óV'4r   