o
    i                     @   s   d Z ddlZddlZddlmZ ddlZddlmZ ddl	Z	ddl
mZ dgZdd ZejejeZe	dd	 Ze	d
d	 Ze	dd	 Ze	dd	 Ze	dd	 Ze	jdd Ze	jdd ZdS )zpytest fixtures.    N)join)LabServerAppzpytest_jupyter.jupyter_serverc                 G   s"   | j | }| s|jdd |S )zUtil for making a directory.T)parents)joinpathexistsmkdir)tmp_pathpartspath r   Z/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/jupyterlab_server/pytest_plugin.pyr      s   
r   c                 C   
   t | dS )Napp_settingsr   r   r   r   r   <lambda>      
 r   c                 C   r   )Nuser_settingsr   r   r   r   r   r      r   c                 C   r   )Nschemasr   r   r   r   r   r      r   c                 C   r   )N
workspacesr   r   r   r   r   r      r   c                 C   r   )Nlabextensions_dirr   r   r   r   r   r       r   c              	      s   fdd} d}|d ttddd}	ttd}
tj|
r/t	|
 t
|	|
 dD ]T}|d	 }ttd|}ttddd|}	t|dd|}
t|
r^t	|
 t
|	|
 tt|d
d}t|tddd}t|| W d   n1 sw   Y  q7ttddd}	tt d}
tj|
rt|
 t|	|
 ttdd}t|D ]!}t||}	tt|}
tj|
rt|
 t|	t q|S )z8Return a factory function for a labserver extension app.c               
      s6   t ttdt ttttgdS )z/Factory function for lab server extension apps.z/lab)
static_dirtemplates_dirapp_urlapp_settings_diruser_settings_dirschemas_dirworkspaces_dirextra_labextensions_path)r   str)kwargsr   jp_root_dirjp_template_dirr   r   r   r   r   r   _make_labserver_extension_app/   s   zCmake_labserver_extension_app.<locals>._make_labserver_extension_appz
index.htmla  
<!DOCTYPE html>
<html>
<head>
  <title>{{page_config['appName'] | e}}</title>
</head>
<body>
    {# Copy so we do not modify the page_config with updates. #}
    {% set page_config_full = page_config.copy() %}

    {# Set a dummy variable - we just want the side effect of the update. #}
    {% set _ = page_config_full.update(baseUrl=base_url, wsUrl=ws_url) %}

      <script id="jupyter-config-data" type="application/json">
        {{ page_config_full | tojson }}
      </script>
  <script src="{{page_config['fullStaticUrl'] | e}}/bundle.js" main="index"></script>

  <script type="text/javascript">
    /* Remove token from URL. */
    (function () {
      var parsedUrl = new URL(window.location.href);
      if (parsedUrl.searchParams.get('token')) {
        parsedUrl.searchParams.delete('token');
        window.history.replaceState({ }, '', parsedUrl.href);
      }
    })();
  </script>
</body>
</html>
	test_datar   z@jupyterlab)zapputils-extensionzcodemirror-extensionz
-federatedzpackage.orig.jsonwT)	extension)name
jupyterlabNzapp-settingszoverrides.jsonr   )r   
write_textpjoinHEREr   osr
   r   shutilrmtreecopytreeospopendictjsondumpremovecopyfilelistdircopy)r"   r#   r   r   r   r   r   r$   indexsrcdstr(   target_nametargetfiddataws_pathitemr   r!   r   make_labserver_extension_app#   sH   
#





rC   c                 C   s   | }| |  |  |S )zA lab server app.)_link_jupyter_server_extension
initialize)jp_serverapprC   appr   r   r   labserverapp   s   
rH   )__doc__r4   r-   os.pathr
   r1   r.   r   r+   pytestjupyterlab_serverr   pytest_pluginsr   abspathdirname__file__r,   fixturer   r   r   r   r   rC   rH   r   r   r   r   <module>   s(   
c