U
    3‰do  ã                   @   s   G d d„ de ƒZdS )c                       s@   e Zd ZdZ‡ fdd„Zdd„ Zdd„ Zdd	„ Zd
d„ Z‡  Z	S )ÚBunchaØ  Container object exposing keys as attributes.

    Bunch objects are sometimes used as an output for functions and methods.
    They extend dictionaries by enabling values to be accessed by key,
    `bunch["value_key"]`, or by an attribute, `bunch.value_key`.

    Examples
    --------
    >>> from sklearn.utils import Bunch
    >>> b = Bunch(a=1, b=2)
    >>> b['b']
    2
    >>> b.b
    2
    >>> b.a = 3
    >>> b['a']
    3
    >>> b.c = 6
    >>> b['c']
    6
    c                    s   t ƒ  |¡ d S ©N)ÚsuperÚ__init__)ÚselfÚkwargs©Ú	__class__© ú8/tmp/pip-unpacked-wheel-zrfo1fqw/sklearn/utils/_bunch.pyr      s    zBunch.__init__c                 C   s   || |< d S r   r	   )r   ÚkeyÚvaluer	   r	   r
   Ú__setattr__   s    zBunch.__setattr__c                 C   s   |   ¡ S r   )Úkeys)r   r	   r	   r
   Ú__dir__   s    zBunch.__dir__c                 C   s,   z
| | W S  t k
r&   t|ƒ‚Y nX d S r   )ÚKeyErrorÚAttributeError)r   r   r	   r	   r
   Ú__getattr__!   s    
zBunch.__getattr__c                 C   s   d S r   r	   )r   Ústater	   r	   r
   Ú__setstate__'   s    	zBunch.__setstate__)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   Ú__classcell__r	   r	   r   r
   r      s   r   N)Údictr   r	   r	   r	   r
   Ú<module>   ó    