
    Xh                         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eee      Zej.                  xZZy)JupyterLab Server Application    )glob)relpath)Any)ExtensionAppExtensionAppJinjaMixin)url_path_join)DictIntegerUnicodeobserve   )__version__)	LabConfigadd_handlersc                   T   e Zd ZdZdZdZdZdZede	fd       Z
 edd	      Zd
Z edd	      j                  e      Z edd
d      Z edd
d      Z edd
d      Z edd
d      Z edd
d      Z ei d
d      ZdddZ e ee       deddfd       ZddZddZddZ y) LabServerAppz1A Lab Server Application that runs out-of-the-boxjupyterlab_serverz/labr   z	/lab/treereturnc                     | j                   S )N)nameselfs    I/var/www/html/myenv/lib/python3.12/site-packages/jupyterlab_server/app.pyapp_namespacezLabServerApp.app_namespace   s    yy    z'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                 N   |j                   }| j                  j                  |      \  }}t        | |      }||j                  k7  r`| j
                  j                  d| j                  j                  ||| j                  j                  |       t        | ||j                         yy)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_values         r   _deprecated_traitzLabServerApp._deprecated_traitU   s     ;; 4488B'D(+	

" HHI'''' D(FJJ/ #r   c                    t        | j                  j                  dg             }|j                  | j                         | j
                  | j                  z   D ]N  }t        | dd      D cg c]"  }t        | j                  t        ||            $ }}|j                  |       P | j                  j                  dt        |      i       yc c}w )zuInitialize the settings:

        set the static files as immutable, since they should have all hashed name.
        static_immutable_cachez
/**/staticT)	recursiveN)setsettingsr)   addstatic_url_prefixlabextensions_pathextra_labextensions_pathr   ujoinlabextensions_urlr   updatelist)r   immutable_cacheextension_pathpathextensions_urls        r   initialize_settingsz LabServerApp.initialize_settingsj   s    
 dmm//0H"MN 	D223 #558U8UU 	3N !N#3:!>$O d,,gdN.KLN 
 "">2	3 	6_8MNOs   /'Cc                 L    | j                   g| _        | j                  g| _        y)zInitialize templates.N)
static_dirstatic_pathstemplates_dirtemplate_pathsr   s    r   initialize_templatesz!LabServerApp.initialize_templates   s"    !__-#112r   c                 0    t        | j                  |        y)zInitialize handlers.N)r   handlersr   s    r   initialize_handlersz LabServerApp.initialize_handlers   s    T]]D)r   )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   rB   r   r5   rG   rM   rP    r   r   r   r      s6   ;DM.H!Os   &'PQK !"#DEIIR]I^K
4VN &
	 
4VN &
	  '#W   $
[  =< d&'(0 0 0 )0(P*3
*r   r   N)rS   r   os.pathr   typingr   $jupyter_server.extension.applicationr   r   jupyter_server.utilsr	   r?   	traitletsr
   r   r   r   _versionr   rO   r   r   r   launch_instancemainlaunch_new_instancer_   r   r   <module>ri      sL    #
    U 7 5 5 ! -t*)9l t*n *99 9r   