
    Xh                     |    d Z ddlmZ ddlmZmZmZ ddlmZm	Z	m
Z
mZ ddlmZ ddlmZ ddlmZ  G d	 d
ee      Zy)a  A license reporting CLI

Mostly ready-to-use, the downstream must provide the location of the application's
static resources. Licenses from an app's federated_extensions will also be discovered
as configured in `labextensions_path` and `extra_labextensions_path`.

    from traitlets import default
    from jupyterlab_server import LicensesApp

    class MyLicensesApp(LicensesApp):
        version = "0.1.0"

        @default("static_dir")
        def _default_static_dir(self):
            return "my-static/"

    class MyApp(JupyterApp, LabConfig):
        ...
        subcommands = dict(
            licenses=(MyLicensesApp, MyLicensesApp.description.splitlines()[0])
        )

    )Any)
JupyterAppbase_aliases
base_flags)BoolEnumInstanceUnicode   )__version__)	LabConfig)LicensesManagerc                        e Zd ZdZeZdZ eddd      Z e	ddd      Z
 eg d	d
dd      Z eddd      Z ee      Zi edddZi ed ddiidfd ddiidfd ddiidfdZdededdf fdZd dZd dZ xZS )!LicensesAppzA license management app.z"
    Report frontend licenses
     Tz0The static directory from which to show licenses)confighelpFz/Also print out full license text (if available))markdownjsoncsvr   zReporter formatz.*z(A regular expression of bundles to printzLicensesApp.bundles_patternzLicensesApp.report_format)bundleszreport-format	full_textz*Print out full license text (if available)report_formatr   z.Print out report as JSON (implies --full-text)r   z-Print out report as CSV (implies --full-text))z	full-textr   r   argskwargsreturnNc                 D    t        |   |i | | j                          y)zInitialize the app.N)super
initializeinit_licenses_manager)selfr   r   	__class__s      R/var/www/html/myenv/lib/python3.12/site-packages/jupyterlab_server/licenses_app.pyr   zLicensesApp.initializeP   s!    D+F+""$    c                 &    t        |       | _        y)zInitialize the license manager.)parentN)r   licenses_manager)r!   s    r#   r    z!LicensesApp.init_licenses_managerU   s     /!
r$   c                     | j                   j                  | j                  | j                  | j                        d   }t        |       | j                  d       y)zStart the app.)r   r   bundles_patternr   N)r'   reportr   r   r)   printexit)r!   r*   s     r#   startzLicensesApp.start[   sT    &&--,,nn 00 . 
 	
 	f		!r$   )r   N)__name__
__module____qualname____doc__r   versiondescriptionr
   
static_dirr   r   r   r   r)   r	   r   r'   r   aliasesr   flagsr   r   r    r-   __classcell__)r"   s   @r#   r   r   %   s    #GK D/abJU4._`I#ZCTM d46`aO0
04G
 [$/08

 _f56<

 _e45;
E % %s %t %

r$   r   N)r1   typingr   jupyter_core.applicationr   r   r   	traitletsr   r   r	   r
   _versionr   r   r   licenses_handlerr   r    r$   r#   <module>r>      s2   .  I I 3 3 !  ->*i >r$   