
    Eh                    f   S r SSKJr  SSKrSSKrSSKJr  SSKJr	  SSK
JrJrJrJrJrJrJrJrJrJrJrJrJrJr  SSKJr  SS	KJr  SS
KJr  SSKJ r J!r!  \RD                  " S\#SS9  / SQr$\r%\r&\	RN                  r( " S S\)5      r*S r+S r,S r-S r.S r/S r0S\%4S jrS\%4S jr1SS jr2SS jr3g)zDeprecated API for working with notebooks

- use nbformat for read/write/validate public API
- use nbformat.vX directly for Python API for composing notebooks
    )annotationsN)
get_logger)v3)NotebookNodenbformatnbformat_minornbformat_schema
new_authornew_code_cellnew_heading_cellnew_metadatanew_notebook
new_outputnew_text_cellnew_worksheetparse_filenameto_notebook_json   )versions)convert)reads)ValidationErrorvalidateznbformat.current is deprecated since before nbformat 3.0

- use nbformat for read/write/validate public API
- use nbformat.vX directly to composing notebooks of a particular version
   
stacklevel)r   r   r   r   r   r   r   r   r
   r   r   r   r	   r   r   r   NBFormatErrorparse_py
reads_jsonwrites_jsonreads_py	writes_pyr   writesreadwritec                      \ rS rSrSrSrg)r   S   z&An error raised for an nbformat error. N)__name__
__module____qualname____firstlineno____doc____static_attributes__r(       cC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\nbformat/current.pyr   r   S   s    0r/   r   c                 .    [         R                  " SSS9  g )NzwNon-JSON file support in nbformat is deprecated since nbformat 1.0.
    Use nbconvert to create files of other formats.r   r   )warningswarnr(   r/   r0   _warn_formatr4   W   s    MM	7r/   c                    [         n[        nSn[        R                  " X@5      nUbK  UR	                  S5      R                  S5      n[        US   5      n[        U5      S:  a  [        US   5      nX#U 4$ )z/Parse a string into a (nbformat, string) tuple.z0# <nbformat>(?P<nbformat>\d+[\.\d+]*)</nbformat>r   .r   r   )current_nbformatcurrent_nbformat_minorresearchgroupsplitintlen)skwargsnbfnbmpatternmdigitss          r0   r   r   _   sl    
C
 CAG
		'A}$**3/&)nv;?fQi.CQ;r/   c                L    [         R                  " S[        SS9  [        U 5      $ )zDEPRECATED, use readsz6reads_json is deprecated since nbformat 3.0, use readsr   r   )r2   r3   DeprecationWarningr   )nbjsonr@   s     r0   r   r   o   s#    MM@
 =r/   c                N    [         R                  " S[        SS9  [        U 40 UD6$ )zDEPRECATED, use writesz8writes_json is deprecated since nbformat 3.0, use writesr   r   )r2   r3   rG   r#   nbr@   s     r0   r    r    y   s)    MMB
 "r/   c                    [        5         [        U 40 UD6u  p#n US;   a  [        U   R                  " U 40 UD6nU$ [	        SU-  5      e)DEPRECATED: use nbconvert)r      z#Unsupported PY nbformat version: %i)r4   r   r   to_notebook_pyr   )r?   r@   rA   rB   rK   s        r0   r!   r!      sT    N1''KCa
f}c]))!6v6 I ACGHHr/   c                J    [        5         [        S   R                  " U 40 UD6$ )rM   rN   )r4   r   r"   rJ   s     r0   r"   r"      s!    NA;  .v..r/   
DEPRECATEDc                `   US;  a
  [        5         [        U 40 UD6n[        XB5      n [        R                  " 5          [        R
                  " S[        S9  [        USS9  SSS5        U$ ! , (       d  f       U$ = f! [         a%  n[        5       R                  SU5         SnAU$ SnAff = f)a^  Read a notebook from a string and return the NotebookNode object.

This function properly handles notebooks of any version. The notebook
returned will always be in the current version's format.

Parameters
----------
s : unicode
    The raw unicode string to read the notebook from.

Returns
-------
nb : NotebookNode
    The notebook that was read.
>   jsonrQ   ignorecategoryFrepair_duplicate_cell_idsNNotebook JSON is invalid: %s)r4   reader_readsr   r2   catch_warningsfilterwarningsrG   r   r   r   error)r?   formatversionr@   rK   es         r0   r   r      s      ++	a	"6	"B		B>$$&##H7IJR59 '
 I '&
 I  >91==I>s4   A> $A,"A> ,
A;6A> ;A> >
B-B((B-c                t   US;  a
  [        5         [        X5      n  [        R                  " 5          [        R                  " S[
        S9  [        U SS9  SSS5        [        U   R                  " U 40 UD6$ ! , (       d  f       N(= f! [         a$  n[        5       R                  SU5         SnANTSnAff = f)aj  Write a notebook to a string in a given format in the current nbformat version.

This function always writes the notebook in the current nbformat version.

Parameters
----------
nb : NotebookNode
    The notebook to write.
version : int
    The nbformat version to write.
    Used for downgrading notebooks.

Returns
-------
s : unicode
    The notebook string.
>   rS   rQ   rT   rU   FrW   NrY   )r4   r   r2   r[   r\   rG   r   r   r   r]   r   r    )rK   r^   r_   r@   r`   s        r0   r#   r#      s    $ ++		B>$$&##H7IJR59 '
 G((6v66 '&  >91==>s4   B	 $A8B	 8
BB	 B	 	
B7B22B7c                6    [        U R                  5       40 UD6$ )aQ  Read a notebook from a file and return the NotebookNode object.

This function properly handles notebooks of any version. The notebook
returned will always be in the current version's format.

Parameters
----------
fp : file
    Any file-like object with a read method.

Returns
-------
nb : NotebookNode
    The notebook that was read.
)r   r$   )fpr^   r@   s      r0   r$   r$      s      %f%%r/   c                    [        U 40 UD6n[        U[        5      (       a  UR                  S5      nUR	                  U5      $ )a  Write a notebook to a file in a given format in the current nbformat version.

This function always writes the notebook in the current nbformat version.

Parameters
----------
nb : NotebookNode
    The notebook to write.
fp : file
    Any file-like object with a write method.
utf8)r#   
isinstancebytesdecoder%   )rK   rc   r^   r@   r?   s        r0   r%   r%      s<     	rVA!UHHV88A;r/   )rQ   )4r-   
__future__r   r9   r2   traitlets.logr   r   r   	_v_latestnbformat.v3r   r   r	   r
   r   r   r   r   r   r   r   r   r    r   	converterr   readerr   rZ   	validatorr   r   r3   rG   __all__r7   r8   r)   current_nbformat_module
ValueErrorr   r4   r   r   r    r!   r"   r#   r$   r%   r(   r/   r0   <module>rt      s    # 	  $ $   "   ) 0 
 :  ' #,, 1J 1  / !*: : #,< 7<&&r/   