o
    tf                     @   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-boxZjupyterlab_serverz/labr   z	/lab/treereturnc                 C   s   | j S )N)nameself r   ^/var/www/html/software/conda/envs/catlas/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                    st   t jdg }|j jj D ]  fddt  dddD }|| qjdt	|i dS )zuInitialize the settings:

        set the static files as immutable, since they should have all hashed name.
        Zstatic_immutable_cachec                    s   g | ]}t jt| qS r   )ujoinZlabextensions_urlr   ).0pathZextension_pathr   r   r   
<listcomp>v   s    z4LabServerApp.initialize_settings.<locals>.<listcomp>z
/**/staticT)	recursiveN)
setsettingsr$   addZstatic_url_prefixZlabextensions_pathZextra_labextensions_pathr   updatelist)r   Zimmutable_cacheZextensions_urlr   r4   r   initialize_settingsj   s   z LabServerApp.initialize_settingsc                 C   s   | j g| _| jg| _dS )zInitialize templates.N)Z
static_dirZstatic_pathsZtemplates_dirZ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   Zextension_urlZapp_nameZfile_url_prefixpropertystrr   r   Zdefault_urlZload_other_extensionstagr   Zapp_versionr    r   r!   r   r
   Zlistings_refresh_secondsr	   Zlistings_request_optionsr#   r   r;   r   r0   r<   r=   r?   r   r   r   r   r      sV    


r   N)rB   r   Zos.pathr   typingr   Z$jupyter_server.extension.applicationr   r   Zjupyter_server.utilsr   r1   Z	traitletsr	   r
   r   r   _versionr   r>   r   r   r   Zlaunch_instancemainZlaunch_new_instancer   r   r   r   <module>   s    w