§
    ŽŸj-  ã                   óŠ   — d Z ddlZddlZddlZddlmZ ddlmZ ddlm	Z	 ddl
mZmZ ddlmZ d	„ Zd
„ Z G d„ de¦  «        ZdS )z‹A preprocessor that extracts all of the outputs from the
notebook file.  The extracted outputs are returned in the 'resources' dictionary.
é    N)Ú
a2b_base64©Úguess_extension)Údedent)ÚSetÚUnicodeé   )ÚPreprocessorc                 ó4   — t          | ¦  «        }|dk    rd}|S )zÕ
    This function fixes a problem with '.jpe' extensions
    of jpeg images which are then not recognised by latex.
    For any other case, the function works in the same way
    as mimetypes.guess_extension
    z.jpez.jpegr   )ÚmimetypeÚexts     úr/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/nbconvert/preprocessors/extractoutput.pyÚguess_extension_without_jper      s$   € õ ˜(Ñ
#Ô
#€CØ
ˆf‚}€}ØˆØ€Jó    c                 ó¦   — t          | t          ¦  «        r;t          j        dk    r|                      dd¦  «        } |                      d¦  «        } | S )zEncode data based on platform.Úwin32ú
z
úutf-8)Ú
isinstanceÚstrÚsysÚplatformÚreplaceÚencode)Údatas    r   Úplatform_utf_8_encoder   !   sJ   € å�$�ÑÔð $ÝŒ<˜7Ò"Ð"Ø—<’<  fÑ-Ô-ˆDØ�{Š{˜7Ñ#Ô#ˆØ€Kr   c                   ó˜   — e Zd ZdZ ed¦  «                             d¬¦  «        Z eh d£¦  «                             d¬¦  «        Zd„ Z	dS )ÚExtractOutputPreprocessorz„
    Extracts all of the outputs from the notebook file.  The extracted
    outputs are returned in the 'resources' dictionary.
    z,{unique_key}_{cell_index}_{index}{extension}T)Úconfig>   úimage/svg+xmlú	image/pngú
image/jpegúapplication/pdfc                 óÔ  — |                      dd¦  «        }|                      dd¦  «        }t          |d         t          ¦  «        si |d<   t          |                      dg ¦  «        ¦  «        D �]ô\  }}|j        dvrŒd|j        v r$t          |d         d         ¦  «        |d         d<   | j        D �]®}||j        v �r¡|j        |         }	|d	v rt          |	¦  «        }	nv|d
k    st          |	t          ¦  «        sLt          |	t          ¦  «        r|	                     d¦  «        }	t          t          j        |	¦  «        ¦  «        }	nt          |	¦  «        }	t          |¦  «        }
|
€d|                     d¦  «        d         z   }
|j                              dd¦  «        r(|j        d         }|                     |
¦  «        s||
z  }n| j                             ||||
¬¦  «        }|� t*          j                             ||¦  «        }|j                             di ¦  «         ||j        d         |<   ||d         v rd|› d|› d�}t3          |¦  «        ‚|	|d         |<   �Œ°�Œö||fS )a¨  
        Apply a transformation on each cell,

        Parameters
        ----------
        cell : NotebookNode cell
            Notebook cell being processed
        resources : dictionary
            Additional resources used in the conversion process.  Allows
            preprocessors to pass variables into the Jinja engine.
        cell_index : int
            Index of the cell being processed (see base.py)
        Ú
unique_keyÚoutputÚoutput_files_dirNÚoutputs>   Údisplay_dataÚexecute_resultz	text/htmlr   >   r!   r"   r#   zapplication/jsonr   ú.ú/éÿÿÿÿÚfilenameÚ )r%   Ú
cell_indexÚindexÚ	extensionÚ	filenameszåYour outputs have filename metadata associated with them. Nbconvert saves these outputs to external files using this filename metadata. Filenames need to be unique across the notebook, or images will be overwritten. The filename ze is associated with more than one output. The second output associated with this filename is in cell )Úgetr   ÚdictÚ	enumerateÚoutput_typer   r   Úextract_output_typesr   r   ÚbytesÚdecoder   ÚjsonÚdumpsr   ÚrsplitÚmetadataÚendswithÚoutput_filename_templateÚformatÚosÚpathÚjoinÚ
setdefaultÚ
ValueError)ÚselfÚcellÚ	resourcesr0   r%   r'   r1   ÚoutÚ	mime_typer   r   r.   Úmsgs                r   Úpreprocess_cellz)ExtractOutputPreprocessor.preprocess_cell8   sÅ  € ð$ —]’] <°Ñ:Ô:ˆ
Ø$Ÿ=š=Ð);¸TÑBÔBÐõ ˜) IÔ.µÑ5Ô5ð 	&Ø#%ˆI�iÑ õ $ D§H¢H¨Y¸Ñ$;Ô$;Ñ<Ô<ð B	:ñ B	:‰JˆE�3ØŒÐ&HÐHÐHØØ˜cœhÐ&Ð&Ý+1°#°f´+¸kÔ2JÑ+KÔ+K��F”˜KÑ(à!Ô6ð <:ñ <:�	Ø ¤Ð(Ñ(Øœ8 IÔ.�Dð !Ð$RÐRÐRõ  *¨$Ñ/Ô/˜˜Ø"Ð&8Ò8Ð8Å
È4ÕQTÑ@UÔ@UÐ8õ & d­EÑ2Ô2ð 8ð $(§;¢;¨wÑ#7Ô#7˜DÝ4µT´ZÀÑ5EÔ5EÑFÔF˜˜õ  5°TÑ:Ô:˜å5°iÑ@Ô@�CØ�{Ø! I×$4Ò$4°SÑ$9Ô$9¸"Ô$=Ñ=˜Ø”|×'Ò'¨
°BÑ7Ô7ð Ø#&¤<°
Ô#;˜Ø'×0Ò0°Ñ5Ô5ð ,Ø$¨™O˜Høà#'Ô#@×#GÒ#GØ'1¸jÐPUÐadð $Hñ $ô $˜ð (Ð3Ý#%¤7§<¢<Ð0@À(Ñ#KÔ#K˜Ø”L×+Ò+¨K¸Ñ<Ô<Ð<Ø;C�C”L Ô-¨iÑ8à 9¨YÔ#7Ð7Ð7ð-ð LTð	-ð -ð  *ð-ð -ð -ð õ )¨™oœoÐ-ð 6:�I˜iÔ(¨Ñ2ùñy<:ð| �YˆÐr   N)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Útagr@   r   r8   rM   © r   r   r   r   *   s�   € € € € € ðð ð
  '˜wÐ'UÑVÔV×ZÒZØð  [ñ  ô  Ðð ˜3Ð^Ð^Ð^Ñ_Ô_×cÒcØð dñ ô Ðð^ð ^ð ^ð ^ð ^r   r   )rQ   r;   rB   r   Úbinasciir   Ú	mimetypesr   Útextwrapr   Ú	traitletsr   r   Úbaser
   r   r   r   rS   r   r   ú<module>rY      sè   ððð ð €€€Ø 	€	€	€	Ø 
€
€
€
Ø Ð Ð Ð Ð Ð Ø %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð à "Ð "Ð "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð ð
ð 
ð 
ðð ð ðlð lð lð lð l ñ lô lð lð lð lr   