
    ^h                    6   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J	r	J
r
JrJr   " S S\R                  5      r " S	 S
\5      r " S S\	5      r\" 5       r\" 5       r\R&                  r\R(                  r\R*                  r\R,                  r\R.                  rg)z(Read and write notebooks in JSON format.    )annotationsN   )	from_dict)NotebookReaderNotebookWriterrejoin_linessplit_linesstrip_transientc                      \ rS rSrSrS rSrg)BytesEncoder   z@A JSON encoder that accepts b64 (and other *ascii*) bytestrings.c                    [        U[        5      (       a  UR                  S5      $ [        R                  R                  X5      $ )z#Get the default value of an object.ascii)
isinstancebytesdecodejsonJSONEncoderdefault)selfobjs     L/home/james-whalen/.local/lib/python3.13/site-packages/nbformat/v3/nbjson.pyr   BytesEncoder.default   s5    c5!!::g&&''22     N)__name__
__module____qualname____firstlineno____doc__r   __static_attributes__r   r   r   r   r      s
    J3r   r   c                  $    \ rS rSrSrS rS rSrg)
JSONReader   zA JSON notebook reader.c                p    [         R                  " U40 UD6nU R                  " U40 UD6n[        U5      nU$ )zConvert a string to a notebook.)r   loadsto_notebookr
   )r   skwargsnbs       r   readsJSONReader.reads   s9    ZZ$V$b+F+R 	r   c                *    [        [        U5      5      $ )zConvert a dict to a notebook.)r   r   )r   dr)   s      r   r'   JSONReader.to_notebook"   s    IaL))r   r   N)r   r   r   r   r    r+   r'   r!   r   r   r   r#   r#      s    !*r   r#   c                      \ rS rSrSrS rSrg)
JSONWriter'   zA JSON notebook writer.c                    [         US'   SUS'   SUS'   SUS'   [        R                  " U5      n[        U5      nUR	                  SS5      (       a  [        U5      n[        R                  " U40 UD6$ )	zConvert a notebook to a string.clsr   indentT	sort_keys),z: 
separatorsr	   )r   copydeepcopyr
   popr	   r   dumps)r   r*   r)   s      r   writesJSONWriter.writes*   so    $ux"{*|]]2R ::mT**RBzz"'''r   r   N)r   r   r   r   r    r=   r!   r   r   r   r1   r1   '   s
    !
(r   r1   )r    
__future__r   r9   r   nbbaser   rwbaser   r   r   r	   r
   r   r   r#   r1   _reader_writerr+   readr'   writer=   r   r   r   <module>rF      s    . #    ^ ^34## 3* *( (  ,
,||!!	r   