Ë
    :vžj}T  ã                  ó2  — d Z ddlmZ ddlZddlZddlZddlZddlmZm	Z	 ddl
mZ ddlmZ ddl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mZ d„ Zd„ Zdd„Z dd„Z!d„ Z"d„ Z#edd„«       Z$edd„«       Z% G d„ dee«      Z& G d„ de&«      Z'y)z9
Utilities for file-based Contents/Checkpoints managers.
é    )ÚannotationsN)ÚdecodebytesÚencodebytes)Úcontextmanager)Úpartial)Úrun_sync)Ú	HTTPError)ÚBoolÚEnum)ÚConfigurable)ÚLoggingConfigurable)ÚApiPathÚto_api_pathÚ
to_os_pathc                ó0   — t        j                  | |«       y)zreplace dst with srcN)ÚosÚreplace©ÚsrcÚdsts     úx/workspace/moltex-experiments/.pixi/envs/default/lib/python3.12/site-packages/jupyter_server/services/contents/fileio.pyÚreplace_filer      s   € ä‡J�Jˆs�CÕó    c              ƒ  óV   K  — t        t        j                  | |«      ƒ d{  –—†  y7 Œ­w)z#replace dst with src asynchronouslyN)r   r   r   r   s     r   Úasync_replace_filer       s   è ø€ ä
”2—:‘:˜s CÓ
(×(Ò(ús   ‚)¡'¢)c                óx  — t        j                  | t         j                  «      }|sst        j                  | t         j                  «      }	 t        j
                  |«       t        j                  |«       t        j                  | t         j                  «      }|s1|r|j                  d| «       t        t        j                  d| › �«      ‚t        j                  | |«       	 t        j                  | |«       y# t        j                  |«       w xY w# t        $ r |r|j                  d|d¬«       Y yY yw xY w)zZcopy src to dst

    like shutil.copy2, but log errors in copystat instead of raising
    ú Source file, %s, is not writableúFile is not writable: úcopystat on %s failedT©Úexc_infoN)r   ÚaccessÚW_OKÚopenÚO_RDONLYÚfsyncÚcloseÚdebugÚPermissionErrorÚerrnoÚEACCESÚshutilÚcopyfileÚcopystatÚOSError)r   r   ÚlogÚis_writableÚfds        r   Ú
copy2_safer3   %   sî   € ô
 —)‘)˜C¤§¡Ó)€Káô �W‰W�Sœ"Ÿ+™+Ó&ˆð	Ü�H‰H�RŒLä�H‰H�RŒLä—i‘i ¤R§W¡WÓ-ˆñ ÙØ�I‰IÐ8¸#Ô>ÜœeŸl™lÐ.DÀSÀEÐ,JÓKÐKä
‡O�O�C˜ÔðCÜ�‰˜˜SÕ!øô �H‰H�R�Lûô ò CÙØ�I‰IÐ-¨s¸TˆIÖBñ ðCús   ÁC; Ã$D Ã;DÄD9Ä8D9c              ƒ  óš  K  — t        j                  | t         j                  «      s1|r|j                  d| «       t	        t
        j                  d| › �«      ‚t        t        j                  | |«      ƒ d{  –—†  	 t        t        j                  | |«      ƒ d{  –—†  y7 Œ)7 Œ# t        $ r |r|j                  d|d¬«       Y yY yw xY w­w)zicopy src to dst asynchronously

    like shutil.copy2, but log errors in copystat instead of raising
    r   r   Nr   Tr    )r   r"   r#   r(   r)   r*   r+   r   r,   r-   r.   r/   )r   r   r0   s      r   Úasync_copy2_safer5   F   s«   è ø€ ô
 �9‰9�Sœ"Ÿ'™'Ô"ÙØ�I‰IÐ8¸#Ô>ÜœeŸl™lÐ.DÀSÀEÐ,JÓKÐKä
