§
    ŽŸj´  ã                   óB   — d Z ddlmZmZ ddlmZ  G d„ de¦  «        ZdS )zFModule containing a preprocessor that removes metadata from code cellsé    )ÚBoolÚSeté   )ÚPreprocessorc                   óH  ‡ — e Zd ZdZ edd¬¦  «                             d¬¦  «        Z edd¬¦  «                             d¬¦  «        Z edgd¬¦  «                             d¬¦  «        Z	 ed¬¦  «                             d¬¦  «        Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zˆ fd„Zˆ xZS )ÚClearMetadataPreprocessorzE
    Removes all the metadata from all code cells in a notebook.
    TzRFlag to choose if cell metadata is to be cleared in addition to notebook metadata.)Úhelp)ÚconfigzRFlag to choose if notebook metadata is to be cleared in addition to cell metadata.)Úlanguage_infoÚnamez«Indicates the key paths to preserve when deleting metadata across both cells and notebook metadata fields. Tuples of keys can be passed to preserved specific nested valuesc                 ój   — t          |t          ¦  «        r|S t          |¦  «        dk    rdS |d         S )z#Get the current key for a mask key.r   N)Ú
isinstanceÚstrÚlen)ÚselfÚmask_keys     úr/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/nbconvert/preprocessors/clearmetadata.pyÚcurrent_keyz%ClearMetadataPreprocessor.current_key(   s9   € å�h¥Ñ$Ô$ð 	ØˆOÝˆx‰=Œ=˜AÒÐà�4Ø˜Œ{Ðó    c                 ó    ‡ — ˆ fd„|D ¦   «         S )z Get the current mask for a mask.c                 ód   •— h | ],}‰                      |¦  «        ®‰                      |¦  «        ’Œ-S )N)r   ©Ú.0Úkr   s     €r   ú	<setcomp>z9ClearMetadataPreprocessor.current_mask.<locals>.<setcomp>3   s:   ø€ ÐUÐUÐU¨°T×5EÒ5EÀaÑ5HÔ5HÐ5T�× Ò  Ñ#Ô#Ð5TÐ5TÐ5Tr   © ©r   Úmasks   ` r   Úcurrent_maskz&ClearMetadataPreprocessor.current_mask1   s   ø€ àUÐUÐUÐU¨TÐUÑUÔUÐUr   c                 ó    ‡ — ˆ fd„|D ¦   «         S )z Get the nested masks for a mask.c                 ó¬   •— i | ]P}|rLt          |t          ¦  «        s7t          |¦  «        d k    ¯,‰                     |d         ¦  «        |d d…         “ŒQS )r   r   N)r   r   r   r   r   s     €r   ú
<dictcomp>z:ClearMetadataPreprocessor.nested_masks.<locals>.<dictcomp>7   sj   ø€ ð 
ð 
ð 
àØð
õ $ A¥sÑ+Ô+ð
õ 14°A±´¸²
°
ð ×Ò˜Q˜qœTÑ"Ô" A a b b¤Eà0:°
°
r   r   r   s   ` r   Únested_masksz&ClearMetadataPreprocessor.nested_masks5   s.   ø€ ð
ð 
ð 
ð 
àð
ñ 
ô 
ð 	
r   c              #   óN  K  — |                       |¦  «        }|                      |¦  «        }|D ]u\  }}|                     |¦  «        }||v rW|�Ot          |t          ¦  «        r9|t	          |                      |                     ¦   «         |¦  «        ¦  «        fV — Œo||fV — ŒvdS )z-Get the nested filter for items given a mask.N)r   r#   Úgetr   ÚdictÚnested_filterÚitems)r   r(   r   Úkeep_currentÚkeep_nested_lookupr   ÚvÚkeep_nesteds           r   r'   z'ClearMetadataPreprocessor.nested_filter=   sÁ   è è € à×(Ò(¨Ñ.Ô.ˆØ!×.Ò.¨tÑ4Ô4ÐØð 	ð 	‰DˆAˆqØ,×0Ò0°Ñ3Ô3ˆKØ�LÐ Ð ØÐ*Ý! !¥TÑ*Ô*ð RØ¥ d×&8Ò&8¸¿º¹¼ÀKÑ&PÔ&PÑ!QÔ!QÐQÐQÐQÐQøà˜Q˜$�J�J�Jøð	ð 	r   c                 ó¾   — | j         rS|j        dk    rHd|v rDt          |                      |j                             ¦   «         | j        ¦  «        ¦  «        |_        ||fS )zO
        All the code cells are returned with an empty metadata field.
        ÚcodeÚmetadata)Úclear_cell_metadataÚ	cell_typer&   r'   r/   r(   Úpreserve_cell_metadata_mask)r   ÚcellÚ	resourcesÚ
cell_indexs       r   Úpreprocess_cellz)ClearMetadataPreprocessor.preprocess_cellJ   sg   € ð Ô#ð 	¨¬¸&Ò(@Ð(@à˜TÐ!Ð!Ý $Ø×&Ò& t¤}×':Ò':Ñ'<Ô'<¸dÔ>^Ñ_Ô_ñ!ô !�”ð �YˆÐr   c                 óô   •— t          ¦   «                              ||¦  «        \  }}| j        rHd|v rDt          |                      |j                             ¦   «         | j        ¦  «        ¦  «        |_        ||fS )ax  
        Preprocessing to apply on each notebook.

        Must return modified nb, resources.

        Parameters
        ----------
        nb : NotebookNode
            Notebook being converted
        resources : dictionary
            Additional resources used in the conversion process.  Allows
            preprocessors to pass variables into the Jinja engine.
        r/   )ÚsuperÚ
preprocessÚclear_notebook_metadatar&   r'   r/   r(   Úpreserve_nb_metadata_mask)r   Únbr4   Ú	__class__s      €r   r9   z$ClearMetadataPreprocessor.preprocessV   sx   ø€ õ ™œ×*Ò*¨2¨yÑ9Ô9‰ˆˆIØÔ'ð 	¨J¸"Ð,<Ð,<ÝØ×"Ò" 2¤;×#4Ò#4Ñ#6Ô#6¸Ô8VÑWÔWñô ˆBŒKð �9ˆ}Ðr   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Útagr0   r:   r   r;   r2   r   r   r#   r'   r6   r9   Ú__classcell__)r=   s   @r   r   r      s^  ø€ € € € € ðð ð ˜$ØØbðñ ô ÷ 
‚c�€cÑÔð ð #˜dØØbðñ ô ÷ 
‚c�€cÑÔð ð !$ Ø	"Ð#ðEð!ñ !ô !÷ 
‚c�€cÑÔð ð #& #ðEð#ñ #ô #÷ 
‚c�€cÑÔð  ðð ð ðVð Vð Vð
ð 
ð 
ðð ð ð
ð 
ð 
ðð ð ð ð ð ð ð ð r   r   N)rA   Ú	traitletsr   r   Úbaser   r   r   r   r   ú<module>rF      su   ðØ LÐ Lð
  Ð Ð Ð Ð Ð Ð Ð à Ð Ð Ð Ð Ð ð^ð ^ð ^ð ^ð ^ ñ ^ô ^ð ^ð ^ð ^r   