a
    ø£Be.  ã                   @   sŽ   d 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)Ú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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d„ ƒZdd„ Zdd„ Zdd „ Zd!S )"ÚLabServerAppz1A Lab Server Application that runs out-of-the-boxZjupyterlab_serverz/labr   z	/lab/treec                 C   s   | j S )N)Úname©Úself© r   úX/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/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 listsz“The 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_urisc                 C   sZ   |j }| j |¡\}}t| |ƒ}||jkrV| j dj| jj	|||d�¡ t
| ||jƒ dS )zobserver for deprecated traitszJ{cls}.{old} is deprecated in JupyterLab {version}, use {cls}.{new} instead)ÚclsÚoldÚnewÚversionN)r   Ú_deprecated_aliasesÚgetÚgetattrr"   ÚlogÚwarningÚformatÚ	__class__Ú__name__Úsetattr)r   ZchangeÚold_attrÚnew_attrr#   Ú	new_valuer   r   r   Ú_deprecated_traitT   s    

üÿzLabServerApp._deprecated_traitc                    st   t ˆj dg ¡ƒ}| ˆj¡ ˆjˆj D ]0‰ ‡ ‡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>t   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_settingsh   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_handlersN)r+   Ú
__module__Ú__qualname__Ú__doc__r   Zextension_urlZapp_nameZfile_url_prefixÚpropertyr   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;   r0   r<   r=   r?   r   r   r   r   r      sT   
ÿýÿýÿýþ

r   N)rB   r   Úos.pathr   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   v