
    @=d)1                        d Z ddlmZmZ ddlZddlZddlZddlmZ ddl	Z	ddl	m
Z
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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! ddl"m#Z# ddl$m%Z% ddl&m'Z' dZ(i Z)i Z*dddii ed          fe)d<   dddiidfe)d<   dddii ed          fe)d<   e*+                    d d!d"d#d$d%d&d'd(            G d) de%eee'          Z,e,j-        xZ.Z/dS )*z(A tornado based Jupyter notebook server.    )absolute_importprint_functionN)RedirectHandler)DEFAULT_STATIC_FILES_PATHDEFAULT_TEMPLATE_PATH_LISTnbclassic_path)__version__)UnicodeListBooldefault)jupyter_path)FileFindHandler)url_path_join)ExtensionAppExtensionAppJinjaMixin)_i18n)load_handlers   )TerminalHandler)NotebookConfigShimMixin)NotebookAppTraitsz
jupyter nbclassic                       # start the notebook
jupyter nbclassic --certfile=mycert.pem # use SSL/TLS certificate
jupyter nbclassic password              # enter a password to protect the server
	ServerAppopen_browserFz3Don't open the notebook in a browser after startup.z
no-browserNotebookAppenable_mathjaxa4  Disable MathJax

    MathJax is the javascript library Jupyter uses to render math/LaTeX. It is
    very large, so you may want to disable it if you have a slow internet
    connection, or for offline use of the notebook.

    When disabled, equations etc. will appear as their untransformed TeX source.
    z
no-mathjax
allow_rootTz,Allow the notebook to be run from root user.z
allow-rootzServerApp.ipzServerApp.portzServerApp.port_retrieszServerApp.keyfilezServerApp.certfilezServerApp.client_cazServerApp.notebook_dirzServerApp.browser)ipportzport-retrieskeyfilecertfilez	client-caznotebook-dirbrowserc                       e Zd ZdZeZ ed          ZeZe	Z	dZ
i Z ed e            z                                d          Z edd                              d          Z ed	dd
          Z e e             ed                    Z ed          d             Z e e            d ed                    Zed             Zed             Zed             Z fdZ fdZd Zd Z xZ S )r   	nbclassiczThe Jupyter HTML Notebook.

    This launches a Tornado based HTML Notebook Server that serves up an HTML5/Javascript Notebook client.z/treez%s/treeT)configa  Whether to open in a browser after starting.
        The specific browser used is platform dependent and
        determined by the python standard library `webbrowser`
        module, unless it is overridden using the --browser
        (ServerApp.browser) configuration option.
        )helpjupyter_notebook_configzSpecify a config file to load.)r%   r&   z!Path to search for custom.js, cssstatic_custom_pathc                 2    d | j         t          fD             S )Nc                 N    g | ]"}t           j                            |d           #S )custom)ospathjoin).0ds     5lib/python3.11/site-packages/nbclassic/notebookapp.py
<listcomp>z;NotebookApp._default_static_custom_path.<locals>.<listcomp>   s5     
 
 
*+BGLLH%%
 
 
    )
config_dirr   selfs    r1   _default_static_custom_pathz'NotebookApp._default_static_custom_path   s-    
 
)0+
 
 
 	
r3   z6extra paths to look for Javascript notebook extensionsc                 4    | j         t          d          z   }|S )z3The path to look for Javascript notebook extensionsnbextensions)extra_nbextensions_pathr   )r6   r-   s     r1   nbextensions_pathzNotebookApp.nbextensions_path   s     +l>.J.JJr3   c                 "    | j         t          gz   S )zRename trait in jupyter_server.)extra_static_pathsr   r5   s    r1   static_pathszNotebookApp.static_paths   s     &+D*EEEr3   c                      | j         t          z   S )z Rename trait for Jupyter Server.)extra_template_pathsr   r5   s    r1   template_pathszNotebookApp.template_paths   s     (+EEEr3   c                    t          t          |                                            t          j                            t          j                  }t          j	        dt          j        
                    |d          d          }| j                            |d           | j        j                            t                     d S )Nnbuiznbclassic/i18nT)	localedirfallbackF)newstyle)r   )superr   _prepare_templatesr,   r-   dirnamer$   __file__gettexttranslationr.   
jinja2_envinstall_gettext_translationsglobalsupdater   )r6   base_dirrC   	__class__s      r1   rH   zNotebookApp._prepare_templates   s    k4  33555 7??9#566"6RW\\&6( 6(268 8 844TE4JJJ&&n&EEEEEr3   c                     d }t          |          |j        _        d }t          |          | j        _        t                                          |          S )Nc                 B    | j         t          j        t          j        gz   S ))return extra paths + the default location)r=   jupyter_serverr   r$   r5   s    r1   static_file_path_jupyter_serverzSNotebookApp._link_jupyter_server_extension.<locals>.static_file_path_jupyter_server   s    *n.VXaX{-|||r3   c                 ~    | j         t          j                            t          j        d          t          j        gz   S )rU   notebook)r=   r,   r-   r.   r$   r   r5   s    r1   static_file_path_nbclassiczNNotebookApp._link_jupyter_server_extension.<locals>.static_file_path_nbclassic   s=     *iA&( ()2)LNN Nr3   )propertyrR   static_file_pathrG   _link_jupyter_server_extension)r6   	serverapprW   rZ   rR   s       r1   r]   z*NotebookApp._link_jupyter_server_extension   sn    	} 	} 	} 08+0- 0-	,		N 		N 		N +33M*N*N'ww55i@@@r3   c           
         | j         rx| j                            t          d                     | j                            t          d          dz             t	          j        t          d          t                     t          | j        dt          | j
        j        d| j        d          gi| j         | j        | j        | j                  } | j        j        d
