ó
í^c           @   s   d  e  f d     YZ d S(   t   nested_dictc           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   sŤ   
    A nested dict is a dictionary with a parent.  If key lookup fails,
    it recursively continues into the parent.  Writes always happen to
    the top level dict.
    c         C   s   | | |  _  |  _ d  S(   N(   t   baset   parent(   t   selfR   R   (    (    s   tools/autograd/nested_dict.pyt   __init__	   s    c         C   s   | |  j  k p | |  j k S(   N(   R   R   (   R   t   item(    (    s   tools/autograd/nested_dict.pyt   __contains__   s    c         C   s-   |  j  j |  } | d  k	 r" | S|  j | S(   N(   R   t   gett   NoneR   (   R   t   xt   r(    (    s   tools/autograd/nested_dict.pyt   __getitem__   s    (   t   __name__t
   __module__t   __doc__R   R   R   (    (    (    s   tools/autograd/nested_dict.pyR       s   		N(   t   objectR    (    (    (    s   tools/autograd/nested_dict.pyt   <module>   t    