
    -e                    P   U d Z ddlmZ ddlZ ej        e          ZddlmZm	Z	 ddl
mZmZ ddlmZmZmZmZmZmZ ddlmZmZmZmZ erdd	lmZ d
Ze G d d                      Zeeeeedf         f         ef         Zde d<   eedf         Z!de d<    G d de          Z"dS )zX Provides a base class for defining subcommands of the Bokeh command
line application.

    )annotationsN)ABCMetaabstractmethod)ArgumentParser	Namespace)TYPE_CHECKINGAnyClassVarLiteralSequenceUnion   )NotRequiredUnspecified	dataclassentries)	TypeAlias)
Subcommandc                      e Zd ZU eZded<   eZded<   eZded<   eZded<   eZ	ded	<   eZ
d
ed<   eZded<   eZded<   eZded<   dS )ArgumentzzNotRequired[Literal['store', 'store_const', 'store_true', 'append', 'append_const', 'count', 'help', 'version', 'extend']]actionz0NotRequired[int | Literal['?', '*', '+', '...']]nargszNotRequired[Any]constdefaultzNotRequired[type[Any]]typezNotRequired[Sequence[Any]]choiceszNotRequired[bool]requiredzNotRequired[str]helpmetavarN)__name__
__module____qualname__r   r   __annotations__r   r   r   r   r   r   r   r        8lib/python3.11/site-packages/bokeh/command/subcommand.pyr   r   ?   s          JUF  U  U  U  U>IEIIII)E)))) +G++++#.D....*5G5555"-H----(D(((( +G++++++r%   r   .r   ArgArgsc                  V    e Zd ZU dZded<   ded<   dZded<   ddZedd            ZdS )r   a   Abstract base class for subcommands

    Subclasses should implement an ``invoke(self, args)`` method that accepts
    a set of argparse processed arguments as input.

    Subclasses should also define the following class attributes:

    * ``name`` a name for this subcommand

    * ``help`` a help string for argparse to use for this subcommand

    * ``args`` the parameters to pass to ``parser.add_argument``

    The format of the ``args`` should be a sequence of tuples of the form:

    .. code-block:: python

        ('argname', Argument(
            metavar='ARGNAME',
            nargs='+',
        ))

    Example:

        A simple subcommand "foo" might look like this:

        .. code-block:: python

            class Foo(Subcommand):

                name = "foo"
                help = "performs the Foo action"
                args = (
                    ('--yell', Argument(
                        action='store_true',
                        help="Make it loud",
                    )),
                )

                def invoke(self, args):
                    if args.yell:
                        print("FOO!")
                    else:
                        print("foo")

        Then executing ``bokeh foo --yell`` would print ``FOO!`` at the console.

    zClassVar[str]namer   r$   zClassVar[Args]argsparserr   returnNonec                    || _         | j        D ]e}|\  }}t          |t                    s|f}t          |t                    st	          t          |                    }n|} | j         j        |i | fdS )at   Initialize the subcommand with its parser

        Args:
            parser (Parser) : an Argparse ``Parser`` instance to configure
                with the args for this subcommand.

        This method will automatically add all the arguments described in
        ``self.args``. Subclasses can perform any additional customizations
        on ``self.parser``.

        N)r,   r+   
isinstancetupledictr   add_argument)selfr,   argflagsspeckwargss         r&   __init__zSubcommand.__init__   s     9 		7 		7CKE4eU++ !dD)) gdmm,, $DK$e6v6666		7 		7r%   r   bool | Nonec                     t          d          )a   Takes over main program flow to perform the subcommand.

        *This method must be implemented by subclasses.*
        subclassed overwritten methods return different types:
        bool: Build
        None: FileOutput (subclassed by HTML, SVG and JSON. PNG overwrites FileOutput.invoke method), Info, Init,                 Sampledata, Secret, Serve, Static


        Args:
            args (argparse.Namespace) : command line arguments for the subcommand to parse

        Raises:
            NotImplementedError

        zimplement invoke())NotImplementedError)r4   r+   s     r&   invokezSubcommand.invoke   s    $ ""6777r%   N)r,   r   r-   r.   )r+   r   r-   r:   )	r    r!   r"   __doc__r#   r+   r9   r   r=   r$   r%   r&   r   r   N   s         / /b D7 7 7 70 8 8 8 ^8 8 8r%   r   )	metaclass)#r>   
__future__r   logging	getLoggerr    logabcr   r   argparser   r   typingr   r	   r
   r   r   r   util.dataclassesr   r   r   r   typing_extensionsr   __all__r   r1   strr'   r#   r(   r   r$   r%   r&   <module>rK      s     # " " " " " g!! ( ' ' ' ' ' ' ' . . . . . . . .                            ,++++++ 	, 	, 	, 	, 	, 	, 	, 	, uS%S/12H<= = = = =S/ ! ! ! !`8 `8 `8 `8 `87 `8 `8 `8 `8 `8 `8r%   