a
    õ£Be  ã                   @  s0   d Z ddlmZ ddlmZ G dd„ deƒZdS )zJYet another implementation of bunch

attribute-access of items on a dict.
é    )Úannotations)ÚAnyc                   @  s@   e Zd ZdZdddœdd„Zddddœd	d
„Zddœdd„ZdS )ÚBunchzA dict with attribute-accessÚstrr   )ÚkeyÚreturnc              
   C  s@   z|   |¡W S  ty: } zt|ƒ|‚W Y d }~n
d }~0 0 d S ©N)Ú__getitem__ÚKeyErrorÚAttributeError)Úselfr   Úe© r   úX/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/traitlets/utils/bunch.pyÚ__getattr__   s    zBunch.__getattr__ÚNone)r   Úvaluer   c                 C  s   |   ||¡ d S r   )Ú__setitem__)r   r   r   r   r   r   Ú__setattr__   s    zBunch.__setattr__z	list[str])r   c                 C  s   t i ƒ}| |  ¡ ¡ |S r   )ÚdirÚextendÚkeys)r   Únamesr   r   r   Ú__dir__   s    zBunch.__dir__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r      s   r   N)r   Ú
__future__r   Útypingr   Údictr   r   r   r   r   Ú<module>   s   