
    ^hj                        % S r SSKJ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  \(       a  SS
KJr  Sr " S S\\R&                  5      r/ rS\S'   g)z.Serve files directly from the ContentsManager.    )annotationsN)decodebytes)TYPE_CHECKING)ensure_async)web)
authorized)JupyterHandler)	Awaitablecontentsc                     ^  \ rS rSrSr\r\U 4S j5       r\	R                  \SS j5       5       r\	R                  \SS j5       5       rSrU =r$ )	FilesHandler   zserve files via ContentsManager

Normally used when ContentsManager is not a FileContentsManager.

FileContentsManager subclasses use AuthenticatedFilesHandler by default,
a subclass of StaticFileHandler.
c                   > [         TU ]  S-   $ )zThe content security policy.z; sandbox allow-scripts)supercontent_security_policy)self	__class__s    W/home/james-whalen/.local/lib/python3.13/site-packages/jupyter_server/files/handlers.pyr   $FilesHandler.content_security_policy"   s    
 w.1JJJ    c                b    U R                  USS9  U R                  5         U R                  USS9$ )zThe head response.F)include_body)getcheck_xsrf_cookie)r   paths     r   headFilesHandler.head)   s3     	E* xx5x11r   c                  #    U R                  5         U R                  nUR                  (       dX  [        UR	                  U5      5      I Sh  vN (       a1  U R
                  R                  S5        [        R                  " S5      eUR                  S5      nSU;   a  UR                  SS5      u  pEOUn[        UR                  USUS95      I Sh  vN nU R                  SS5      (       a  U R                  U5        UR                  5       R                  S	5      (       a  U R!                  S
S5        O["        R$                  " U5      u  pxUS:X  a  U R!                  S
S5        US:X  a  U R!                  S
S5        OZUb  U R!                  S
S5        ODUb  U R!                  S
U5        O.US   S:X  a  U R!                  S
S5        OU R!                  S
S5        U(       a]  US   S:X  a/  US   R'                  S5      n	U R)                  [+        U	5      5        OU R)                  US   5        U R-                  5         gg GN GNo7f)zGet a file by path.Nz,Refusing to serve hidden file, via 404 Errori  /   file)typecontentdownloadz.ipynbzContent-Typezapplication/x-ipynb+jsonz
text/plainztext/plain; charset=UTF-8gzipzapplication/gzipzapplication/octet-streamformatbase64r#   ascii)r   contents_managerallow_hiddenr   	is_hiddenloginfor   	HTTPErrorstriprsplitr   get_argumentset_attachment_headerlowerendswith
set_header	mimetypes
guess_typeencodewriter   flush)
r   r   r   cm_namemodelcur_mimeencoding	b64_bytess
             r   r   FilesHandler.get1   s    
 	 ""bll46H)I#I#IHHMMHI--$$zz#$;kk#q)GAtD"266$V\6#RSSZ..&&t, ::<  **OON,FG!*!5!5d!;H<'0KL6!0BC%0JK%9xH,0JK0KLX(*!),33G<	

;y12

5+,JJL E $J Ts&   AIH?BIIE,II )r   strreturnzAwaitable[None] | None)T)__name__
__module____qualname____firstlineno____doc__AUTH_RESOURCEauth_resourcepropertyr   r   authenticatedr   r   r   __static_attributes____classcell__)r   s   @r   r   r      sg     "MK K 	2  2 	.  .r   r   zlist[JupyterHandler]default_handlers)rJ   
__future__r   r6   r'   r   typingr   jupyter_core.utilsr   tornador   jupyter_server.auth.decoratorr   jupyter_server.base.handlersr	   collections.abcr
   rK   StaticFileHandlerr   rQ   __annotations__rC   r   r   <module>r[      sR    4 #     +  4 7)J>3#8#8 JZ *, & +r   