a
    ø£BeY  ã                   @   sj   d 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])
        )

é    )Ú
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‡ fdd„Zdd„ Z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)Z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   c                    s   t ƒ j|i |¤Ž |  ¡  dS )zInitialize the app.N)ÚsuperÚ
initializeÚinit_licenses_manager)ÚselfÚargsÚkwargs©Ú	__class__© úa/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/jupyterlab_server/licenses_app.pyr   N   s    zLicensesApp.initializec                 C   s   t | d�| _dS )zInitialize the license manager.)ÚparentN)r   Úlicenses_manager)r   r   r   r   r   S   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   ÚstartY   s    ýüzLicensesApp.start)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   ÚversionÚdescriptionr   Z
static_dirr   r   r   r   r"   r   r   r!   r   Úaliasesr   Úflagsr   r   r&   Ú__classcell__r   r   r   r   r   #   s@   ÿÿýÿ
þ
þ
þör   N)r*   Zjupyter_core.applicationr   r   r   Z	traitletsr   r   r   r   Ú_versionr
   r   r   Zlicenses_handlerr   r   r   r   r   r   Ú<module>   s   