
    h                    |   S SK Jr  S SKJrJrJrJrJrJrJ	r	  S SK
Jr  S SKJrJr  S SKJr  SSKJr  SSKJr  \" S	5      r\	S
S
S
SSSS
SS
S.	                     SS jj5       r\	S
S
S
SSSS
SS
S.	                     SS jj5       rS
S
S
SSSS
SS
S.	                     SS jjrg
)    )annotations)AnyCallableDictSequenceTypeVarUnionoverload)	Annotated)MarkerSuppress)ConstructorRegistry   )cli)
subcommandTNFT)	progdescriptionargsuse_underscoresconsole_outputsadd_helpconfigsort_subcommandsregistryc       	            g N 
subcommandsr   r   r   r   r   r   r   r   r   s
             _/home/james-whalen/.local/lib/python3.13/site-packages/tyro/extras/_subcommand_cli_from_dict.pysubcommand_cli_from_dictr"      s     	    c       	            g r   r   r   s
             r!   r"   r"   "   s     r#   c       	           [        U R                  5       5      n
U(       a  [        U
5      n
[        [        [        U
 Vs/ s H  n[        [        [        XU   S94   PM     sn[        S[        4   /-   5         UUUUUUUU	S9	$ s  snf )a  Generate a subcommand CLI from a dictionary of functions.

For an input like:

.. code-block:: python

    tyro.extras.subcommand_cli_from_dict(
        {
            "checkout": checkout,
            "commit": commit,
        }
    )

This is internally accomplished by generating and calling:

.. code-block:: python

    from typing import Annotated, Any, Union
    import tyro

    tyro.cli(
        Union[
            Annotated[
                Any,
                tyro.conf.subcommand(name="checkout", constructor=checkout),
            ],
            Annotated[
                Any,
                tyro.conf.subcommand(name="commit", constructor=commit),
            ],
        ]
    )

Args:
    subcommands: Dictionary that maps the subcommand name to function to call.
    prog: The name of the program printed in helptext. Mirrors argument from
        :py:class:`argparse.ArgumentParser`.
    description: Description text for the parser, displayed when the --help flag is
        passed in. If not specified, `f`'s docstring is used. Mirrors argument from
        :py:class:`argparse.ArgumentParser`.
    args: If set, parse arguments from a sequence of strings instead of the
        commandline. Mirrors argument from :py:meth:`argparse.ArgumentParser.parse_args()`.
    use_underscores: If True, use underscores as a word delimeter instead of hyphens.
        This primarily impacts helptext; underscores and hyphens are treated equivalently
        when parsing happens. We default helptext to hyphens to follow the GNU style guide.
        https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
    console_outputs: If set to ``False``, parsing errors and help messages will be
        supressed. This can be useful for distributed settings, where :func:`tyro.cli()`
        is called from multiple workers but we only want console outputs from the
        main one.
    add_help: Add a -h/--help option to the parser. This mirrors the argument from
        :py:class:`argparse.ArgumentParser()`.
    config: Sequence of config marker objects, from :mod:`tyro.conf`.
    registry: A :class:`tyro.constructors.ConstructorRegistry` instance containing custom
        constructor rules.
)nameconstructorN)r   r   r   r   r   r   r   r   )
listkeyssortedr   r	   tupler   r   r   r   )r    r   r   r   r   r   r   r   r   r   r)   ks               r!   r"   r"   2   s    L   "#Dd|  "	 "  #1~FH "	 T8^,-.	
$ ''5 	s   #B)r    zDict[str, Callable[..., T]]r   
str | Noner   r-   r   Sequence[str] | Noner   boolr   r/   r   r/   r   Sequence[Marker] | Noner   r/   r   ConstructorRegistry | Nonereturnr   )r    zDict[str, Callable[..., Any]]r   r-   r   r-   r   r.   r   r/   r   r/   r   r/   r   r0   r   r/   r   r1   r2   r   )
__future__r   typingr   r   r   r   r   r	   r
   typing_extensionsr   tyro.conf._markersr   r   tyro.constructorsr   _clir   confr   r   r"   r   r#   r!   <module>r:      s   " J J J ' / 1  CL 
 "!%! &*"+/,  	
     $  )  
" 
 "!%! &*"+/.  	
     $  ) 	 
$ "!%! &*"+/f.f f 	f
 f f f f $f f )f 	fr#   