
    Gh5                    P   S r SSKJr  SSKrSSKrSSKrSSKJr  SSK	J
r
  SSKJr  SSKJr  SSKJr  SS	KJrJr  SS
KJr  SSKJrJr  SSKJr  SSKJrJrJr  SSKJ r   SSK!J"r"J#r#J$r$  SSK%J&r&J'r'  SSK(J)r)  SSK*J+r+  SSK,J-r-J.r.J/r/  SSK0J1r1  SSK2J3r3  \" \45      Rj                  Rm                  5       r7\Rp                  \Rr                  \:\Rv                  \:S4   4   \Rv                  \Rr                  \Rp                  \:\Rx                  4   \14   \:4   4   r=\" \" 5       5      r>\3r? " S S\\\5      r@ " S S\@5      rA " S S\@5      rB " S S\@5      rC " S  S!\@5      rD " S" S#\@5      rE " S$ S%\@5      rF\G" \5      rH " S& S'\)\ 5      rI\IR                  =rKrL\MS(:X  a  \K" 5         gg))zJupyter notebook application.    )annotationsN)Path)ensure_async)base_aliases)jupyter_config_dir)JupyterHandler)ExtensionHandlerJinjaMixinExtensionHandlerMixin)flags)
url_escapeurl_is_absolute)url_path_join)get_app_dirget_user_settings_dirget_workspaces_dir)LabServerApp)	LabConfigget_page_configrecursive_update)
_camelCaseis_url)NotebookConfigShimMixin)web)BoolUnicodedefault)Config   )__version__.c                  6    \ rS rSrSr\SS j5       rSS jrSrg)	NotebookBaseHandler2   zThe base notebook API handler.c                :    U R                   R                  SS5      $ )N
custom_cssT)settingsgetselfs    _C:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\notebook/app.pyr$   NotebookBaseHandler.custom_css5   s    }}  t44    c           
        [        5       nU R                  nU R                  R                  SS5      nU R                  R	                  S0 5      n0 UE[
        U R                  U R                  R                  SS5      U R                  S   [        U R                  SU R                  5      [        U R                  S5      UR                  S.EnU R                  R                  S	S
5      nUR                  [        R                  S5      n[        R                  R                  [        U5      R!                  5       5      n U R"                  R$                  U:w  a;  S[        R                  R'                  U R"                  R$                  U5      -   US'   OSUS'    U R                  R                  SS5      nU R                  R                  SS5      n[+        U5      (       d6  UR-                  U R                  5      (       d  [        U R                  U5      nUR	                  SU5        UR	                  SU5        UR	                  S[/        5       5        UR1                  5        H  n	[3        X)5      U[5        U	5      '   M     UR1                  5        HS  n	U	R7                  S5      (       d  M  [5        SU	-   5      n
[3        X)5      n[9        U5      (       d  [        X;5      nXU
'   MU     UR:                  UR<                  -   n[?        U[A        UU RB                  S95        U R                  R                  SS5      nU(       a  U" X5      nU$ ! [(         a	    SUS'    GNf = f)zGet the page config.base_url/page_config_dataterminals_availableFtokenstatic)
appVersionbaseUrlterminalsAvailabler1   fullStaticUrlfrontendUrlexposeAppInBrowserserver_root_dir preferredPathmathjax_configzTeX-AMS_HTML-full,Safemathjax_urlz?https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.jsmathjaxConfigfullMathjaxUrljupyterConfigDir_urlfull_)loggerpage_config_hookN)"r   extensionappr%   r&   
setdefaultversionr-   ujoinnameexpose_app_in_browserreplaceosseppathnormpathr   
expanduser	serverapppreferred_dirrelpath	Exceptionr   
startswithr   trait_namesgetattrr   endswithr   extra_labextensions_pathlabextensions_pathr   r   log)r(   configappr-   r/   page_configserver_rootr<   r=   rI   	full_namefull_urlrZ   rD   s                 r)   r   #NotebookBaseHandler.get_page_config9   s   "&"3"3==$$Z5==334FK	
	
!}}"&--"3"34I5"Q]]7+"4==(DIIF 4"%";";	
 mm''(92>!))"&&#6gg&&tK'8'C'C'EF		/~~++{:/2RWW__NN00+6 0O, 03O, **+;=UVmm''M
 {++K4J4J4==4Y4Y{;K?/=13E3GH &&(D,3C,>K
4() ) &&(D==(("7T>2Is)H(## 4%-	" ) !99C<R<RR"xx	
  ==,,-?F*4=K[  	/+.K(	/s   AM M M%$M% Nreturnt.Any)re   dict[str, t.Any])	__name__
__module____qualname____firstlineno____doc__propertyr$   r   __static_attributes__rc   r+   r)   r!   r!   2   s    (5 5Ir+   r!   c                  D    \ rS rSrSr\R                  SSS jj5       rSrg)TreeHandler   zA tree page handler.c                  #    UR                  S5      nU R                  n[        UR                  US95      I Sh  vN (       a  [        UR	                  U5      5      I Sh  vN (       aB  UR
                  (       d1  U R                  R                  S5        [        R                  " S5      eU R                  5       nXS'   U R                  SUS9nU R                  U5      $ [        UR                  U5      5      I Sh  vN (       a  [        UR                  US	S
95      I Sh  vN nUS   S:X  a!  [        U R                   S[#        U5      5      nO [        U R                   S[#        U5      5      nU R                  R%                  SU R&                  R(                  U5        U R+                  U5        g[        R                  " S5      e GN GNo N N7f)z
Display appropriate page for given path.

- A directory listing is shown if path is a directory
- Redirected to notebook page if path is a notebook
- Render the raw file if path is any other file
r.   rN   Nz1Refusing to serve hidden directory, via 404 Errori  treePathz	tree.htmlr^   F)contenttypenotebook	notebooksfileszRedirecting %s to %s)stripcontents_managerr   
dir_exists	is_hiddenallow_hiddenr[   infor   	HTTPErrorr   render_templatewritefile_existsr&   rH   r-   r   debugrequestrN   redirect)r(   rN   cmr^   tplmodelurls          r)   r&   TreeHandler.get   sj     zz#""bmmm6777!",,t"4555booQRmmC(( ..0K&*
#&&{&LC::c?"bnnT2333&rvvdEv'BCCEV}
*DMM;
48HI DMM7Jt4DEHHNN14<<3D3DcJMM#mmC  - 85 4CsG   9GG&G"G#BG G%G&G'B(GGGGrc   Nr:   )rN   strre   None	rh   ri   rj   rk   rl   r   authenticatedr&   rn   rc   r+   r)   rp   rp      s    !! !!r+   rp   c                  D    \ rS rSrSr\R                  SSS jj5       rSrg)ConsoleHandler   zA console page handler.Nc                `    U R                  SU R                  5       S9nU R                  U5      $ )zGet the console page.zconsoles.htmlru   r   r   r   r(   rN   r   s      r)   r&   ConsoleHandler.get   s0     ""?@T@T@V"Wzz#r+   rc   NrN   z
str | Nonere   rf   r   rc   r+   r)   r   r      s    ! r+   r   c                  D    \ rS rSrSr\R                  SSS jj5       rSrg)TerminalHandler   zA terminal page handler.Nc                `    U R                  SU R                  5       S9nU R                  U5      $ )zGet the terminal page.zterminals.htmlru   r   r   s      r)   r&   TerminalHandler.get   s1     ""#3AUAUAW"Xzz#r+   rc   r   r   r   rc   r+   r)   r   r      s    " r+   r   c                  D    \ rS rSrSr\R                  SSS jj5       rSrg)FileHandler   zA file page handler.Nc                `    U R                  SU R                  5       S9nU R                  U5      $ )zGet the file page.z	edit.htmlru   r   r   s      r)   r&   FileHandler.get   s0     "";D<P<P<R"Szz#r+   rc   r   r   r   rc   r+   r)   r   r      s     r+   r   c                  D    \ rS rSrSr\R                  SSS jj5       rSrg)NotebookHandler   zA notebook page handler.c                  #    UR                  S5      nU R                  n[        UR                  US95      I Sh  vN (       ac  [	        U R
                  S[        U5      5      nU R                  R                  SU R                  R                  U5        U R                  U5        gU R                  SU R                  5       S9nU R                  U5      $  N7f)z4Get the notebook page. Redirect if it's a directory.r.   rs   Ntreez.Redirecting %s to %s since path is a directoryznotebooks.htmlru   )r{   r|   r   r}   rH   r-   r   r[   r   r   rN   r   r   r   r   )r(   rN   r   r   r   s        r)   r&   NotebookHandler.get   s      zz#""bmmm6777vz$/?@CHHNNKT\\M^M^`cdMM#""#3AUAUAW"Xzz# 8s   9CCBCrc   Nr   )rN   r   re   rf   r   rc   r+   r)   r   r      s    " r+   r   c                  @    \ rS rSrSr\R                  SS j5       rSrg)CustomCssHandler   zA custom CSS handler.c                   U R                  SS5        U R                  5       nUS    S3n[        U5      R                  5       (       d5  [        R
                  " SUS   5      nUb  UR                  5       S   nU S	3n[        U5      R                  5        nU R                  UR                  5       5      sSSS5        $ ! , (       d  f       g= f)
zGet the custom css file.zContent-Typeztext/cssr@   /custom/custom.cssz^(.*?)static	staticDirNr   zcustom/custom.css)

set_headerr   r   is_filerematchgroupsopenr   read)r(   r^   custom_css_filestatic_path_root
custom_dircss_fs         r)   r&   CustomCssHandler.get   s     	
3**,();<==OPO$,,..!xxK8PQ+-446q9
%/L0A"B/"'')U::ejjl+ *))s   C  
Crc   Nrd   r   rc   r+   r)   r   r      s    , ,r+   r   c                    ^  \ rS rSr% SrSrSrSr\r\	" \SS9r
Sr\	" S	S
SS9rS	rS
r\r0 rS\S'   \" SS
SS9r\" S
S
SS9r\rS\S'   S SS
00S4\S'   S SS
00S4\S'   \" S5      S-S j5       r\" S5      S-S j5       r\" S5      S-S j5       r\" S 5      S-S! j5       r\" S"5      S-S# j5       r\" S$5      S-S% j5       r\" S&5      S-S' j5       rS.U 4S( jjrS/S) jrS.U 4S* jjr S0S1U 4S+ jjjr!S,r"U =r#$ )2JupyterNotebookApp   z"The notebook server extension app.rx   zJupyter NotebookzMJupyter Notebook - A web-based notebook environment for interactive computingzThe version of the application.)helpr.   z/treeTz'The default URL to redirect to from `/`)r\   r   rg   subcommandsFzJWhether to expose the global app instance to browser via window.jupyterappzeWhether custom CSS is loaded on the page.
        Defaults to True and custom CSS is loaded.
        Flagsr   rJ   z@Expose the global app instance to browser via window.jupyterapp.zexpose-app-in-browserr$   z7Load custom CSS in template html files. Default is Truez
