
    Mh                     @   d dl Zd dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d Z ej        d           Z ej        d	           Z ej        d
           Z ej        d           Zej        d             Zej        d             Zej        d             ZdS )    N)url_path_join)	LabConfig)
url_escape)UnicodeLabAppc                 n     | j         | }|                                s|                    d           |S )NT)parents)joinpathexistsmkdir)tmp_pathpartspaths      X/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/jupyterlab/pytest_plugin.pyr   r      s:    8e$D;;== !

4
   K    c                 "    t          | d          S )Napp_settingsr   r   s    r   <lambda>r      s    5>3R3R r   c                 "    t          | d          S )Nuser_settingsr   r   s    r   r   r      s    E(O4T4T r   c                 "    t          | d          S )Nschemasr   r   s    r   r   r      s    eHi.H.H r   c                 "    t          | d          S )N
workspacesr   r   s    r   r   r      s    x1N1N r   c                 z      fd}                     d          }|                    d           |S )Nc                  P     G fddt                     } |            }|S )Nc                       e Zd ZdZdZ edd          Z ed e           e          d e            e           e           e                    Z	dS )7make_lab_app.<locals>._make_lab_app.<locals>.TestLabAppz/lab/z'The default URL to redirect to from `/`)helpzJupyterLab Test App)app_name
static_dirtemplates_dirapp_urlapp_settings_diruser_settings_dirschemas_dirworkspaces_dirN)
__name__
__module____qualname__base_urlextension_urlr   default_urlr   str
lab_config)r(   jp_root_dirjp_template_dirr*   r)   r+   s   r   
TestLabAppr!   !   s        H"M!'#,UVVVK".3{++!c/22!$%5!6!6"%#&7"8"8C,,"s>22	 	 	JJJr   r6   r   )	kwargsr6   appr(   r4   r5   r*   r)   r+   s	      r   _make_lab_appz#make_lab_app.<locals>._make_lab_app    sb    	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 jll
r   z
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>
)r   
write_text)r4   r5   r(   r)   r*   r+   r9   indexs   ``````  r   make_lab_appr<      su             ( $$\22E		     D r   c                 l     |            }|                     |            |                                 |S )N)_link_jupyter_server_extension
initialize)jp_serverappr<   r8   s      r   labapprA   Z   s6    
,..C&&|444NNJr   c                 "     ddd fd
}|S )z3fetch fixture that handles auth, base_url, and pathN)headersparamsc                     t          t          | d          }t          	|          }t          j                            |pi           }|dz   |z   }| pi } |                                 j        |f| dd|S )NF)plus?   )rC   request_timeout)r   r   urllibparse	urlencodeupdatefetch)
rC   rD   r   r7   path_url
params_urlurlhttp_server_clientjp_auth_headerjp_base_urls
          r   client_fetchz fetch_long.<locals>.client_fetchf   s    mU3%@@@ h77\++FLb99
nz)-R~&&&'!'\Wc\\U[\\\r    )rR   rS   rT   rU   s   ``` r   
fetch_longrW   b   sJ     &*$ 
] 
] 
] 
] 
] 
] 
] 
] 
] r   )urllib.parserJ   pytestjupyter_server.utilsr   jupyterlab_serverr   tornado.escaper   	traitletsr   jupyterlab.labappr   r   fixturer(   r)   r*   r+   r<   rA   rW   rV   r   r   <module>r`      s?        . . . . . . ' ' ' ' ' ' % % % % % %       $ $ $ $ $ $   "6>"R"RSS "FN#T#TUU fnHHII N NOO : : :z        r   