
    ^h                         S r SSKrSSKrSSKr " S S\5      r " S S\5      r " S S\5      r " S	 S
\5      rSS jr	SS jr
S rg)zExtension utilities.    Nc                       \ rS rSrSrSrg)ExtensionLoadingError   zAn extension loading error. N__name__
__module____qualname____firstlineno____doc____static_attributes__r       X/home/james-whalen/.local/lib/python3.13/site-packages/jupyter_server/extension/utils.pyr   r      s    %r   r   c                       \ rS rSrSrSrg)ExtensionMetadataError   zAn extension metadata error.r   Nr   r   r   r   r   r      s    &r   r   c                       \ rS rSrSrSrg)ExtensionModuleNotFound   z$An extension module not found error.r   Nr   r   r   r   r   r      s    .r   r   c                       \ rS rSrSrSrg)NotAnExtensionApp   z2An error raised when a module is not an extension.r   Nr   r   r   r   r   r      s    <r   r   c                      U R                   $ ! [         a     Of = f U R                  nO! [         a    Sn[        U5      Sef = f[        R
                  " SU < S3[        SS9  U$ )zLooks for _load_jupyter_server_extension as an attribute
of the object or module.

Adds backwards compatibility for old function name missing the
underscore prefix.
z6_load_jupyter_server_extension function was not found.Nz=A `_load_jupyter_server_extension` function was not found in z. Instead, a `load_jupyter_server_extension` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.   )
stacklevel)_load_jupyter_server_extensionAttributeErrorload_jupyter_server_extensionr   warningswarnDeprecationWarning)objloggerfuncmsgs       r   
get_loaderr&      s    111 300 3F#C(d23 MM	7 	
 	 Ks    
, Ac                    [         R                  " 5       n[        R                  " U 5      n[         R                  " 5       nXB-
  nU(       a.  US:  a  UR                  OUR
                  nU" SU  SUS S35         X3R                  5       4$ ! [         a     Of = f UR                  5       nU(       a  UR                  SU  S35        X74$ ! [         a     Of = fU(       a  UR                  SU  S35        X0U S	./4$ )
a  Find the extension metadata from an extension package.

This looks for a `_jupyter_server_extension_points` function
that returns metadata about all extension points within a Jupyter
Server Extension package.

If it doesn't exist, return a basic metadata packet given
the module name.
g?zExtension package z took z.4fzs to importz?A `_jupyter_server_extension_points` function was not found in z. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.zS, so Jupyter Server will look for extension points in the extension pacakge's root.)modulename)
timeperf_counter	importlibimport_moduleinfodebug _jupyter_server_extension_pointsr   _jupyter_server_extension_pathswarning)package_namer#   
start_timer(   end_timedurationlogextension_pointss           r   get_metadatar9   6   s!    ""$J$$\2F  "H$H %^fkk fXcN+NO>>@@@ !AACNN(> *%% '' 
 (> *	
 \BCCCs$   ;B 
BB.C 
CCc                     SSK Jn  U" U S9$ )a?  Raises an exception is the extension is missing a needed
hook or metadata field.
An extension is valid if:
1) name is an importable Python package.
1) the package has a _jupyter_server_extension_points function
2) each extension path has a _load_jupyter_server_extension function

If this works, nothing should happen.
   )ExtensionPackage)r)   )managerr<   )r)   r<   s     r   validate_extensionr>   m   s     *&&r   )N)r   r,   r*   r   	Exceptionr   r   r   r   r&   r9   r>   r   r   r   <module>r@      sR       &I &'Y '/i /=	 =<4Dn'r   