§
    bP„jy  ã                  ó€   — d Z ddlmZ ddlmZ ddlmZ ddlm	Z	 e
eeee ed¦  «        efZ G d„ d	e	¦  «        Zd
„ ZdS )z/NotebookNode - adding attribute access to dictsé    )Úannotations)ÚMapping)Údeepcopyé   )ÚStructNc                  ó.   ‡ — e Zd ZdZˆ fd„Z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      €úZ/root/disk_3tb/conda_envs/Huy-visual/lib/python3.11/site-packages/nbformat/notebooknode.pyr   zNotebookNode.__setitem__   sS   ø€ å�e�WÑ%Ô%ð 	%­j¸ÅÑ.MÔ.Mð 	%Ý˜eÑ$Ô$ˆEÝ‰Œ×Ò˜C Ñ'Ô'Ð'Ð'Ð'ó    c                óä  ‡— |                       ¦   «         }|‰t          | ¦  «        <   |                      ¦   «         D ]\  }}t          |¦  «        }|t          v rt
                               |||¦  «         Œ:|t          u r)t
                               ||ˆfd„|D ¦   «         ¦  «         Œlt          |‰¦  «        ||<   Œ€| j	        r-|j	         
                    t          | j	        ‰¦  «        ¦  «         |S )ar  Deep-copy the node without going through `copy._reconstruct`.

        `copy.deepcopy` only takes its fast path for exact `dict`s, so a `dict`
        subclass falls back to the generic `__reduce_ex__` machinery once per
        node. Notebooks get deep-copied on every `isvalid`, `normalize` and
        `writes` call, which makes that fallback worth avoiding.
        c                ó0   •— g | ]}t          |‰¦  «        ‘ŒS © )Ú	_deepcopy)Ú.0ÚitemÚmemos     €r   ú
<listcomp>z-NotebookNode.__deepcopy__.<locals>.<listcomp>(   s#   ø€ Ð+TÐ+TÐ+TÀd­I°d¸DÑ,AÔ,AÐ+TÐ+TÐ+Tr   )r   ÚidÚitemsÚtypeÚ_ATOMIC_TYPESÚdictr   Úlistr   Ú__dict__Úupdate)r   r   Únewr   r   Ú
value_types    `    r   Ú__deepcopy__zNotebookNode.__deepcopy__   s÷   ø€ ð �nŠnÑÔˆØˆ�R�‰XŒX‰ØŸ*š*™,œ,ð 	2ð 	2‰JˆC�Ý˜e™œˆJØ�]Ð*Ð*Ý× Ò   c¨5Ñ1Ô1Ð1Ð1Ø�tÐ#Ð#õ × Ò   cÐ+TÐ+TÐ+TÐ+TÈeÐ+TÑ+TÔ+TÑUÔUÐUÐUõ % U¨DÑ1Ô1��C‘�ð Œ=ð 	@ØŒL×Ò¥	¨$¬-¸Ñ >Ô >Ñ?Ô?Ð?Øˆ
r   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   Úhasattrr   )r   ÚargsÚkwargsÚotherr   r   s         r   r$   zNotebookNode.update3   sù   € õ
 ˆt‰9Œ9�qŠ=ˆ=ÝÐIÍCÐPTÉIÌIÑUÑVÔVÐVØð 
	&Ø˜”GˆEÝ˜%¥Ñ)Ô)ð &Ø ð +ð +�CØ % c¤
�D˜‘I�Ið+å˜ Ñ'Ô'ð &Ø ð +ð +�CØ % c¤
�D˜‘I�Ið+ð #(ð &ð &‘J�C˜Ø %�D˜‘I�IØ Ÿ,š,™.œ.ð 	ð 	‰JˆC�ØˆD�‰IˆIð	ð 	r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r'   r$   Ú__classcell__)r   s   @r   r	   r	      s\   ø€ € € € € Ø0Ð0ð(ð (ð (ð (ð (ðð ð ð8ð ð ð ð ð ð r   r	   c                óÖ   — t          | t          ¦  «        r+t          d„ |                      ¦   «         D ¦   «         ¦  «        S t          | t          t
          f¦  «        rd„ | D ¦   «         S | S )zßConvert 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   ©r   )r   ÚkÚvs      r   ú
<dictcomp>zfrom_dict.<locals>.<dictcomp>Q   s$   € ÐCÐCÐC±°°A˜Q¥	¨!¡¤ÐCÐCÐCr   c                ó,   — g | ]}t          |¦  «        ‘ŒS r   r7   )r   Úis     r   r   zfrom_dict.<locals>.<listcomp>S   s   € Ð(Ð(Ð( •	˜!‘”Ð(Ð(Ð(r   )r   r!   r	   r   Útupler"   )Úds    r   r   r   I   sk   € õ �!•TÑÔð EÝÐCÐC¸¿º¹¼ÐCÑCÔCÑDÔDÐDÝ�!•e�T�]Ñ#Ô#ð )Ø(Ð( aÐ(Ñ(Ô(Ð(Ø€Hr   )r3   Ú
__future__r   Úcollections.abcr   Úcopyr   r   Ú_structr   ÚstrÚintÚfloatÚboolÚbytesr   Úcomplexr    r	   r   r   r   r   ú<module>rI      sµ   ðØ 5Ð 5à "Ð "Ð "Ð "Ð "Ð "à #Ð #Ð #Ð #Ð #Ð #Ø &Ð &Ð &Ð &Ð &Ð &à Ð Ð Ð Ð Ð ð �c˜5 $¨¨t¨t°D©z¬z¸7ÐC€ð8ð 8ð 8ð 8ð 8�6ñ 8ô 8ð 8ðvð ð ð ð r   