o
    ^iD                     @   s   d Z ddlmZ ddlmZ ddlmZ ddlmZmZ ddl	m
Z ddlmZmZmZmZ dd	lmZ dd
lmZmZ G dd deeeZej ZZdS )JupyterLab Server Application    )glob)relpath)Any)ExtensionAppExtensionAppJinjaMixin)url_path_join)DictIntegerUnicodeobserve   )__version__)	LabConfigadd_handlersc                   @   s   e Zd ZdZdZdZdZdZede	fddZ
edd	d
ZdZeddd
jedZeddddZeddddZeddddZeddddZeddddZei dddZdddZeee deddfddZd$ddZd$d d!Zd$d"d#Z dS )%LabServerAppz1A Lab Server Application that runs out-of-the-boxjupyterlab_serverz/labr   z	/lab/treereturnc                 C   s   | j S )N)nameself r   P/home/ubuntu/hpml_nyu/venv/lib/python3.10/site-packages/jupyterlab_server/app.pyapp_namespace   s   zLabServerApp.app_namespacez'The default URL to redirect to from `/`)helpT zThe version of the application.)defaultz6Deprecated, use `LabServerApp.blocked_extensions_uris`)configr   z
        A list of comma-separated URIs to get the blocked extensions list

        .. versionchanged:: 2.0.0
            `LabServerApp.blacklist_uris` renamed to `blocked_extensions_uris`
        z6Deprecated, use `LabServerApp.allowed_extensions_uris`z
        "A list of comma-separated URIs to get the allowed extensions list

        .. versionchanged:: 2.0.0
            `LabServerApp.whitetlist_uris` renamed to `allowed_extensions_uris`
        i  z2The interval delay in seconds to refresh the listszThe optional kwargs to use for the listings HTTP requests             as described on https://2.python-requests.org/en/v2.7.0/api/#requests.request)blocked_extensions_uris1.2)allowed_extensions_urisr   )blacklist_uriswhitelist_urischangeNc                 C   s^   |j }| j|\}}t| |}||jkr-| jd| jj||| jj| t	| ||j dS dS )zobserver for deprecated traitsz7%s.%s is deprecated in JupyterLab %s, use %s.%s insteadN)
r   _deprecated_aliasesgetgetattrnewlogwarning	__class____name__setattr)r   r#   old_attrnew_attrversion	new_valuer   r   r   _deprecated_traitU   s   

	zLabServerApp._deprecated_traitc                    s   t jdg }|j jj D ]  fddt  dddD }|| qjdt	|i j
rXtj
jdd}|rZj
j}|jd	i }t	||d< dS dS dS )
zuInitialize the settings:

        set the static files as immutable, since they should have all hashed name.
        static_immutable_cachec                    s   g | ]}t jt| qS r   )ujoinlabextensions_urlr   ).0pathextension_pathr   r   r   
<listcomp>v   s    z4LabServerApp.initialize_settings.<locals>.<listcomp>z
/**/staticT)	recursiveuntracked_message_typesNpage_config_data)setsettingsr%   addstatic_url_prefixlabextensions_pathextra_labextensions_pathr   updatelist	serverappr&   kernel_managerweb_app
setdefault)r   immutable_cacheextensions_urlr;   rG   r<   r   r7   r   initialize_settingsj   s$   
z LabServerApp.initialize_settingsc                 C   s   | j g| _| jg| _dS )zInitialize templates.N)
static_dirstatic_pathstemplates_dirtemplate_pathsr   r   r   r   initialize_templates   s   
z!LabServerApp.initialize_templatesc                 C   s   t | j|  dS )zInitialize handlers.N)r   handlersr   r   r   r   initialize_handlers   s   z LabServerApp.initialize_handlers)r   N)!r+   
__module____qualname____doc__r   extension_urlapp_namefile_url_prefixpropertystrr   r   default_urlload_other_extensionstagr   app_versionr!   r   r"   r    r
   listings_refresh_secondsr	   listings_request_optionsr$   r   rD   r   r1   rK   rP   rR   r   r   r   r   r      sV    


r   N)rU   r   os.pathr   typingr   $jupyter_server.extension.applicationr   r   jupyter_server.utilsr   r3   	traitletsr	   r
   r   r   _versionr   rQ   r   r   r   launch_instancemainlaunch_new_instancer   r   r   r   <module>   s    