custom-css
static_dirc                &    [        [        S-  5      $ )Nr2   r   HEREr'   s    r)   _default_static_dir&JupyterNotebookApp._default_static_dir  s    4(?##r+   templates_dirc                &    [        [        S-  5      $ )N	templatesr   r'   s    r)   _default_templates_dir)JupyterNotebookApp._default_templates_dir!  s    4+%&&r+   app_settings_dirc                &    [        [        S-  5      $ )Nr%   r   app_dirr'   s    r)   _default_app_settings_dir,JupyterNotebookApp._default_app_settings_dir%  s    7Z'((r+   schemas_dirc                &    [        [        S-  5      $ )Nschemasr   r'   s    r)   _default_schemas_dir'JupyterNotebookApp._default_schemas_dir)  s    7Y&''r+   
themes_dirc                &    [        [        S-  5      $ )Nthemesr   r'   s    r)   _default_themes_dir&JupyterNotebookApp._default_themes_dir-  s    7X%&&r+   user_settings_dirc                H    [         R                  " [        [        5       5      $ r   )tcastr   r   r'   s    r)   _default_user_settings_dir-JupyterNotebookApp._default_user_settings_dir1  s    vvc0233r+   workspaces_dirc                H    [         R                  " [        [        5       5      $ r   )r   r   r   r   r'   s    r)   _default_workspaces_dir*JupyterNotebookApp._default_workspaces_dir5  s    vvc-/00r+   c                   > [         [        U ]  5         U R                  R                  R                  U R                  S9  g )N)r$   )superr   _prepare_templates
jinja2_envglobalsupdater$   )r(   	__class__s    r)   r   %JupyterNotebookApp._prepare_templates9  s/    lD46&&$//&Br+   c                    U R                   c  g U R                   R                  R                  U   R                  SL nU$ ! [        [
        [        4 a    Sn U$ f = f)z%Check if server extension is enabled.FT)rQ   extension_manager
extensionsenabledAttributeErrorKeyError	TypeError)r(   	extensionextension_enableds      r)   server_extension_is_enabled.JupyterNotebookApp.server_extension_is_enabled=  si    >>!	&00;;IFNNRVV 
 !  )4 	& %  	&s   /A AAc                x  > U R                   c   eU R                   R                  R                  R                  S0 5      nU R	                  S5      nX!S'   SU R                   R
                  ;   aw  U R                   R
                  nUS   nXAS'   US   US'   US	   US
