o
    iD                     @   s4   d dl Z d dlZd dlZd dlZdd Zdd ZdS )    Nc                   C   s   dddddgS )z&Metadata for notebook bundlerextensiontarball_bundlerz!nbclassic.bundler.tarball_bundlerzNotebook Tarball (tar.gz)download)namemodule_namelabelgroup r   r   r   \/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/nbclassic/bundler/tarball_bundler.py_jupyter_bundlerextension_paths   s
   r
   c           	   	   C   s   |d }t |d d}tj|d }d|}t|}t	||_
t <}tj|d|d}||t| W d   n1 sFw   Y  | | | d	d
 | |  W d   dS 1 shw   Y  dS )a
  Create a compressed tarball containing the notebook document.
    
    Parameters
    ----------
    handler : tornado.web.RequestHandler
        Handler that serviced the bundle request
    model : dict
        Notebook model from the configured ContentManager
    r   contentzutf-8r   z	{}.tar.gzzw:gz)fileobjNzContent-Typezapplication/gzip)nbformatwritesencodeospathsplitextformattarfileTarInfolensizeioBytesIOopenaddfileset_attachment_header
set_headerfinishgetvalue)	handlermodelnotebook_filenamenotebook_contentnotebook_nametar_filenameinfo
tar_buffertarr   r   r	   bundle   s   





"r)   )r   r   r   r   r
   r)   r   r   r   r	   <module>   s   