o
    ^i                     @   sv   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
 d
eeZdS )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                       s   e Zd ZdZeZdZeddddZe	ddddZ
eg d	d
dddZed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dZd#dd Zd#d!d"Z  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                    s   t  j|i | |   dS )zInitialize the app.N)super
initializeinit_licenses_manager)selfr   r   	__class__ Y/home/ubuntu/hpml_nyu/venv/lib/python3.10/site-packages/jupyterlab_server/licenses_app.pyr   P   s   zLicensesApp.initializec                 C   s   t | d| _dS )zInitialize the license manager.)parentN)r   licenses_manager)r   r!   r!   r"   r   U   s   z!LicensesApp.init_licenses_managerc                 C   s2   | j j| j| j| jdd }t| | d dS )zStart the app.)r   r   bundles_patternr   N)r$   reportr   r   r%   printexit)r   r&   r!   r!   r"   start[   s   zLicensesApp.start)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!   r!   r   r"   r   %   sB    



r   N)r-   typingr   jupyter_core.applicationr   r   r   	traitletsr   r   r   r	   _versionr   r   r   licenses_handlerr   r   r!   r!   r!   r"   <module>   s   