i | d	S )z Add settings to the tornado app.z@The `ignore_minified_js` flag is deprecated and no longer works.zIAlternatively use `%s` when working on the notebook's Javascript and LESSznpm run build:watchzOThe `ignore_minified_js` flag is deprecated and will be removed in Notebook 6.0no_cache_pathsstaticr+   )r(   static_handler_argsignore_minified_jsmathjax_urlmathjax_configr;   N )rc   logwarningr   warningswarnDeprecationWarningdictr(   r   r^   base_urlnamerd   re   r;   settingsrP   )r6   ro   s     r1   initialize_settingszNotebookApp.initialize_settings   s!   " 	xH\]]_ _ _HU_a acxy z z zM%ac cdvx x x #6 !!/ 	 	 #
!  $6(."4!
 
 
$ 	((x(((((r3   c                    g }t          t                                dk    r,|                    dt          d| j        j        dz   if           | j        d         D ]$}|                    t          |                     %|                    t          d                     |                    t          d                     |                    t          d                     | j	                            |           g }| j        j        }t          }|                     ||d	          t          d
| j        if           |                     ||d          t          | j        d         dgdf           |                     ||d          t          | j        d         dgdf           t          d          }t          |          dz   }| j        j        j        }|j        d|          }	|j        | d         }
g |_        |                    |	           |                    |           |                    |
           t%          d           dS )z:Load the (URL pattern, handler) tuples for each component.r   z
/nbclassicurlznbclassic/treeextra_servicesznbclassic.tree.handlersznbclassic.notebook.handlersznbclassic.edit.handlersz/terminals/(\w+)rn   z/nbextensions/(.*)r;   /)r-   r`   z/custom/(.*)r(   zjupyter_server.base.handlers   Na  
  _   _          _      _
 | | | |_ __  __| |__ _| |_ ___
 | |_| | '_ \/ _` / _` |  _/ -_)
  \___/| .__/\__,_\__,_|\__\___|
       |_|
                                                                           
Read the migration plan to Notebook 7 to learn about the new features and the actions to take if you are using extensions.

https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html

Please note that updating to Notebook 7 might break some of your extensions.
)lenr   appendr   r^   rm   ro   extendr   handlersr   r   rn   r   web_appwildcard_routerrules	add_rulesprint)r6   ry   servicestatic_handlersrm   ujoinbase_handlersnrouter
core_rulesfinal_ruless              r1   initialize_handlerszNotebookApp.initialize_handlers   s     ~  1$$OO"#DN34DDE   }%56 	4 	4GOOM'223333&?@@AAA&CDDEEE&?@@AAAX&&& >*U8011?VTYDWX	
 	
 	
 	U8233_&9:#&%G G 	
 	
 	
 	U8_--&:;#&%A A 	
 	
 	
 &&DEE "'7\#A2#&
lA233'$$$)))%%%  	 	 	 	 	r3   )!__name__
__module____qualname__rn   r	   versionr   descriptionaliasesflagsextension_urlsubcommandsr
   r   tagdefault_urlr   r   config_file_namer   r(   r   r7   r:   r[   r;   r>   rA   rH   r]   rp   r   __classcell__)rR   s   @r1   r   r   g   s(        DG% n o oK GEMK')nn&6&6677;;4;HHK 4   
cc  w!-   ggii#(5"I$K $K     
 W!""
 
 #"
 #d7799T(-'c)e )e% % %
   X
 F F XF F F XF	F 	F 	F 	F 	FA A A A A4) ) )>V V V V V V Vr3   )0__doc__
__future__r   r   r,   rK   ri   tornado.webr   r$   r   r   r   nbclassic._versionr	   	traitletsr
   r   r   r   jupyter_core.pathsr   rV   jupyter_server.base.handlersr   jupyter_server.utilsr   $jupyter_server.extension.applicationr   r   jupyter_server.transutilsr   jupyter_server.serverappr   terminal.handlersr   notebook_shim.shimr   notebook_shim.traitsr   	_examplesr   r   rP   r   launch_instancemainlaunch_new_instancerf   r3   r1   <module>r      s   . .
 7 6 6 6 6 6 6 6 				   ' ' ' ' ' '              + * * * * *            , + + + + +     8 8 8 8 8 8 . . . . . .       
 , + + + + +      / . . . . . 6 6 6 6 6 6 2 2 2 2 2 2	 	
>5)*	E
?@@l 
 %u-.
l  <&'	E
899l 
 
,"$&,"    $d d d d d	d d dX )8 8r3   