
    Mhv                    P    d Z ddlmZ ddlmZ ddlmZ  G d de          Zd Zd	S )
z/NotebookNode - adding attribute access to dicts    )annotations)Mapping   )Structc                  (     e Zd ZdZ fdZd Z xZS )NotebookNodez&A dict-like node with attribute-accessc                    t          |t                    r$t          |t                    st          |          }t	                                          ||           dS )zSet an item on the notebook.N)
isinstancer   r   	from_dictsuper__setitem__)selfkeyvalue	__class__s      U/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/nbformat/notebooknode.pyr   zNotebookNode.__setitem__   sS    eW%% 	%j.M.M 	%e$$EC'''''    c                d   t          |          dk    rt          dt          |          z            |r\|d         }t          |t                    r|D ]}||         | |<   n.t	          |d          r|D ]}||         | |<   n|D ]
\  }}|| |<   |                                D ]
\  }}|| |<   dS )zf
        A dict-like update method based on CPython's MutableMapping `update`
        method.
        r   z+update expected at most 1 arguments, got %dr   keysN)len	TypeErrorr
   r   hasattritems)r   argskwargsotherr   r   s         r   updatezNotebookNode.update   s    
 t99q==ICPTIIUVVV 
	&GE%)) &  + +C %c
DII+'' &  + +C %c
DII+ #( & &JC %DII ,,.. 	 	JCDII	 	r   )__name__
__module____qualname____doc__r   r   __classcell__)r   s   @r   r   r   
   sM        00( ( ( ( (      r   r   c                    t          | t                    r+t          d |                                 D                       S t          | t          t
          f          rd | D             S | S )zConvert dict to dict-like NotebookNode

    Recursively converts any dict in the container to a NotebookNode.
    This does not check that the contents of the dictionary make a valid
    notebook or part of a notebook.
    c                4    i | ]\  }}|t          |          S  r   ).0kvs      r   
<dictcomp>zfrom_dict.<locals>.<dictcomp>1   s$    CCCAQ	!CCCr   c                ,    g | ]}t          |          S r%   r&   )r'   is     r   
<listcomp>zfrom_dict.<locals>.<listcomp>3   s    (((	!(((r   )r
   dictr   r   tuplelist)ds    r   r   r   )   sk     !T ECCCCCDDD!eT]## )((a((((Hr   N)	r!   
__future__r   collections.abcr   _structr   r   r   r%   r   r   <module>r5      s    5 5 " " " " " " # # # # # #          6   >    r   