
    @=d
                     <    d dl Z d dlZd dlZd dlmc mZ d Zd ZdS )    Nc                      dddddg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
       =lib/python3.11/site-packages/nbclassic/bundler/zip_bundler.py_jupyter_bundlerextension_pathsr      s$     ,5:	   r   c                 Z   t           j                            | j        d         j        |d                   }|d         }t           j                            |          d         }t           j                            |          d         dz   }|                     |           |                     dd           t          j	        |d          }t          j                    }t          j        |d	t          j        
          }|                    ||           t           j                            |          }	|D ]8}
t           j                            |	|
          }|                    ||
           9|                                 |                     |                                           dS )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      sr    ',,w/0BCLf KfG$$%677:M 7##M2215>L!!,///~'8999 -k1==M J?:CW=QRRRDJJ{-...7??;//L - 1 1l,@AA

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