a
    ø£Be€  ã                   @   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   úb/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/jupyterlab_server/pytest_plugin.pyr      s    
r   c                 C   s
   t | dƒS )NZapp_settings©r   ©r   r   r   r   Ú<lambda>   ó    r   c                 C   s
   t | dƒS )NZuser_settingsr   r   r   r   r   r      r   c                 C   s
   t | dƒS )NÚschemasr   r   r   r   r   r      r   c                 C   s
   t | dƒS )NÚ
workspacesr   r   r   r   r   r      r   c                 C   s
   t | dƒS )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 ]ª}|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  ƒ qn1 �s0    Y  qnttdddƒ}	ttˆ ƒdƒ}
tj |
¡�rNt |
¡ t |	|
¡ ttddƒ}t |¡D ]F}t||ƒ}	ttˆƒ|ƒ}
tj |
¡�r¤t |
¡ t |	tˆƒ¡ �qp|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)Z
static_dirZtemplates_dirZapp_urlÚapp_settings_dirÚuser_settings_dirÚschemas_dirÚworkspaces_dirZ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>
Z	test_datar   z@jupyterlab)zapputils-extensionzcodemirror-extensionz
-federatedzpackage.orig.jsonÚwT)Ú	extension)ÚnameZ
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    Ztarget_nameÚtargetÚfidÚdataZws_pathÚitemr   r   r   Úmake_labserver_extension_app#   sD    
ÿ#


.


r8   c                 C   s   |ƒ }|  | ¡ | ¡  |S )zA lab server app.)Z_link_jupyter_server_extensionZ
initialize)Zjp_serverappr8   Zappr   r   r   Úlabserverapp‡   s    
r9   )Ú__doc__r+   r$   Úos.pathr
   r(   r%   r   r"   ZpytestZjupyterlab_serverr   Zpytest_pluginsr   ÚabspathÚdirnameÚ__file__r#   Zfixturer   r   r   r   r   r8   r9   r   r   r   r   Ú<module>   s&   
c