§
    �Ÿjª  ã                  ó&  — d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	m
Z
mZ ddlmZmZ ddlmZ g d	¢Zee	e
ed
œZddlmZ ddlmZ ddlmZmZ ddlmZ ddlmZ ddlmZmZ  G d„ de ¦  «        Z! ede"d¦  «        Z#dd„Z$e#dfd„Z%dd„Z&e#dfd„Z'dS )znThe Jupyter notebook format

Use this module to read or write notebook files as particular nbformat versions.
é    )Úannotations)ÚPath)Ú
get_loggeré   )Úv1Úv2Úv3Úv4)Ú__version__Úversion_info)ÚSentinel)ÚversionsÚvalidateÚValidationErrorÚconvertÚ	from_dictÚNotebookNodeÚcurrent_nbformatÚcurrent_nbformat_minorÚNBFormatErrorÚ
NO_CONVERTÚreadsÚreadÚwritesÚwriter   r   r   )r   é   é   é   )Úreader)r   )r   r   )Únbformat)Únbformat_minor)r   r   c                  ó   — e Zd ZdS )r   N)Ú__name__Ú
__module__Ú__qualname__© ó    ú^/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/nbformat/__init__.pyr   r   5   s   € € € € € Ø€Dr'   r   r   zKValue to prevent nbformat to convert notebooks to most recent version.
    Nc                ó$  — t          j        | fi |¤Ž}|t          urt          ||¦  «        }	 t	          |¦  «         nS# t
          $ rF}t          ¦   «                              d|¦  «         t          |t          ¦  «        r||d<   Y d}~nd}~ww xY w|S )a9  Read a notebook from a string and return the NotebookNode object as the given version.

    The string can contain a notebook of any version.
    The notebook will be returned `as_version`, converting, if necessary.

    Notebook format errors will be logged.

    Parameters
    ----------
    s : unicode
        The raw unicode string to read the notebook from.
    as_version : int
        The version of the notebook format to return.
        The notebook will be converted, if necessary.
        Pass nbformat.NO_CONVERT to prevent conversion.
    capture_validation_error : dict, optional
        If provided, a key of "ValidationError" with a
        value of the ValidationError instance will be added
        to the dictionary.

    Returns
    -------
    nb : NotebookNode
        The notebook that was read.
    úNotebook JSON is invalid: %sr   N)