”6—?‘? C¨Ó
-×-Ð-ðCÜ”v—‘¨¨SÓ1×1Ñ1ð .øà1ùÜò CÙØ�I‰IÐ-¨s¸TˆIÖBñ ðCüsH   ‚A4CÁ6B Á7CÁ<B$ ÂB"ÂB$ ÂCÂ"B$ Â$CÃCÃCÃCc                óŒ   — t         j                  j                  | «      \  }}t         j                  j                  |d|z   «      S )ztName of the intermediate file used in atomic writes.

    The .~ prefix will make Dropbox ignore the temporary file.z.~©r   ÚpathÚsplitÚjoin©r8   ÚdirnameÚbasenames      r   Úpath_to_intermediater>   X   s4   € ô Ÿ™Ÿ™ dÓ+Ñ€GˆXÜ�7‰7�<‰<˜ ¨¡Ó1Ð1r   c                óŒ   — t         j                  j                  | «      \  }}t         j                  j                  ||dz   «      S )zEName of invalid file after a failed atomic write and subsequent read.z.invalidr7   r;   s      r   Úpath_to_invalidr@   `   s3   € äŸ™Ÿ™ dÓ+Ñ€GˆXÜ�7‰7�<‰<˜ ¨JÑ!6Ó7Ð7r   c              +  óâ  K  — t         j                  j                  | «      rPt         j                  j                  t         j                  j	                  | «      t        j
                  | «      «      } t         j                  j	                  | «      xs t        j                  «       }t         j                  j                  | «      rƒt        j                  |t         j                  «      s_t        j                  | t         j                  «      r;|rdnd}|rt        | |fd|i|¤Ž}nt        | |fi |¤Ž}	 |–— |j                  «        yt        | «      }t         j                  j                  | «      rt        | ||¬«       |r"|j                  dd«       t        | dfd|i|¤Ž}nt        | dfi |¤Ž}	 |–— |j#                  «        t        j$                  |j'                  «       «       |j                  «        t         j                  j                  |«      rt        j(                  |«       yy# |j                  «        w xY w# t        $ r |j                  «        t!        || «       ‚ w xY w­w)aÑ  Context manager to write to a file only if the entire write is successful.

    This works by copying the previous file contents to a temporary file in the
    same directory, and renaming that file back to the target if the context
    exits with an error. If the context is successful, the new data is synced to
    disk and the temporary file is removed.

    Parameters
    ----------
    path : str
        The target file to write to.
    text : bool, optional
        Whether to open the file in text mode (i.e. to write unicode). Default is
        True.
    encoding : str, optional
        The encoding to use for files opened in text mode. Default is UTF-8.
    **kwargs
        Passed to :func:`io.open`.
    ÚwÚwbÚencodingN©r0   ÚnewlineÚ
)r   r8   Úislinkr:   r<   ÚreadlinkÚgetcwdÚisfiler"   r#   r$   r'   r>   r3   Ú
setdefaultÚBaseExceptionr   Úflushr&   ÚfilenoÚremove)	r8   ÚtextrD   r0   ÚkwargsÚdirpathÚmodeÚfileobjÚtmp_paths	            r   Úatomic_writingrW   f   sÅ  è ø€ ô0 
‡w�w‡~�~�dÔÜ�w‰w�|‰|œBŸG™GŸO™O¨DÓ1´2·;±;¸tÓ3DÓEˆô �g‰g�o‰o˜dÓ#Ò2¤r§y¡y£{€GÜ	‡w�w‡~�~�dÔ¤B§I¡I¨g´r·w±wÔ$?ÄBÇIÁIÈdÔTV×T[ÑT[ÔD\Ù‰s ˆáÜ˜4 ÑC°ÐC¸FÑC‰Gä˜4 Ñ0¨Ñ0ˆGð	ØŠMà�M‰MŒOØä# DÓ)€Hä	‡w�w‡~�~�dÔÜ�4˜ sÕ+áà×Ñ˜) TÔ*Ü�t˜SÑ>¨8Ð>°vÑ>‰ä�t˜TÑ, VÑ,ˆðØŠð ‡M�M„OÜ‡H�HˆW�^‰^ÓÔØ‡M�M„Oô 
‡w�w‡~�~�hÔÜ
�	‰	�(Õð  øð; �M‰M�Oûô" ò à�‰ŒÜ�X˜tÔ$Øð	üs8   ‚D1I/Ä4H0 Ä8A:I/Æ3I Æ7A9I/È0IÉI/É'I,É,I/c              +  ó²  K  — t         j                  j                  | «      rPt         j                  j                  t         j                  j	                  | «      t        j
                  | «      «      } |r"|j                  dd«       t        | dfd|i|¤Ž}nt        | dfi |¤Ž}	 |–— |j                  «        y# t        $ r |j                  «        ‚ w xY w­w)aÊ  Context manager to write file without doing atomic writing
    (for weird filesystem eg: nfs).

    Parameters
    ----------
    path : str
        The target file to write to.
    text : bool, optional
        Whether to open the file in text mode (i.e. to write unicode). Default is
        True.
    encoding : str, optional
        The encoding to use for files opened in text mode. Default is UTF-8.
    **kwargs
        Passed to :func:`io.open`.
    rF   rG   rB   rD   rC   N)
r   r8   rH   r:   r<   rI   rL   r$   rM   r'   )r8   rQ   rD   r0   rR   rU   s         r   Ú_simple_writingrY   ®   s­   è ø€ ô( 
‡w�w‡~�~�dÔÜ�w‰w�|‰|œBŸG™GŸO™O¨DÓ1´2·;±;¸tÓ3DÓEˆáà×Ñ˜) TÔ*Ü�t˜SÑ>¨8Ð>°vÑ>‰ä�t˜TÑ, VÑ,ˆðØŠð
 ‡M�M…Oøô	 ò Ø�‰ŒØðüs   ‚B!CÂ$B9 Â(CÂ9CÃCc                  óÎ   — e Zd ZdZ eddd¬«      Z eej                  ddd¬«      Z	e
d„ «       Ze
d	„ «       Ze
dd
„«       Zd„ Zd„ Z	 d	 dd„Zdd„Zdd„Z	 d	 	 	 	 	 	 	 dd„Zd„ Zy)ÚFileManagerMixina›  
    Mixin for ContentsAPI classes that interact with the filesystem.

    Provides facilities for reading, writing, and copying files.

    Shared by FileContentsManager and FileCheckpoints.

    Note
    ----
    Classes using this mixin must provide the following attributes:

    root_dir : unicode
        A directory against against which API-style paths are to be resolved.

    log : logging.Logger
    Ta  By default notebooks are saved on disk on a temporary file and then if successfully written, it replaces the old ones.
      This procedure, namely 'atomic_writing', causes some bugs on file system without operation order enforcement (like some networked fs).
      If set to False, the new notebook is written directly on the old one which could fail (eg: full filesystem or quota ))ÚconfigÚhelpÚsha256z:Hash algorithm to use for file content, support by hashlib)Údefault_valuer\   r]   c              /  ó¨   K  — | j                  |«      5  t        |g|¢­i |¤Ž5 }|–— ddd«       ddd«       y# 1 sw Y   ŒxY w# 1 sw Y   yxY w­w)z<wrapper around io.open that turns permission errors into 403N)Úperm_to_403r$   ©ÚselfÚos_pathÚargsrR   Úfs        r   r$   zFileManagerMixin.openö   sG   è ø€ ð ×Ñ˜gÕ&¬¨WÐ(F°tÒ(F¸vÒ(FÈ!ØŠG÷ )G×&Ð&×(FÐ(Fú×&Ð&üs.   ‚A”A¤:©A±	AºA	¿AÁAÁAc              /  ó0  K  — | j                  |«      5  | j                  |d<   | j                  rt        |g|¢­i |¤Ž5 }|–— ddd«       nt	        |g|¢­i |¤Ž5 }|–— ddd«       ddd«       y# 1 sw Y   ŒxY w# 1 sw Y   ŒxY w# 1 sw Y   yxY w­w)záwrapper around atomic_writing that turns permission errors to 403.
        Depending on flag 'use_atomic_writing', the wrapper perform an actual atomic writing or
        simply writes the file (whatever an old exists or not)r0   N)ra   r0   Úuse_atomic_writingrW   rY   rb   s        r   rW   zFileManagerMixin.atomic_writingü   s�   è ø€ ð
 ×Ñ˜gÕ&Ø ŸH™HˆF�5‰MØ×&Ò&Ü# GÐ=¨dÒ=°fÒ=ÀØ’G÷ >Ð=ô % WÐ>¨tÒ>°vÒ>À!Ø’G÷ ?÷ 'Ð&÷ >Ð=ú÷ ?Ð>ú÷ 'Ð&üsK   ‚B”+B
¿A2ÁB
ÁA>Á!B
Á)	BÁ2A;	Á7B
Á>B	ÂB
Â
BÂBc              #  ó  K  — 	 d–— y# t         $ rk}|j                  t        j                  t        j                  hv r9|s|j                  xs d}t        || j                  ¬«      }t        dd|z  «      |‚‚ d}~ww xY w­w)z7context manager for turning permission errors into 403.Nzunknown file)Úrooti“  zPermission denied: %s)r/   r*   ÚEPERMr+   Úfilenamer   Úroot_dirr	   )rc   rd   Úer8   s       r   ra   zFileManagerMixin.perm_to_403
  sq   è ø€ ð	ÜøÜò 
	Ø�w‰wœ5Ÿ;™;¬¯©Ð5Ñ5ñ ØŸj™jÒ:¨N�GÜ" 7°·±Ô?�Ü Ð%<¸tÑ%CÓDÈ!ÐKàûð
	üs%   ‚B „	 ˆB ‰	A=’A&A8Á8A=Á=B c                ó4   — t        ||| j                  ¬«       y©zPcopy src to dest

        like shutil.copy2, but log errors in copystat
        rE   N)r3   r0   ©rc   r   Údests      r   Ú_copyzFileManagerMixin._copy  s   € ô
 	�3˜ $§(¡(Ö+r   c                óˆ  — t         j                  j                  | j                  «      }t         j                  j	                  |«      d   rt        dd|z  «      ‚t        t        |«      |«      }	 t        j                  |«       t         j                  j                  |«      |k7  rst         j                  j                  |«      t         j                  j                  z   j                  |t         j                  j                  z   «      st        dd|z  «      ‚|S # t        $ r Y Œ¢t        $ r t        d|› d�«      d‚w xY w)aS  Given an API path, return its file system path.

        Parameters
        ----------
        path : str
            The relative API path to the named file.

        Returns
        -------
        path : str
            Native, absolute OS path to for a file.

        Raises
        ------
        404: if path is outside root
        r   i”  z%s is not a relative API pathz is not a valid pathNz%%s is outside root contents directory)r   r8   Úabspathrm   Ú
splitdriver	   r   r   Úlstatr/   Ú
ValueErrorr<   ÚsepÚ
startswith)rc   r8   rj   rd   s       r   Ú_get_os_pathzFileManagerMixin._get_os_path"  s  € ô& �w‰w�‰˜tŸ}™}Ó-ˆä�7‰7×Ñ˜dÓ# AÒ&Ü˜CÐ!@À4Ñ!GÓHÐHÜœW T›]¨DÓ1ˆð	JÜ�H‰H�WÔô �7‰7�?‰?˜4Ó  DÒ(Ü—G‘G—O‘O GÓ,¬r¯w©w¯{©{Ñ:×FÑFÀtÌbÏgÉgÏkÉkÑGYÔZÜ Ð%LÈtÑ%SÓTÐTØˆøô ò 	ñ Üò 	JÜ˜C D 6Ð)=Ð!>Ó?ÀTÐIð	Jús   Á1D Ä	EÄ(ENc                ó¨  — | j                  |d|¬«      }	 t        j                  |d   ||¬«      }|r||d   fS |S # t        $ r}|}Y d}~nd}~ww xY wt	        |«      }	| j
                  rt        j                  j                  |	«      st        dd|› d	|›�«      ‚t        |«      }
t        ||
«       t        |	|«       | j                  ||||¬
«      S )ú Read a notebook from an os path.rQ   )Úrawr   ©Ú
as_versionÚcapture_validation_erroré   Né�  úUnreadable Notebook: Ú ©r�   r~   )Ú
_read_fileÚnbformatÚreadsÚ	Exceptionr>   rh   r   r8   Úexistsr	   r@   r   Ú_read_notebook©rc   rd   r€   r�   r~   ÚanswerÚnbrn   Úe_origrV   Úinvalid_files              r   rŒ   zFileManagerMixin._read_notebookK  së   € ð —‘ ¨&°c�Ó:ˆð		Ü—‘Ø�q‘	Ø%Ø)AôˆBñ '*�B˜˜q™	�?Ð1¨rÐ1øÜò 	Ø�Fûð	úô (¨Ó0ˆà×&Ò&¬b¯g©g¯n©n¸XÔ.FÜØØ'¨ y°°&°Ð<óð ô ' wÓ/ˆÜ�W˜lÔ+Ü�X˜wÔ'Ø×"Ñ"Ø�ZÐ:RÐX[ð #ó 
ð 	
s   –#< º< ¼	AÁAÁAc                ó¢   — | j                  |d¬«      5 }t        j                  ||t        j                  |¬«       ddd«       y# 1 sw Y   yxY w©zSave a notebook to an os_path.úutf-8)rD   )Úversionr�   N)rW   rˆ   ÚwriteÚ
NO_CONVERT©rc   rd   r�   r�   rf   s        r   Ú_save_notebookzFileManagerMixin._save_notebooko  sA   € à× Ñ  °7Ð Ô;¸qÜ�N‰NØØÜ ×+Ñ+Ø)Aõ	÷ <×;Ñ;ús   ”(AÁAc                óŒ   — | j                   }t        j                  |«      }|j                  |«       |j	                  «       |dœS )a^  Compute the hash hexdigest for the provided bytes.

        The hash algorithm is provided by the `hash_algorithm` attribute.

        Parameters
        ----------
        byte_content : bytes
            The bytes to hash

        Returns
        -------
        A dictionary to be appended to a model {"hash": str, "hash_algorithm": str}.
        )ÚhashÚhash_algorithm)rœ   ÚhashlibÚnewÚupdateÚ	hexdigest)rc   Úbyte_contentÚ	algorithmÚhs       r   Ú	_get_hashzFileManagerMixin._get_hashy  s:   € ð ×'Ñ'ˆ	Ü�K‰K˜	Ó"ˆØ	�‰�ÔØŸ™›¸ÑCÐCr   c                ó  — t         j                  j                  |«      st        dd|z  «      ‚| j	                  |d«      5 }|j                  «       }ddd«       |dk(  r|rd|fS dfS |�|dk(  r*	 |rj                  d«      d|fS j                  d«      dfS |rt        «      j                  d«      d|fS t        «      j                  d«      dfS # 1 sw Y   Œ…xY w# t        $ r!}|dk(  rt        dd|z  d	¬
«      |‚Y d}~Œld}~ww xY w©a­  Read a non-notebook file.

        Parameters
        ----------
        os_path: str
            The path to be read.
        format: str
            If 'text', the contents will be decoded as UTF-8.
            If 'base64', the raw bytes contents will be encoded as base64.
            If 'byte', the raw bytes contents will be returned.
            If not specified, try to decode as UTF-8, and fall back to base64
        raw: bool
            [Optional] If True, will return as third argument the raw bytes content

        Returns
        -------
        (content, format, byte_content) It returns the content in the given format
        as well as the raw byte content.
        rƒ   zCannot read non-file %sÚrbNÚbyterQ   Úutf8z%s is not UTF-8 encodedz
bad format)ÚreasonÚasciiÚbase64)	r   r8   rK   r	   r$   ÚreadÚdecodeÚUnicodeErrorr   ©rc   rd   Úformatr~   rf   Úbcontentrn   s          r   r‡   zFileManagerMixin._read_fileŒ  sD  € ô, �w‰w�~‰~˜gÔ&Ü˜CÐ!:¸WÑ!DÓEÐEà�Y‰Y�w Ô%¨Ø—v‘v“xˆH÷ &ð �VÒá36�H˜f hÐ/ÐN¸XÀvÐ<NÐNàˆ>˜V vÒ-ðñ ð —_‘_ VÓ,¨f°hÐ?ðð !Ÿ™¨Ó/Øððñ" ô ˜Ó"×)Ñ)¨'Ó2°H¸hÐGð	
ô ˜HÓ%×,Ñ,¨WÓ5Øðð	
÷5 &Ð%ûô&  ò Ø˜VÒ#Ü#ØØ1°GÑ;Ø+ôð ð	ô $ûðús*   ÁCÁ2C" ÂC" ÃCÃ"	DÃ+DÄDc                óF  — |dvrt        dd«      ‚	 |dk(  r|j                  d«      }n|j                  d«      }t        |«      }| j	                  |d
¬«      5 }|j                  |«       d	d	d	«       y	# t        $ r}t        dd|› d|› �«      |‚d	}~ww xY w# 1 sw Y   y	xY w©zSave content of a generic file.>   rQ   r¬   rƒ   z:Must specify format of file contents as 'text' or 'base64'rQ   r©   r«   zEncoding error saving z: NF)rQ   )r	   Úencoder   rŠ   rW   r–   ©rc   rd   Úcontentr±   r²   Ú	b64_bytesrn   rf   s           r   Ú
_save_filezFileManagerMixin._save_fileÈ  s·   € àÐ+Ñ+ÜØØLóð ð	QØ˜ÒØ"Ÿ>™>¨&Ó1‘à#ŸN™N¨7Ó3�	Ü& yÓ1�ð × Ñ  ¨uÐ Ô5¸Ø�G‰G�HÔ÷ 6Ð5øô ò 	QÜ˜CÐ#9¸'¸À"ÀQÀCÐ!HÓIÈqÐPûð	Qú÷ 6Ð5ús#   ’3A3 ÁBÁ3	BÁ<BÂBÂB )Ú ©é   NF©r~   Úbool©N)r¡   ÚbytesÚreturnzdict[str, str]©F©rd   Ústrr±   z
str | Noner~   r¾   rÁ   z8tuple[str | bytes, str] | tuple[str | bytes, str, bytes])Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   rh   r   r�   Úalgorithms_availablerœ   r   r$   rW   ra   rs   r{   rŒ   r™   r¤   r‡   r¹   © r   r   r[   r[   Õ   sÖ   „ ññ" ØØðôÐñ Ø×$Ñ$ØØØIô	€Nð ñó ðð
 ñó ðð òó ðò ,ò'ðT QVð"
ØIMó"
óHóDð( =Bð:
Øð:
Ø$.ð:
Ø59ð:
à	Aó:
óxr   r[   c                  óL   — e Zd ZdZd„ Z	 d	 d	d„Zd
d„Z	 d	 	 	 	 	 	 	 dd„Zd„ Zy)ÚAsyncFileManagerMixinzY
    Mixin for ContentsAPI classes that interact with the filesystem asynchronously.
    c              ƒ  óP   K  — t        ||| j                  ¬«      ƒ d{  –—†  y7 Œ­wrp   )r5   r0   rq   s      r   rs   zAsyncFileManagerMixin._copyá  s   è ø€ ô
 ˜s D¨d¯h©hÔ7×7Ò7ús   ‚&ž$Ÿ&Nc              ƒ  ó,  K  — | j                  |d|«      ƒ d{  –—† }	 t        t        t        j                  ||¬«      |d   «      ƒ d{  –—† }|r||d   fS |S 7 ŒA7 Œ# t
        $ r}|}Y d}~nd}~ww xY wt        |«      }	| j                  rt        j                  j                  |	«      st        dd|› d|›�«      ‚t        |«      }
t        ||
«      ƒ d{  –—†7   t        |	|«      ƒ d{  –—†7   | j                  ||||¬	«      ƒ d{  –—†7  }|S ­w)
r}   rQ   Nr   r   r‚   rƒ   r„   r…   r†   )r‡   r   r   rˆ   r‰   rŠ   r>   rh   r   r8   r‹   r	   r@   r   rŒ   r�   s              r   rŒ   z$AsyncFileManagerMixin._read_notebookè  s)  è ø€ ð —‘ w°¸Ó<×<ˆð	ÜÜÜ—N‘NØ)Ø-Eôð
 �q‘	ó÷ ˆBñ '*�B˜˜q™	�?Ð1¨rÐ1ð =øðùô ò 	Ø�Fûð	úô (¨Ó0ˆà×&Ò&¬b¯g©g¯n©n¸XÔ.FÜØØ'¨ y°°&°Ð<óð ô ' wÓ/ˆÜ  ¨,Ó7×7Ñ7Ü  ¨7Ó3×3Ñ3Ø×*Ñ*Ø�ZÐ:RÐX[ð +ó 
÷ 
ð 
ˆð ˆùs{   ‚D™AšDŸ,A ÁAÁA ÁDÁA ÁDÁA Á	A4Á(A/Á*DÁ/A4Á4A%DÃCÃDÃ.C1Ã/DÄDÄDc              ƒ  óÚ   K  — | j                  |d¬«      5 }t        t        t        j                  t        j
                  |¬«      ||«      ƒ d{  –—†  ddd«       y7 Œ# 1 sw Y   yxY w­wr“   )rW   r   r   rˆ   r–   r—   r˜   s        r   r™   z$AsyncFileManagerMixin._save_notebook  sf   è ø€ à× Ñ  °7Ð Ô;¸qÜÜÜ—N‘NÜ$×/Ñ/Ø-Eôð
 Øó÷ ð ÷ <Ð;ðø÷ <Ð;üs.   ‚A+–9AÁAÁAÁ	A+ÁAÁA(Á$A+c              ƒ  óD  K  — t         j                  j                  |«      st        dd|z  «      ‚| j	                  |d«      5 }t        |j                  «      ƒ d{  –—† }ddd«       |dk(  r|rd|fS dfS |�|dk(  r*	 |rj                  d«      d|fS j                  d«      dfS |rt        «      j                  d«      d|fS t        «      j                  d«      dfS 7 Œˆ# 1 sw Y   Œ‡xY w# t        $ r!}|dk(  rt        dd|z  d	¬
«      |‚Y d}~Œnd}~ww xY w­wr¦   )
r   r8   rK   r	   r$   r   r­   r®   r¯   r   r°   s          r   r‡   z AsyncFileManagerMixin._read_file  sP  è ø€ ô, �w‰w�~‰~˜gÔ&Ü˜CÐ!:¸WÑ!DÓEÐEà�Y‰Y�w Ô%¨Ü% a§f¡fÓ-×-ˆH÷ &ð �VÒá36�H˜f hÐ/ÐN¸XÀvÐ<NÐNàˆ>˜V vÒ-ðñ ð —_‘_ VÓ,¨f°hÐ?ðð !Ÿ™¨Ó/Øððñ" ô ˜Ó"×)Ñ)¨'Ó2°H¸hÐGð	
ô ˜hÓ'×.Ñ.¨wÓ7¸ÐBð	
ð3 .ø÷ &Ð%ûô&  ò Ø˜VÒ#Ü#ØØ1°GÑ;Ø+ôð ð	ô $ûðüsf   ‚AD ÁC'ÁC%ÁC'Á!D ÂC3 ÂD ÂC3 Â)<D Ã%C'Ã'C0Ã,D Ã3	DÃ<DÄD ÄDÄD c              ƒ  ól  K  — |dvrt        dd«      ‚	 |dk(  r|j                  d«      }n|j                  d«      }t        |«      }| j	                  |d
¬«      5 }t        |j                  |«      ƒ d	{  –—†  d	d	d	«       y	# t        $ r}t        dd|› d|› �«      |‚d	}~ww xY w7 Œ1# 1 sw Y   y	xY w­wr´   )r	   rµ   r   rŠ   rW   r   r–   r¶   s           r   r¹   z AsyncFileManagerMixin._save_fileV  sÈ   è ø€ àÐ+Ñ+ÜØØLóð ð	QØ˜ÒØ"Ÿ>™>¨&Ó1‘à#ŸN™N¨7Ó3�	Ü& yÓ1�ð × Ñ  ¨uÐ Ô5¸Ü˜1Ÿ7™7 HÓ-×-Ð-÷ 6Ð5øô ò 	QÜ˜CÐ#9¸'¸À"ÀQÀCÐ!HÓIÈqÐPûð	Qúð .ø÷ 6Ð5üsR   ‚B4”3B ÁB4ÁB(Á4B&Á5B(Á9	B4Â	B#ÂBÂB#Â#B4Â&B(Â(B1Â-B4r»   r½   r¿   rÂ   rÃ   )	rÅ   rÆ   rÇ   rÈ   rs   rŒ   r™   r‡   r¹   rÊ   r   r   rÌ   rÌ   Ü  sW   „ ñò8ð QVð&ØIMó&óPð =Bð7
Øð7
Ø$.ð7
Ø59ð7
à	Aó7
ór.r   rÌ   r¿   )Tr”   N)(rÈ   Ú
__future__r   r*   r�   r   r,   r¬   r   r   Ú
contextlibr   Ú	functoolsr   rˆ   Úanyio.to_threadr   Útornado.webr	   Ú	traitletsr
   r   Útraitlets.configr   Útraitlets.config.configurabler   Újupyter_server.utilsr   r   r   r   r   r3   r5   r>   r@   rW   rY   r[   rÌ   rÊ   r   r   Ú<module>rÛ      sª   ðñõ #ã Û Û 	Û ß +Ý %Ý ã Ý $Ý !ß  Ý )Ý =ç AÑ Aòò
)ó
CóBCò$2ò8ð òDó ðDðN ò#ó ð#ôLDÐ*¨Lô DôNK.Ð,õ K.r   