
    ^h                      :    S SK r S SKrS SKrS SKJs  Jr  S rS rg)    Nc                      SSSSS./$ )z&Metadata for notebook bundlerextensionnotebook_zip_downloadzIPython Notebook bundle (.zip)znbclassic.bundler.zip_bundlerdownload)namelabelmodule_namegroup r
       W/home/james-whalen/.local/lib/python3.13/site-packages/nbclassic/bundler/zip_bundler.py_jupyter_bundlerextension_pathsr      s     ,5:	  r   c                 &   [         R                  R                  U R                  S   R                  US   5      nUS   n[         R                  R                  U5      S   n[         R                  R                  U5      S   S-   nU R                  U5        U R                  SS5        [        R                  " US5      n[        R                  " 5       n[        R                  " US	[        R                  S
9nUR                  X#5        [         R                  R!                  U5      n	U H3  n
[         R                  R                  X5      nUR                  X5        M5     UR#                  5         U R%                  UR'                  5       5        g)a  Create a zip file containing the original notebook and files referenced
from it. Retain the referenced files in paths relative to the nbclassic.
Return the zip as a file download.

Assumes the notebook and other files are all on local disk.

Parameters
----------
handler : tornado.web.RequestHandler
    Handler that serviced the bundle request
model : dict
    Notebook model from the configured ContentManager
contents_managerpathr   r   z.zipzContent-Typezapplication/zip   w)modecompressionN)osr   joinsettingsroot_dirsplitextset_attachment_header
set_headertoolsget_file_referencesioBytesIOzipfileZipFileZIP_DEFLATEDwritedirnameclosefinishgetvalue)handlermodelabs_nb_pathnotebook_filenamenotebook_namezip_filenameref_filenames
zip_bufferzipfnotebook_dirnb_relative_filenameabs_fns               r   bundler4      s6    '',,w//0BCLLfKfGG$$%67:M 77##M215>L!!,/~'89 --k1=M J??:CW=Q=QRDJJ{.77??;/L -lA

60	 !. 	JJL NN:&&()r   )r   r   r    nbclassic.bundler.toolsbundlerr   r   r4   r
   r   r   <module>r7      s     
 	  ' '**r   