'   [        US5      US'   [        U R                   S5      (       a  U R                   R                  US'   SUS'   U R                  R                  S[        45        U R                  R                  S[        45        U R                  R                  S[        45        U R                  R                  S[        45        U R                  R                  S[        45        U R                  R                  S[         45        ["        TU ]I  5         g)zInitialize handlers.Nr/   	nbclassicnbclassic_enabled
hub_prefix	hubPrefixhub_hosthubHostuserhubUserzuser-redirectshareUrlserver_namehubServerNamer:   r1   z	/tree(.*)z/notebooks(.*)z	/edit(.*)z/consoles/(.*)z/terminals/(.*)r   )rQ   web_appr%   rF   r   tornado_settingsrH   hasattrr  handlersappendrp   r   r   r   r   r   r   initialize_handlers)r(   r^   r   r  r   r   s        r)   r  &JupyterNotebookApp.initialize_handlersI  s   ~~)))nn,,55@@ASUWX <<[I+<'( 4>>:::#~~>>),7J'1$%5j%AK	"%5f%=K	"&+J&HK
#t~~}55/3~~/I/IO,
 $&K k;78.@Ak;78.?@/AB24DEF#%r+   c                "   > [         TU ]  5         g)zMSubclass because the ExtensionApp.initialize() method does not take argumentsN)r   
initialize)r(   argvr   s     r)   r  JupyterNotebookApp.initializei  s    r+   rc   )re   r   )re   r   )r   r   re   boolr   )r  zlist[str] | Nonere   r   )$rh   ri   rj   rk   rl   rI   app_namedescriptionrG   r   app_versionextension_urldefault_urlfile_url_prefixload_other_extensionsr   r   __annotations__r   rJ   r$   r   r   r   r   r   r   r   r   r   r   r   r  r  rn   __classcell__)r   s   @r)   r   r      s   ,D!HaKG'(IJKM'$5^_KO G$&K!& Y J E5	 7>?J&E
!" 
d34AE,
 \$ $ _' '  ) !) ]( ( \' '  !4 "4 1 1C
!&@ r+   r   __main__)Nrl   
__future__r   rL   r   typingr   pathlibr   jupyter_client.utilsr   jupyter_core.applicationr   jupyter_core.pathsr   jupyter_server.base.handlersr    jupyter_server.extension.handlerr	   r
   jupyter_server.serverappr   jupyter_server.utilsr   r   r   rH   jupyterlab.commandsr   r   r   jupyterlab_serverr   jupyterlab_server.configr   r   r   jupyterlab_server.handlersr   r   notebook_shim.shimr   tornador   	traitletsr   r   r   traitlets.config.loaderr   _versionr   __file__parentresolver   DictUnionr   TupleAnyr   r   rG   r!   rp   r   r   r   r   r   dictaliasesr   launch_instancemainlaunch_new_instancerh   rc   r+   r)   <module>r<     s   # " 	 	   - 1 1 7 + < 7 
 + 
 : 6  , , * !H~$$&	qwwsAGGCH--.sAEEz@RTZ@Z8[]`8`0aab
{}


P46K^ Pf%!% %!P( ) % ) $,* ,* |
v0, vr 0?? ?zF r+   