r   r   r   r   r   r   r   ÚerrorÚ
isinstanceÚdict)ÚsÚ
as_versionÚcapture_validation_errorÚkwargsÚnbÚes         r(   r   r   B   s¬   € õ4 
Œ�aÐ	"Ð	"˜6Ð	"Ð	"€BØ�Ð#Ð#Ý�R˜Ñ$Ô$ˆð<Ý�‰ŒˆˆøÝð <ð <ð <Ý‰Œ×ÒÐ9¸1Ñ=Ô=Ð=ÝÐ.µÑ5Ô5ð 	<Ø:;Ð$Ð%6Ñ7øøøøøøøøøð<øøøð €Is   ­= ½
BÁ<BÂBc                ó\  — |t           urt          | |¦  «        } nt          j        | ¦  «        \  }}	 t	          | ¦  «         nS# t
          $ rF}t          ¦   «                              d|¦  «         t          |t          ¦  «        r||d<   Y d}~nd}~ww xY wt          |         j        | fi |¤ŽS )a¯  Write a notebook to a string in a given format in the given nbformat version.

    Any notebook format errors will be logged.

    Parameters
    ----------
    nb : NotebookNode
        The notebook to write.
    version : int, optional
        The nbformat version to write.
        If unspecified, or specified as nbformat.NO_CONVERT,
        the notebook's own version will be used and no conversion performed.
    capture_validation_error : dict, optional
        If provided, a key of "ValidationError" with a
        value of the ValidationError instance will be added
        to the dictionary.

    Returns
    -------
    s : unicode
        The notebook as a JSON string.
    r*   r   N)r   r   r   Úget_versionr   r   r   r+   r,   r-   r   Úwrites_json)r2   Úversionr0   r1   Ú_r3   s         r(   r   r   h   sÄ   € ð. •jÐ Ð Ý�R˜Ñ!Ô!ˆˆåÔ'¨Ñ+Ô+‰
ˆ�ð<Ý�‰ŒˆˆøÝð <ð <ð <Ý‰Œ×ÒÐ9¸1Ñ=Ô=Ð=ÝÐ.µÑ5Ô5ð 	<Ø:;Ð$Ð%6Ñ7øøøøøøøøøð<øøøõ �GÔÔ(¨Ð6Ð6¨vÐ6Ð6Ð6s   ³A Á
BÁ<BÂBc                ó  — 	 |                       ¦   «         }n\# t          $ rO t          | d¬¦  «        5 }t          |                      ¦   «         ||fi |¤Žcddd¦  «         cY S # 1 swxY w Y   Y nw xY wt          |||fi |¤ŽS )ar  Read a notebook from a file as a NotebookNode of the given version.

    The string can contain a notebook of any version.
    The notebook will be returned `as_version`, converting, if necessary.

    Notebook format errors will be logged.

    Parameters
    ----------
    fp : file or str
        A file-like object with a read method that returns unicode (use
        ``io.open()`` in Python 2), or a path to a file.
    as_version : int
        The version of the notebook format to return.
        The notebook will be converted, if necessary.
        Pass nbformat.NO_CONVERT to prevent conversion.
    capture_validation_error : dict, optional
        If provided, a key of "ValidationError" with a
        value of the ValidationError instance will be added
        to the dictionary.

    Returns
    -------
    nb : NotebookNode
        The notebook that was read.
    Úutf8©ÚencodingN)r   ÚAttributeErrorÚopenr   )Úfpr/   r0   r1   ÚbufÚfs         r(   r   r   Œ   s  € ð8SØ�gŠg‰iŒiˆˆøÝð Sð Sð SÝ�"˜vÐ&Ñ&Ô&ð 	S¨!Ý˜Ÿš™œ :Ð/GÐRÐRÈ6ÐRÐRð	Sð 	Sð 	Sð 	Sñ 	Sô 	Sð 	Sð 	Sð 	Sð 	Sð 	Sð 	Sð 	Sð 	Søøøð 	Sð 	Sð 	Sð 	Sð 	Sð 	SðSøøøõ ��jÐ":ÐEÐE¸fÐEÐEÐEs2   ‚ —A0²!A"ÁA0Á"A&	Á&A0Á)A&	Á*A0Á/A0c                ó  — t          | ||fi |¤Ž}t          |t          ¦  «        r|                     d¦  «        }	 |                     |¦  «         |                     d¦  «        s|                     d¦  «         dS dS # t          $ r� t          |¦  «                             dd¬¦  «        5 }|                     |¦  «         |                     d¦  «        s|                     d¦  «         ddd¦  «         Y dS # 1 swxY w Y   Y dS w xY w)a  Write a notebook to a file in a given nbformat version.

    The file-like object must accept unicode input.

    Parameters
    ----------
    nb : NotebookNode
        The notebook to write.
    fp : file or str
        Any file-like object with a write method that accepts unicode, or
        a path to write a file.
    version : int, optional
        The nbformat version to write.
        If nb is not this version, it will be converted.
        If unspecified, or specified as nbformat.NO_CONVERT,
        the notebook's own version will be used and no conversion performed.
    capture_validation_error : dict, optional
        If provided, a key of "ValidationError" with a
        value of the ValidationError instance will be added
        to the dictionary.
    r:   ú
Úwr;   N)	r   r,   ÚbytesÚdecoder   Úendswithr=   r   r>   )r2   r?   r7   r0   r1   r.   rA   s          r(   r   r   ±   sZ  € õ, 	ˆr�7Ð4Ð?Ð?¸Ð?Ð?€AÝ�!•UÑÔð Ø�HŠH�VÑÔˆðØ
�Š�‰ŒˆØ�zŠz˜$ÑÔð 	Ø�HŠH�T‰NŒNˆNˆNˆNð	ð 	øåð ð ð Ý�"‰XŒX�]Š]˜3¨ˆ]Ñ0Ô0ð 	°AØ�GŠG�A‰JŒJˆJØ—:’:˜dÑ#Ô#ð Ø—’˜‘”�ð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð 	ð 	ð 	ðøøøs6   »?A> Á>.D	Â,A C:Ã,D	Ã:C>	Ã>D	ÄC>	ÄD	ÄD	)N)(Ú__doc__Ú
__future__r   Úpathlibr   Útraitlets.logr   Ú r   r   r	   r
   Ú_versionr   r   Úsentinelr   Ú__all__r   r   Ú	converterr   Únotebooknoder   r   r    r   r!   r   Ú	validatorr   r   Ú
ValueErrorr   r#   r   r   r   r   r   r&   r'   r(   ú<module>rT      sñ  ððð ð #Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð à $Ð $Ð $Ð $Ð $Ð $à Ð Ð Ð Ð Ð Ð Ð Ð Ð Ð Ð Ø /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ø Ð Ð Ð Ð Ð ðð ð €ð* 
Ø	Ø	Ø	ð	ð €ð Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0ð	ð 	ð 	ð 	ð 	�Jñ 	ô 	ð 	ð
 ˆXØØðñô €
ð#ð #ð #ð #ðL "¸Dð !7ð !7ð !7ð !7ðH"Fð "Fð "Fð "FðJ %¸tð "ð "ð "ð "ð "ð "r'   